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