X-Git-Url: http://ftp.carnet.hr/carnet-debian/scm?a=blobdiff_plain;f=debian%2Fpostinst;h=9fcb5487eca6854ae39ca031af14807034260bae;hb=a57315045176d50b56a1e3452e19a67682d3bd1a;hp=462ad6f9ed90da21f05681b13de163b1ebc350b4;hpb=fcde92dd00b7faa947dcb7b7d1918ecf53f1d5af;p=kernel-cn.git diff --git a/debian/postinst b/debian/postinst index 462ad6f..9fcb548 100755 --- a/debian/postinst +++ b/debian/postinst @@ -147,20 +147,48 @@ if [ ! -z "$SHIELD" ]; then echo -n " execshield1" fi -# remove obsolete devfs compat links +# remove obsolete devfs/compat links and restore normal udev behaviour rm -f /etc/udev/rules.d/devfs.rules /etc/udev/rules.d/compat.rules \ /etc/udev/rules.d/compat-full.rules +if [ ! -e /etc/udev/rules.d/udev.rules ]; then + ln -s ../udev.rules /etc/udev/rules.d/udev.rules +fi udevcontrol reload_rules >/dev/null 2>&1 || true echo -n " udev" -# install grub loader -if ! grub-install --no-floppy '(hd0)' >/dev/null 2>&1; then +# update device map if possible +device_map=/boot/grub/device.map +if [ -f $device_map ]; then + mv -f $device_map $device_map.old +fi +grub --batch --no-floppy --device-map=$device_map </dev/null 2>&1 +quit +EOF +if [ ! -s $device_map ]; then + if [ -f $device_map.old ]; then + mv -f $device_map.old $device_map + fi +else + rm -f $device_map.old +fi +echo -n " grub4" + +# install GRUB loader +install_device=$(grep '^(hd0)' $device_map | \ + sed -e 's%[^[:space:]]*[[:space:]]*\([^[:space:]]*\)%\1%') +if [ -z "$install_device" ]; then echo "." - echo "CN: FATAL ERROR running grub-install!" + echo "CN: FATAL ERROR while detecting boot disk!" echo "CN: Do not reboot your server and report this to OTRS immediately!" exit 1 fi -echo -n " grub4" +if ! grub-install --no-floppy "$install_device" >/dev/null 2>&1; then + echo "." + echo "CN: FATAL ERROR while running grub-install!" + echo "CN: Do not reboot your server and report this to OTRS immediately!" + exit 1 +fi +echo -n " grub5" # fix possible wrong params in menu.lst cp_check_and_sed '^# groot=' \ @@ -170,7 +198,7 @@ cp_check_and_sed '^# kopt=' \ "s;^# kopt=\(.*\)root=[^[:space:]]*\(.*\);# kopt=\1root=$root_device\2;g" \ /boot/grub/menu.lst || true /usr/sbin/update-grub >/dev/null 2>&1 || true -echo -n " grub5" +echo -n " grub6" # restore execshield state if [ ! -z "$SHIELD" ]; then