gpg: simplify Python entry point and refactor Bash scripts a bit

Now there is a single 'trezor-gpg' tool, with various subcommands.
This commit is contained in:
Roman Zeyde
2017-04-26 22:05:49 +03:00
parent 02c8e729b7
commit eb525e1b62
5 changed files with 44 additions and 28 deletions

2
scripts/gpg-agent Executable file
View File

@@ -0,0 +1,2 @@
#!/bin/bash
trezor-gpg agent

View File

@@ -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"

View File

@@ -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)" </dev/null
gpg-connect-agent --agent-program "$(dirname $0)/gpg-agent" </dev/null
COMMAND=$*
if [ -z "${COMMAND}" ]