From b60c4a15e4ab32d16e8648bd448801e02903321e Mon Sep 17 00:00:00 2001 From: "Robin H. Johnson" Date: Mon, 28 Nov 2022 12:41:33 -0800 Subject: sign-autobuilds: avoid cleansign error on EEXISTS Signed-off-by: Robin H. Johnson --- sign-autobuilds.sh | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/sign-autobuilds.sh b/sign-autobuilds.sh index 9e8fd66..832964d 100755 --- a/sign-autobuilds.sh +++ b/sign-autobuilds.sh @@ -33,8 +33,11 @@ signone() { signone_clearsign() { # only for text files! f="$1" - $DEBUGP ${GPG} --armor --clearsign "${f}" - $DEBUGP mv "${f}".asc "${f}" + d="${1}.asc.tmp" + rm -f "$d" + # Clearsign aborts if the destfile exists + $DEBUGP ${GPG} --armor --clearsign --output "$d" "${f}" + $DEBUGP mv "${d}" "${f}" } gpgconf --kill all @@ -69,12 +72,7 @@ done #echo "Text helper files:" -files="$(find autobuilds -name '*.sha256' -or -name '*.DIGESTS')" -unsigned="" -for dgst in $files ; do - grep -sq "BEGIN PGP SIGNED MESSAGE-----" $dgst || unsigned="${unsigned} ${dgst}" -done - +unsigned="$(find autobuilds \( -name '*.sha256' -or -name '*.DIGESTS' \) -exec grep -L -e '^-----BEGIN PGP SIGNED MESSAGE-----$' \{} \+ )" for dgst in $unsigned ; do $VERBOSEP echo "Signing (inline/cleartext) $dgst" signone_clearsign $dgst -- cgit v1.2.3-65-gdbad