/
check.sh
executable file
·158 lines (144 loc) · 4.17 KB
/
check.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
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
#!/bin/bash
MAVEN_VER="apache-maven-3.0.4"
workingDir="`pwd`"
needRoot()
{
if [ "`id -u`" != "0" ]; then
echo "Needs to be run as root."
exit
fi
}
needNonRoot()
{
if [ "`id -u`" == "0" ]; then
echo "Now run as non-root."
exit
fi
}
require()
{
echo -n "Checking for $1... "
if [ "`which $1`" == "" ]; then
echo "not found."
echo "Installing $1";
needRoot
apt-get install $2
else
echo -e "found."
fi
}
require java default-jdk
require git git
require wget wget
require unzip unzip
needNonRoot
[ -e $workingDir/build ] || mkdir $workingDir/build;
cd $workingDir/build
if [[ ! -e "${MAVEN_VER}" && "`which mvn`" == "" ]]; then
closestMaven="`\
wget -qO - http://www.apache.org/dyn/closer.cgi/maven/binaries/${MAVEN_VER}-bin.tar.gz \
| grep ${MAVEN_VER}-bin.tar.gz | head -n 1 | sed 's/.*"\([^"]*\)".*/\1/' \
`"
echo "downloading: $closestMaven"
wget $closestMaven
tar xf "${MAVEN_VER}-bin.tar.gz"
cd
mkdir .m2
[ -e .m2/settings.xml ] || echo '
<settings>
<profiles>
<profile>
<id>xwiki</id>
<repositories>
<repository>
<id>xwiki-releases</id>
<name>XWiki Nexus Releases Repository Proxy</name>
<url>http://nexus.xwiki.org/nexus/content/groups/public</url>
<releases>
<enabled>true</enabled>
</releases>
<snapshots>
<enabled>false</enabled>
</snapshots>
</repository>
<repository>
<id>xwiki-snapshots</id>
<name>XWiki Nexus Snapshot Repository Proxy</name>
<url>http://nexus.xwiki.org/nexus/content/groups/public-snapshots</url>
<releases>
<enabled>false</enabled>
</releases>
<snapshots>
<enabled>true</enabled>
</snapshots>
</repository>
</repositories>
<pluginRepositories>
<pluginRepository>
<id>xwiki-plugins-releases</id>
<name>XWiki Nexus Plugin Releases Repository Proxy</name>
<url>http://nexus.xwiki.org/nexus/content/groups/public</url>
<releases>
<enabled>true</enabled>
</releases>
<snapshots>
<enabled>false</enabled>
</snapshots>
</pluginRepository>
<pluginRepository>
<id>xwiki-plugins-snapshots</id>
<name>XWiki Nexus Plugin Snapshot Repository Proxy</name>
<url>http://nexus.xwiki.org/nexus/content/groups/public-snapshots</url>
<releases>
<enabled>false</enabled>
</releases>
<snapshots>
<enabled>true</enabled>
</snapshots>
</pluginRepository>
</pluginRepositories>
</profile>
</profiles>
<activeProfiles>
<activeProfile>xwiki</activeProfile>
</activeProfiles>
</settings>
' > .m2/settings.xml
fi
export PATH="$PATH:$workingDir/build/${MAVEN_VER}/bin"
download()
{
cd $workingDir/build
if [ ! -e "$1" ]; then
git clone $2 $1 || exit 1
cd $1
git checkout $3 || exit 1
cd $4
else
cd $1
git pull || exit 1
git checkout $3 || exit 1
cd $4
fi
}
downloadAndBuild()
{
download $1 $2 $3 $4
mvn clean install
}
downloadAndBuild Datanucleus-Cassandra-Plugin git://github.com/xwiki-contrib/Datanucleus-Cassandra-Plugin.git master .
downloadAndBuild xwiki-newstore git://github.com/xwiki-contrib/compatibleone-xwiki-newstore.git master .
download xwiki-enterprise git://github.com/xwiki/xwiki-enterprise.git xwiki-enterprise-4.2-milestone-1 .
git apply < $workingDir/xwiki-enterprise-4.2-milestone-1-wiki-nodes.patch
cd $workingDir;
rm ./xwiki-enterprise-jetty-datanucleus-* -r;
mv `find $workingDir -name 'xwiki-enterprise-jetty-datanucleus-?.?-SNAPSHOT.zip'` $workingDir
unzip *.zip;
cp templates/start_xwiki.sh ./xwiki-enterprise-jetty-datanucleus-*/
cp templates/cassandra.yaml.vm ./xwiki-enterprise-jetty-datanucleus-*/webapps/xwiki/WEB-INF/classes/
rm ./xwiki-enterprise-jetty-datanucleus-*.zip;
echo '
# enable jgroups
observation.remote.channels=tcp
observation.remote.enabled=true
' >> ./xwiki-enterprise-jetty-datanucleus-*/webapps/xwiki/WEB-INF/xwiki.properties