From c55cbfbd5f3659ee5c105bbdb932cdb7afab5f2a Mon Sep 17 00:00:00 2001 From: Allan McRae Date: Sat, 30 Jul 2011 12:24:46 +1000 Subject: pacman-key: follow gpg options for listing keys The current --list option outputed the keys and all their signatures which can be overly verbose. It also did not take a list of keys on the command line to limit its output (although the code suggests that was intended). That patch brings consistency with gpg, providing --list-keys and --list-sigs options that function equivalently to those provided by gpg. Signed-off-by: Allan McRae Signed-off-by: Dan McGee --- scripts/pacman-key.sh.in | 21 +++++++++++++-------- 1 file changed, 13 insertions(+), 8 deletions(-) (limited to 'scripts/pacman-key.sh.in') diff --git a/scripts/pacman-key.sh.in b/scripts/pacman-key.sh.in index e6a4691b..1fc1ab5b 100644 --- a/scripts/pacman-key.sh.in +++ b/scripts/pacman-key.sh.in @@ -35,7 +35,8 @@ FINGER=0 IMPORT=0 IMPORT_TRUSTDB=0 INIT=0 -LIST=0 +LISTKEYS=0 +LISTSIGS=0 RECEIVE=0 RELOAD=0 UPDATEDB=0 @@ -58,7 +59,7 @@ usage() { echo "$(gettext " -e, --export [] Export the specified or all keyids")" echo "$(gettext " -f, --finger [] List fingerprint for specified or all keyids")" echo "$(gettext " -h, --help Show this help message and exit")" - echo "$(gettext " -l, --list List keys")" + echo "$(gettext " -l, --list-keys [] List the specified or all keys")" echo "$(gettext " -r, --receive Fetch the specified keyids")" echo "$(gettext " -u, --updatedb Update the trustdb of pacman")" echo "$(gettext " -v, --verify Verify the file specified by the signature")" @@ -71,6 +72,7 @@ usage() { echo "$(gettext " --import Imports pubring.gpg and trustdb.gpg from dir(s)")" echo "$(gettext " --import-trustdb Imports ownertrust values from trustdb.gpg in dir(s)")" echo "$(gettext " --init Ensure the keyring is properly initialized")" + echo "$(gettext " --list-sigs [] List keys and their signatures")" echo "$(gettext " --reload Reload the default keys")" } @@ -317,10 +319,10 @@ if ! type gettext &>/dev/null; then } fi -OPT_SHORT="a::d:e:f::hlr:uv:V" +OPT_SHORT="a::d:e:f::hl::r:uv:V" OPT_LONG="add::,config:,delete:,edit-key:,export::,finger::,gpgdir:" -OPT_LONG+=",help,import:,import-trustdb:,init,list,receive:,reload,updatedb" -OPT_LONG+=",verify:,version" +OPT_LONG+=",help,import:,import-trustdb:,init,list-keys::,list-sigs::,,receive:" +OPT_LONG+=",reload,updatedb,verify:,version" if ! OPT_TEMP="$(parse_options $OPT_SHORT $OPT_LONG "$@")"; then echo; usage; exit 1 # E_INVALID_OPTION; fi @@ -344,7 +346,8 @@ while true; do --import) IMPORT=1; shift; IMPORT_DIRS=($1) ;; --import-trustdb) IMPORT_TRUSTDB=1; shift; IMPORT_DIRS=($1) ;; --init) INIT=1 ;; - -l|--list) LIST=1 ;; + -l|--list-keys) LISTKEYS=1; [[ -n $2 && ${2:0:1} != "-" ]] && shift && KEYIDS=($1) ;; + --list-sigs) LISTSIGS=1; [[ -n $2 && ${2:0:1} != "-" ]] && shift && KEYIDS=($1) ;; -r|--receive) RECEIVE=1; shift; TMP=($1); KEYSERVER=${TMP[0]}; KEYIDS=(${TMP[@]:1}); unset TMP;; --reload) RELOAD=1 ;; -u|--updatedb) UPDATEDB=1 ;; @@ -383,7 +386,8 @@ PACMAN_KEYRING_DIR=${PACMAN_KEYRING_DIR:-$(get_from "$CONFIG" "GPGDir" || echo " GPG_PACMAN=(gpg --homedir ${PACMAN_KEYRING_DIR} --no-permission-warning) # check only a single operation has been given -numopt=$(( ADD + DELETE + EDITKEY + EXPORT + FINGER + IMPORT + IMPORT_TRUSTDB + INIT + LIST + RECEIVE + RELOAD + UPDATEDB + VERIFY )) +numopt=$(( ADD + DELETE + EDITKEY + EXPORT + FINGER + IMPORT + IMPORT_TRUSTDB + + INIT + LISTKEYS + LISTSIGS + RECEIVE + RELOAD + UPDATEDB + VERIFY )) case $numopt in 0) @@ -407,7 +411,8 @@ esac (( IMPORT )) && import (( IMPORT_TRUSTDB)) && import_trustdb (( INIT )) && initialize -(( LIST )) && "${GPG_PACMAN[@]}" --batch --list-sigs "${KEYIDS[@]}" +(( LISTKEYS )) && "${GPG_PACMAN[@]}" --batch --list-keys "${KEYIDS[@]}" +(( LISTSIGS )) && "${GPG_PACMAN[@]}" --batch --list-sigs "${KEYIDS[@]}" (( RECEIVE )) && receive_keys (( RELOAD )) && reload_keyring (( UPDATEDB )) && "${GPG_PACMAN[@]}" --batch --check-trustdb -- cgit v1.2.3-24-g4f1b