Statistics
| Revision:

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

History | View | Annotate | Download (1.6 kB)

1
NO_ARGS=0 
2
E_OPTERROR=85
3

    
4
# parameters
5
TOMCAT="/home/txm/tomcat-txm/webapps"
6
SRCFILES="/home/txm/projets"
7
APPNAME="demo"
8
TXMWEBHOME="/home/txm/.TXMWEB"
9
WARPATH="/home/txm/projets/demo.war"
10
USER="txm"
11
PASSWORD=""
12
URL="textometrie.risc.cnrs.fr"
13

    
14

    
15
if [ $# -eq "$NO_ARGS" ]    # Script invoked with no command-line args?
16
then
17
  echo "Usage: sh txmweb.sh [install|upgrade] -user xxx -password yyy -url zzz -war aaa -app bbb -repo ccc -tomcat ddd -txmhome eee"
18
  echo "Or sh txmweb.sh [install|upgrade] -u xxx -p yyy -l zzz -w aaa -a bbb -e ccc -t ddd -x eee"
19
  exit $E_OPTERROR
20
fi  
21

    
22
WHAT=$1
23
shift
24
echo "do $WHAT"
25

    
26
if ! options=$(getopt -o uplwaetx -l user,password,url,war,appname,repo,tomcat,txmhome -- "$@")
27
then
28
    # something went wrong, getopt will put out an error message for us
29
    exit 1
30
fi
31

    
32
while [ $# -gt 0 ]
33
do
34
  case "$1" in
35
    -u|--user     ) USER="$2";;
36
    -p|--password ) PASSWORD="$2";;
37
    -l|--url      ) URL="$2";;
38
    -w|--war      ) WARPATH="$2";;
39
    -a|--appname  ) APPNAME="$2";;
40
    -e|--repo     ) SRCFILES="$2";;
41
    -t|--tomcat   ) TOMCAT="$2";;
42
    -x|--txmhome  ) TXMWEBHOME="$2";;
43
    (--) shift; break;;
44
    (-*) echo "$0: error - unrecognized option $1" 1>&2; exit 1;;
45
    (*)  break;;
46
  esac
47
  shift
48
  shift
49
done
50

    
51
echo "user: $USER"
52
echo "password: $PASSWORD"
53
echo "url: $URL"
54
echo "tomcat: $TOMCAT"
55
echo "srcfiles: $SRCFILES"
56
echo "txmweb home: $TXMWEBHOME"
57
echo "war: $WARPATH"
58
echo "appname: $APPNAME"
59

    
60
if [ $WHAT = "upgrade" ]
61
then
62
	sh upgrade.sh "$USER" "$PASSWORD" "$URL" "$TOMCAT" "$SRCFILES" "$TXMWEBHOME" "$WARPATH" "$APPNAME"
63
else
64
	sh install.sh "$USER" "$PASSWORD" "$URL" "$TOMCAT" "$SRCFILES" "$TXMWEBHOME" "$WARPATH" "$APPNAME"
65
fi;