forked from espressif/esp32-arduino-lib-builder
-
Notifications
You must be signed in to change notification settings - Fork 25
/
Copy pathinstall-arduino.sh
executable file
·99 lines (93 loc) · 3.12 KB
/
install-arduino.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
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
#/bin/bash
source ./tools/config.sh
#
# CLONE/UPDATE ARDUINO
#
if [ "$AR_BRANCH" ]; then
echo "Installing Arduino from branch '$AR_BRANCH'"
if [ ! -d "$AR_COMPS/arduino" ]; then
# for using a branch we need no full clone
git clone -b "$AR_BRANCH" --recursive --depth 1 --shallow-submodule $AR_REPO_URL "$AR_COMPS/arduino"
else
# update existing branch
cd "$AR_COMPS/arduino"
git pull
git reset --hard $AR_BRANCH
# -ff is for cleaning untracked files as well as submodules
git clean -ffdx
cd -
fi
fi
if [ ! -d "$AR_COMPS/arduino" ]; then
# we need a full clone since no branch was set
echo "Full cloning of ESP32 Arduino repo '$AR_REPO_URL'"
git clone $AR_REPO_URL "$AR_COMPS/arduino"
else
if [ "$AR_BRANCH" ]; then
echo "ESP32 Arduino is up to date"
else
# update existing branch
echo "Updating ESP32 Arduino"
cd "$AR_COMPS/arduino"
git pull
# -ff is for cleaning untracked files as well as submodules
git clean -ffdx
cd -
fi
fi
if [ -z $AR_BRANCH ]; then
if [ -z $GITHUB_HEAD_REF ]; then
current_branch=`git branch --show-current`
else
current_branch="$GITHUB_HEAD_REF"
fi
echo "Current Branch: $current_branch"
if [[ "$current_branch" != "master" && `git_branch_exists "$AR_COMPS/arduino" "$current_branch"` == "1" ]]; then
export AR_BRANCH="$current_branch"
else
if [ "$IDF_TAG" ]; then #tag was specified at build time
AR_BRANCH_NAME="idf-$IDF_TAG"
elif [ "$IDF_COMMIT" ]; then #commit was specified at build time
AR_BRANCH_NAME="idf-$IDF_COMMIT"
else
AR_BRANCH_NAME="idf-$IDF_BRANCH"
fi
has_ar_branch=`git_branch_exists "$AR_COMPS/arduino" "$AR_BRANCH_NAME"`
if [ "$has_ar_branch" == "1" ]; then
export AR_BRANCH="$AR_BRANCH_NAME"
else
has_ar_branch=`git_branch_exists "$AR_COMPS/arduino" "$AR_PR_TARGET_BRANCH"`
if [ "$has_ar_branch" == "1" ]; then
export AR_BRANCH="$AR_PR_TARGET_BRANCH"
fi
fi
fi
fi
if [ $? -ne 0 ]; then exit 1; fi
#
# remove code and libraries not needed/wanted for Tasmota framework
#
rm -rf "$AR_COMPS/arduino/docs"
rm -rf "$AR_COMPS/arduino/idf_component_examples"
rm -rf "$AR_COMPS/arduino/package"
rm -rf "$AR_COMPS/arduino/tests"
rm -rf "$AR_COMPS/arduino/tools/pre-commit"
rm -rf "$AR_COMPS/arduino/cores/esp32/chip-debug-report.cpp"
rm -rf "$AR_COMPS/arduino/cores/esp32/chip-debug-report.h"
rm -rf "$AR_COMPS/arduino/libraries/Matter"
rm -rf "$AR_COMPS/arduino/libraries/RainMaker"
rm -rf "$AR_COMPS/arduino/libraries/Insights"
rm -rf "$AR_COMPS/arduino/libraries/ESP_I2S"
rm -rf "$AR_COMPS/arduino/libraries/SPIFFS"
rm -rf "$AR_COMPS/arduino/libraries/BLE"
rm -rf "$AR_COMPS/arduino/libraries/SimpleBLE"
rm -rf "$AR_COMPS/arduino/libraries/BluetoothSerial"
rm -rf "$AR_COMPS/arduino/libraries/WiFiProv"
rm -rf "$AR_COMPS/arduino/libraries/WiFiClientSecure"
rm -rf "$AR_COMPS/arduino/libraries/NetworkClientSecure"
rm -rf "$AR_COMPS/arduino/libraries/ESP32"
rm -rf "$AR_COMPS/arduino/libraries/ESP_SR"
rm -rf "$AR_COMPS/arduino/libraries/ESP_NOW"
rm -rf "$AR_COMPS/arduino/libraries/TFLiteMicro"
rm -rf "$AR_COMPS/arduino/libraries/OpenThread"
rm -rf "$AR_COMPS/arduino/libraries/Zigbee"