X-Git-Url: https://git.rrq.au/?a=blobdiff_plain;f=debian%2Flilo.postinst;h=11a899f8945986e6549a7d82916a8964622406bc;hb=49e489f4c3e75e13f92bd14075cc5b8dd10f9cee;hp=df041153ad2a1d621b0ea525ab0085d7b9e205a2;hpb=511a6cbff1026487ac9c9fffbad5a51e003a88e4;p=rrq%2Fmaintain_lilo.git diff --git a/debian/lilo.postinst b/debian/lilo.postinst index df04115..11a899f 100644 --- a/debian/lilo.postinst +++ b/debian/lilo.postinst @@ -1,12 +1,18 @@ -#!/bin/sh +#!/bin/sh +# postinst script lilo +# +# see: dh_installdeb(1) set -e +LNKS="sarge sid" + if [ -f /usr/share/debconf/confmodule ]; then . /usr/share/debconf/confmodule fi -#DEBHELPER# +# targets: configure|abort-upgrade|abort-remove|abort-deconfigure + case "$1" in configure|reconfigure) @@ -16,87 +22,86 @@ case "$1" in fi # Check whether /boot is on another partition and mount it. See Bug#216250 - - if grep "[[:space:]]/boot[[:space:]]" /etc/fstab | grep -vq ^#; then + if grep "[[:space:]]/boot[[:space:]]" /etc/fstab | grep -vq "^#"; then if ! grep -q "[[:space:]]/boot[[:space:]]" /etc/mtab ; then mount /boot 2>&1 > /dev/null if [ $? -ne 0 ]; then echo echo "WARNING: /boot is in another partition but could not be mounted." - echo "LILO may fail in the next steps." + echo "LILO may fail in the next steps!" fi fi fi - cp /usr/share/lilo/*.bmp /boot - + # copy all background images to the right place if [ -L /boot/debian.bmp ]; then - if [ x`readlink /boot/debian.bmp | cut -d/ -f 2` != x"boot" ]; then - ln -sf /boot/sid.bmp /boot/debian.bmp - fi - fi + rm -f /boot/debian.bmp; fi - if [ ! -e /boot/debian.bmp ]; then - ln -sf /boot/sarge.bmp /boot/debian.bmp - fi + install -m 0644 /usr/share/lilo/*.bmp /boot + # stay compatible with old lilo 22.8 + for i in ${LNKS}; do + ln -s debian.bmp /boot/${i}.bmp + done + + if test -f /etc/kernel/postinst.d/zz-lilo; then + rm -f /etc/kernel/postinst.d/zz-lilo; fi + if test -f /etc/kernel/postrm.d/zz-lilo; then + rm -f /etc/kernel/postrm.d/zz-lilo; fi + if test -f /etc/initramfs/post-update.d/lilo; then + rm -f /etc/initramfs/post-update.d/lilo; fi # Nasty part to create network block devices if needed. Bug#235805. if [ `uname -r | sed -e 's/-.*//g' -ne 's/\(^[0-9]\{1\}\.[0-9]\{1,2\}\).*/\1/p'` = "2.6" ] && \ [ `uname -r | sed -e 's/-.*//g' -ne 's/.*\.\([0-9]\{1,3\}\).*/\1/p'` -ge "3" ]; then - garbage=$(cat /proc/partitions | sed -ne 's/^[ \t]*//pg' | sed -ne '/^43/p') + garbage=$(cat /proc/partitions | sed -ne 's/^[ \t]*//pg' | sed -ne '/^43/p') - if [ x"$garbage" != "x" ]; then - + if [ x"$garbage" != "x" ]; then # Create the missing devices echo -n "Creating network block devices... " (cd /dev; ./MAKEDEV nb) > /dev/null echo "done." - fi + fi fi db_get lilo/add_large_memory || true; if [ x"$RET" = x"true" -a -e /etc/lilo.conf ]; then if ! grep -q "^[[:space:]]*large-memory" /etc/lilo.conf; then sed -i -e '1i\# Automatically added by lilo postinst script\nlarge-memory\n' /etc/lilo.conf - echo "WARNING: Added large-memory option, please run lilo before you reboot" + echo "WARNING: Added option 'large-memory', please run 'lilo' before you reboot." fi - elif [ -e /vmlinuz -a -e /initrd.img -a -e /etc/lilo.conf ]; then - kernel_size=$(stat -L -c %s /vmlinuz) - initrd_size=$(stat -L -c %s /initrd.img) - size=$(($kernel_size+$initrd_size)) - large_mem=$(grep -c "^[[:space:]]*large-memory" /etc/lilo.conf) || true - if [ $large_mem -eq 0 -a $size -ge 8388608 ]; then - echo - echo "WARNING: You have a large kernel+initrd and large-memory is not set in lilo.conf." - echo "WARNING: Do NOT reboot or LILO may fail to boot." - echo "WARNING: Please read /usr/share/doc/lilo/README.Debian" - echo + fi + + db_get lilo/diskid_uuid || true; + if [ x"$RET" = x"true" -a -e /etc/lilo.conf ]; then + if [ `grep -c -E "dev/disk/by-|UUID=" /etc/lilo.conf` -lt 2 ]; then + if test -x /usr/sbin/lilo-uuid-diskid; then + lilo-uuid-diskid + echo "WARNING: If boot / root options were converted, please run 'lilo' before you reboot." + fi fi - else - echo - echo "WARNING: kernel & initrd not found in the root directory (/vmlinuz & /initrd.img)" - echo "WARNING: Do NOT reboot or LILO may fail to boot if your kernel+initrd is large." - echo "WARNING: Please read /usr/share/doc/lilo/README.Debian" - echo fi db_get lilo/runme || true; if [ x"$RET" = x"true" ]; then echo "Running lilo..." - /sbin/lilo -H + lilo -H fi ;; - abort-upgrade|abort-remove|abort-deconfigure) - - ;; + abort-upgrade|abort-remove|abort-deconfigure) + ;; - *) - echo "postinst called with unknown argument \`$1'" >&2 - exit 1 - ;; + *) + echo "postinst called with unknown argument \`$1'" >&2 + exit 1 + ;; esac +# dh_installdeb will replace this with shell code automatically +# generated by other debhelper scripts. + +#DEBHELPER# + exit 0