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

Last change on this file since 4045 was 4045, checked in by Gregory Vincic, 13 years ago

Updated init.sh script to use SERVICE_PATH setting in WEB-INF/config throughout the whole init process. Also modified version number in recipe.

  • Property svn:executable set to *
  • Property svn:keywords set to Id
File size: 4.3 KB
Line 
1#!/bin/sh
2
3# $Id: init.sh 4045 2010-11-26 12:59:07Z gregory $
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 log4j.properties file if not existing.
102if [ ! -f log4j.properties ]; then
103  cp -p log4j.properties.in log4j.properties
104fi
105
106# Update proteios Proteios FTP Server start script
107java -jar ../lib/Replace.jar \
108                $SERVICE_PATH/proteios_ftp_server.sh.in $SERVICE_PATH/proteios_ftp_server.sh \
109                __CATALINA_HOME__="$CATALINA_HOME" \
110                __FTP_CONTROL_PORT__=$FTP_CONTROL_PORT \
111                __TEMP_FILES_DIR__=$TEMP_FILES_DIR
112
113# End configuration replacements
114cd ..
115
116# Build classpath
117CP=classes
118for i in `ls lib/*.jar`; do CP=${CP}:${i}; done
119
120# Create user files directory if not existing.
121mkdir -p "$USER_FILES_DIR/conf"
122chown $TOMCAT_USER -R $USER_FILES_DIR
123chgrp $TOMCAT_GROUP -R $USER_FILES_DIR
124
125# Create temporary files directory if not existing.
126mkdir -p "$TEMP_FILES_DIR"
127chown $TOMCAT_USER -R $TEMP_FILES_DIR
128chgrp $TOMCAT_GROUP -R $TEMP_FILES_DIR
129
130# Initialize database
131java -server -cp $CP org.proteios.install.InitDB $APP_ROOT_PWD
132
133
134if [ -e $SERVICE_PATH/proteios_ftp_server.sh ]; then
135  chmod ugo+x $SERVICE_PATH/proteios_ftp_server.sh
136else
137  echo "warning: $SERVICE_PATH/proteios_ftp_server.sh is missing"
138fi
139
140
Note: See TracBrowser for help on using the repository browser.