From 78328d23da08f533b0738c907b1f90be6945e198 Mon Sep 17 00:00:00 2001 From: josch Date: Sat, 28 Mar 2015 11:40:51 +0100 Subject: find_dpkg_trigger_cycles: store all temp files in /tmp.dpkg_trigger_cycles.XXXXXXXXXX and remove using a trap on EXIT --- bin/find_dpkg_trigger_cycles.sh | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'bin/find_dpkg_trigger_cycles.sh') diff --git a/bin/find_dpkg_trigger_cycles.sh b/bin/find_dpkg_trigger_cycles.sh index 8e5f7448..36460dc8 100755 --- a/bin/find_dpkg_trigger_cycles.sh +++ b/bin/find_dpkg_trigger_cycles.sh @@ -146,6 +146,12 @@ printf "" > $DIRECTORY/interested-explicit printf "" > $DIRECTORY/activated-file printf "" > $DIRECTORY/activated-explicit +scratch=$(mktemp -d -t tmp.dpkg_trigger_cycles.XXXXXXXXXX) +function finish { + rm -rf "$scratch" +} +trap finish EXIT + # find all binary packages with /triggers$ curl --globoff "http://binarycontrol.debian.net/?q=&path=${DIST}%2F[^%2F]%2B%2Ftriggers%24&format=pkglist" \ | xargs apt-get $APT_OPTS --print-uris download \ @@ -153,7 +159,7 @@ curl --globoff "http://binarycontrol.debian.net/?q=&path=${DIST}%2F[^%2F]%2B%2Ft | sort \ | while read pkg url; do echo "working on $pkg..." >&2 - tmpdir=`mktemp -d` + tmpdir=`mktemp -d --tmpdir="$scratch"` ( curl --retry 2 --retry-delay 10 --location --silent "$url" || ( echo "curl failed with exit $?">&2; exit 1 ) ) \ | dpkg-deb --ctrl-tarfile /dev/stdin \ | tar -C "$tmpdir" --exclude=./md5sums -x -- cgit v1.2.3-70-g09d2