]> git.saurik.com Git - apt.git/blobdiff - cmdline/apt-key
* buildlib/configure.mak:
[apt.git] / cmdline / apt-key
index e632be706c49c581d3d9593ec3e48e2a9ec9c34d..c184e3e755b44f96ffd40a43abc7102756d6bb4f 100755 (executable)
@@ -11,7 +11,8 @@ GPG_CMD="gpg --ignore-time-conflict --no-options --no-default-keyring --secret-k
 
 if [ "$(id -u)" -eq 0 ]; then
        # we could use a tmpfile here too, but creation of this tends to be time-consuming
-       GPG_CMD="$GPG_CMD --trustdb-name /etc/apt/trustdb.gpg"
+       eval $(apt-config shell TRUSTDBDIR Dir::Etc/d)
+       GPG_CMD="$GPG_CMD --trustdb-name ${TRUSTDBDIR}/trustdb.gpg"
 fi
 
 GPG="$GPG_CMD"
@@ -152,7 +153,7 @@ if [ "$1" = "--keyring" ]; then
         #echo "keyfile given"
        shift
        TRUSTEDFILE="$1"
-       if [ -r "$TRUSTEDFILE" ]; then
+       if [ -r "$TRUSTEDFILE" ] || [ "$2" = 'add' ]; then
                GPG="$GPG --keyring $TRUSTEDFILE --primary-keyring $TRUSTEDFILE"
        else
                echo >&2 "Error: The specified keyring »$TRUSTEDFILE« is missing or not readable"