[debian-edu-commits] debian-edu/ 127/183: Adjust traps so I can't make them fail during testing anymore
Alexander Alemayhu
ccscanf-guest at moszumanska.debian.org
Wed Jun 11 16:48:40 UTC 2014
This is an automated email from the git hooks/post-receive script.
ccscanf-guest pushed a commit to branch master
in repository desktop-profiles.
commit 0e4b135e2167fce0c56d0df5ab3415f6dd0b9bfc
Author: Bart Cornelis <cobaco at linux.be>
Date: Wed Dec 6 18:35:39 2006 +0000
Adjust traps so I can't make them fail during testing anymore
---
20desktop-profiles_activateDesktopProfiles | 43 +++++++++++++++++++-----------
1 file changed, 28 insertions(+), 15 deletions(-)
diff --git a/20desktop-profiles_activateDesktopProfiles b/20desktop-profiles_activateDesktopProfiles
index 858c9e7..ba695c0 100644
--- a/20desktop-profiles_activateDesktopProfiles
+++ b/20desktop-profiles_activateDesktopProfiles
@@ -32,6 +32,17 @@ else
INSTALLED=false
fi;
+general_trap () {
+ rm -f "$GCONF_FILE";
+ exit;
+}
+
+sort_profiles_trap () {
+ rm -f "$GCONF_FILE";
+ rm -f "$PROFILES";
+ exit;
+}
+
#########################################################################
# Sort all profiles that have their requirements met by kind
# (result for each $KIND is saved in the corresponding env variable
@@ -40,20 +51,24 @@ fi;
sort_profiles(){
#make sure we start with empty variables
- KDEDIRS='';XDG_CONFIG_DIRS='';XDG_DATA_DIRS='';CHOICESPATH='';GNUSTEP_PATHLIST='';UDEDIRS=''
+ KDEDIRS='';XDG_CONFIG_DIRS='';XDG_DATA_DIRS='';CHOICESPATH='';GNUSTEP_PATHLIST='';UDEDIRS='';PROFILES='';
# adjust trap to ensure we don't leave any tempfiles behind
- trap "rm -f $GCONF_FILE $PROFILES; exit" HUP INT TERM
+ trap sort_profiles_trap HUP INT TERM;
# get profiles that are have fulfilled requirements, and save result on file descriptor 3
PROFILES=`tempfile`;
exec 3<> $PROFILES;
- (# get profiles that are have fulfilled requirements
- cat $(list_listings) | grep -v -e "^[[:space:]]*#" -e "^[[:space:]]*$" | while read PROFILE; do
- if (test_profile_requirements "$PROFILE"); then
- echo $PROFILE;
- fi;
- done;
+ (#reset trap as we're now in a subshell
+ trap sort_profiles_trap HUP INT TERM;
+
+ # get profiles that are have fulfilled requirements
+ cat $(list_listings) | grep -v -e "^[[:space:]]*#" -e "^[[:space:]]*$" | while read PROFILE; do
+ if (test_profile_requirements "$PROFILE"); then
+ echo $PROFILE;
+ fi;
+ done;
+
#and sort them by preference
) | sort --reverse --general-numeric-sort --field-separator=";" --key 4 > $PROFILES;
@@ -79,12 +94,10 @@ sort_profiles(){
fi;
done;
- # close filedescriptor,delete tempfile
+ # close filedescriptor, delete tempfile, readjust trap
exec 3>&- ;
- rm $PROFILES;
-
- # readjust trap to ensure we don't leave any tempfiles behind
- trap "rm -f $GCONF_FILE; exit" HUP INT TERM
+ rm -f $PROFILES;
+ trap general_trap HUP INT TERM;
}
##########################################################
@@ -252,7 +265,7 @@ activate_GCONF () {
fi;
# cleanup tempfile
- rm $GCONF_FILE;
+ rm -f $GCONF_FILE;
}
#####################
@@ -283,7 +296,7 @@ if (test $INSTALLED = true); then
############################################################
if (test "$ACTIVE_PROFILE_KINDS"x != "x"); then
# add trap to ensure we don't leave any tempfiles behind
- trap "rm -f $GCONF_FILE $PROFILES; exit" HUP INT TERM
+ trap general_trap HUP INT TERM;
# get temp file
GCONF_FILE=`tempfile`;
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/debian-edu/pkg-team/desktop-profiles.git
More information about the debian-edu-commits
mailing list