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
  fi
}

maybe_init_keyring
