-
Notifications
You must be signed in to change notification settings - Fork 4
/
build
executable file
·68 lines (55 loc) · 3.35 KB
/
build
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
#!/bin/bash
die() { echo $1; exit 1; }
node -e 'console.log("hello world")' | grep 'hello world' >/dev/null || die "ERROR: Nodejs required"
mvn -v | grep 'Apache Maven 3.' >/dev/null || die "ERROR: Maven 3.x required"
ls ./externals >/dev/null || die "ERROR: please run ./update first"
tar --version | grep '^tar ' >/dev/null || die "ERROR: please install TAR first"
VERSION='0.3-SNAPSHOT'
mkdir result || die "Please delete result directory before building again"
(
cd ./webapp-core
MAVEN_OPTS="-Xmx1024m -XX:MaxPermSize=256m" mvn clean install --settings ./etc/settings.xml
) || die "Maven failed";
cp -r ./webapp-core/riscoss-platform-dm/riscoss-platform-dm-war/target/riscoss-platform-dm-war-$VERSION ./result
cp -r ./webapp-core/riscoss-platform-rdr/riscoss-platform-rdr-war/target/riscoss-platform-rdr-war-$VERSION ./result
(
cd resources/WEB-INF
tar -cf - . | ( cd ../../result/riscoss-platform-dm-war-$VERSION/WEB-INF/ && tar -xf - )
) || die "Tar WEB-INF failed";
( cd result && tar -xf ../resources/apache-tomcat* ) || die "Tar tomcat failed";
cp ./resources/start.sh ./result || die "copy start.sh failed"
cp ./externals/riscoss-data-collector/riscoss-rdc-app/target/riscoss-rdc-app-*-jar-with-dependencies.jar ./result/riscoss-data-collector-$VERSION.jar || die "Copy rdc jar failed";
## Wait while start gets the server up
( cd ./result && ./start.sh )
## Import the main wiki
curl -v -H 'Content-type: application/octet-stream' \
--user superadmin:system \
-X POST \
--data-binary @./webapp-core/riscoss-platform-dm/riscoss-platform-dm-distribution/riscoss-platform-dm-ui-mainwiki-all/target/riscoss-platform-dm-ui-mainwiki-all.xar \
'http://localhost:8080/riscoss/rest/wikis/xwiki?backup=true&history=RESET'
## Create the subwiki
curl -v \
--user superadmin:system \
-X POST \
--data 'content=%7B%7Bgroovy%7D%7DString%20x%3D%22gha%22%3Bprintln(services.wiki.createWiki(x%2Cx%2C%22xwiki%3AXWiki.Admin%22%2Ctrue))%3Bprintln(services.wiki.user.setUserScope(x%2C%22local_and_global%22))%3Bprintln(services.wiki.user.setMembershipType(x%2C%22open%22))%7B%7B%2Fgroovy%7D%7D' \
'http://localhost:8080/riscoss/bin/view/Main/preview//?xpage=plain&action_preview=1'
curl -v -H 'Content-type: application/octet-stream' \
--user superadmin:system \
-X POST \
--data-binary @./webapp-core/riscoss-platform-dm/riscoss-platform-dm-distribution/riscoss-platform-dm-ui-wiki-all/target/riscoss-platform-dm-ui-wiki-all.xar \
'http://localhost:8080/riscoss/rest/wikis/gha?backup=true&history=RESET'
curl \
--user superadmin:system \
-T ./externals/riscoss-data-collector/riscoss-rdc-app/target/riscoss-rdc-app-*-jar-with-dependencies.jar \
http://localhost:8080/riscoss/rest/wikis/gha/spaces/RISCOSSPlatformRiskDataCollectors/pages/GitHub/attachments/collector.jar
curl \
--user superadmin:system \
-T ./externals/riscoss-analyser/riscoss-remote-risk-analyser/target/riscoss-remote-risk-analyser-*-jar-with-dependencies.jar \
http://localhost:8080/riscoss/rest/wikis/gha/spaces/RISCOSSPlatformAnalysers/pages/LogicAnalyser/attachments/analyser.jar
curl \
--user superadmin:system \
-T ./externals/riscoss-risk-modeling/risk-models/Maintenance/github_risk_new-1446714752911.xml \
http://localhost:8080/riscoss/rest/wikis/gha/spaces/RISCOSSPlatformRiskModels/pages/BasicRiskModel/attachments/model.xml
echo
echo 'done';
echo