Hello.

Support for new gpg kbx files in imports.
Allow Import for both types pubring.gpg and pubring.kbx.

```
diff --git a/001-import-pubring-kbx-and-gpg.patch b/001-import-pubring-kbx-and-gpg.patch
new file mode 100644
index 0000000..bc246d5
--- /dev/null
+++ b/001-import-pubring-kbx-and-gpg.patch
@@ -0,0 +1,29 @@
+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
```
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

Attachment: OpenPGP_0x6D3F33D06E5447B6.asc
Description: OpenPGP public key

Attachment: OpenPGP_signature
Description: OpenPGP digital signature

Reply via email to