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. --- 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 <. +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