diff options
author | Robin H. Johnson <robbat2@gentoo.org> | 2023-10-12 08:51:07 -0700 |
---|---|---|
committer | Robin H. Johnson <robbat2@gentoo.org> | 2023-10-12 08:51:07 -0700 |
commit | 11f2e445889e064c0b7f26428c650ba89d661cf4 (patch) | |
tree | a0bec7ecee0a738e1bd20dced4b51a9d55c42c79 | |
parent | sign-autobuilds: the resign loop was accidently broken years ago when a varia... (diff) | |
download | mastermirror-scripts-11f2e445889e064c0b7f26428c650ba89d661cf4.tar.gz mastermirror-scripts-11f2e445889e064c0b7f26428c650ba89d661cf4.tar.bz2 mastermirror-scripts-11f2e445889e064c0b7f26428c650ba89d661cf4.zip |
sign-autobuilds: shellcheck fixes
Signed-off-by: Robin H. Johnson <robbat2@gentoo.org>
-rwxr-xr-x | sign-autobuilds.sh | 29 |
1 files changed, 14 insertions, 15 deletions
diff --git a/sign-autobuilds.sh b/sign-autobuilds.sh index b70ba42..5d40fd0 100755 --- a/sign-autobuilds.sh +++ b/sign-autobuilds.sh @@ -10,15 +10,15 @@ ARCHES=${ARCHES:-${_ARCHES}} RELEASES=/var/tmp/gmirror-releases/releases/ [[ $HOSTNAME == TODO ]] && RELEASES=/var/tmp/gmirror/releases/ -: ${DEBUG:=''} -: ${VERBOSE=''} -GPG='gpg --homedir /home/gmirror/.gnupg-releng/ --batch --no-tty' +: "${DEBUG:=''}" +: "${VERBOSE=''}" +GPG=(gpg --homedir /home/gmirror/.gnupg-releng/ --batch --no-tty) # Do not change DEBUGP= VERBOSEP=false -[ -n "$DEBUG" ] && DEBUGP=echo -[ -n "$VERBOSE" ] && VERBOSEP= +[ -n "$DEBUG" ] && DEBUGP='echo' +[ -n "$VERBOSE" ] && VERBOSEP='' [ -n "$DEBUG" ] && RSYNC_OPTS="${RSYNC_OPTS} -n" [ -n "$VERBOSE" ] && RSYNC_OPTS="${RSYNC_OPTS} -v" @@ -27,16 +27,16 @@ VERBOSEP=false signone() { f="$1" - $DEBUGP ${GPG} --armor --detach-sign "${f}" + $DEBUGP "${GPG[@]}" --armor --detach-sign "${f}" } signone_clearsign() { # only for text files! f="$1" - d="${1}.asc.tmp" + d=".${1}.asc.tmp" rm -f "$d" # Clearsign aborts if the destfile exists - $DEBUGP ${GPG} --armor --clearsign --output "$d" "${f}" + $DEBUGP "${GPG[@]}" --armor --clearsign --output "$d" "${f}" $DEBUGP mv "${d}" "${f}" } @@ -52,17 +52,18 @@ cleanup() { find autobuilds \ -type f \ -name 'latest*txt.asc' \ - -exec grep -L -e '^-----BEGIN PGP SIGNED MESSAGE-----$' \{} \+ \ - | xargs --no-run-if-empty rm -f + -exec grep -L -e '^-----BEGIN PGP SIGNED MESSAGE-----$' \{\} \+ \ + | tr '\n' '\0' \ + | xargs -0 --no-run-if-empty rm -f } gpgconf --kill all for a in $ARCHES ; do -pushd $RELEASES/$a >/dev/null || continue +cd "$RELEASES/$a" >/dev/null || continue -[[ -d autobuilds ]] || exit +[[ -d autobuilds ]] || continue #echo "Release files:" @@ -109,7 +110,7 @@ find_unsigned_helper_cmd=( # marker files to declare latest builds. -or -name 'latest*txt' \) - -exec grep -L -e '^-----BEGIN PGP SIGNED MESSAGE-----$' \{} \+ + -exec grep -L -e '^-----BEGIN PGP SIGNED MESSAGE-----$' \{\} \+ ) files="$( "${find_files_cmd[@]}" )" @@ -144,6 +145,4 @@ done cleanup -popd >/dev/null - done |