-
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsetupkeys.sh
More file actions
executable file
·24 lines (19 loc) · 930 Bytes
/
setupkeys.sh
File metadata and controls
executable file
·24 lines (19 loc) · 930 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
#!/bin/sh
# setupkeys.sh - set up keys for signing
# Copyright (C) 2020 Kaz Nishimura
#
# Copying and distribution of this file, with or without modification, are
# permitted in any medium without royalty provided the copyright notice and
# this notice are preserved. This file is offered as-is, without any warranty.
# This script set up GnuPG keys for automated signing.
#
# The signing keys are imported from the file given as the first parameter.
# It also reads a passphrase from the standard input for the key specified by
# the 'GPG_KEYNAME' environment variable.
export GNUPGHOME=${GNUPGHOME:-$HOME/.gnupg}
mkdir -p -m go-rwx "$GNUPGHOME"
echo allow-preset-passphrase >> "$GNUPGHOME"/gpg-agent.conf || exit $?
gpg --import --batch "$1" || exit $?
keygrip=`gpg --list-secret-keys --with-colons "$GPG_KEYNAME" | \
awk -F : '$1 == "grp" { print $10 }'`
exec /usr/lib/gnupg/gpg-preset-passphrase --preset "$keygrip"