summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEric Bélanger <snowmaniscool@gmail.com>2012-10-24 21:25:52 +0200
committerDave Reisner <dreisner@archlinux.org>2012-10-25 02:49:05 +0200
commit0cdd65ec02af63c91873dd068f9ca2d6f8959ca3 (patch)
tree6887da9369b720eafb05441b2b970568b041a5a0
parent7f1517275d22a7ce6bc8cece7ae87fb187b439ea (diff)
downloadmkinitcpio-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-xmkinitcpio14
1 files changed, 12 insertions, 2 deletions
diff --git a/mkinitcpio b/mkinitcpio
index 8e5f9a8..27902f1 100755
--- a/mkinitcpio
+++ b/mkinitcpio
@@ -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 ;;