X-Git-Url: http://git.grml.org/?p=grml-rescueboot.git;a=blobdiff_plain;f=debian%2Fpostinst;h=d95d77fb8d571b8f647af5efa93cc6e9aafffa56;hp=eb3a28dcf5d31448ce6b6e3075aaca63f6d332d4;hb=74c0e31416ec2e4412a75d0d510da5e537def629;hpb=199476a3ee4fb6e6e4e71f719c9f29f5fa93cf5d diff --git a/debian/postinst b/debian/postinst index eb3a28d..d95d77f 100644 --- a/debian/postinst +++ b/debian/postinst @@ -3,19 +3,38 @@ set -e +update_grub_wrapper() { + # default, unless configured otherwise: + ISO_LOCATION=/boot/grml + + if [ -r /etc/default/grml-rescueboot ] ; then + . /etc/default/grml-rescueboot + fi + + if ! ls "${ISO_LOCATION}"/*iso >/dev/null 2>&1 ; then + echo "INFO: No *.iso files found inside ${ISO_LOCATION}." + echo "INFO: Execute 'update-grml-rescueboot' to download and integrate a Grml ISO." + return 0 + fi + + if ! which update-grub >/dev/null 2>&1; then + echo "WARN: ISOs found inside ${ISO_LOCATION} but update-grub not present (huh?)" + return 0 + fi + + if ! [ -e /boot/grub/grub.cfg ] ; then + echo "WARN: ISOs found inside ${ISO_LOCATION} but /boot/grub/grub.cfg does not exist." + echo "WARN: Ignoring request to run update-grub to avoid possible boot loader problems." + return 0 + fi + + echo "INFO: ISOs found inside ${ISO_LOCATION}, invoking update-grub:" + update-grub +} + case "$1" in configure) - if ls /boot/grml/*iso >/dev/null 2>&1 ; then - if which update-grub >/dev/null 2>&1; then - echo "ISOs found inside /boot/grml, invoking update-grub:" - update-grub - else - echo "WARN: ISOs found inside /boot/grml but update-grub not present (huh?)" - fi - else - echo "No *.iso files found inside /boot/grml/. Please create /boot/grml and" - echo "place Grml ISO(s) there. Finally invoke update-grub and enjoy your rescue system." - fi + update_grub_wrapper ;; abort-upgrade|abort-remove|abort-deconfigure)