From d1317ea4ef22e0f2699f307b435ab067875c7819 Mon Sep 17 00:00:00 2001 From: Iru Cai Date: Sat, 6 Apr 2019 00:14:18 +0800 Subject: add an option to clean the live USB --- buildlive | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/buildlive b/buildlive index cebe132..30ac729 100755 --- a/buildlive +++ b/buildlive @@ -16,6 +16,7 @@ GRUBCFG_ONLY=0 DOWNLOAD_ONLY=0 UMOUNT_BOOT=0 UMOUNT_ROOT=0 +CLEAN_USB=0 . functions.sh @@ -37,6 +38,7 @@ options: --root=: set the path to put the live USB data files --boot --boot=: set the path to put the kernel and loader files + --clean: clean the old live USB files before installing --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 @@ -98,6 +100,9 @@ do --downloadonly) DOWNLOAD_ONLY=1 ;; + --clean) + CLEAN_USB=1 + ;; *=*|-*) usage exit 1 @@ -162,6 +167,11 @@ if [ ! -z "$DEVNAME" ]; then msg "Boot sector will be written to $DEVNAME" fi +if [[ "$CLEAN_USB" = 1 ]]; then + msg "Cleaning old live USB files." + rm -rf "$KERNELDIR"/* "$DATADIR"/* +fi + for i in ${DISTROLIST[@]} do process_isoinfo "$i" -- cgit v1.2.3