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