To cut down on spam during --populate, both locally signing and
revoking keys now hide the specific keys being signed or revoked,
but can be shown with --verbose. A count was added, to show the
number of keys signed/revoked during the process.

This commit closes:
FS#64142 - pacman-key: make populate less noisy

Signed-off-by: Matthew Sexton <[email protected]>
---
 scripts/pacman-key.sh.in | 14 ++++++++++++--
 1 file changed, 12 insertions(+), 2 deletions(-)

diff --git a/scripts/pacman-key.sh.in b/scripts/pacman-key.sh.in
index a59dba52..4eea248b 100644
--- a/scripts/pacman-key.sh.in
+++ b/scripts/pacman-key.sh.in
@@ -334,11 +334,16 @@ populate_keyring() {
        done
 
        if (( ${#revoked_ids[@]} > 0 )); then
+               local key_count=0
                msg "$(gettext "Disabling revoked keys in keyring...")"
                for key_id in "${!revoked_ids[@]}"; do
-                       msg2 "$(gettext "Disabling key %s...")" "${key_id}"
+                       key_count=$((key_count+1))
+                       if (( VERBOSE )); then
+                               msg2 "$(gettext "Disabling key %s...")" 
"${key_id}"
+                       fi
                        printf 'disable\nquit\n' | LANG=C "${GPG_PACMAN[@]}" 
--command-fd 0 --quiet --batch --edit-key "${key_id}" 2>/dev/null
                done
+               msg2 "$(gettext "Disabled %s keys.")" "${key_count}"
        fi
 }
 
@@ -447,19 +452,24 @@ lsign_keys() {
        check_keyids_exist
 
        local ret=0
+       local key_count=0
        for key_id in "$@"; do
-               msg2 "$(gettext "Locally signing key %s...")" "${key_id}"
+               if (( VERBOSE )); then
+                       msg2 "$(gettext "Locally signing key %s...")" 
"${key_id}"
+               fi
                # we cannot use --yes here as gpg would still ask for 
confirmation if a key has more than one uid
                printf 'y\ny\n' | LANG=C "${GPG_PACMAN[@]}" --command-fd 0 
--quiet --batch --lsign-key "${key_id}" 2>/dev/null
                if (( PIPESTATUS[1] )); then
                        error "$(gettext "%s could not be locally signed.")" 
"${key_id}"
                        ret=1
                fi
+               key_count=$((key_count+1))
        done
 
        if (( ret )); then
                exit 1
        fi
+       msg2 "$(gettext "Locally signed %s keys.")" "${key_count}"
 }
 
 receive_keys() {
-- 
2.23.0

Reply via email to