-
Notifications
You must be signed in to change notification settings - Fork 7
/
Copy pathmatter_setup.sh
72 lines (59 loc) · 1.52 KB
/
matter_setup.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
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
#!/bin/bash
if [ "$#" -lt 1 ]; then
echo "Usage: $0 <IC type>"
echo "IC type: amebaz2 / amebaz2plus / amebad"
exit 1
fi
AMEBA="$1"
files_to_delete=(
"$PWD/component/soc/realtek/8710c/misc/utilities/include/ctype.h"
)
BASE_DIR="$PWD/project"
delete_files() {
for file_path in "${files_to_delete[@]}"; do
if [ -e "$file_path" ]; then
rm "$file_path"
echo "File $file_path removed."
else
echo "File $file_path does not exist."
fi
done
}
modify_makefiles() {
find "$BASE_DIR" -type f -name "Makefile" | while read -r FILE; do
if grep -q "ENABLE_MATTER = 0" "$FILE"; then
echo "Modifying $FILE"
sed -i 's/^ENABLE_MATTER = 0/ENABLE_MATTER = 1/' "$FILE"
fi
done
}
case "$AMEBA" in
amebaz2 | amebaz2plus)
echo "Configuring for $AMEBA"
delete_files
if [ "$AMEBA" = "amebaz2plus" ]; then
modify_makefiles
fi
;;
amebad)
echo "Configuring for $AMEBA"
;;
*)
echo "Invalid argument. Expected 'amebaz2', 'amebaz2plus', or 'amebad'."
exit 1
;;
esac
if [ ! -d third_party ];then
mkdir third_party
else
rm third_party/connectedhomeip
fi
cd third_party
rm -rf connectedhomeip
ln -s ../../connectedhomeip connectedhomeip
cd ../
if [ ! -d component/common/application/matter ] || [ -z "$(find component/common/application/matter -mindepth 1)" ]; then
mkdir -p component/common/application/matter
git clone https://github.com/Ameba-AIoT/ameba-rtos-matter.git component/common/application/matter
fi
echo "Matter setup complete"