mirror of
https://github.com/romanz/amodem.git
synced 2026-05-01 06:47:24 +08:00
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`."""
|
"""Starting GnuPG 2.2.x, the default installation uses `gpg`."""
|
||||||
for cmd in ['gpg2', 'gpg']:
|
for cmd in ['gpg2', 'gpg']:
|
||||||
try:
|
try:
|
||||||
return sp.check_output(args=['which', cmd]).strip()
|
return sp.check_output(args=['which', cmd]).strip().decode('ascii')
|
||||||
except subprocess.CalledProcessError:
|
except subprocess.CalledProcessError:
|
||||||
log.debug('%r not found', cmd)
|
log.debug('%r not found', cmd)
|
||||||
continue
|
continue
|
||||||
|
|||||||
@@ -5,9 +5,10 @@ USER_ID="${1}"
|
|||||||
DEVICE=${DEVICE:="trezor"} # or "ledger"
|
DEVICE=${DEVICE:="trezor"} # or "ledger"
|
||||||
CURVE=${CURVE:="nist256p1"} # or "ed25519"
|
CURVE=${CURVE:="nist256p1"} # or "ed25519"
|
||||||
TIMESTAMP=${TIMESTAMP:=`date +%s`} # key creation timestamp
|
TIMESTAMP=${TIMESTAMP:=`date +%s`} # key creation timestamp
|
||||||
GPG_BINARY=${GPG_BINARY:="gpg2"} # starting from GnuPG 2.2, gpg2 -> gpg
|
|
||||||
HOMEDIR=~/.gnupg/${DEVICE}
|
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
|
${GPG_BINARY} --version # verify that GnuPG 2.1+ is installed
|
||||||
|
|
||||||
# Prepare new GPG home directory for hardware-based identity
|
# Prepare new GPG home directory for hardware-based identity
|
||||||
|
|||||||
Reference in New Issue
Block a user