mirror of
https://github.com/dynup/kpatch
synced 2024-12-23 21:52:07 +00:00
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:
parent
eb54876936
commit
273ea9a06c
@ -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"
|
||||
|
Loading…
Reference in New Issue
Block a user