From: Joerg Jaspert Date: Thu, 30 Sep 2010 10:33:17 +0000 (+0200) Subject: Rewrite so that it uses mktemp. also let a trap for the cleanup function handle the... X-Git-Url: https://err.no/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=2709b350308e22107319ae9c573f62765012f588;p=dak Rewrite so that it uses mktemp. also let a trap for the cleanup function handle the rm of the tempfile, we save on the whole if then Signed-off-by: Joerg Jaspert --- diff --git a/config/debian/cron.daily b/config/debian/cron.daily index 1815260c..16d9d9d1 100755 --- a/config/debian/cron.daily +++ b/config/debian/cron.daily @@ -9,14 +9,17 @@ export SCRIPTVARS=/srv/ftp-master.debian.org/dak/config/debian/vars ################################################################################ +TMPFILE=$( mktemp -p ${TMPDIR} ) + +function cleanup { + ERRVAL=$? + rm -f ${TMPFILE} + exit ${ERRVAL} +} +trap cleanup SIGHUP SIGINT SIGPIPE SIGTERM EXIT ERR # get the latest list of wnpp bugs and their source packages -if $( wget -q -O/srv/ftp-master.debian.org/scripts/masterfiles/wnpp_rm.tmp http://qa.debian.org/data/bts/wnpp_rm ) ; then - mv /srv/ftp-master.debian.org/scripts/masterfiles/wnpp_rm.tmp /srv/ftp-master.debian.org/scripts/masterfiles/wnpp_rm -else - if [ -f /srv/ftp-master.debian.org/scripts/masterfiles/wnpp_rm.tmp ] ; then - rm /srv/ftp-master.debian.org/scripts/masterfiles/wnpp_rm.tmp - fi -fi +wget -q -O${TMPFILE} http://qa.debian.org/data/bts/wnpp_rm +mv ${TMPFILE} /srv/ftp-master.debian.org/scripts/masterfiles/wnpp_rm ################################################################################