aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRobin H. Johnson <robbat2@gentoo.org>2023-10-12 08:51:57 -0700
committerRobin H. Johnson <robbat2@gentoo.org>2023-10-12 08:51:57 -0700
commit56038c33672d12f1b5ff73ecfe7c7c43d59fd76a (patch)
tree27cb87a3ffc51b410a791dd8cb5e9357293d579e
parentsign-autobuilds: shellcheck fixes (diff)
downloadmastermirror-scripts-56038c33672d12f1b5ff73ecfe7c7c43d59fd76a.tar.gz
mastermirror-scripts-56038c33672d12f1b5ff73ecfe7c7c43d59fd76a.tar.bz2
mastermirror-scripts-56038c33672d12f1b5ff73ecfe7c7c43d59fd76a.zip
sign-autobuilds: fix variable name-induced confusion bugs in files being signed20231012T155212Z
Signed-off-by: Robin H. Johnson <robbat2@gentoo.org>
-rwxr-xr-xsign-autobuilds.sh26
1 files changed, 15 insertions, 11 deletions
diff --git a/sign-autobuilds.sh b/sign-autobuilds.sh
index 5d40fd0..adf2848 100755
--- a/sign-autobuilds.sh
+++ b/sign-autobuilds.sh
@@ -119,28 +119,32 @@ unsigned="$(comm -23 <(echo "$files" |sort) <(echo "$sigs" | sed -e 's,.asc$,,g'
#$VERBOSEP echo "=== ARCH: $a"
-for dgst in $unsigned ; do
- if [ ! -f ${dgst}.asc ]; then
- $VERBOSEP echo "Signing $dgst"
- signone $dgst
+for src in ${unsigned} ; do
+ dgst=${src}.asc
+ if [[ -f "$src" ]] && [[ ! -f "${dgst}" ]]; then
+ $VERBOSEP echo "Signing $src"
+ signone "$src"
fi
done
for dgst in ${sigs}; do
- dgst=${dgst%.asc}
- if [ -f ${dgst}.asc -a ${dgst} -nt ${dgst}.asc ]; then
+ src=${dgst%.asc}
+ # If both the source & signature are files, not symlinks, and the source is
+ # newer, then resign. Need to check both for being files, in case we are in
+ # a symlink location.
+ if [[ -f "${src}" ]] && [[ -f "${dgst}" ]] && [[ "${src}" -nt "${dgst}" ]]; then
$VERBOSEP echo "Resigning $dgst"
- rm -f ${dgst}.asc
- signone $dgst
+ rm -f "${dgst}"
+ signone "$src"
fi
done
#echo "Text helper files:"
unsigned="$( "${find_unsigned_helper_cmd[@]}" )"
-for dgst in $unsigned ; do
- $VERBOSEP echo "Signing (inline/cleartext) $dgst"
- signone_clearsign $dgst
+for src in $unsigned ; do
+ $VERBOSEP echo "Signing (inline/cleartext) $src"
+ signone_clearsign "$src"
done
cleanup