summaryrefslogtreecommitdiff
path: root/scripts
diff options
context:
space:
mode:
authorAllan McRae <allan@archlinux.org>2011-07-30 12:24:46 +1000
committerDan McGee <dan@archlinux.org>2011-08-02 08:20:42 -0400
commitc55cbfbd5f3659ee5c105bbdb932cdb7afab5f2a (patch)
treee02dea7326447bab4a760aee1e871c4187eafcd9 /scripts
parentcbaff216b3eca57b4fd717da53f43a6713722e95 (diff)
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 <allan@archlinux.org> Signed-off-by: Dan McGee <dan@archlinux.org>
Diffstat (limited to 'scripts')
-rw-r--r--scripts/pacman-key.sh.in21
1 files changed, 13 insertions, 8 deletions
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 [<keyid(s)>] Export the specified or all keyids")"
echo "$(gettext " -f, --finger [<keyid(s)>] 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 [<keyid(s)>] List the specified or all 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")"
@@ -71,6 +72,7 @@ usage() {
echo "$(gettext " --import <dir(s)> Imports pubring.gpg and trustdb.gpg from dir(s)")"
echo "$(gettext " --import-trustdb <dir(s)> Imports ownertrust values from trustdb.gpg in dir(s)")"
echo "$(gettext " --init Ensure the keyring is properly initialized")"
+ echo "$(gettext " --list-sigs [<keyid(s)>] 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