46 lines
719 B
Bash
46 lines
719 B
Bash
|
#!/bin/sh
|
||
|
set -ef
|
||
|
|
||
|
: "${GPG_KEYSERVER:=hkps://keyserver.ubuntu.com}"
|
||
|
|
||
|
[ $# != 0 ] || exit 1
|
||
|
|
||
|
case "$1" in
|
||
|
1 | start )
|
||
|
[ -n "${GNUPGHOME}" ] || exit 1
|
||
|
[ -d "${GNUPGHOME}" ] || exit 1
|
||
|
|
||
|
cd "${GNUPGHOME}"
|
||
|
cat > gpg.conf <<-EOF
|
||
|
quiet
|
||
|
batch
|
||
|
trust-model always
|
||
|
no-auto-check-trustdb
|
||
|
ignore-time-conflict
|
||
|
keyid-format 0xlong
|
||
|
keyserver ${GPG_KEYSERVER}
|
||
|
EOF
|
||
|
cat > dirmngr.conf <<-EOF
|
||
|
quiet
|
||
|
batch
|
||
|
keyserver ${GPG_KEYSERVER}
|
||
|
EOF
|
||
|
gpg --update-trustdb >/dev/null 2>&1
|
||
|
gpg --list-keys >/dev/null 2>&1
|
||
|
dirmngr >/dev/null 2>&1
|
||
|
;;
|
||
|
0 | stop )
|
||
|
[ -n "${GNUPGHOME}" ] || exit 0
|
||
|
[ -d "${GNUPGHOME}" ] || exit 1
|
||
|
|
||
|
cd "${GNUPGHOME}"
|
||
|
gpgconf --kill all
|
||
|
cd /
|
||
|
rm -rf "${GNUPGHOME}"
|
||
|
;;
|
||
|
* )
|
||
|
exit 1
|
||
|
;;
|
||
|
esac
|
||
|
exit 0
|