Skip to content

Commit aa026ba

Browse files
committed
feat(gpg): take care of YK
1 parent 8ce1c64 commit aa026ba

1 file changed

Lines changed: 16 additions & 6 deletions

File tree

‎install/gpg.sh‎

Lines changed: 16 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4,20 +4,28 @@ set -o nounset -o pipefail -o errexit
44

55
install() {
66
if [[ "${OSTYPE}" =~ ^darwin ]]; then
7-
brew install --quiet gnupg
7+
brew install --quiet gnupg pinentry-mac ykman age
88
elif command -v apt-get > /dev/null 2>&1; then
9-
sudo apt-get install -y -qq gnupg
9+
sudo apt-get install -y -qq gnupg scdaemon pcscd yubikey-manager age
1010
elif command -v pacman > /dev/null 2>&1; then
11-
sudo pacman -S --noconfirm --needed gnupg
11+
sudo pacman -S --noconfirm --needed gnupg pcsclite ccid yubikey-manager age
12+
sudo systemctl enable --now pcscd.socket
1213
fi
1314

1415
if command -v gpg > /dev/null 2>&1; then
1516
mkdir -p "${HOME}/.gnupg"
1617
chmod 700 "${HOME}/.gnupg/"
1718

18-
echo 'enable-ssh-support
19-
default-cache-ttl 43200
20-
max-cache-ttl 43200' > "${HOME}/.gnupg/gpg-agent.conf"
19+
local AGENT_CONF='enable-ssh-support
20+
default-cache-ttl 60
21+
max-cache-ttl 120'
22+
23+
if [[ "${OSTYPE}" =~ ^darwin ]]; then
24+
AGENT_CONF="pinentry-program $(brew --prefix)/bin/pinentry-mac
25+
${AGENT_CONF}"
26+
fi
27+
28+
printf '%s\n' "${AGENT_CONF}" > "${HOME}/.gnupg/gpg-agent.conf"
2129

2230
echo 'personal-cipher-preferences AES256 AES192 AES CAST5
2331
personal-digest-preferences SHA512 SHA384 SHA256 SHA224
@@ -35,5 +43,7 @@ verify-options show-uid-validity
3543
with-fingerprint
3644
require-cross-certification
3745
use-agent' > "${HOME}/.gnupg/gpg.conf"
46+
47+
gpgconf --kill gpg-agent
3848
fi
3949
}

0 commit comments

Comments
 (0)