diff options
author | Iru Cai <mytbk920423@gmail.com> | 2016-08-06 11:08:20 +0800 |
---|---|---|
committer | Iru Cai <mytbk920423@gmail.com> | 2016-08-06 11:09:28 +0800 |
commit | 6bc7f72a6c72714e55d687f108bdde8adb287c0c (patch) | |
tree | e4085f212e5f1120cba2124fa5d0150e0100b888 | |
parent | f56d7904f6fab99a0e2774828ba1858d77af042f (diff) | |
download | liveusb-builder-6bc7f72a6c72714e55d687f108bdde8adb287c0c.tar.xz |
buildlive: change grub-install commands
- use as-root to run grub-install
- add --removable when installing grub-efi
- add --no-grub option
-rwxr-xr-x | buildlive | 14 |
1 files changed, 10 insertions, 4 deletions
@@ -7,6 +7,7 @@ ROOTPATH= DEVNAME= KERNELDIR= DATADIR= +INSTALL_GRUB=1 . functions.sh @@ -20,7 +21,7 @@ fatalerror() { } usage() { - msg "$0 --root=<rootpath> --dev=<devname> [distro 1] [distro 2] ..." + msg "$0 --root=<rootpath> --dev=<devname> [--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 |