source: trunk/client/servlet/www/WEB-INF/init.sh @ 4551

Last change on this file since 4551 was 4551, checked in by Fredrik Levander, 9 years ago

Refs #630. Added support for URIs with basic authentication. Refs #823. Added possibilities to specify alternate URIs in connection-properties file. Updated installation scripts for the connection-properties file.

  • Property svn:executable set to *
  • Property svn:keywords set to Id
File size: 4.8 KB
Line 
1#!/bin/bash
2
3# $Id: init.sh 4551 2014-03-25 10:02:42Z fredrik $
4
5#  Copyright (C) 2009 Gregory Vincic
6
7#  Files are copyright by their respective authors. The contributions to
8#  files where copyright is not explicitly stated can be traced with the
9#  source code revision system.
10
11#  This file is part of Proteios.
12#  Available at http://www.proteios.org/
13
14#  Proteios is free software; you can redistribute it and/or
15#  modify it under the terms of the GNU General Public License
16#  as published by the Free Software Foundation; either version 2
17#  of the License, or (at your option) any later version.
18
19#  Proteios is distributed in the hope that it will be useful,
20#  but WITHOUT ANY WARRANTY; without even the implied warranty of
21#  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
22#  GNU General Public License for more details.
23
24#  You should have received a copy of the GNU General Public License
25#  along with this program; if not, write to the Free Software
26#  Foundation, Inc., 59 Temple Place - Suite 330,
27#  Boston, MA  02111-1307, USA.
28
29# Configuration script that should be used after istallation. (rpm only)
30
31. ./config
32
33
34stty -echo
35read -p "Mysql password for user $DB_MANAGER: " DB_MANAGER_PWD; echo
36SQL_EXEC="mysql -h $DB_HOST -u $DB_MANAGER -p$DB_MANAGER_PWD -e"
37DB_EXISTS=`$SQL_EXEC "show databases" | grep "^$DB_NAME\$"`
38if [ "$DB_EXISTS" == "$DB_NAME" ]; then
39  echo "Database '$DB_NAME' already exists. Change DB_NAME in config file and try again."
40  stty echo
41  exit
42fi
43
44read -p "Proteios SE password for root: " APP_ROOT_PWD; echo
45stty echo
46HOST_NAME=`java -jar lib/GetHostName.jar`
47
48
49# Create database and user
50$SQL_EXEC "CREATE DATABASE IF NOT EXISTS \`$DB_NAME\` DEFAULT CHARACTER SET utf8;"
51$SQL_EXEC "GRANT ALL ON \`$DB_NAME\`.* TO '$APP_USER'@'$DB_HOST' IDENTIFIED BY '$APP_USER_PWD'; FLUSH PRIVILEGES;"
52
53# Update proteios web.xml file (used by Tomcat)
54java -jar lib/Replace.jar \
55                web.xml.in web.xml \
56                __TEMPFILES__="$TEMP_FILES_DIR"
57
58cd classes
59java -jar ../lib/Replace.jar \
60                proteios.config.in proteios.config \
61                __USERNAME__=$APP_USER \
62                __PASSWORD__=$APP_USER_PWD \
63                __DATABASE__=$DB_NAME \
64                __USERFILES__="$USER_FILES_DIR" \
65                __HOST__=$DB_HOST \
66                __SMTPHOST__=$MAIL_SERVER \
67                __MAIL_FROM_ADDRESS__=$MAIL_FROM_ADDRESS
68
69
70# Update proteios ftp.properties file (used by FTP Server)
71java -jar ../lib/Replace.jar \
72                ftp.properties.in ftp.properties \
73                __CONTROL_PORT__=$FTP_CONTROL_PORT \
74                __PASSIVE_PORT_RANGE__=$FTP_PASSIVE_PORT_RANGE \
75                __USERNAME__=$APP_USER \
76                __PASSWORD__=$APP_USER_PWD \
77                __DATABASE__=$DB_NAME \
78                __USERFILES__="$USER_FILES_DIR" \
79                __HOST__=$DB_HOST
80
81# Create proteios xtandem.properties file if not existing.
82if [ ! -f xtandem.properties ]; then
83  cp -p xtandem.properties.in xtandem.properties
84fi
85
86# Create proteios mascot.properties file if not existing.
87if [ ! -f mascot.properties ]; then
88  cp -p mascot.properties.in mascot.properties
89fi
90
91# Create proteios omssa.properties file if not existing.
92if [ ! -f omssa.properties ]; then
93  cp -p omssa.properties.in omssa.properties
94fi
95
96# Create proteios pike.properties file if not existing.
97if [ ! -f pike.properties ]; then
98  cp -p pike.properties.in pike.properties
99fi
100
101# Create proteios msinspect.properties file if not existing.
102if [ ! -f msinspect.properties ]; then
103  cp -p msinspect.properties.in msinspect.properties
104fi
105
106# Create proteios openms.properties file if not existing.
107if [ ! -f openms.properties ]; then
108  cp -p openms.properties.in openms.properties
109fi
110
111# Create proteios log4j.properties file if not existing.
112if [ ! -f log4j.properties ]; then
113  cp -p log4j.properties.in log4j.properties
114fi
115
116# Create proteios connection.properties file if not existing.
117if [ ! -f connection.properties ]; then
118  cp -p connection.properties.in connection.properties
119fi
120
121
122# Update proteios Proteios FTP Server start script
123java -jar ../lib/Replace.jar \
124                $SERVICE_PATH/proteios_ftp_server.sh.in $SERVICE_PATH/proteios_ftp_server.sh \
125                __CATALINA_BASE__="$CATALINA_BASE" \
126                __FTP_CONTROL_PORT__=$FTP_CONTROL_PORT \
127                __TEMP_FILES_DIR__=$TEMP_FILES_DIR \
128                __TOMCAT_USER__=$TOMCAT_USER
129
130# End configuration replacements
131cd ..
132
133# Build classpath
134CP=classes
135for i in `ls lib/*.jar`; do CP=${CP}:${i}; done
136
137# Create user files directory if not existing.
138mkdir -p "$USER_FILES_DIR/conf"
139chown $TOMCAT_USER -R $USER_FILES_DIR
140chgrp $TOMCAT_GROUP -R $USER_FILES_DIR
141
142# Create temporary files directory if not existing.
143mkdir -p "$TEMP_FILES_DIR"
144chown $TOMCAT_USER -R $TEMP_FILES_DIR
145chgrp $TOMCAT_GROUP -R $TEMP_FILES_DIR
146
147# Initialize database
148java -server -cp $CP org.proteios.install.InitDB $APP_ROOT_PWD
149
150
151if [ -e $SERVICE_PATH/proteios_ftp_server.sh ]; then
152  chmod ugo+x $SERVICE_PATH/proteios_ftp_server.sh
153else
154  echo "warning: $SERVICE_PATH/proteios_ftp_server.sh is missing"
155fi
156
157
Note: See TracBrowser for help on using the repository browser.