From 8823b6238f391b267408ca2d50dd90bd0308c3be Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20Gr=C3=B6ber?= Date: Thu, 28 Oct 2021 04:09:19 +0200 Subject: [PATCH] server: Fix gpgv script We do in fact control the upload order, it's in the makefile. So just upload the zone first then the sig and then only verify and copy on the sig upload. --- server/knot-gpgv-import | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/server/knot-gpgv-import b/server/knot-gpgv-import index b30c168..826c416 100644 --- a/server/knot-gpgv-import +++ b/server/knot-gpgv-import @@ -5,16 +5,16 @@ set -eu file="$1" case "$file" in - # We don't control the order of the zone/sig upload so just try on both - *.zone) ;; *.zone.sig) ;; # Ignore everything else *) exit 0 ;; esac +zone=${file%*.sig} + [ -f "$file" ] || exit 1 -[ -f "$file".sig ] || exit 2 -gpgv --keyring $HOME/trustedkeys.kbx "$file".sig "$file" || exit 3 -cp -t /var/lib/knot "$file" || exit 4 -sudo -u knot knotc zone-reload "$(basename "${file%*.zone*}")" +[ -f "$zone" ] || exit 2 +gpgv --keyring $HOME/trustedkeys.kbx "$file" "$zone" || exit 3 +cp -t /var/lib/knot "$zone" || exit 4 +sudo -u knot knotc zone-reload "$(basename "${zone%*.zone*}")"