post-maintainer scripts: make sure update-grub is present before executing it.
authorMichael Prokop <mika@grml.org>
Fri, 7 Jan 2011 10:07:52 +0000 (11:07 +0100)
committerMichael Prokop <mika@grml.org>
Fri, 7 Jan 2011 10:07:52 +0000 (11:07 +0100)
Reported-by: Samat K Jain
debian/postinst
debian/postrm

index 99343dc..eb3a28d 100644 (file)
@@ -6,8 +6,12 @@ set -e
 case "$1" in
     configure)
       if ls /boot/grml/*iso >/dev/null 2>&1 ; then
-       echo "ISOs found inside /boot/grml, invoking update-grub:"
-        update-grub
+       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."
index 6291c90..2154b59 100644 (file)
@@ -5,8 +5,10 @@ set -e
 
 case "$1" in
     purge|remove|upgrade|failed-upgrade|abort-install|abort-upgrade|disappear)
-      echo "Updating grub.cfg to make sure there are no non-existing entries being left."
-      update-grub
+      if which update-grub >/dev/null 2>&1; then
+        echo "Updating grub.cfg to make sure there are no non-existing entries being left."
+        update-grub
+      fi
     ;;
 
     *)