From 80210c3f303cb2f9523f49dcf370f7de76c3cbfb Mon Sep 17 00:00:00 2001 From: Iru Cai Date: Fri, 23 Sep 2016 11:29:50 +0800 Subject: add --downloadonly option --- buildlive | 22 +++++++++++++++++++--- 1 file changed, 19 insertions(+), 3 deletions(-) diff --git a/buildlive b/buildlive index e75f2e9..caf03ac 100755 --- a/buildlive +++ b/buildlive @@ -10,6 +10,7 @@ KERNELDIR= DATADIR= INSTALL_GRUB=1 GRUBCFG_ONLY=0 +DOWNLOAD_ONLY=0 . functions.sh @@ -24,11 +25,12 @@ fatalerror() { usage() { >&2 cat << EOF -$0 --root= [options] [distro 1] [distro 2] ... +$0 [--root=] [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 + --downloadonly: only download the ISO files --dev=: write boot sector to (default is autodetected from ) EOF } @@ -59,6 +61,9 @@ do --grubcfg) GRUBCFG_ONLY=1 ;; + --downloadonly) + DOWNLOAD_ONLY=1 + ;; *=*|-*) usage exit 1 @@ -75,12 +80,19 @@ do shift done -if [[ "${#DISTROLIST[@]}" == 0 || -z "$ROOTPATH" ]]; then +if [[ -z "$ROOTPATH" && "$DOWNLOAD_ONLY" == 0 ]]; then + usage + exit 1 +fi + +if [[ "${#DISTROLIST[@]}" == 0 ]]; then usage exit 1 fi -msg "Boot sector will be written to $DEVNAME" +if [ ! -z "$DEVNAME" ]; then + msg "Boot sector will be written to $DEVNAME" +fi for i in ${DISTROLIST[@]} do @@ -95,6 +107,10 @@ do fi done +if [[ "$DOWNLOAD_ONLY" == 1 ]]; then + exit 0 +fi + install -d "$ROOTPATH/grub" echo '# The live USB grub.cfg file' > "$GRUBCFG" -- cgit v1.2.3