Gentoo Archives: gentoo-commits

From: "Zac Medico (zmedico)" <zmedico@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] portage r12055 - main/trunk/bin
Date: Sun, 23 Nov 2008 21:02:48
Message-Id: E1L4M6P-0002BH-Nz@stork.gentoo.org
1 Author: zmedico
2 Date: 2008-11-23 21:02:45 +0000 (Sun, 23 Nov 2008)
3 New Revision: 12055
4
5 Modified:
6 main/trunk/bin/etc-update
7 Log:
8 Fix SIGINT and SIGTERM trap handling so the temp dir always cleaned up when
9 killed.
10
11
12 Modified: main/trunk/bin/etc-update
13 ===================================================================
14 --- main/trunk/bin/etc-update 2008-11-23 19:48:54 UTC (rev 12054)
15 +++ main/trunk/bin/etc-update 2008-11-23 21:02:45 UTC (rev 12055)
16 @@ -446,10 +446,9 @@
17 }
18
19 die() {
20 - trap "" TERM
21 - trap "" KILL
22 + trap SIGTERM SIGINT
23
24 - if [ ${2} -eq 0 ]; then
25 + if [ "$2" -eq 0 ]; then
26 echo "Exiting: ${1}"
27 scan > /dev/null
28 [ ${count} -gt 0 ] && echo "NOTE: ${count} updates remaining"
29 @@ -500,7 +499,8 @@
30 export PORTAGE_TMPDIR
31
32 TMP="${PORTAGE_TMPDIR}/etc-update-$$"
33 -trap die term
34 +trap "die terminated 1" SIGTERM
35 +trap "die interrupted 1" SIGINT
36
37 [ -w ${PORTAGE_CONFIGROOT}etc ] || die "Need write access to ${PORTAGE_CONFIGROOT}etc" 1
38 #echo $PORTAGE_TMPDIR