diff options
author | P. J. McDermott <pjm@nac.net> | 2012-03-21 22:16:21 (EDT) |
---|---|---|
committer | P. J. McDermott <pjm@nac.net> | 2012-03-21 22:16:21 (EDT) |
commit | 1ae3846b2b7efecfa8c2bedbeef997c87700392c (patch) | |
tree | 8a3052cb3acd43f52b27e003afc4b34662f8216f /src/opkbuild.sh | |
parent | e8a1999e499aab8e1ec3fd41df9c73ddd7375dc0 (diff) |
Add '-V' option to opkbuild to print version info.
Diffstat (limited to 'src/opkbuild.sh')
-rw-r--r-- | src/opkbuild.sh | 19 |
1 files changed, 18 insertions, 1 deletions
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 <<EOF +opkbuild (@@PACKAGE@@) @@VERSION@@ +Copyright (C) 2012 Patrick "P. J." McDermott +License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>. +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 |