[X2Go-Commits] [buildscripts] 06/06: bin/createsusetagsrepo: create RPM gpg key file (or really copy content.key) if not available yet.

git-admin at x2go.org git-admin at x2go.org
Sun Dec 4 06:54:36 CET 2016


This is an automated email from the git hooks/post-receive script.

x2go pushed a commit to branch master
in repository buildscripts.

commit b161e0d9ef2088ad09e712c796f8ee15f789982a
Author: Mihai Moldovan <ionic at ionic.de>
Date:   Sun Dec 4 06:54:19 2016 +0100

    bin/createsusetagsrepo: create RPM gpg key file (or really copy content.key) if not available yet.
---
 bin/createsusetagsrepo |   28 ++++++++++++++++++++++++++++
 1 file changed, 28 insertions(+)

diff --git a/bin/createsusetagsrepo b/bin/createsusetagsrepo
index 6401673..4a862c2 100755
--- a/bin/createsusetagsrepo
+++ b/bin/createsusetagsrepo
@@ -117,6 +117,34 @@ create_directory () {
 sign_metadata () {
   rm -f -- 'content.asc' && gpg -a -u "${gpg_key}" --detach-sign 'content'
   test -e 'content.key' || gpg -a --output 'content.key' --export "${gpg_key}"
+
+  typeset rpm_key_file_name="gpg-pubkey-"
+  typeset key_id_short=""
+  key_id_short="$(gpg --keyid-format=short 'content.key' | grep -Em 1 '^pub' | sed -e '/^pub.*\/\([0-9a-fA-F]\{8\}\) .*$/!d;s//\1/')"
+
+  if [ -z "${key_id_short}" ]; then
+    echo "Unable to get the short key ID of pub key ${gpg_key}." >&2
+    exit "1"
+  fi
+
+  typeset key_creation_date=""
+  key_creation_date="$(gpg --list-packets --verbose < 'content.key' 2>/dev/null | grep -Em 1 'created [0-9][0-9]*,' | sed -e '/.*created \([0-9][0-9]*\), .*/!d;s//\1/')"
+
+  if [ -z "${key_creation_date}" ]; then
+    echo "Unable to get the key creation date of pub key ${gpg_key}." >&2
+    exit "1"
+  fi
+
+  key_creation_date="$(printf '%x' "${key_creation_date}")"
+
+  if [ "$?" -ne "0" ]; then
+    echo "Unable to convert decimal key creation date of pub key ${gpg_key} to hexadecimal." >&2
+    exit "1"
+  fi
+
+  rpm_key_file_name="${rpm_key_file_name}${key_id_short}-${key_creation_date}.asc"
+
+  test -e "${rpm_key_file_name}" || cp -av 'content.key' "${rpm_key_file_name}"
 }
 
 set -e

--
Alioth's /srv/git/code.x2go.org/buildscripts.git//..//_hooks_/post-receive-email on /srv/git/code.x2go.org/buildscripts.git


More information about the x2go-commits mailing list