X-Git-Url: http://git.grml.org/?p=grml-rescueboot.git;a=blobdiff_plain;f=debian%2Fpostinst;h=d95d77fb8d571b8f647af5efa93cc6e9aafffa56;hp=6442637d29755a0237dcc4cd5d0e3111feb650dd;hb=HEAD;hpb=39cb619b74bd0dbd2c4a038699ad181cd1fd53ca diff --git a/debian/postinst b/debian/postinst index 6442637..d95d77f 100644 --- a/debian/postinst +++ b/debian/postinst @@ -1,26 +1,40 @@ #!/bin/sh # postinst script for grml-rescueboot -# -# see: dh_installdeb(1) set -e -# summary of how this script can be called: -# * `configure' -# * `abort-upgrade' -# * `abort-remove' `in-favour' -# -# * `abort-remove' -# * `abort-deconfigure' `in-favour' -# `removing' -# -# for details, see http://www.debian.org/doc/debian-policy/ or -# the debian-policy package +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) - /usr/sbin/update-grub + update_grub_wrapper ;; abort-upgrade|abort-remove|abort-deconfigure) @@ -32,9 +46,6 @@ case "$1" in ;; esac -# dh_installdeb will replace this with shell code automatically -# generated by other debhelper scripts. - #DEBHELPER# exit 0