Project

General

Profile

« Previous | Next » 

Revision 8913

Added by Jing Tao about 10 years ago

Used variables to replace the hard code.

View differences:

src/scripts/bash/install-java7-tomcat7.sh
5 5
#It modifies the workers.properties file for apache-tomcat connector.
6 6
#The user running the script should have the sudo permission.
7 7

  
8
NEW_JDK_HOME=/usr/lib/jvm/java-7-openjdk-amd64
9
NEW_CATALINA_PROPERTIES=/etc/tomcat7/catalina.properties
10
JK_CONF=/etc/apache2/mods-enabled/jk.conf
11
NEW_TOMCAT_HOME=/usr/share/tomcat7
12
NEW_TOMCAT_BASE=/var/lib/tomcat7
13

  
8 14
echo "install openjdk-7-jdk"
9 15
sudo apt-get install openjdk-7-jdk
10 16
sleep 3
11 17
echo "configure java, java, keytool and javaws"
12
sudo update-alternatives --set java /usr/lib/jvm/java-7-openjdk-amd64/jre/bin/java
13
sudo update-alternatives --set javac /usr/lib/jvm/java-7-openjdk-amd64/bin/javac
14
sudo update-alternatives --set keytool /usr/lib/jvm/java-7-openjdk-amd64/jre/bin/keytool
15
sudo update-alternatives --set javaws /usr/lib/jvm/java-7-openjdk-amd64/jre/bin/javaws
18
sudo update-alternatives --set java ${NEW_JDK_HOME}/jre/bin/java
19
sudo update-alternatives --set javac ${NEW_JDK_HOME}/bin/javac
20
sudo update-alternatives --set keytool ${NEW_JDK_HOME}/jre/bin/keytool
21
sudo update-alternatives --set javaws ${NEW_JDK_HOME}/jre/bin/javaws
16 22

  
17 23
echo "install tomcat7"
18 24
sudo apt-get install tomcat7
19
sudo sed -i.bak '$ a\org.apache.tomcat.util.buf.UDecoder.ALLOW_ENCODED_SLASH=true' /etc/tomcat7/catalina.properties 
20
sudo sed -i '$ a\org.apache.catalina.connector.CoyoteAdapter.ALLOW_BACKSLASH=true' /etc/tomcat7/catalina.properties
25
sudo sed -i.bak '$ a\org.apache.tomcat.util.buf.UDecoder.ALLOW_ENCODED_SLASH=true' ${NEW_CATALINA_PROPERTIES} 
26
sudo sed -i '$ a\org.apache.catalina.connector.CoyoteAdapter.ALLOW_BACKSLASH=true' ${NEW_CATALINA_PROPERTIES}
21 27

  
22 28
echo "read the location of the workers.properties file from the jk_conf"
23 29
while read f1 f2 
24 30
do
25 31
        if [ "$f1" = "JkWorkersFile" ]; then
26
		JKWORKERPATH="$f2"	
32
		JK_WORKER_PATH="$f2"	
27 33
	fi
28
done < /etc/apache2/mods-enabled/jk.conf
29
echo "the jk workers.properties location is $JKWORKERPATH"
34
done < ${JK_CONF}
35
echo "the jk workers.properties location is $JK_WORKER_PATH"
30 36

  
31 37
echo "update the tomcat home and java home in workers.properties file"
32 38
sudo sed -i.bak --regexp-extended "s/(workers\.tomcat_home=).*/\1\/usr\/share\/tomcat7/;

Also available in: Unified diff