summaryrefslogtreecommitdiffstats
path: root/scripts/pacman-key.sh.in
diff options
context:
space:
mode:
authorAllan McRae <allan@archlinux.org>2011-07-09 03:41:04 +0200
committerAllan McRae <allan@archlinux.org>2011-07-19 02:27:54 +0200
commit0e85c4989b7a7a20978ba0dcc7b56f0f1853b974 (patch)
tree270bf96bdee48905069ff42b3bb55cf4e55581db /scripts/pacman-key.sh.in
parentfec10d4a65ebfdcac1f0e3dec9e24c1fe67bb52a (diff)
downloadpacman-0e85c4989b7a7a20978ba0dcc7b56f0f1853b974.tar.gz
pacman-0e85c4989b7a7a20978ba0dcc7b56f0f1853b974.tar.xz
pacman-key: add --verify option
Signed-off-by: Allan McRae <allan@archlinux.org>
Diffstat (limited to 'scripts/pacman-key.sh.in')
-rw-r--r--scripts/pacman-key.sh.in10
1 files changed, 7 insertions, 3 deletions
diff --git a/scripts/pacman-key.sh.in b/scripts/pacman-key.sh.in
index 776fc0e9..937dcad5 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: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: