1
0
mirror of https://github.com/moparisthebest/pacman synced 2024-12-22 15:58:50 -05:00

pacman-key: add --verify option

Signed-off-by: Allan McRae <allan@archlinux.org>
This commit is contained in:
Allan McRae 2011-07-09 11:41:04 +10:00
parent fec10d4a65
commit 0e85c4989b
2 changed files with 11 additions and 4 deletions

View File

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

View File

@ -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:uV"
OPT_SHORT="a::d:e:f::hlr:uv:V"
OPT_LONG="add::,config:,delete:,edit-key:,export::,finger::,gpgdir:"
OPT_LONG+=",help,list,receive:,reload,updatedb,version"
OPT_LONG+=",help,list,receive:,reload,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: