+kernel-2.6-cn (3:2.6.26-3) stable; urgency=low
+
+ * Grub shell workaroundovi (divertovi) za ExecShield (grub i grub-probe)
+
+ -- Dinko Korunic <kreator@carnet.hr> Wed, 03 Jun 2009 13:19:06 +0200
+
kernel-2.6-cn (3:2.6.26-2) stable; urgency=low
* niz manjih izmjena u postinst rutinama za bolju detekciju root/boot
grub-functions.sh usr/share/kernel-2.6-cn
+grub usr/sbin
+grub-probe usr/sbin
echo -n " grub2"
# workaround grsec
-if [ -x /sbin/chpax ]; then
- if [ -x /usr/sbin/grub ]; then
- chpax -spmrx /usr/sbin/grub || true
+if uname -a | grep -q grsec; then
+ if [ -x /sbin/chpax ]; then
+ # grub
+ if [ -x /usr/sbin/grub.real ]; then
+ chpax -spmrx /usr/sbin/grub.real >/dev/null 2>&1 || true
+ elif [ -x /usr/sbin/grub ]; then
+ chpax -spmrx /usr/sbin/grub >/dev/null 2>&1 || true
+ fi
+
+ # grub-probe
+ if [ -x /usr/sbin/grub-probe.real ]; then
+ chpax -spmrx /usr/sbin/grub-probe.real >/dev/null 2>&1 || true
+ elif [ -x /usr/sbin/grub-probe ]; then
+ chpax -spmrx /usr/sbin/grub-probe >/dev/null 2>&1 || true
+ fi
+
+ echo -n " grsec"
fi
- if [ -x /usr/sbin/grub-probe ]; then
- chpax -spmrx /usr/sbin/grub-probe || true
- fi
-fi
-echo -n " grub3"
-
-# workaround execshield
-SHIELD=$(sysctl -e -n kernel.exec-shield)
-if [ ! -z "$SHIELD" ]; then
- sysctl -e -w kernel.exec-shield=0 >/dev/null 2>&1
- echo -n " execshield1"
fi
# remove obsolete devfs/compat links and restore normal udev behaviour
else
rm -f "$device_map.old"
fi
-echo -n " grub4"
+echo -n " grub3"
# import GRUB helper functions (again, updated device map)
. /usr/share/kernel-2.6-cn/grub-functions.sh
|| true
fi
fi
-echo -n " grub5"
+echo -n " grub4"
# install GRUB loader
if ! grub-install --no-floppy "$install_device" >/dev/null 2>&1; then
echo "CN: Do not reboot your server and report this to OTRS immediately!"
exit 1
fi
-echo -n " grub6"
+echo -n " grub5"
# fix possible wrong params in menu.lst
cp_check_and_sed '^# groot=' \
"s;^# kopt=\(.*\)root=[^[:space:]]*\(.*\);# kopt=\1root=$root_device\2;g" \
"$menu_file" || true
/usr/sbin/update-grub >/dev/null 2>&1 || true
-echo -n " grub7"
+echo -n " grub6"
# and final stage of devfs/udev brokeness fix
if [ "x$install_device_resolved" != "x$install_device" ]; then
"s;\(^kernel.*\)root=[^[:space:]]*\(.*\);\1root=$root_device\2;g" \
"$menu_file" || true
fi
-echo -n " grub8"
-
-# restore execshield state
-if [ ! -z "$SHIELD" ]; then
- sysctl -e -w "kernel.exec-shield=$SHIELD" >/dev/null 2>&1
- echo -n " execshield2"
-fi
+echo -n " grub7"
# disable lilo
if [ -e /etc/lilo.conf ]; then
echo "."
+################################################################################
+
+DIVERT_TO="grub grub-probe"
+
+echo -n "CN: Undiverting binaries:"
+for i in $DIVERT_TO; do
+ dpkg-divert --remove --rename --package 'kernel-2.6-cn' \
+ --divert /usr/sbin/$i.real /usr/sbin/$i >/dev/null
+ echo -n " $i"
+done
+echo "."
+
# dh_installdeb will replace this with shell code automatically
# generated by other debhelper scripts.
# make GRUB template directory
if [ ! -d /boot/grub ]; then
+ echo "CN: Made /boot/grub directory."
mkdir -p /boot/grub
fi
+################################################################################
+
+DIVERT_TO="grub grub-probe"
+
+echo -n "CN: Diverting binaries:"
+for i in $DIVERT_TO; do
+ dpkg-divert --add --rename --package 'kernel-2.6-cn' \
+ --divert /usr/sbin/$i.real /usr/sbin/$i >/dev/null
+ echo -n " $i"
+done
+echo "."
+
# dh_installdeb will replace this with shell code automatically
# generated by other debhelper scripts.
--- /dev/null
+#!/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
--- /dev/null
+grub
\ No newline at end of file