-
Notifications
You must be signed in to change notification settings - Fork 63
/
apply_embARC_patch.sh
executable file
·54 lines (46 loc) · 1.2 KB
/
apply_embARC_patch.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
#!/usr/bin/env bash
dir="${BASH_SOURCE[0]}"
if uname | grep -q "MINGW"; then
win_build=1
pwd_opt="-W"
else
win_build=0
pwd_opt=""
fi
# identify OS source tree root directory
export EMBARC_ROOT=$( builtin cd "$( dirname "$dir" )" > /dev/null && pwd ${pwd_opt})
unset pwd_opt
patches_required_folders="library,middleware,os"
patches_required_folder_list=(${patches_required_folders//,/ })
PREV_DIR=$(pwd)
SCRIPT_DIR=$(dirname $0)
cd ${SCRIPT_DIR}
echo "Start to download required source code and apply patches for embARC"
echo ""
exit_ok=0
for patch_folder in ${patches_required_folder_list[@]}
do
patch_scripts=$(find ${EMBARC_ROOT}/${patch_folder} -maxdepth 2 -name "apply_embARC_patch.sh")
for script in ${patch_scripts[@]}
do
patch_dir=$(dirname ${script})
echo "+++++Try to patch ${patch_dir}+++++"
chmod +x ${script} && ${script}
if [[ $? -eq 0 ]] ; then
echo "-----Patch ${patch_dir} successfully-----"
else
echo "-----Patch ${patch_dir} failed-----"
exit_ok=1
fi
echo ""
done
done
echo ""
if [[ ${exit_ok} -eq 0 ]] ; then
echo "Apply patches for embARC successfully"
else
echo "Apply patches for embARC failed"
exit ${exit_ok}
fi
echo "Patch job ended"
cd ${PREV_DIR}