gpg: detect installed GnuPG binary
This commit is contained in:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user