From fe09c477171e3fc99508ded4515e2090a3b2adbb Mon Sep 17 00:00:00 2001 From: Knut Ahlers Date: Thu, 4 Apr 2019 18:09:42 +0200 Subject: [PATCH] Add key retrieval Signed-off-by: Knut Ahlers --- Dockerfile | 1 + getkeys.sh | 16 ++++++++++++++++ run.sh | 3 +++ 3 files changed, 20 insertions(+) create mode 100755 getkeys.sh diff --git a/Dockerfile b/Dockerfile index 68b2d47..a7c90a5 100644 --- a/Dockerfile +++ b/Dockerfile @@ -18,5 +18,6 @@ VOLUME ["/src", "/repo", "/config"] WORKDIR /src COPY run.sh /usr/local/bin/ +COPY getkeys.sh /usr/local/bin/ ENTRYPOINT ["/usr/local/bin/run.sh"] diff --git a/getkeys.sh b/getkeys.sh new file mode 100755 index 0000000..a8b4c35 --- /dev/null +++ b/getkeys.sh @@ -0,0 +1,16 @@ +#!/bin/bash +set -euo pipefail + +[ -f "PKGBUILD" ] || { + echo "No PKGBUILD file found" + exit 1 +} + +source PKGBUILD + +[ -n "${validgpgkeys:-}" ] || { + echo "No 'validgpgkeys' directive found, nothing to do" + exit 0 +} + +exec gpg --recv-keys "${validgpgkeys[@]}" diff --git a/run.sh b/run.sh index 620a3d2..e2e4f3c 100755 --- a/run.sh +++ b/run.sh @@ -30,6 +30,9 @@ fi # Update pacman index pacman -Sy +# Retrieve GPG keys if required +gosu builder getkeys.sh + # Execute the build itself gosu builder makepkg ${MAKEPKG_OPTS[@]}