Project

General

Profile

« Previous | Next » 

Revision 8936

Added by Jing Tao about 10 years ago

Add the code to add the attribute useHttpOnly='false' to the Context element in the context.xml file.

View differences:

src/scripts/bash/install-java7-tomcat7.sh
23 23
NEW_TOMCAT_HOME=/usr/share/${NEW_TOMCAT}
24 24
NEW_TOMCAT_BASE=/var/lib/${NEW_TOMCAT}
25 25
NEW_TOMCAT_SERVER_CONIF=$NEW_TOMCAT_BASE/conf/server.xml
26
NEW_TOMCAT_CONTEXT_CONF=$NEW_TOMCAT_BASE/conf/context.xml
26 27

  
27 28
KNB=knb
28 29
SSL=ssl
......
52 53
sudo update-alternatives --set javaws ${NEW_JDK_HOME}/jre/bin/javaws
53 54

  
54 55
echo "install ${NEW_TOMCAT}"
56
sudo ${INIT_START_DIR}/${OLD_TOMCAT} stop
55 57
sudo apt-get install ${NEW_TOMCAT_LIB}
56 58
sudo apt-get install ${NEW_TOMCAT_COMMON}
57 59
sudo apt-get install ${NEW_TOMCAT}
......
69 71
   sudo sed -i "$ a\\${TOMCAT_CONFIG_BACKSLASH}" ${NEW_CATALINA_PROPERTIES}
70 72
fi
71 73

  
74
echo "add an attribute useHttpOnly='false' to the element Context if it doesn't have one in the $NEW_TOMCAT_CONTEXT_CONF"
75
sudo cp $NEW_TOMCAT_CONTEXT_CONF $NEW_TOMCAT_CONTEXT_CONF.bak
76
useHttpOnly=$(sudo xmlstarlet sel -t --value-of "/Context/@useHttpOnly" $NEW_TOMCAT_CONTEXT_CONF)
77
echo "the uerHttpOnly is $useHttpOnly"
78
if [[ -n $useHttpOnly ]]; then
79
	if [[ $useHttpOnly == 'false' ]]; then
80
		echo "Attribute useHttpOnly was set to false and we don't need to do anything"
81
        else
82
		echo "Update the attribute useHttpOnly's value to false"
83
		sudo xmlstarlet ed -L -P -u "/Context/@useHttpOnly" -v false $NEW_TOMCAT_CONTEXT_CONF
84
	fi
85
else 
86
	echo "Attribute useHttpOnly hasn't been set and we will add one"
87
	sudo xmlstarlet ed -L -P -s "/Context" --type attr -n useHttpOnly -v false $NEW_TOMCAT_CONTEXT_CONF
88
fi
89

  
72 90
echo "remove the 8080 ports and add the 8009 ports to the tomcat7 server.xml"
73 91
sudo cp $NEW_TOMCAT_SERVER_CONIF $NEW_TOMCAT_SERVER_CONIF.bak
74 92
sudo xmlstarlet ed -L -P -d "//Connector[@port='8080']" $NEW_TOMCAT_SERVER_CONIF
......
87 105

  
88 106

  
89 107
echo "move Metacat and other web applications from $OLD_TOMCAT to $NEW_TOMCAT"
90
sudo ${INIT_START_DIR}/${OLD_TOMCAT} stop
91 108
sudo ${INIT_START_DIR}/${NEW_TOMCAT} stop
92 109
sudo rm -rf ${NEW_TOMCAT_BASE}/${WEBAPPS}/*
93 110
sudo cp -R ${OLD_TOMCAT_BASE}/${WEBAPPS}/*  ${NEW_TOMCAT_BASE}/${WEBAPPS}/.

Also available in: Unified diff