]> git.saurik.com Git - apt.git/blobdiff - cmdline/apt-key.in
set a primary-keyring only if we have access to it
[apt.git] / cmdline / apt-key.in
index ab62d4c8fdaac5d9a3e738ad9239e14904b562ac..9da5fceb81ab510eec6d6b12ff1552333e1fd2b2 100644 (file)
@@ -281,8 +281,8 @@ if [ -z "$TRUSTEDFILE" ]; then
    eval $(apt-config shell TRUSTEDFILE Dir::Etc::Trusted/f)
    if [ -r "$TRUSTEDFILE" ]; then
       GPG="$GPG --keyring $TRUSTEDFILE"
+      GPG="$GPG --primary-keyring $TRUSTEDFILE"
    fi
-   GPG="$GPG --primary-keyring $TRUSTEDFILE"
    TRUSTEDPARTS="/etc/apt/trusted.gpg.d"
    eval $(apt-config shell TRUSTEDPARTS Dir::Etc::TrustedParts/d)
    if [ -d "$TRUSTEDPARTS" ]; then
@@ -316,6 +316,8 @@ if [ "$command" != "help" ]; then
        if [ -w "$(dirname "$TRUSTEDFILE")" ]; then
           touch -- "$TRUSTEDFILE"
           chmod 0644 -- "$TRUSTEDFILE"
+          GPG="$GPG --keyring $TRUSTEDFILE"
+          GPG="$GPG --primary-keyring $TRUSTEDFILE"
        fi
     fi
 fi