fstabstate="$(cat /etc/fstab | awk '!/^#|^[[:blank:]]+#|^\/dev\/BOOT/ {print $2}' | egrep "^/boot$" )" procstate="$(cat /proc/mounts | awk '{print $2}' | egrep "^/boot$" )" proc_ro="$(cat /proc/mounts | awk '{ print $2, $4 }' | sed -n '/\/boot/{ /[ ,]\?ro[ ,]\?/p }' )" if [ -n "${fstabstate}" ] && [ -n "${procstate}" ]; then if [ -n "${proc_ro}" ]; then mount -o remount,rw /boot &>/dev/null if [ "$?" -ne 0 ]; then echo "Your /boot partition is mounted read-only and an attempt to remount failed." echo "Please fix this manually." exit 1 fi fi elif [ -n "${fstabstate}" ] && [ -z "${procstate}" ]; then mount /boot -o rw &>/dev/null if [ "$?" -eq 0 ]; then unmount="1" else echo "You have a separate /boot partition, but it can't be automounted as read/write." echo "Please do this manually." exit 2 fi fi /sbin/lilo $@ if [ -n "${proc_ro}" ]; then mount -o remount,ro /boot &>/dev/null if [ "$?" -ne 0 ]; then echo "Your /boot partition was remounted read/write for lilo, but can't be remounted read-only." echo "Please do this manually." exit 3 fi fi if [ -n "${unmount}" ]; then umount /boot if [ "$?" -ne 0 ]; then echo "Your /boot partition was automounted for lilo, but can't be unmounted." echo "Please do this manually." exit 4 fi fi