BuildSourceImage: version flag

Signed-off-by: Vincent Batts <vbatts@hashbangbash.com>
This commit is contained in:
Vincent Batts 2019-09-10 09:17:24 -04:00
parent 433272896f
commit 84b889e1ad
Signed by: vbatts
GPG key ID: 10937E57733F1362

View file

@ -6,8 +6,14 @@ export ABV_NAME="SrcImg"
# TODO maybe a flag for this? # TODO maybe a flag for this?
export source_image_suffix="-source" export source_image_suffix="-source"
# output version string
_version() {
echo "$(basename "${0}") version 0.1"
}
# output the cli usage and exit
_usage() { _usage() {
_version
echo "Usage: $(basename "$0") [-D] [-b <path>] [-c <path>] [-e <path>] [-r <path>] [-o <path>] [-i <image>] [-p <image>] [-l] [-d <drivers>]" echo "Usage: $(basename "$0") [-D] [-b <path>] [-c <path>] [-e <path>] [-r <path>] [-o <path>] [-i <image>] [-p <image>] [-l] [-d <drivers>]"
echo "" echo ""
echo -e " -b <path>\tbase path for source image builds" echo -e " -b <path>\tbase path for source image builds"
@ -20,6 +26,8 @@ _usage() {
echo -e " -i <image>\timage reference to fetch and inspect its rootfs to derive sources" echo -e " -i <image>\timage reference to fetch and inspect its rootfs to derive sources"
echo -e " -p <image>\tpush source image to specified reference after build" echo -e " -p <image>\tpush source image to specified reference after build"
echo -e " -D\t\tdebuging output. Can be set via DEBUG env variable" 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 exit 1
} }
@ -898,7 +906,7 @@ main() {
base_dir="$(pwd)/${ABV_NAME}" base_dir="$(pwd)/${ABV_NAME}"
# using the bash builtin to parse # 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 case "${opts}" in
b) b)
base_dir="${OPTARG}" base_dir="${OPTARG}"
@ -930,6 +938,10 @@ main() {
s) s)
srpm_dir=${OPTARG} srpm_dir=${OPTARG}
;; ;;
v)
_version
exit 0
;;
D) D)
export DEBUG=1 export DEBUG=1
;; ;;