-
Notifications
You must be signed in to change notification settings - Fork 3
/
get_libs.sh
executable file
·56 lines (49 loc) · 1.38 KB
/
get_libs.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
#ARDUINO_DIR=~/arduino-1.8.9/
#ARDUINO_LIB_DIR=${ARDUINO_DIR}libraries/
#ARDUINO_EXEC=${ARDUINO_DIR}arduino
ARDUINO_LIB_DIR=~/Documents/Arduino/libraries/
#ARDUINO_LIB_DIR=~/Documents/tmp_test/
declare -a arr=(
"[email protected]:PaulStoffregen/Time.git"
"[email protected]:arduino-libraries/NTPClient.git"
"[email protected]:pikot/WiFiManager.git" # development
"[email protected]:bblanchon/ArduinoJson.git"
"[email protected]:lorol/LITTLEFS.git"
"[email protected]:olikraus/U8g2_Arduino.git"
"[email protected]:davetcc/TaskManagerIO.git" #1.6.4
"[email protected]:davetcc/IoAbstraction.git"
"[email protected]:davetcc/tcMenuLib.git" # 1.6.1
"[email protected]:stevemarple/AsyncDelay.git"
"[email protected]:stevemarple/SoftWire.git"
"[email protected]:siara-cc/esp32_arduino_sqlite3_lib.git"
)
function create_dir_ifnotexist {
local _dir=$1
if [ -d "$_dir" ]
then
return 0
fi
mkdir -p "$_dir"
return 1
}
i=0
for url in "${arr[@]}"
do
((i=i+1))
echo $i ". try to get -- $url"
if [[ $url != *\.git ]]; then
echo $url " is not git repo, skip"
continue
fi
postf=.git
fname="${url##*/}"
name="${fname%$postf}"
new_repo=$ARDUINO_LIB_DIR$name
create_dir_ifnotexist "$new_repo"
found_dir=$?
if [ "$found_dir" -eq 1 ] ; then
git clone $url $new_repo
else
echo $i . $name " found in library"
fi
done