summaryrefslogtreecommitdiff
path: root/buildlive
diff options
context:
space:
mode:
authorIru Cai <mytbk920423@gmail.com>2016-07-14 00:11:25 +0800
committerIru Cai <mytbk920423@gmail.com>2016-08-02 12:17:03 +0800
commit05df260db64c1ffa141af22aa50920d7c62940ef (patch)
treefc17314f408152e50980fc2b1fb542c09df2d1e3 /buildlive
parent7be29a553f8bc94df3a6d67c497faa2371913dce (diff)
downloadliveusb-builder-05df260db64c1ffa141af22aa50920d7c62940ef.tar.xz
use fatalerror() instead of errmsg(), add UUID detection
Diffstat (limited to 'buildlive')
-rwxr-xr-xbuildlive26
1 files changed, 11 insertions, 15 deletions
diff --git a/buildlive b/buildlive
index 6a1d578..94b2101 100755
--- a/buildlive
+++ b/buildlive
@@ -14,8 +14,9 @@ msg() {
echo -e "$1" >&2
}
-errmsg() {
+fatalerror() {
msg "\x1b[1;31m$1\x1b[0m"
+ exit 1
}
usage() {
@@ -27,14 +28,12 @@ do
case "$1" in
--root=*)
ROOTPATH=${1/--root=}
- if [ -d "$ROOTPATH" ]; then
- KERNELDIR="$ROOTPATH/liveusb-kernel"
- DATADIR="$ROOTPATH/liveusb-data"
- install -d "$KERNELDIR" "$DATADIR"
- msg "Files will be copy to $ROOTPATH"
- else
- errmsg "Invalid root path $ROOTPATH"
- fi
+ UUID="$(findmnt -o UUID --raw --noheadings $ROOTPATH \
+ || fatalerror "UUID of $ROOTPATH not found, not a mountpoint?")"
+ KERNELDIR="$ROOTPATH/liveusb-kernel"
+ DATADIR="$ROOTPATH/liveusb-data"
+ install -d "$KERNELDIR" "$DATADIR"
+ msg "Files will be copy to $ROOTPATH"
;;
--dev=*)
DEVNAME=${1/--dev=}
@@ -49,8 +48,7 @@ do
then
DISTROLIST=(${DISTROLIST[@]} "$1")
else
- errmsg "directory distro/$1 not found"
- exit 1
+ fatalerror "directory distro/$1 not found"
fi
;;
esac
@@ -65,12 +63,10 @@ do
if [[ $CKSUM == $SHA256 ]]; then
msg "$ISOFILE ok."
else
- errmsg "$ISOFILE checksum bad!"
- exit 1
+ fatalerror "$ISOFILE checksum bad!"
fi
else
- errmsg "File isofiles/$ISOFILE not found!"
- exit 1
+ fatalerror "File isofiles/$ISOFILE not found!"
fi
install_live