From 5a206374b047241ee6fadd74f883aefa976040dd Mon Sep 17 00:00:00 2001 From: Santiago Lo Coco Date: Mon, 28 Feb 2022 23:59:01 -0300 Subject: [PATCH] Add support for signing packages --- pkgbuild.sh | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/pkgbuild.sh b/pkgbuild.sh index fef9eb9..4cd3d37 100755 --- a/pkgbuild.sh +++ b/pkgbuild.sh @@ -6,8 +6,20 @@ setPermissions() { chmod -R a+rw . } +importPrivateKey() { + echo "$INPUT_GPGPRIVATEKEY" > private.key + sudo -u nobody gpg --batch --pinentry-mode loopback --passphrase "$INPUT_GPGPASSPHRASE" --import private.key + rm private.key + sed -i -e "s/gpg/gpg --batch --pinentry-mode loopback --passphrase \"$INPUT_GPGPASSPHRASE\"/" /usr/share/makepkg/integrity/generate_signature.sh +} + buildPackage() { - sudo -u nobody makepkg -s --noconfirm + if [ -n "$INPUT_GPGPRIVATEKEY" ] && [ -n "$INPUT_GPGPUBLICKEY" ]; then + importPrivateKey + sudo -u nobody makepkg -s --sign --key "$INPUT_GPGPUBLICKEY" --noconfirm + else + sudo -u nobody makepkg -s --noconfirm + fi } exportPackageFiles() {