X-Git-Url: https://git.grml.org/?p=grml-rescueboot.git;a=blobdiff_plain;f=debian%2Fpostinst;h=d5f9b750bf5dfd21e7c581f6c68ca935896ba694;hp=131e59f290c2ea1305ec7657f0c5e5b9fe906494;hb=395abc5bda9903f9bbe0ecd1df63a59bdb6b0071;hpb=1e7153d9b0746e3969856189987c70b82783a5c7;ds=inline diff --git a/debian/postinst b/debian/postinst index 131e59f..d5f9b75 100644 --- a/debian/postinst +++ b/debian/postinst @@ -3,27 +3,39 @@ 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: Please create ${ISO_LOCATION} and place rescue ISO(s) there." + echo "INFO: Finally invoke update-grub and enjoy your rescue system." + 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) - # 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: Please create ${ISO_LOCATION} and place rescue ISO(s) there." - echo "INFO: Finally invoke update-grub and enjoy your rescue system." - else - if ! which update-grub >/dev/null 2>&1; then - echo "WARN: ISOs found inside ${ISO_LOCATION} but update-grub not present (huh?)" - else - echo "INFO: ISOs found inside ${ISO_LOCATION}, invoking update-grub:" - update-grub - fi - fi + update_grub_wrapper ;; abort-upgrade|abort-remove|abort-deconfigure)