diff options
author | Eric Bélanger <snowmaniscool@gmail.com> | 2012-10-24 21:25:52 +0200 |
---|---|---|
committer | Dave Reisner <dreisner@archlinux.org> | 2012-10-25 02:49:05 +0200 |
commit | 0cdd65ec02af63c91873dd068f9ca2d6f8959ca3 (patch) | |
tree | 6887da9369b720eafb05441b2b970568b041a5a0 | |
parent | 7f1517275d22a7ce6bc8cece7ae87fb187b439ea (diff) | |
download | mkinitcpio-0cdd65ec02af63c91873dd068f9ca2d6f8959ca3.tar.gz mkinitcpio-0cdd65ec02af63c91873dd068f9ca2d6f8959ca3.tar.xz |
Add -V/--version option to display version information
Signed-off-by: Eric Bélanger <snowmaniscool@gmail.com>
-rwxr-xr-x | mkinitcpio | 14 |
1 files changed, 12 insertions, 2 deletions
@@ -52,12 +52,19 @@ usage: ${0##*/} [options] -S, --skiphooks <hooks> Skip specified hooks, comma-separated, during build -s, --save Save build directory. (default: no) -t, --builddir <dir> Use DIR as the temporary build directory + -V, --version Display version information and exit -v, --verbose Verbose output (default: no) -z, --compress <program> Use an alternate compressor on the image EOF } +version() { + cat <<EOF +mkinitcpio $version +EOF +} + cleanup() { local err=${1:-$?} @@ -243,10 +250,10 @@ install_modules() { trap 'cleanup 130' INT trap 'cleanup 143' TERM -_opt_short='A:c:g:H:hk:nLMp:r:S:st:vz:' +_opt_short='A:c:g:H:hk:nLMp:r:S:st:Vvz:' _opt_long=('add:' 'addhooks:' 'config:' 'generate:' 'hookhelp:' 'help' 'kernel:' 'listhooks' 'automods' 'moduleroot:' 'nocolor' - 'preset:' 'skiphooks:' 'save' 'builddir:' 'verbose' 'compress:') + 'preset:' 'skiphooks:' 'save' 'builddir:' 'version' 'verbose' 'compress:') parseopts "$_opt_short" "${_opt_long[@]}" -- "$@" || exit 1 set -- "${OPTRET[@]}" @@ -277,6 +284,9 @@ while :; do -h|--help) usage cleanup 0 ;; + -V|--version) + version + cleanup 0 ;; -p|--preset) shift _optpreset=$1 ;; |