X-Git-Url: https://git.saurik.com/apt.git/blobdiff_plain/f7bd44bae0d7cb7f9838490b5eece075da83899e..6dcae298f972eb20223838f0e1dc376c44bc9cc3:/cmdline/apt-key.in diff --git a/cmdline/apt-key.in b/cmdline/apt-key.in index cfd4be35d..b309142cf 100644 --- a/cmdline/apt-key.in +++ b/cmdline/apt-key.in @@ -193,7 +193,7 @@ remove_key_from_keyring() { get_fingerprints_of_keyring "$KEYRINGFILE" > "$FINGERPRINTS" # strip leading 0x, if present: - KEY="$(printf %s "$KEY" | sed s/^0x//)" + KEY="${KEY#0x}" # check if the key is in this keyring if ! grep -iq "^[0-9A-F]*${KEY}$" "$FINGERPRINTS"; then @@ -493,8 +493,21 @@ create_gpg_home() { } prepare_gpg_home() { + # crude detection if we are called from a maintainerscript where the + # package depends on gnupg or not. We accept recommends here as + # well as the script hopefully uses apt-key optionally then like e.g. + # debian-archive-keyring for (upgrade) cleanup did + if [ -n "$DPKG_MAINTSCRIPT_PACKAGE" ]; then + if ! dpkg-query --show --showformat '${Pre-Depends}${Depends}${Recommends}\n' "$DPKG_MAINTSCRIPT_PACKAGE" 2>/dev/null | grep -q gnupg; then + cat >&2 <