setup: add subcommand for machine list
Add a subcommand that gives a human-readable list of vendors
and associated machines for which there is code in the repository.
Signed-off-by: Patrick Williams <patrick@stwcx.xyz>
Change-Id: Ie4ce61d89397803bd53d1c8927106801ea9ad0fb
diff --git a/setup b/setup
index 823cc1b..f05800d 100755
--- a/setup
+++ b/setup
@@ -52,6 +52,9 @@
name=${cfg##*/}
name=${name%.conf}
tmpl=${cfg%/machine/*.conf}
+ vendor=${cfg%%/*}
+ vendor=${vendor##meta-}
+ vendor=${vendor%%-openbmc}
if [ "$tmpl" = "poky/meta/conf" ]; then
# This is a QEMU machine, use phosphor defaults.
@@ -82,7 +85,7 @@
return
fi
else
- echo "${name}"
+ echo "${vendor}/${name}"
fi
done
@@ -92,7 +95,22 @@
if [ -z "$1" ]; then
echo Target machine must be specified. Use one of:
echo
- machine | sort | sed "s/qemu[^[:space:]]*//" | "${COLUMN[@]}"
+ machine | sed "/qemu[^[:space:]]*/d" | sed "s#.*/##" | sort -h | "${COLUMN[@]}"
+ exit
+fi
+
+if [ "$1" == "machines" ]; then
+ vendors=""
+ for m in $(machine | sort -h | sed "/qemu[^[:space:]]*/d"); do
+ vendor=${m%%/*}
+ machine=${m##*/}
+
+ if [[ ! "$vendors" =~ -$vendor- ]]; then
+ vendors="$vendors -$vendor-"
+ echo "* $vendor"
+ fi
+ echo " * $machine"
+ done
exit
fi