summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorIru Cai <mytbk920423@gmail.com>2016-08-21 15:45:54 +0800
committerIru Cai <mytbk920423@gmail.com>2016-08-21 15:45:54 +0800
commit40900cfbc2a0ee3530736ef246654a1bf9f61b12 (patch)
tree2ecb01cbac4b6b481e1e0ee929b2aa42cc720061
parent12f50194c2d6be71d06832128fb826ce5f2d565b (diff)
downloadliveusb-builder-40900cfbc2a0ee3530736ef246654a1bf9f61b12.tar.xz
buildlive: add -L option to list available distro isos
-rwxr-xr-xbuildlive4
-rwxr-xr-xlistisos.sh18
2 files changed, 22 insertions, 0 deletions
diff --git a/buildlive b/buildlive
index 9327f43..4d5d52c 100755
--- a/buildlive
+++ b/buildlive
@@ -23,11 +23,15 @@ fatalerror() {
usage() {
msg "$0 --root=<rootpath> --dev=<devname> [--no-grub] [distro 1] [distro 2] ..."
+ msg "use $0 -L to list available distros"
}
while [[ -n "$1" ]]
do
case "$1" in
+ -L)
+ exec ./listisos.sh
+ ;;
--root=*)
ROOTPATH=${1/--root=}
UUID="$(findmnt -o UUID --raw --noheadings $ROOTPATH \
diff --git a/listisos.sh b/listisos.sh
new file mode 100755
index 0000000..1aef8f9
--- /dev/null
+++ b/listisos.sh
@@ -0,0 +1,18 @@
+#!/bin/bash
+
+ISOINFOS=($(find distro -name isoinfo))
+for _isoinfo in "${ISOINFOS[@]}"
+do
+ _distrobase="$(cut -d'/' -f1-2 <<< "$_isoinfo")"
+ _distroisodir="$(dirname $_isoinfo | cut -d'/' -f2-)"
+ if [ -f "$_distrobase/distroinfo" ]; then
+ source "$_distrobase/distroinfo"
+ else
+ continue
+ fi
+ source "$_isoinfo"
+ if [ -n "$ISONAME" ]; then
+ echo "$_distroisodir: $ISONAME"
+ fi
+done
+