From 3bcafe4b44b7fa06e12a218e05ebdf21eb00d7e7 Mon Sep 17 00:00:00 2001 From: Chris Hofstaedtler Date: Mon, 13 Nov 2023 23:30:33 +0100 Subject: [PATCH] grub_install: use same method for checking grub-install and update-grub --- chroot-script | 17 ++++++----------- 1 file changed, 6 insertions(+), 11 deletions(-) diff --git a/chroot-script b/chroot-script index ad23449..8f8e5ff 100755 --- a/chroot-script +++ b/chroot-script @@ -717,6 +717,10 @@ grub_install() { echo "Error: grub-install not available. (Error while installing grub package?)" >&2 return 1 fi + if ! [ -x "$(command -v update-grub)" ] ; then + echo "Error: update-grub not available. (Error while installing grub package?)" >&2 + return 1 + fi if [ -n "$SELECTED_PARTITIONS" ] ; then # using sw-raid for device in $SELECTED_PARTITIONS ; do @@ -741,16 +745,6 @@ grub_install() { echo "Adjusting grub configuration for use on ${GRUB}." - # finally install grub - if [ -x /usr/sbin/update-grub ] ; then - UPDATEGRUB='/usr/sbin/update-grub' - elif [ -x /sbin/update-grub ] ; then - UPDATEGRUB='/sbin/update-grub' - else - echo "Error: update-grub not available, can not execute it." >&2 - return 1 - fi - if [ -n "${BOOT_APPEND}" ] ; then echo "Adding BOOT_APPEND configuration ['${BOOT_APPEND}'] to /etc/default/grub." sed -i "/GRUB_CMDLINE_LINUX_DEFAULT/ s#\"\$# ${BOOT_APPEND}\"#" /etc/default/grub @@ -758,7 +752,8 @@ grub_install() { mountpoint /boot/efi &>/dev/null && umount /boot/efi - $UPDATEGRUB + # finally install grub. Existence of update-grub is checked above. + update-grub } # }}} -- 2.1.4