gpg: detect installed GnuPG binary

nistp521
Roman Zeyde 7 years ago
parent b7743e12a5
commit 377af1466c
No known key found for this signature in database
GPG Key ID: 87CAE5FA46917CBB

@ -179,7 +179,7 @@ def get_gnupg_binary(sp=subprocess):
"""Starting GnuPG 2.2.x, the default installation uses `gpg`."""
for cmd in ['gpg2', 'gpg']:
try:
return sp.check_output(args=['which', cmd]).strip()
return sp.check_output(args=['which', cmd]).strip().decode('ascii')
except subprocess.CalledProcessError:
log.debug('%r not found', cmd)
continue

@ -5,9 +5,10 @@ USER_ID="${1}"
DEVICE=${DEVICE:="trezor"} # or "ledger"
CURVE=${CURVE:="nist256p1"} # or "ed25519"
TIMESTAMP=${TIMESTAMP:=`date +%s`} # key creation timestamp
GPG_BINARY=${GPG_BINARY:="gpg2"} # starting from GnuPG 2.2, gpg2 -> gpg
HOMEDIR=~/.gnupg/${DEVICE}
# NOTE: starting from GnuPG 2.2, gpg2 -> gpg
GPG_BINARY=$(python -c "import libagent.gpg.keyring as k; print(k.get_gnupg_binary())")
${GPG_BINARY} --version # verify that GnuPG 2.1+ is installed
# Prepare new GPG home directory for hardware-based identity

Loading…
Cancel
Save