summaryrefslogtreecommitdiffstats
path: root/debian/extra/gen-signing-template
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-06-19 09:14:35 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-06-19 09:14:35 +0000
commitc1edb76da8591808b80d74d6a79b7c475e6ff6cf (patch)
treea2116ab4179baaba7a4adc285b39d78b1ccda931 /debian/extra/gen-signing-template
parentAdding debian version 256-1. (diff)
downloadsystemd-c1edb76da8591808b80d74d6a79b7c475e6ff6cf.tar.xz
systemd-c1edb76da8591808b80d74d6a79b7c475e6ff6cf.zip
Adding debian version 256-2.debian/256-2
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'debian/extra/gen-signing-template')
-rwxr-xr-xdebian/extra/gen-signing-template45
1 files changed, 45 insertions, 0 deletions
diff --git a/debian/extra/gen-signing-template b/debian/extra/gen-signing-template
new file mode 100755
index 0000000..6c13571
--- /dev/null
+++ b/debian/extra/gen-signing-template
@@ -0,0 +1,45 @@
+#!/bin/bash
+
+set -euE
+
+export DEB_VERSION="$1"
+export DEB_HOST_ARCH="$2"
+export DEB_HOST_ARCH_EFI="$3"
+
+DISTRIBUTION="$(dpkg-parsechangelog -SDistribution)"
+URGENCY="$(dpkg-parsechangelog -SUrgency)"
+MAINT="$(dpkg-parsechangelog -SMaintainer)"
+DATE="$(dpkg-parsechangelog -SDate)"
+
+DEB_VERSION_MANGLED="$(echo "$DEB_VERSION" | sed -re 's/-/\+/;s/\+(b[[:digit:]]+)$/.\1/')"
+DEB_VERSION_SOURCE="$(echo "$DEB_VERSION" | sed -re 's/\+b[[:digit:]]+$//')"
+export DEB_VERSION_SOURCE
+SIGN_TEMPLATE_DIR="debian/systemd-boot-efi-${DEB_HOST_ARCH}-signed-template/usr/share/code-signing/systemd-boot-efi-${DEB_HOST_ARCH}-signed-template"
+SIGN_SOURCE_DIR="${SIGN_TEMPLATE_DIR}/source-template/debian"
+FILE=usr/lib/systemd/boot/efi/systemd-boot${DEB_HOST_ARCH_EFI}.efi
+
+for i in $(find debian/signing-template -type f -printf '%P\n'); do
+ mkdir -p "$SIGN_SOURCE_DIR/$(dirname "$i")"
+ envsubst < "debian/signing-template/$i" > "$SIGN_SOURCE_DIR/$i"
+done
+
+(
+ echo "systemd-boot-efi-${DEB_HOST_ARCH}-signed (${DEB_VERSION_MANGLED}) ${DISTRIBUTION}; urgency=${URGENCY}"
+ echo
+ echo " * Sign EFI binaries from systemd-boot-efi ${DEB_VERSION}"
+ dpkg-parsechangelog -SChanges | sed -rne 's/^.$//p' -e '/^ /p'
+ echo
+ echo " -- ${MAINT} ${DATE}"
+) > "$SIGN_SOURCE_DIR/changelog"
+
+jq -n --arg file "${FILE}" '
+{
+ "packages": {
+ "systemd-boot-efi": {
+ "trusted_certs": [],
+ "files": [
+ {"sig_type": "efi", "file": $file}
+ ]
+ }
+ }
+}' > "$SIGN_TEMPLATE_DIR/files.json"