From 1ae3846b2b7efecfa8c2bedbeef997c87700392c Mon Sep 17 00:00:00 2001 From: P. J. McDermott Date: Wed, 21 Mar 2012 22:16:21 -0400 Subject: Add '-V' option to opkbuild to print version info. --- (limited to 'src') diff --git a/src/opkbuild.sh b/src/opkbuild.sh index 7d5f963..25bb041 100644 --- a/src/opkbuild.sh +++ b/src/opkbuild.sh @@ -28,6 +28,19 @@ print_usage() printf 'Usage: %s [-r assume-uid0-cmd] [-p target-platform] [-d]\n' "${1}" } +print_version() +{ + cat <. +This is free software: you are free to change and redistribute it. +There is NO WARRANTY, to the extent permitted by law. + +Written by P. J. McDermott. +EOF +} + error() { [ ${#} -eq 1 ] && printf 'opkbuild: [%s] Error\n' "${1}" >&2 @@ -40,7 +53,7 @@ error() exit 1 } -opts=$(getopt -n "${0}" -o 'r:p:ds:' -- "${@}") +opts=$(getopt -n "${0}" -o 'r:p:ds:V' -- "${@}") if [ ${?} -ne 0 ]; then print_usage "${0}" >&2 exit 1; @@ -64,6 +77,10 @@ while true; do status_override=${2} shift 2 ;; + -V) + print_version + exit 0 + ;; --) shift break -- cgit v0.9.1