Override lintian I: package-contains-empty-directory
[grml-rescueboot.git] / debian / postinst
index 6442637..131e59f 100644 (file)
@@ -1,26 +1,29 @@
 #!/bin/sh
 # postinst script for grml-rescueboot
-#
-# see: dh_installdeb(1)
 
 set -e
 
-# summary of how this script can be called:
-#        * <postinst> `configure' <most-recently-configured-version>
-#        * <old-postinst> `abort-upgrade' <new version>
-#        * <conflictor's-postinst> `abort-remove' `in-favour' <package>
-#          <new-version>
-#        * <postinst> `abort-remove'
-#        * <deconfigured's-postinst> `abort-deconfigure' `in-favour'
-#          <failed-install-package> <version> `removing'
-#          <conflicting-package> <version>
-# for details, see http://www.debian.org/doc/debian-policy/ or
-# the debian-policy package
-
-
 case "$1" in
     configure)
-      /usr/sbin/update-grub
+      # 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
     ;;
 
     abort-upgrade|abort-remove|abort-deconfigure)
@@ -32,9 +35,6 @@ case "$1" in
     ;;
 esac
 
-# dh_installdeb will replace this with shell code automatically
-# generated by other debhelper scripts.
-
 #DEBHELPER#
 
 exit 0