forked from seam/build
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcheckout.sh
executable file
·124 lines (112 loc) · 2.29 KB
/
checkout.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
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
#!/bin/sh
usage()
{
cat << EOF
usage: $0 options
This script will check out Seam 3.
OPTIONS:
-h Show this usage message
-d Destination directory, otherwise the PWD is used
-m Checkout (clone) in manager mode (SSH mode) (default is read-only)
-v Be more verbose
-c Don't run git fetch if the repository has already been cloned
-b Build and install parent, tools and bom modules
EOF
}
work()
{
if [ "$READONLY" -eq "1" ]
then
GITBASE="git://github.com/seam"
else
GITBASE="[email protected]:seam"
fi
if [ "$VERBOSE" -eq "0" ]
then
GITARGS=""
fi
if [ -d $DESTINATION ]
then
echo "Using existing destination directory $DESTINATION"
else
echo "Creating destination directory $DESTINATION"
mkdir $DESTINATION
fi
for repo in $REPOS
do
unset gitcmd
url="$GITBASE/$repo.git"
repodir=$DESTINATION/$repo
if [ -d $repodir ]
then
if [ "$GITFETCH" -eq "1" ]; then
echo "Updating $repo"
gitcmd="git $GITARGS --git-dir=$DESTINATION/$repo/.git fetch"
else
echo "Skipping existing cloned repository $DESTINATION/$repo"
fi
else
echo "Cloning $repo"
gitcmd="git clone $GITARGS $url $DESTINATION/$repo"
fi
if [ -n "$gitcmd" ]
then
$gitcmd
fi
done
if [ "$BUILD" -eq "1" ]
then
echo "Building Seam parent, tools and bom modules"
cd build/parent
mvn clean install
cd -
cd build/tools
mvn clean install
cd -
cd dist
mvn clean install -N
cd -
fi
}
DESTINATION=`pwd`
READONLY=1
VERBOSE=0
GITBASE=
GITARGS=
GITFETCH=1
BUILD=0
RUN=1
# NOTE still waiting on mail to be migrated
REPOS="parent build dist examples catch documents drools faces international jbpm jms persistence js-remoting rest security servlet wicket xml-config clouds ticket-monster solder"
while getopts “hmd:bcv” OPTION
do
case $OPTION in
h)
usage
RUN=0
;;
d)
DESTINATION=$OPTARG
;;
c)
GITFETCH=0
;;
m)
READONLY=0
;;
b)
BUILD=1
;;
v)
VERBOSE=1
;;
[?])
usage;
RUN=0
;;
esac
done
if [ "$RUN" -eq "1" ]
then
work;
fi