summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorP. 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)
commit1ae3846b2b7efecfa8c2bedbeef997c87700392c (patch)
tree8a3052cb3acd43f52b27e003afc4b34662f8216f
parente8a1999e499aab8e1ec3fd41df9c73ddd7375dc0 (diff)
Add '-V' option to opkbuild to print version info.
-rw-r--r--ChangeLog1
-rw-r--r--TODO1
-rw-r--r--man/opkbuild.1.in3
-rw-r--r--src/opkbuild.sh19
4 files changed, 22 insertions, 2 deletions
diff --git a/ChangeLog b/ChangeLog
index d567b55..471121c 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,6 +1,7 @@
0.2.0 ()
[ P. J. McDermott ]
+ * Output version information when opkbuild is passed a '-V' option.
* Support manual package status overrides (to satisfy build dependencies).
* Fix expected format of "Build-Depends" control field.
(Note that versioned build dependencies are still not supported yet.)
diff --git a/TODO b/TODO
index 98f0bec..51b5305 100644
--- a/TODO
+++ b/TODO
@@ -1,5 +1,4 @@
For version 0.2.x:
- * Output version information when opkbuild is passed a '-V' option.
Future Plans:
* Check on file ownership and modes.
diff --git a/man/opkbuild.1.in b/man/opkbuild.1.in
index 557cbe0..b0bf285 100644
--- a/man/opkbuild.1.in
+++ b/man/opkbuild.1.in
@@ -42,6 +42,9 @@ for the syntax of this file.
.TP
.BI \-d
Start a debugging shell if the package build fails.
+.TP
+.BI \-V
+Output version information and exit.
.SH COPYRIGHT
Copyright (C) 2012 Patrick "P. J." McDermott
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