From f3c4fa96ef3bf1e41309c9e618837043a34dafe9 Mon Sep 17 00:00:00 2001 From: Dieter Plaetinck Date: Sun, 2 Jan 2011 18:12:56 +0100 Subject: Use local vars in execute () By using local variables, we prevent getting cwd's and object names getting mixed up during recursive calls. This fixes the configure_system worker not being registered as having run successfully, and preventing the user from going to the install bootloader step in the interactive procedure. --- src/core/libs/lib-flowcontrol.sh | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'src/core/libs/lib-flowcontrol.sh') diff --git a/src/core/libs/lib-flowcontrol.sh b/src/core/libs/lib-flowcontrol.sh index e4d3df1..b9830b0 100755 --- a/src/core/libs/lib-flowcontrol.sh +++ b/src/core/libs/lib-flowcontrol.sh @@ -91,8 +91,8 @@ execute () { [ -z "$1" -o -z "$2" ] && debug 'MAIN' "execute $@" && die_error "Use the execute function like this: execute with type=phase/worker" [ "$1" != phase -a "$1" != worker ] && debug 'MAIN' "execute $@" && die_error "execute's first argument must be a valid type (phase/worker)" - PWD_BACKUP=`pwd` - object=$1_$2 + local PWD_BACKUP=`pwd` + local object=$1_$2 if [ "$1" = worker ] then @@ -102,7 +102,7 @@ execute () shift 2 $object "$@" local ret=$? - exit_var=exit_$object + local exit_var=exit_$object read $exit_var <<< $ret # maintain exit status of each worker else die_error "$object is not defined!" @@ -110,7 +110,7 @@ execute () elif [ "$1" = phase ] then log "******* Executing phase $2" - exit_var=exit_$object + local exit_var=exit_$object read $exit_var <<< 0 # TODO: for some reason the hack below does not work (tested in virtualbox), even though it really should. Someday I must get indirect array variables working and clean this up... # debug 'MAIN' "\$1: $1, \$2: $2, \$object: $object, \$exit_$object: $exit_object" -- cgit v1.2.3-54-g00ecf