From eb525e1b622437eec6358b4a614defb7d4e50e6e Mon Sep 17 00:00:00 2001 From: Roman Zeyde Date: Wed, 26 Apr 2017 22:05:49 +0300 Subject: [PATCH] gpg: simplify Python entry point and refactor Bash scripts a bit Now there is a single 'trezor-gpg' tool, with various subcommands. --- scripts/gpg-agent | 2 ++ scripts/gpg-init | 4 +-- scripts/gpg-shell | 4 +-- setup.py | 4 +-- trezor_agent/gpg/__main__.py | 56 +++++++++++++++++++++++------------- 5 files changed, 43 insertions(+), 27 deletions(-) create mode 100755 scripts/gpg-agent diff --git a/scripts/gpg-agent b/scripts/gpg-agent new file mode 100755 index 0000000..0ea74e7 --- /dev/null +++ b/scripts/gpg-agent @@ -0,0 +1,2 @@ +#!/bin/bash +trezor-gpg agent diff --git a/scripts/gpg-init b/scripts/gpg-init index 3c4cdba..83496d2 100755 --- a/scripts/gpg-init +++ b/scripts/gpg-init @@ -14,7 +14,7 @@ mkdir -p "${HOMEDIR}" chmod 700 "${HOMEDIR}" # Generate new GPG identity and import into GPG keyring -trezor-gpg-create -v "${USER_ID}" -t "${TIMESTAMP}" -e "${CURVE}" > "${HOMEDIR}/pubkey.asc" +trezor-gpg create -v "${USER_ID}" -t "${TIMESTAMP}" -e "${CURVE}" > "${HOMEDIR}/pubkey.asc" gpg2 --homedir "${HOMEDIR}" --import < "${HOMEDIR}/pubkey.asc" rm -f "${HOMEDIR}/S.gpg-agent" # (otherwise, our agent won't be started automatically) @@ -24,7 +24,7 @@ echo "${FINGERPRINT}:6" | gpg2 --homedir "${HOMEDIR}" --import-ownertrust # Prepare GPG configuration file echo "# TREZOR-based GPG configuration -agent-program $(which trezor-gpg-agent) +agent-program $(dirname ${0})/gpg-agent personal-digest-preferences SHA512 " | tee "${HOMEDIR}/gpg.conf" diff --git a/scripts/gpg-shell b/scripts/gpg-shell index fbbf046..b4db164 100755 --- a/scripts/gpg-shell +++ b/scripts/gpg-shell @@ -13,10 +13,10 @@ then fi # Make sure that the device is unlocked before starting the shell -trezor-gpg-unlock +trezor-gpg unlock # Make sure TREZOR-based gpg-agent is running -gpg-connect-agent --agent-program "$(which trezor-gpg-agent)"