| 1 |
#!/bin/sh |
| 2 |
|
| 3 |
set -e |
| 4 |
|
| 5 |
umask 0077 |
| 6 |
|
| 7 |
GPG_MASTER_PUB_KEYRING="/usr/share/keyrings/debian-debdelta-archive-keyring.gpg" |
| 8 |
GPG_HOME="/etc/debdelta/gnupg" |
| 9 |
|
| 10 |
sha1it () { |
| 11 |
( |
| 12 |
cd ${GPG_HOME} |
| 13 |
echo '#if this file is deleted or it does not match, then ' > sha1_hashes.txt |
| 14 |
echo '# these files will not be removed when purging "debdelta" ' >> sha1_hashes.txt |
| 15 |
sha1sum pubring.gpg secring.gpg >> sha1_hashes.txt |
| 16 |
if test -f trustdb.gpg ; then sha1sum trustdb.gpg >> sha1_hashes.txt ; fi |
| 17 |
) |
| 18 |
} |
| 19 |
|
| 20 |
check1it () { |
| 21 |
( |
| 22 |
cd ${GPG_HOME} |
| 23 |
test -f sha1_hashes.txt && sha1sum -c --quiet sha1_hashes.txt |
| 24 |
) |
| 25 |
} |
| 26 |
|
| 27 |
case "$1" in |
| 28 |
configure|reconfigure) |
| 29 |
if test ! -r ${GPG_HOME} ; then |
| 30 |
echo "Debdelta: creating ${GPG_HOME}" |
| 31 |
mkdir ${GPG_HOME} |
| 32 |
fi |
| 33 |
if test ! -r ${GPG_HOME}/pubring.gpg -a \ |
| 34 |
! -r ${GPG_HOME}/secring.gpg ; then |
| 35 |
echo "Debdelta: creating keyrings in ${GPG_HOME}" |
| 36 |
touch ${GPG_HOME}/secring.gpg ${GPG_HOME}/pubring.gpg |
| 37 |
sha1it |
| 38 |
else |
| 39 |
echo "Debdelta: updating public keyring in ${GPG_HOME}" |
| 40 |
fi |
| 41 |
|
| 42 |
c=0 ; if check1it ; then c=1 ; fi |
| 43 |
gpg --no-tty --batch --no-options --no-auto-check-trustdb --homedir ${GPG_HOME} --import ${GPG_MASTER_PUB_KEYRING} || true |
| 44 |
gpgconf --homedir ${GPG_HOME} --kill gpg-agent || true |
| 45 |
if test $c = 1 ; then sha1it ; fi |
| 46 |
|
| 47 |
;; |
| 48 |
esac |