summaryrefslogtreecommitdiff
path: root/buildlive
diff options
context:
space:
mode:
authorIru Cai <mytbk920423@gmail.com>2016-09-18 21:01:13 +0800
committerIru Cai <mytbk920423@gmail.com>2016-09-18 21:16:53 +0800
commita2da39387bd9ee2d5c1da28257463490d7311a00 (patch)
tree3f1f44c84552904176ef8dbcc250278826aa74d6 /buildlive
parent33e03ad19f8a1eb7c9c06612fc66dc2c5f11520a (diff)
downloadliveusb-builder-a2da39387bd9ee2d5c1da28257463490d7311a00.tar.xz
Add a --grubcfg option for testing purpose
Diffstat (limited to 'buildlive')
-rwxr-xr-xbuildlive21
1 files changed, 17 insertions, 4 deletions
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=<rootpath> --dev=<devname> [--no-grub] [distro 1] [distro 2] ..."
- msg "use $0 -L to list available distros"
+ >&2 cat << EOF
+$0 --root=<rootpath> --dev=<devname> [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"