-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathpull.sh
executable file
·47 lines (39 loc) · 1014 Bytes
/
pull.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
#!/bin/bash
###############################################################
# pull.sh
# A script to pull new versions from git servers automatically
# in the current directory.
# Timestamp of last pull will be updated in pull_timestamp.
#
# Sean <[email protected]>
###############################################################
#directories to be ignored, separated with space character
except="linux ecos"
dir=$(pwd)
module_skipped()
{
for m in $except; do
if [ $m = $1 ]; then
return 1
fi
done
return 0
}
for d in $(ls -l | awk '/^d/{print $9}'); do
module_skipped $d
if [ $? -ne 1 ]; then
echo "****************************"
echo $d
echo "****************************"
echo "pull $dir/$d..."
cd ${dir}/$d; git pull; if [ $? -ne 0 ]; then exit 1; fi
echo "$d done"
else
echo "$d is skipped"
continue
fi
done
echo "last pull:" > $dir/pull_timestamp
echo $(date +%Y%m%d%H%M%S) >> $dir/pull_timestamp
echo ""
echo "all done!"