kpatch-build: reduce dependency on bash version >4.0

Before this patch, kpatch_build dependends on bash version >4.0
that support declare -A. This patch remove this dependency by
replacing dict(declare -A) with array.

Signed-off-by: Li Bin <huawei.libin@huawei.com>
This commit is contained in:
Li Bin 2015-11-13 17:00:16 +08:00
parent eb54876936
commit 273ea9a06c

View File

@ -506,7 +506,7 @@ cd "$TEMPDIR/patched"
FILES="$(find * -type f)"
cd "$TEMPDIR"
mkdir output
declare -A objnames
declare -a objnames
CHANGED=0
ERROR=0
for i in $FILES; do
@ -537,11 +537,11 @@ for i in $FILES; do
if [[ $rc -eq 0 ]]; then
[[ -n $ERROR_IF_DIFF ]] && die $ERROR_IF_DIFF
CHANGED=1
objnames[$KOBJFILE]=1
objnames[${#objnames[@]}]=$KOBJFILE
fi
else
cp -f "patched/$i" "output/$i"
objnames[$KOBJFILE]=1
objnames[${#objnames[@]}]=$KOBJFILE
fi
done
@ -554,7 +554,10 @@ if [[ $CHANGED -eq 0 ]]; then
fi
echo -n "Patched objects:"
for i in "${!objnames[@]}"; do echo -n " $(basename $i)"; done
for i in $(echo "${objnames[@]}" | tr ' ' '\n' | sort -u | tr '\n' ' ')
do
echo -n " $(basename $i)"
done
echo
export KCFLAGS="-I$DATADIR/patch"