aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRobin H. Johnson <robbat2@gentoo.org>2023-08-07 13:38:35 -0700
committerRobin H. Johnson <robbat2@gentoo.org>2023-08-07 13:38:35 -0700
commita499bca87c1a85044d06dfecd0ad0928718658d8 (patch)
tree5368e4b16538f0df49fbc55622df130034b1213d
parentsign-sync-binpackages: fix early exit on verbose (diff)
downloadmastermirror-scripts-a499bca87c1a85044d06dfecd0ad0928718658d8.tar.gz
mastermirror-scripts-a499bca87c1a85044d06dfecd0ad0928718658d8.tar.bz2
mastermirror-scripts-a499bca87c1a85044d06dfecd0ad0928718658d8.zip
sign-sync-binpackages: make the lock safer20230807T203847Z
Signed-off-by: Robin H. Johnson <robbat2@gentoo.org>
-rwxr-xr-xsign-sync-binpackages.sh6
1 files changed, 2 insertions, 4 deletions
diff --git a/sign-sync-binpackages.sh b/sign-sync-binpackages.sh
index cc1a957..862cea9 100755
--- a/sign-sync-binpackages.sh
+++ b/sign-sync-binpackages.sh
@@ -54,6 +54,8 @@ if [[ -f ${LOCKFILE} ]] ; then
exit 112
fi
touch ${LOCKFILE} || exit 110
+# ensure the lock is cleaned on exit
+trap "rm -f ${LOCKFILE}" SIGINT SIGTERM
# make sure we have an updated gpg-agent
gpgconf --kill all
@@ -122,8 +124,4 @@ for a in ${ARCHES}; do
date -u > ${arch_binpackages}/.timestamp
done
-
-# we're done so remove the "lockfile"
-rm ${LOCKFILE}
-
# vim: et ts=2 sts=2 sw=2