root / Portal / configurations / demo / upgrade.sh @ 400
History | View | Annotate | Download (2.8 kB)
1 |
#!/bin/bash |
---|---|
2 |
|
3 |
echo "** TXMWEB deploy: start." |
4 |
|
5 |
# auth params |
6 |
USER="$1" |
7 |
PASSWORD="$2" |
8 |
URL="$3" |
9 |
# parameters |
10 |
TOMCAT="$4" |
11 |
SRCFILES="$5" |
12 |
TXMWEBHOME="$6" |
13 |
# application |
14 |
WARPATH="$7" |
15 |
APPNAME="$8" |
16 |
|
17 |
MANAGERURL="http://$USER:$PASSWORD@$URL/manager/html" |
18 |
|
19 |
# check params |
20 |
# Test if $TOMCAT exists |
21 |
if [ ! -d "$TOMCAT" ]; then |
22 |
echo "** TXMWEB deploy: $TOMCAT is missing. Can't continue the installation." |
23 |
exit 1; |
24 |
fi |
25 |
|
26 |
# Test if $WARPATH exists |
27 |
if [ ! -f "$WARPATH" ]; then |
28 |
echo "** TXMWEB deploy: war zip is missing: $WARPATH. Can't continue the installation." |
29 |
exit 1; |
30 |
fi |
31 |
|
32 |
# Test $SRCFILES content |
33 |
if [ ! -d "$SRCFILES/$APPNAME/biblio" ]; then |
34 |
echo "** TXMWEB deploy: $SRCFILES/$APPNAME/biblio is missing. This folder contains the bibliographic records of texts" |
35 |
exit 1; |
36 |
fi |
37 |
|
38 |
if [ ! -d "$SRCFILES/$APPNAME/css" ]; then |
39 |
echo "** TXMWEB deploy: $SRCFILES/$APPNAME/css is missing. This folder contains the css files" |
40 |
exit 1; |
41 |
fi |
42 |
|
43 |
if [ ! -d "$SRCFILES/$APPNAME/html" ]; then |
44 |
echo "** TXMWEB deploy: $SRCFILES/$APPNAME/html is missing. This folder contains the HTML files" |
45 |
exit 1; |
46 |
fi |
47 |
|
48 |
if [ ! -d "$SRCFILES/$APPNAME/images" ]; then |
49 |
echo "** TXMWEB deploy: $SRCFILES/$APPNAME/images is missing. This folder contains the png, jpg, ... files" |
50 |
exit 1; |
51 |
fi |
52 |
|
53 |
if [ ! -d "$SRCFILES/$APPNAME/jsp" ]; then |
54 |
echo "** TXMWEB deploy: $SRCFILES/$APPNAME/jsp is missing. This folder contains the jsp files. Such as 404.jsp" |
55 |
exit 1; |
56 |
fi |
57 |
|
58 |
if [ ! -d "$SRCFILES/$APPNAME/data/mails" ]; then |
59 |
echo "** TXMWEB deploy: $SRCFILES/$APPNAME/data/mails is missing. This folder contains the mails templates." |
60 |
exit 1; |
61 |
fi |
62 |
|
63 |
# undeploy and deploy $APPNAME |
64 |
wget "$MANAGERURL/undeploy?path=/$APPNAME" -O – -q |
65 |
if [ $? != 0 ]; then |
66 |
echo "** TXMWEB deploy: Failed to undeploy $APPNAME with cmd '$MANAGERURL/undeploy?path=/$APPNAME'. Continuing." |
67 |
fi |
68 |
wget "$MANAGERURL/deploy?deployPath=/$APPNAME&deployConfig=&deployWar=file:$WARPATH" -O – -q |
69 |
echo "$MANAGERURL/deploy?deployPath=/$APPNAME&deployConfig=&deployWar=file:$WARPATH" |
70 |
if [ $? != 0 ]; then |
71 |
echo "** TXMWEB deploy: Failed to deploy $APPNAME with cmd '$MANAGERURL/deploy?deployPath=/$APPNAME&deployConfig=&deployWar=file:$WARPATH'. Aborting." |
72 |
exit 1; |
73 |
fi |
74 |
|
75 |
# test if ant list contains $APPNAME |
76 |
wget "$MANAGERURL/list" -O testwar -q |
77 |
grep -q \/$APPNAME testwar |
78 |
if [ $? != 0 ]; then |
79 |
echo "** TXMWEB deploy: $APPNAME is not ready." |
80 |
exit 1; |
81 |
fi |
82 |
rm -rf testwar |
83 |
|
84 |
# copy biblio, html, images, css and jsp dir in dev webapps |
85 |
cp -rf "$SRCFILES/$APPNAME/biblio" "$TOMCAT/$APPNAME" && |
86 |
cp -rf "$SRCFILES/$APPNAME/html" "$TOMCAT/$APPNAME" && |
87 |
cp -rf "$SRCFILES/$APPNAME/images" "$TOMCAT/$APPNAME" && |
88 |
cp -rf "$SRCFILES/$APPNAME/css" "$TOMCAT/$APPNAME" && |
89 |
cp -rf "$SRCFILES/$APPNAME/jsp" "$TOMCAT/$APPNAME" |
90 |
if [ $? != 0 ]; then |
91 |
echo "** TXMWEB deploy: Failed to copy biblio, html, images, css and jsp dir in webapp $WEBAPPS/$APPNAME." |
92 |
exit 1; |
93 |
fi |
94 |
|
95 |
# the end |
96 |
echo "** TXMWEB dev deploy: done." |