diff options
author | Dieter Plaetinck <dieter@plaetinck.be> | 2011-01-02 18:12:56 +0100 |
---|---|---|
committer | Dieter Plaetinck <dieter@plaetinck.be> | 2011-01-02 18:12:56 +0100 |
commit | f3c4fa96ef3bf1e41309c9e618837043a34dafe9 (patch) | |
tree | 4747e5458520821cf9c48bb944dde7d5254a7f3d /src | |
parent | e43e4d55208a2d2e52bca873d7eae932e0d10e95 (diff) |
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.
Diffstat (limited to 'src')
-rwxr-xr-x | src/core/libs/lib-flowcontrol.sh | 8 |
1 files changed, 4 insertions, 4 deletions
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 <type> <name> 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" |