summaryrefslogtreecommitdiff
path: root/bootstrap
diff options
context:
space:
mode:
authorAlexey Neyman <stilor@att.net>2017-07-07 01:20:44 (GMT)
committerAlexey Neyman <stilor@att.net>2017-07-08 17:57:56 (GMT)
commit4bd6d5f5603e9733852f18fb604eea8f04cd94cc (patch)
treea2283627e327f5a68ab3953d3d6a98597e94aa79 /bootstrap
parent4000e1def3d48571e52200cd0c0e0010b9ca139f (diff)
Fix bootstrap to work with bash 4.3
Signed-off-by: Alexey Neyman <stilor@att.net>
Diffstat (limited to 'bootstrap')
-rwxr-xr-xbootstrap18
1 files changed, 15 insertions, 3 deletions
diff --git a/bootstrap b/bootstrap
index 280af88..8a5b605 100755
--- a/bootstrap
+++ b/bootstrap
@@ -99,17 +99,29 @@ run_if()
do_foreach()
{
local var="${1}"
- local v saveinfo
+ local -A saveinfo
+ local v k
shift
if [ "`type -t enter_${var}`" != "function" ]; then
error "No parameter setup routine for iterator over '${var}'"
fi
for v in ${info[iter_${var}]}; do
- saveinfo=`declare -p info`
+ # This works in bash 4.4, but not in bash 4.3:
+ # local saveinfo=`declare -p info`
+ # ...
+ # eval "${saveinfo}"
+ # Therefore, need to save key-by-key
+ saveinfo=()
+ for k in "${!info[@]}"; do
+ saveinfo["${k}"]=${info["${k}"]}
+ done
eval "enter_${var} ${v}"
eval "$@"
- eval "${saveinfo#declare -A }"
+ info=()
+ for k in "${!saveinfo[@]}"; do
+ info["${k}"]=${saveinfo["${k}"]}
+ done
done
}