From 84b889e1ad7d60511d3632aeddec4b1dd56d720a Mon Sep 17 00:00:00 2001 From: Vincent Batts Date: Tue, 10 Sep 2019 09:17:24 -0400 Subject: [PATCH] BuildSourceImage: version flag Signed-off-by: Vincent Batts --- BuildSourceImage.sh | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/BuildSourceImage.sh b/BuildSourceImage.sh index 1f58520..48e76ac 100755 --- a/BuildSourceImage.sh +++ b/BuildSourceImage.sh @@ -6,8 +6,14 @@ export ABV_NAME="SrcImg" # TODO maybe a flag for this? export source_image_suffix="-source" +# output version string +_version() { + echo "$(basename "${0}") version 0.1" +} +# output the cli usage and exit _usage() { + _version echo "Usage: $(basename "$0") [-D] [-b ] [-c ] [-e ] [-r ] [-o ] [-i ] [-p ] [-l] [-d ]" echo "" echo -e " -b \tbase path for source image builds" @@ -20,6 +26,8 @@ _usage() { echo -e " -i \timage reference to fetch and inspect its rootfs to derive sources" echo -e " -p \tpush source image to specified reference after build" echo -e " -D\t\tdebuging output. Can be set via DEBUG env variable" + echo -e " -h\t\tthis usage information" + echo -e " -v\t\tversion" exit 1 } @@ -898,7 +906,7 @@ main() { base_dir="$(pwd)/${ABV_NAME}" # using the bash builtin to parse - while getopts ":hlDi:c:s:e:o:b:d:p:" opts; do + while getopts ":hlvDi:c:s:e:o:b:d:p:" opts; do case "${opts}" in b) base_dir="${OPTARG}" @@ -930,6 +938,10 @@ main() { s) srpm_dir=${OPTARG} ;; + v) + _version + exit 0 + ;; D) export DEBUG=1 ;;