forked from SmartThingsCommunity/st-device-sdk-c-ref
-
Notifications
You must be signed in to change notification settings - Fork 0
/
setup.sh
executable file
·48 lines (42 loc) · 1.09 KB
/
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
#!/bin/bash
CHIP_LIST=("esp8266" "esp32" "rtl8195" "rtl8720c" "rtl8721c")
CORE_PATH="iot-core"
CHIP_NAME=${1}
print_usage () {
echo " Usage: ./setup.sh CHIP_NAME"
echo "- - - - - - - - - - - - - - - - - - -"
echo " ex) ./setup.sh esp8266"
echo " ex) ./setup.sh esp32"
echo " ex) ./setup.sh rtl8195"
echo " ex) ./setup.sh rtl8720c"
echo " ex) ./setup.sh rtl8721c"
echo
}
if [ "${CHIP_NAME}" == "" ]; then
print_usage
exit 0
fi
if [ ! -e tools/${CHIP_NAME}/setup_${CHIP_NAME}.sh ]; then
echo "Failed to find tools/${CHIP_NAME}/setup_${CHIP_NAME}.sh"
print_usage
exit 1
fi
git submodule status ${CORE_PATH} &> /dev/null
if [ "$?" == "0" ]; then
git submodule sync ${CORE_PATH}
git submodule init ${CORE_PATH}
git submodule update ${CORE_PATH}
cd ${CORE_PATH}
git reset --hard HEAD
cd ..
fi
git submodule status bsp/${CHIP_NAME} &> /dev/null
if [ "$?" == "0" ]; then
git submodule sync bsp/${CHIP_NAME}
git submodule init bsp/${CHIP_NAME}
git submodule update bsp/${CHIP_NAME}
cd bsp/${CHIP_NAME}
git reset --hard HEAD
cd ../..
fi
tools/${CHIP_NAME}/setup_${CHIP_NAME}.sh $@