update-initramfs: Stop second guessing lilo usage.

If people have both lilo and grub installed they need
to figured out on their own, what they want.

The mbr detection is error prone and a nice hack,
but has survived it's time now that grub.cfg would need
to be parsed in a different way.

warn people that they should act.

(closes: #574553)

Signed-off-by: maximilian attems <maks@debian.org>
This commit is contained in:
maximilian attems 2010-03-25 01:22:07 +01:00
parent b5c928d159
commit cc33aa5bfb

View File

@ -184,53 +184,6 @@ run_lilo()
lilo
}
# check if lilo is on mbr
mbr_check()
{
# try to discover grub|grub2 and be happy
[ -r /boot/grub/grub.cfg ] \
&& groot=$(awk '/^set root=/{print substr($2, 7, 3); exit}' \
/boot/grub/grub.cfg)
[ -r /boot/grub/menu.lst ] \
&& groot=$(awk '/^root/{print substr($2, 2, 3); exit}' \
/boot/grub/menu.lst)
[ -e /boot/grub/device.map ] && [ -n "${groot}" ] \
&& dev=$(awk "/${groot}/{ print \$NF}" /boot/grub/device.map)
[ -n "${dev}" ] && [ -r ${dev} ] \
&& dd if="${dev}" bs=512 skip=0 count=1 2> /dev/null \
| grep -q GRUB && return 0
# check out lilo.conf for validity
boot=$(awk -F = '/^boot=/{ print $2}' /etc/lilo.conf)
[ -z "${boot}" ] && return 0
case ${boot} in
/dev/md/*)
if [ -r /proc/mdstat ]; then
MD=${boot#/dev/md/}
boot="/dev/$(awk "/^md${MD}/{print substr(\$5, 1, 3)}" \
/proc/mdstat)"
fi
;;
/dev/md*)
if [ -r /proc/mdstat ]; then
MD=${boot#/dev/}
boot="/dev/$(awk "/^${MD}/{print substr(\$5, 1, 3)}" \
/proc/mdstat)"
fi
;;
esac
[ ! -r "${boot}" ] && return 0
dd if="${boot}" bs=512 skip=0 count=1 2> /dev/null | grep -q LILO \
&& run_lilo && return 0
# no idea which bootloader is used
echo
echo "WARNING: grub and lilo installed."
echo "If you use grub as bootloader everything is fine."
echo "If you use lilo as bootloader you must run lilo!"
echo
}
# Invoke bootloader
run_bootloader()
{
@ -250,7 +203,10 @@ run_bootloader()
fi
# do_bootloader unconfigured
mbr_check
echo
echo "WARNING: grub and lilo installed."
echo "Please deinstall unused bootloader."
echo
return 0
fi
if [ -r /etc/lilo.conf ] && command -v lilo >/dev/null 2>&1; then