mirror of
https://github.com/crosstool-ng/crosstool-ng.git
synced 2024-12-29 17:18:53 +00:00
Fix bootstrap to work with bash 4.3
Signed-off-by: Alexey Neyman <stilor@att.net>
This commit is contained in:
parent
4000e1def3
commit
4bd6d5f560
18
bootstrap
18
bootstrap
@ -99,17 +99,29 @@ run_if()
|
|||||||
do_foreach()
|
do_foreach()
|
||||||
{
|
{
|
||||||
local var="${1}"
|
local var="${1}"
|
||||||
local v saveinfo
|
local -A saveinfo
|
||||||
|
local v k
|
||||||
|
|
||||||
shift
|
shift
|
||||||
if [ "`type -t enter_${var}`" != "function" ]; then
|
if [ "`type -t enter_${var}`" != "function" ]; then
|
||||||
error "No parameter setup routine for iterator over '${var}'"
|
error "No parameter setup routine for iterator over '${var}'"
|
||||||
fi
|
fi
|
||||||
for v in ${info[iter_${var}]}; do
|
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 "enter_${var} ${v}"
|
||||||
eval "$@"
|
eval "$@"
|
||||||
eval "${saveinfo#declare -A }"
|
info=()
|
||||||
|
for k in "${!saveinfo[@]}"; do
|
||||||
|
info["${k}"]=${saveinfo["${k}"]}
|
||||||
|
done
|
||||||
done
|
done
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user