From 3c50c02d4349bffe5b0ea031b6c30dc2293aa388 Mon Sep 17 00:00:00 2001 From: Iru Cai Date: Mon, 19 Sep 2016 08:20:39 +0800 Subject: buildlive: autodetect disk device by partition --- buildlive | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'buildlive') diff --git a/buildlive b/buildlive index 08bbdc4..e07663c 100755 --- a/buildlive +++ b/buildlive @@ -24,11 +24,12 @@ fatalerror() { usage() { >&2 cat << EOF -$0 --root= --dev= [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 + --dev=: write boot sector to (default is autodetected from ) EOF } @@ -42,6 +43,7 @@ do ROOTPATH=${1/--root=} UUID="$(findmnt -o UUID --raw --noheadings $ROOTPATH \ || fatalerror "UUID of $ROOTPATH not found, not a mountpoint?")" + DEVNAME="/dev/$(getdiskbypart "/dev/disk/by-uuid/$UUID")" KERNELDIR="$ROOTPATH/liveusb-kernel" DATADIR="$ROOTPATH/liveusb-data" GRUBCFG="$ROOTPATH/grub/grub.cfg" @@ -50,7 +52,6 @@ do ;; --dev=*) DEVNAME=${1/--dev=} - msg "Boot sector will be written to $DEVNAME" ;; --no-grub) INSTALL_GRUB=0 @@ -79,6 +80,8 @@ if [[ "${#DISTROLIST[@]}" == 0 || -z "$ROOTPATH" ]]; then exit 1 fi +msg "Boot sector will be written to $DEVNAME" + for i in ${DISTROLIST[@]} do process_isoinfo "$i" -- cgit v1.2.3