Call die() so that the $TMP directory is always properly
authorZac Medico <zmedico@gentoo.org>
Sat, 3 Nov 2007 22:51:50 +0000 (22:51 -0000)
committerZac Medico <zmedico@gentoo.org>
Sat, 3 Nov 2007 22:51:50 +0000 (22:51 -0000)
cleaned up. (trunk r8405)

svn path=/main/branches/2.1.2/; revision=8407

bin/etc-update

index bb1160a312d4de993d58a24f0543d7196e436fc3..e8ba989c5fbc7a2c0f0cdabe07dbac45af67f80d 100755 (executable)
@@ -444,11 +444,13 @@ Please select from the menu above (-1 to exit, losing this merge): "
 die() {
        trap "" TERM
        trap "" KILL
-       echo "Exiting: ${1}"
 
        if [ ${2} -eq 0 ]; then
+               echo "Exiting: ${1}"
                scan > /dev/null
                [ ${count} -gt 0 ] && echo "NOTE: ${count} updates remaining"
+       else
+               echo "ERROR: ${1}"
        fi
 
        rm -rf "${TMP}"
@@ -531,20 +533,17 @@ if [ "${using_editor}" == 0 ]; then
        echo > "${TMP}"/.diff-test-2
        
        if ! diff_command "${TMP}"/.diff-test-1 "${TMP}"/.diff-test-2 ; then
-               echo "ERROR: '${diff_command}' does not seem to work, aborting"
-               exit 1
+               die "'${diff_command}' does not seem to work, aborting" 1
        fi
 else
        if ! type ${diff_command%% *} >/dev/null; then
-               echo "ERROR: '${diff_command}' does not seem to work, aborting"
-               exit 1
+               die "'${diff_command}' does not seem to work, aborting" 1
        fi
 fi
 
 if [[ ${mode} == "1" ]] ; then
        if ! type dialog >/dev/null || ! dialog --help >/dev/null ; then
-               echo "ERROR: mode=1 and 'dialog' not found or not executable, aborting"
-               exit 1
+               die "mode=1 and 'dialog' not found or not executable, aborting" 1
        fi
 fi