MSYS2-packages/filesystem/07-pacman-key.post
Christoph Reiter 62f08f4fbc filesystem, gnupg, msys2-keyring: avoid keeping gpg-agent/dirmngr around
They get started in the background and stay around which comes with various problems:
* The files can't be deleted until they are stopped
* Some CI systems wait until all programs are stopped
* On a cygwin update we have to restart everything or forking will be broken
  (though pacman takes care of that now by killing everything cygwin-like on a core update)

Ideally though they would just exit in a controlled way after we no longer need them.

The reason this uses GNUPGHOME instead of passing --home to gpgconf is that dirmngr started by
"pacman-key --refresh-keys" somehow couldn't be killed that way.
Maybe because gpg doesn't forward --homedir in that case. Setting GNUPGHOME helped.
2021-04-18 21:14:38 +02:00

16 lines
332 B
Plaintext

maybe_init_keyring ()
{
if [ ! -d /etc/pacman.d/gnupg ]
then
export GNUPGHOME="$(pacman-conf.exe gpgdir)"
/usr/bin/pacman-key --init
/usr/bin/pacman-key --populate msys2 || true
/usr/bin/pacman-key --refresh-keys || true
/usr/bin/gpgconf --kill all
MAYBE_FIRST_START=true
fi
}
maybe_init_keyring