-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdeps.sh
51 lines (40 loc) · 1.19 KB
/
deps.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
#!/bin/bash
DOWNLOADED=()
CURDIR=${PWD}
function getdeps {
while IFS='' read -r line || [[ -n "$line" ]]; do
IFS=', ' read -r -a parts <<< "$line"
isfound=false
for i in "${DOWNLOADED[@]}"
do
if [ $i == ${parts[0]} ]; then
isfound=true
break
fi
done
if [ $isfound == false ]; then
if ! [ -d ${PWD}/3rdparty/${parts[0]} ]; then
if [ ${#parts[@]} -gt 2 ]; then
git clone --progress -v -b ${parts[2]} ${parts[1]} ${PWD}/3rdparty/${parts[0]}
else
git clone --progress -v ${parts[1]} ${PWD}/3rdparty/${parts[0]}
fi
else
cd ${PWD}/3rdparty/${parts[0]}
if [ ${#parts[@]} -gt 2 ]; then
git pull -v --progress origin ${parts[2]}
else
git pull -v --progress origin master
fi
cd ${CURDIR}
fi
DOWNLOADED+=( ${parts[0]} )
echo ""
if [ -f ${PWD}/3rdparty/${parts[0]}/deps ]; then
echo "get deps: ${PWD}/3rdparty/${parts[0]}/deps"
getdeps "${PWD}/3rdparty/${parts[0]}/deps"
fi
fi
done < "$1"
}
getdeps "deps"