Slightly improve checks for grub-install/update-grub.
authorMichael Prokop <mika@grml.org>
Mon, 22 Feb 2010 21:31:14 +0000 (22:31 +0100)
committerMichael Prokop <mika@grml.org>
Mon, 22 Feb 2010 21:31:14 +0000 (22:31 +0100)
chroot-script
debian/changelog
grml-debootstrap

index 5654b12..bb770a5 100755 (executable)
@@ -380,8 +380,11 @@ grub_config() {
      # finally install grub
      if [ -x /usr/sbin/update-grub ] ; then
         UPDATEGRUB='/usr/sbin/update-grub'
      # finally install grub
      if [ -x /usr/sbin/update-grub ] ; then
         UPDATEGRUB='/usr/sbin/update-grub'
-     else
+     elif [ -x /sbin/update-grub ] ; then
         UPDATEGRUB='/sbin/update-grub'
         UPDATEGRUB='/sbin/update-grub'
+     else
+       echo "Error: update-grub not available, can not execute it."
+       return 1
      fi
 
      # grub2:
      fi
 
      # grub2:
index 0b5d03e..32e4b2e 100644 (file)
@@ -3,8 +3,10 @@ grml-debootstrap (0.34) unstable; urgency=low
   * Move the apt cache removal function to the end to avoid failure
     of grub installation.
   * Display executed debootstrap cmdline when running it.
   * Move the apt cache removal function to the end to avoid failure
     of grub installation.
   * Display executed debootstrap cmdline when running it.
+  * Slightly improve checks for grub-install/update-grub and do
+    no set full path to the binaries.
 
 
- -- Michael Prokop <mika@grml.org>  Mon, 22 Feb 2010 22:22:59 +0100
+ -- Michael Prokop <mika@grml.org>  Mon, 22 Feb 2010 22:30:19 +0100
 
 grml-debootstrap (0.33) unstable; urgency=low
 
 
 grml-debootstrap (0.33) unstable; urgency=low
 
index 91d319c..1e6f49c 100755 (executable)
@@ -922,18 +922,21 @@ grub_install() {
      return 0
   fi
 
      return 0
   fi
 
+  if ! [ -x "$(which grub-install)" ] ; then
+     echo "Error: grub-install not available. (Error while installing grub package?)"
+     return 1
+  fi
+
   if [ -n "$SELECTED_PARTITIONS" ] ; then # using sw-raid
      for device in $SELECTED_PARTITIONS ; do
         GRUB="${device%%[0-9]}"
         einfo "Installing grub on ${GRUB}:"
   if [ -n "$SELECTED_PARTITIONS" ] ; then # using sw-raid
      for device in $SELECTED_PARTITIONS ; do
         GRUB="${device%%[0-9]}"
         einfo "Installing grub on ${GRUB}:"
-        [ -x /usr/sbin/grub-install ] && GRUBINSTALL="/usr/sbin/grub-install --no-floppy" || GRUBINSTALL="/sbin/grub-install --no-floppy"
-        $GRUBINSTALL --root-directory="$MNTPOINT" "$GRUB"
+        grub-install --no-floppy --root-directory="$MNTPOINT" "$GRUB"
         eend $?
      done
   else
      einfo "Installing grub on ${GRUB}:"
         eend $?
      done
   else
      einfo "Installing grub on ${GRUB}:"
-     [ -x /usr/sbin/grub-install ] && GRUBINSTALL="/usr/sbin/grub-install --no-floppy" || GRUBINSTALL="/sbin/grub-install --no-floppy"
-     $GRUBINSTALL --root-directory="$MNTPOINT" "$GRUB"
+     grub-install --no-floppy --root-directory="$MNTPOINT" "$GRUB"
      eend $?
   fi
 }
      eend $?
   fi
 }