Skip to content

Commit d1db1f1

Browse files
authored
Create install-arduino.sh
1 parent 269d9d1 commit d1db1f1

File tree

1 file changed

+61
-0
lines changed

1 file changed

+61
-0
lines changed

tools/install-arduino.sh

Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
#/bin/bash
2+
3+
source ./tools/config.sh
4+
5+
#
6+
# CLONE/UPDATE ARDUINO
7+
#
8+
echo "Updating ESP32 Arduino..."
9+
if [ ! -d "$AR_COMPS/arduino" ]; then
10+
git clone $AR_REPO_URL "$AR_COMPS/arduino"
11+
fi
12+
13+
if [ -z $AR_BRANCH ]; then
14+
if [ -z $GITHUB_HEAD_REF ]; then
15+
current_branch=`git branch --show-current`
16+
else
17+
current_branch="$GITHUB_HEAD_REF"
18+
fi
19+
echo "Current Branch: $current_branch"
20+
if [[ "$current_branch" != "master" && `git_branch_exists "$AR_COMPS/arduino" "$current_branch"` == "1" ]]; then
21+
export AR_BRANCH="$current_branch"
22+
else
23+
if [ "$IDF_TAG" ]; then #tag was specified at build time
24+
AR_BRANCH_NAME="idf-$IDF_TAG"
25+
elif [ "$IDF_COMMIT" ]; then #commit was specified at build time
26+
AR_BRANCH_NAME="idf-$IDF_COMMIT"
27+
else
28+
AR_BRANCH_NAME="idf-$IDF_BRANCH"
29+
fi
30+
has_ar_branch=`git_branch_exists "$AR_COMPS/arduino" "$AR_BRANCH_NAME"`
31+
if [ "$has_ar_branch" == "1" ]; then
32+
export AR_BRANCH="$AR_BRANCH_NAME"
33+
else
34+
has_ar_branch=`git_branch_exists "$AR_COMPS/arduino" "$AR_PR_TARGET_BRANCH"`
35+
if [ "$has_ar_branch" == "1" ]; then
36+
export AR_BRANCH="$AR_PR_TARGET_BRANCH"
37+
fi
38+
fi
39+
fi
40+
fi
41+
42+
if [ "$AR_BRANCH" ]; then
43+
echo "AR_BRANCH='$AR_BRANCH'"
44+
git -C "$AR_COMPS/arduino" checkout "$AR_BRANCH" && \
45+
git -C "$AR_COMPS/arduino" fetch && \
46+
git -C "$AR_COMPS/arduino" pull --ff-only
47+
fi
48+
if [ $? -ne 0 ]; then exit 1; fi
49+
50+
#
51+
# CLONE/UPDATE ESP32-ARDUINO-LIBS
52+
#
53+
if [ ! -d "$IDF_LIBS_DIR" ]; then
54+
echo "Cloning esp32-arduino-libs..."
55+
git clone "$AR_LIBS_REPO_URL" "$IDF_LIBS_DIR"
56+
else
57+
echo "Updating esp32-arduino-libs..."
58+
git -C "$IDF_LIBS_DIR" fetch && \
59+
git -C "$IDF_LIBS_DIR" pull --ff-only
60+
fi
61+
if [ $? -ne 0 ]; then exit 1; fi

0 commit comments

Comments
 (0)