From 0fda360ab5986be65e7ef7354ad92b9ead7e5d85 Mon Sep 17 00:00:00 2001 From: Michael Prokop Date: Mon, 22 Feb 2010 22:31:14 +0100 Subject: [PATCH] Slightly improve checks for grub-install/update-grub. --- chroot-script | 5 ++++- debian/changelog | 4 +++- grml-debootstrap | 11 +++++++---- 3 files changed, 14 insertions(+), 6 deletions(-) diff --git a/chroot-script b/chroot-script index 5654b12..bb770a5 100755 --- a/chroot-script +++ b/chroot-script @@ -380,8 +380,11 @@ grub_config() { # 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' + else + echo "Error: update-grub not available, can not execute it." + return 1 fi # grub2: diff --git a/debian/changelog b/debian/changelog index 0b5d03e..32e4b2e 100644 --- a/debian/changelog +++ b/debian/changelog @@ -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. + * Slightly improve checks for grub-install/update-grub and do + no set full path to the binaries. - -- Michael Prokop Mon, 22 Feb 2010 22:22:59 +0100 + -- Michael Prokop Mon, 22 Feb 2010 22:30:19 +0100 grml-debootstrap (0.33) unstable; urgency=low diff --git a/grml-debootstrap b/grml-debootstrap index 91d319c..1e6f49c 100755 --- a/grml-debootstrap +++ b/grml-debootstrap @@ -922,18 +922,21 @@ grub_install() { 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}:" - [ -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}:" - [ -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 } -- 2.1.4