]> git.saurik.com Git - apt.git/commitdiff
add a (hidden) --quiet option for apt-key
authorDavid Kalnischkies <david@kalnischkies.de>
Fri, 24 Jan 2014 15:43:19 +0000 (16:43 +0100)
committerDavid Kalnischkies <david@kalnischkies.de>
Fri, 26 Sep 2014 22:12:13 +0000 (00:12 +0200)
cmdline/apt-key.in

index 59b69b89cf1236b987e95cfd4aeaeae56ffb35d2..d50ad40ac1d8e5c14bbc72f0a9336e91129a4084 100644 (file)
@@ -39,6 +39,8 @@ ARCHIVE_KEYRING_URI='&keyring-uri;'
 eval $(apt-config shell ARCHIVE_KEYRING_URI APT::Key::ArchiveKeyringURI)
 TMP_KEYRING=${APT_DIR}/var/lib/apt/keyrings/maybe-import-keyring.gpg
 
+aptkey_echo() { echo "$@"; }
+
 requires_root() {
        if [ "$(id -u)" -ne 0 ]; then
                echo >&1 "ERROR: This command can only be used by root."
@@ -142,7 +144,7 @@ net_update() {
     fi
     new_mtime=$(stat -c %Y $keyring)
     if [ $new_mtime -ne $old_mtime ]; then
-       echo "Checking for new archive signing keys now"
+       aptkey_echo "Checking for new archive signing keys now"
        add_keys_with_verify_against_master_keyring $keyring $MASTER_KEYRING
     fi
 }
@@ -227,7 +229,7 @@ remove_key() {
            done
        fi
     fi
-    echo "OK"
+    aptkey_echo "OK"
 }
 
 
@@ -267,6 +269,10 @@ while [ -n "$1" ]; do
         requires_root() { true; }
         shift
         ;;
+      --quiet)
+        aptkey_echo() { true; }
+        shift
+        ;;
       --*)
         echo >&2 "Unknown option: $1"
         usage
@@ -316,7 +322,7 @@ case "$command" in
         requires_root
         init_keyring "$TRUSTEDFILE"
         $GPG --quiet --batch --import "$1"
-        echo "OK"
+        aptkey_echo "OK"
         ;;
     del|rm|remove)
         init_keyring "$TRUSTEDFILE"
@@ -348,7 +354,7 @@ case "$command" in
         ;;
     adv*)
         init_keyring "$TRUSTEDFILE"
-        echo "Executing: $GPG $*"
+        aptkey_echo "Executing: $GPG $*"
         $GPG $*
         ;;
     help)