From 6bc7f72a6c72714e55d687f108bdde8adb287c0c Mon Sep 17 00:00:00 2001 From: Iru Cai Date: Sat, 6 Aug 2016 11:08:20 +0800 Subject: buildlive: change grub-install commands - use as-root to run grub-install - add --removable when installing grub-efi - add --no-grub option --- buildlive | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) (limited to 'buildlive') diff --git a/buildlive b/buildlive index e8e1f83..54cfc35 100755 --- a/buildlive +++ b/buildlive @@ -7,6 +7,7 @@ ROOTPATH= DEVNAME= KERNELDIR= DATADIR= +INSTALL_GRUB=1 . functions.sh @@ -20,7 +21,7 @@ fatalerror() { } usage() { - msg "$0 --root= --dev= [distro 1] [distro 2] ..." + msg "$0 --root= --dev= [--no-grub] [distro 1] [distro 2] ..." } while [[ -n "$1" ]] @@ -40,7 +41,10 @@ do DEVNAME=${1/--dev=} msg "Boot sector will be written to $DEVNAME" ;; - *=*) + --no-grub) + INSTALL_GRUB=0 + ;; + *=*|-*) usage exit 1 ;; @@ -73,5 +77,7 @@ do cat "distro/$i/grub.cfg" >> "$GRUBCFG" done -grub-install --boot-directory="$ROOTPATH" --target=i386-pc "$DEVNAME" -grub-install --boot-directory="$ROOTPATH" --efi-directory="$ROOTPATH" --bootloader-id=grub --target=x86_64-efi --no-nvram "$DEVNAME" +if [ "$INSTALL_GRUB" == 1 ]; then + as-root grub-install --boot-directory="$ROOTPATH" --target=i386-pc "$DEVNAME" + as-root grub-install --boot-directory="$ROOTPATH" --efi-directory="$ROOTPATH" --bootloader-id=grub --target=x86_64-efi --removable --no-nvram "$DEVNAME" +fi -- cgit v1.2.3