forked from espressif/esp32-arduino-lib-builder
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathinstall-arduino.sh
executable file
·48 lines (44 loc) · 1.32 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
#/bin/bash
source ./tools/config.sh
#
# CLONE/UPDATE ARDUINO
#
echo "Updating ESP32 Arduino..."
if [ ! -d "$AR_COMPS/arduino" ]; then
git clone $AR_REPO_URL "$AR_COMPS/arduino"
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 [ "$AR_BRANCH" ]; then
echo "AR_BRANCH='$AR_BRANCH'"
git -C "$AR_COMPS/arduino" fetch --all && \
git -C "$AR_COMPS/arduino" checkout "$AR_BRANCH" && \
git -C "$AR_COMPS/arduino" pull --ff-only
fi
if [ $? -ne 0 ]; then exit 1; fi