Signed-off-by: Allan McRae <[email protected]>
---
 doc/pacman-key.8.txt     |    5 ++++-
 scripts/pacman-key.sh.in |   10 +++++++---
 2 files changed, 11 insertions(+), 4 deletions(-)

diff --git a/doc/pacman-key.8.txt b/doc/pacman-key.8.txt
index f961bc2..2771ece 100644
--- a/doc/pacman-key.8.txt
+++ b/doc/pacman-key.8.txt
@@ -72,7 +72,10 @@ Options
 *-u, \--updatedb*::
        Equivalent to \--check-trustdb in GnuPG.
 
-*-v, \--version*::
+* -v, \--verify* <signature>::
+       Verify the given signature file.
+
+*-V, \--version*::
        Displays the program version.
 
 
diff --git a/scripts/pacman-key.sh.in b/scripts/pacman-key.sh.in
index 55c2abe..5324418 100644
--- a/scripts/pacman-key.sh.in
+++ b/scripts/pacman-key.sh.in
@@ -36,6 +36,7 @@ LIST=0
 RECEIVE=0
 RELOAD=0
 UPDATEDB=0
+VERIFY=0
 
 m4_include(library/output_format.sh)
 
@@ -57,6 +58,7 @@ usage() {
        echo "$(gettext "  -l, --list                List keys")"
        echo "$(gettext "  -r, --receive <keyserver> <keyid(s)> Fetch the 
specified keyids")"
        echo "$(gettext "  -u, --updatedb            Update the trustdb of 
pacman")"
+       echo "$(gettext "  -v, --verify <signature>  Verify the file specified 
by the signature")"
        echo "$(gettext "  -V, --version             Show program version")"
        echo "$(gettext "  --config <file>           Use an alternate config 
file")"
        printf "$(gettext "                                    (instead of 
'%s')")\n" "@sysconfdir@/pacman.conf"
@@ -241,9 +243,9 @@ if ! type gettext &>/dev/null; then
        }
 fi
 
-OPT_SHORT="a::d:e:f::hlr:t:uV"
+OPT_SHORT="a::d:e:f::hlr:t:uv:V"
 OPT_LONG="add,adv:,config:,del:,export::,finger::,gpgdir:,help,list"
-OPT_LONG+=",receive:,reload,trust:,updatedb,version"
+OPT_LONG+=",receive:,reload,trust:,updatedb,verify:,version"
 if ! OPT_TEMP="$(parse_options $OPT_SHORT $OPT_LONG "$@")"; then
        echo; usage; exit 1 # E_INVALID_OPTION;
 fi
@@ -268,6 +270,7 @@ while true; do
                -r|--receive)     RECEIVE=1; shift; KEYSERVER="${1[0]}"; 
KEYIDS=("${1[@]:1}") ;;
                --reload)         RELOAD=1 ;;
                -u|--updatedb)    UPDATEDB=1 ;;
+               -v|--verify)      VERIFY=1; shift; SIGNATURE=$1 ;;
 
                -h|--help)        usage; exit 0 ;;
                -V|--version)     version; exit 0 ;;
@@ -309,7 +312,7 @@ 
PACMAN_KEYRING_DIR=${PACMAN_KEYRING_DIR:-@sysconfdir@/pacman.d/gnupg}
 GPG_PACMAN="gpg --homedir ${PACMAN_KEYRING_DIR} --no-permission-warning"
 
 # check only a single operation has been given
-numopt=$(( ADD + DELETE + EDITKEY + EXPORT + FINGER + LIST + RECEIVE + RELOAD 
+ UPDATEBD ))
+numopt=$(( ADD + DELETE + EDITKEY + EXPORT + FINGER + LIST + RECEIVE + RELOAD 
+ UPDATEBD + VERIFY ))
 
 if (( ! numopt )); then
        error "$(gettext "No operations specified")"
@@ -334,5 +337,6 @@ fi
 (( RECEIVE )) && receive_keys
 (( RELOAD )) && reload_keyring
 (( UPDATEDB )) && ${GPG_PACMAN} --batch --check-trustdb
+(( VERIFY )) && ${GPG_PACMAN} --verify $SIGNATURE
 
 # vim: set ts=2 sw=2 noet:
-- 
1.7.6


Reply via email to