Fix SIGINT and SIGTERM trap handling so the temp dir always cleaned up when
authorZac Medico <zmedico@gentoo.org>
Sun, 23 Nov 2008 21:02:45 +0000 (21:02 -0000)
committerZac Medico <zmedico@gentoo.org>
Sun, 23 Nov 2008 21:02:45 +0000 (21:02 -0000)
killed.

svn path=/main/trunk/; revision=12055

bin/etc-update

index af200f6b48fcaf6f546ba917f0d2ea1797886f0f..35456525dac7c938bd6d756675219dd1d18c20b9 100755 (executable)
@@ -446,10 +446,9 @@ Please select from the menu above (-1 to exit, losing this merge): "
 }
 
 die() {
-       trap "" TERM
-       trap "" KILL
+       trap SIGTERM SIGINT
 
-       if [ ${2} -eq 0 ]; then
+       if [ "$2" -eq 0 ]; then
                echo "Exiting: ${1}"
                scan > /dev/null
                [ ${count} -gt 0 ] && echo "NOTE: ${count} updates remaining"
@@ -500,7 +499,8 @@ eval $(portageq envvar -v CONFIG_PROTECT \
 export PORTAGE_TMPDIR
 
 TMP="${PORTAGE_TMPDIR}/etc-update-$$"
-trap die term
+trap "die terminated 1" SIGTERM
+trap "die interrupted 1" SIGINT
 
 [ -w ${PORTAGE_CONFIGROOT}etc ] || die "Need write access to ${PORTAGE_CONFIGROOT}etc" 1
 #echo $PORTAGE_TMPDIR