X-Git-Url: http://ftp.carnet.hr/carnet-debian/scm?a=blobdiff_plain;f=debian%2Fpostinst;h=e279cfb359f94122c478c72acc26e9d01349585e;hb=8ac8a961503537d2753d9a163834a8108b871880;hp=45f8046cd28573bb1cb23ceea597429906285c1f;hpb=3404916f2b3bab88e5d8bcd8ef0a339f6d980e85;p=kernel-cn.git diff --git a/debian/postinst b/debian/postinst index 45f8046..e279cfb 100755 --- a/debian/postinst +++ b/debian/postinst @@ -154,6 +154,7 @@ 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 +udevsettle || true echo -n " udev" # update device map if possible @@ -167,7 +168,8 @@ if [ ! -s "$device_map" ]; then if [ -f "$device_map.old" ]; then mv -f "$device_map.old" "$device_map" fi -else + +:q!else rm -f "$device_map.old" fi echo -n " grub4" @@ -188,10 +190,11 @@ if [ -h "$install_device" ]; then if [ -z "$install_device_resolved" ]; then install_device_resolved="$install_device" fi + # try to fix device map with symlink resolved device if [ "x$install_device_resolved" != "x$install_device" ]; then - cp_check_and_sed '^(hd0)' \ - "s;^(hd0).*;(hd0) $install_device_resolved" "$device_map" \ + cp_check_and_sed '^\(hd0\)' \ + "s;^(hd0).*;(hd0) $install_device_resolved;" "$device_map" \ || true fi fi @@ -216,6 +219,31 @@ cp_check_and_sed '^# kopt=' \ /usr/sbin/update-grub >/dev/null 2>&1 || true echo -n " grub7" +# and final stage of devfs/udev brokeness fix +if [ "x$install_device_resolved" != "x$install_device" ]; then + # get original (symlinked device) + root_device=$(find_device_nonresolved "/") + if [ -z "$root_device" ]; then + root_device=$(find_root_device) + fi + + # fix (hd0) mapping + cp_check_and_sed '^\(hd0\)' \ + "s;^(hd0).*;(hd0) $install_device;" "$device_map" \ + || true + + # fix global root= invocation + cp_check_and_sed '^# kopt=' \ + "s;^# kopt=\(.*\)root=[^[:space:]]*\(.*\);# kopt=\1root=$root_device\2;g" \ + "$menu_file" || true + + # fix root= invocation for individual kernel profiles + cp_check_and_sed '^kernel' \ + "s;\(^kernel.*\)root=[^[:space:]]*\(.*\);\1root=$root_device\2;g" \ + "$menu_file" || true +fi +echo -n " grub8" + # restore execshield state if [ ! -z "$SHIELD" ]; then sysctl -w -e "kernel.exec-shield=$SHIELD" >/dev/null 2>&1