From a2da39387bd9ee2d5c1da28257463490d7311a00 Mon Sep 17 00:00:00 2001 From: Iru Cai Date: Sun, 18 Sep 2016 21:01:13 +0800 Subject: Add a --grubcfg option for testing purpose --- buildlive | 21 +++++++++++++++++---- 1 file changed, 17 insertions(+), 4 deletions(-) (limited to 'buildlive') diff --git a/buildlive b/buildlive index 1831577..b8295f1 100755 --- a/buildlive +++ b/buildlive @@ -9,6 +9,7 @@ DEVNAME= KERNELDIR= DATADIR= INSTALL_GRUB=1 +GRUBCFG_ONLY=0 . functions.sh @@ -22,8 +23,13 @@ fatalerror() { } usage() { - msg "$0 --root= --dev= [--no-grub] [distro 1] [distro 2] ..." - msg "use $0 -L to list available distros" + >&2 cat << EOF +$0 --root= --dev= [options] [distro 1] [distro 2] ... +use $0 -L to list available distros +options: + --no-grub: do not install GRUB loader (still generate grub.cfg) + --grubcfg: do not do real install, only generate grub.cfg file +EOF } while [[ -n "$1" ]] @@ -49,6 +55,9 @@ do --no-grub) INSTALL_GRUB=0 ;; + --grubcfg) + GRUBCFG_ONLY=1 + ;; *=*|-*) usage exit 1 @@ -106,11 +115,15 @@ do DISTRO="${DISTROLIST[$i-1]}" process_distro "$DISTRO" - install_live + if [ "$GRUBCFG_ONLY" == 0 ]; then + install_live + fi gen_grubcfg "$DISTRO" >> "$GRUBCFG" done -if [ "$INSTALL_GRUB" == 1 ]; then +if [ "$GRUBCFG_ONLY" == 1 ]; then + msg 'Only generate grub.cfg, will not install GRUB.' +elif [ "$INSTALL_GRUB" == 1 ]; then read -p 'Answer Y to install GRUB.[Y/n] ' if [[ "$REPLY" =~ ^[Yy]|^$ ]]; then as-root grub-install --boot-directory="$ROOTPATH" --target=i386-pc "$DEVNAME" -- cgit v1.2.3