summaryrefslogtreecommitdiffstats
path: root/bin
diff options
context:
space:
mode:
authorjosch <j.schauer@email.de>2015-03-28 11:40:51 +0100
committerHolger Levsen <holger@layer-acht.org>2015-03-28 11:43:25 +0100
commit78328d23da08f533b0738c907b1f90be6945e198 (patch)
tree95851aef04aaeead9709d6fa9e9d444b8d541209 /bin
parent9cfb5739a75702a86799d86541cdd40ab7f00f94 (diff)
downloadjenkins.debian.net-78328d23da08f533b0738c907b1f90be6945e198.tar.xz
find_dpkg_trigger_cycles: store all temp files in /tmp.dpkg_trigger_cycles.XXXXXXXXXX and remove using a trap on EXIT
Diffstat (limited to 'bin')
-rwxr-xr-xbin/find_dpkg_trigger_cycles.sh8
1 files changed, 7 insertions, 1 deletions
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