Skip to content

Commit

Permalink
grub_install: use same method for checking grub-install and update-grub
Browse files Browse the repository at this point in the history
  • Loading branch information
zeha committed Nov 17, 2023
1 parent 94b63ad commit 3bcafe4
Showing 1 changed file with 6 additions and 11 deletions.
17 changes: 6 additions & 11 deletions chroot-script
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -741,24 +745,15 @@ 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
fi

mountpoint /boot/efi &>/dev/null && umount /boot/efi

$UPDATEGRUB
# finally install grub. Existence of update-grub is checked above.
update-grub
}
# }}}

Expand Down

0 comments on commit 3bcafe4

Please sign in to comment.