Statistics
| Revision:

root / Portal / configurations / demo / txmweb.sh @ 7

History | View | Annotate | Download (1.6 kB)

1 7 alavrent
NO_ARGS=0
2 7 alavrent
E_OPTERROR=85
3 7 alavrent
4 7 alavrent
# parameters
5 7 alavrent
TOMCAT="/home/txm/tomcat-txm/webapps"
6 7 alavrent
SRCFILES="/home/txm/projets"
7 7 alavrent
APPNAME="demo"
8 7 alavrent
TXMWEBHOME="/home/txm/.TXMWEB"
9 7 alavrent
WARPATH="/home/txm/projets/demo.war"
10 7 alavrent
USER="txm"
11 7 alavrent
PASSWORD=""
12 7 alavrent
URL="textometrie.risc.cnrs.fr"
13 7 alavrent
14 7 alavrent
15 7 alavrent
if [ $# -eq "$NO_ARGS" ]    # Script invoked with no command-line args?
16 7 alavrent
then
17 7 alavrent
  echo "Usage: sh txmweb.sh [install|upgrade] -user xxx -password yyy -url zzz -war aaa -app bbb -repo ccc -tomcat ddd -txmhome eee"
18 7 alavrent
  echo "Or sh txmweb.sh [install|upgrade] -u xxx -p yyy -l zzz -w aaa -a bbb -e ccc -t ddd -x eee"
19 7 alavrent
  exit $E_OPTERROR
20 7 alavrent
fi
21 7 alavrent
22 7 alavrent
WHAT=$1
23 7 alavrent
shift
24 7 alavrent
echo "do $WHAT"
25 7 alavrent
26 7 alavrent
if ! options=$(getopt -o uplwaetx -l user,password,url,war,appname,repo,tomcat,txmhome -- "$@")
27 7 alavrent
then
28 7 alavrent
    # something went wrong, getopt will put out an error message for us
29 7 alavrent
    exit 1
30 7 alavrent
fi
31 7 alavrent
32 7 alavrent
while [ $# -gt 0 ]
33 7 alavrent
do
34 7 alavrent
  case "$1" in
35 7 alavrent
    -u|--user     ) USER="$2";;
36 7 alavrent
    -p|--password ) PASSWORD="$2";;
37 7 alavrent
    -l|--url      ) URL="$2";;
38 7 alavrent
    -w|--war      ) WARPATH="$2";;
39 7 alavrent
    -a|--appname  ) APPNAME="$2";;
40 7 alavrent
    -e|--repo     ) SRCFILES="$2";;
41 7 alavrent
    -t|--tomcat   ) TOMCAT="$2";;
42 7 alavrent
    -x|--txmhome  ) TXMWEBHOME="$2";;
43 7 alavrent
    (--) shift; break;;
44 7 alavrent
    (-*) echo "$0: error - unrecognized option $1" 1>&2; exit 1;;
45 7 alavrent
    (*)  break;;
46 7 alavrent
  esac
47 7 alavrent
  shift
48 7 alavrent
  shift
49 7 alavrent
done
50 7 alavrent
51 7 alavrent
echo "user: $USER"
52 7 alavrent
echo "password: $PASSWORD"
53 7 alavrent
echo "url: $URL"
54 7 alavrent
echo "tomcat: $TOMCAT"
55 7 alavrent
echo "srcfiles: $SRCFILES"
56 7 alavrent
echo "txmweb home: $TXMWEBHOME"
57 7 alavrent
echo "war: $WARPATH"
58 7 alavrent
echo "appname: $APPNAME"
59 7 alavrent
60 7 alavrent
if [ $WHAT = "upgrade" ]
61 7 alavrent
then
62 7 alavrent
	sh upgrade.sh "$USER" "$PASSWORD" "$URL" "$TOMCAT" "$SRCFILES" "$TXMWEBHOME" "$WARPATH" "$APPNAME"
63 7 alavrent
else
64 7 alavrent
	sh install.sh "$USER" "$PASSWORD" "$URL" "$TOMCAT" "$SRCFILES" "$TXMWEBHOME" "$WARPATH" "$APPNAME"
65 7 alavrent
fi;