diff --git a/scripts/pacman-key.sh.in b/scripts/pacman-key.sh.in index 913f2c3..5910b47 100644 --- a/scripts/pacman-key.sh.in +++ b/scripts/pacman-key.sh.in @@ -453,14 +453,21 @@ import() { local importdir local ret=0 for importdir in "$@"; do + if [[ ! -f "${importdir}/pubring.gpg" && ! -f "${importdir}/pubring.kbx" ]]; then + error "$(gettext "Both file %s does not exist and could not be imported.")" "${importdir}/pubring.gpg and ${importdir}/pubring.kbx" + ret=1 if [[ -f "${importdir}/pubring.gpg" ]]; then if ! "${GPG_PACMAN[@]}" --quiet --batch --import "${importdir}/pubring.gpg" ; then error "$(gettext "%s could not be imported.")" "${importdir}/pubring.gpg" ret=1 fi - else - error "$(gettext "File %s does not exist and could not be imported.")" "${importdir}/pubring.gpg" - ret=1 + fi + if [[ -f "${importdir}/pubring.kbx" ]]; then + if ! "${GPG_PACMAN[@]}" --quiet --batch --homedir "${importdir}" --keyring pubring.kbx --export | "${GPG_PACMAN[@]}" --import - ; then + error "$(gettext "%s could not be imported.")" "${importdir}/pubring.kbx" + ret=1 + fi + fi fi done if (( ret )); then