- Grub shell workaroundovi (divertovi) za ExecShield te Etch->Lenny upgrade (grub...
[kernel-cn.git] / grub
diff --git a/grub b/grub
new file mode 100755 (executable)
index 0000000..b5fbe31
--- /dev/null
+++ b/grub
@@ -0,0 +1,26 @@
+#!/bin/sh
+# Grub shell ExecShield wrapper
+#
+# Copyright (C) 2009  Dinko Korunic, CARNet, Grupa za izradu paketa
+#
+# This program is free software; you can redistribute it and/or modify it
+# under the terms of the GNU General Public License as published by the
+# Free Software Foundation; either version 2 of the License, or (at your
+# option) any later version.
+
+SHIELD=$(sysctl -e -n kernel.exec-shield)
+_retval=0
+
+if [ ! -z "$SHIELD" ]; then
+    sysctl -e -w kernel.exec-shield=0 >/dev/null 2>&1 || true
+fi
+
+if [ -x "$0.real" ]; then
+    "$0.real" $@ || _retval=$?
+fi
+
+if [ ! -z "$SHIELD" ]; then
+    sysctl -e -w "kernel.exec-shield=$SHIELD" >/dev/null 2>&1 || true
+fi
+
+exit $_retval