+SECRETKEYRING="$(mktemp)"
+trap "rm -f '${SECRETKEYRING}'" 0 HUP INT QUIT ILL ABRT FPE SEGV PIPE TERM
+GPG_CMD="gpg --ignore-time-conflict --no-options --no-default-keyring --secret-keyring ${SECRETKEYRING}"
+
+if [ "$(id -u)" -eq 0 ]; then
+ # we could use a tmpfile here too, but creation of this tends to be time-consuming
+ eval $(apt-config shell TRUSTDBDIR Dir::Etc/d)
+ GPG_CMD="$GPG_CMD --trustdb-name ${TRUSTDBDIR}/trustdb.gpg"
+fi
+