Skip to content
Newer
Older
100755 80 lines (54 sloc) 1.19 KB
0a3ed3e @krestenkrab new get_deps / deps.config scheme
krestenkrab authored Nov 4, 2011
1 #/bin/bash
2
3 DEPS_DIR=deps
4 CONFIG_FILE=deps.config
5
6 LOADED=""
7
8 function update_dep_url() {
9
10 local DEP=${1}
11 local URL=${2}
12
13 for D in $LOADED; do
14 if [ $D == $DEP ]; then
15 return;
16 fi
17 done
18
19 LOADED="$LOADED $DEP"
20
21 echo "Updating $DEP from $URL..."
22
23 cd $DEPS_DIR
24
25 if [ ! -d $DEP ]; then
26 git clone $URL $DEP
27 else
28 (cd $DEP; git pull)
29 fi
30
31 cd ..
32
33 if [ -d $DEP ]; then
34 chmod -R +w $DEP
35 rm -Rf $DEP
36 fi
37
38 if [ -d $DEPS_DIR/$DEP/src ]; then
39 cp -R $DEPS_DIR/$DEP/src $DEP
40 chmod -R a-w $DEP
41 fi
42
43 if [ -f $DEPS_DIR/$DEP/$CONFIG_FILE ]; then
44 update_from_data_file $DEPS_DIR/$DEP/$CONFIG_FILE
45 fi
46
47 if [ ! -f .gitignore ]; then
48 touch .gitignore
49 fi
50
51 if grep $DEP .gitignore; then
52 sleep 0
53 else
54 echo "Adding $DEP to .gitignore"
55 echo $DEP >> .gitignore
56 fi
57
58 }
59
60 function update_from_data_file() {
61 local FILE=$1
62
63 for DEPANDURL in `cat $FILE | egrep -v '^#.*'`; do
64
65 local DEP=`echo $DEPANDURL | awk '-F=' '{print $1}'`
66 local URL=`echo $DEPANDURL | awk '-F=' '{print $2}'`
67
68 update_dep_url $DEP $URL
69
70 done
71 }
72
73 if [ ! -d $DEPS_DIR ]; then
74 mkdir $DEPS_DIR
75 fi
76
77 update_from_data_file $CONFIG_FILE
78
79
Something went wrong with that request. Please try again.