summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAde Lee <alee@redhat.com>2013-09-18 11:34:07 -0400
committerAde Lee <alee@redhat.com>2013-09-18 16:18:34 -0400
commitfb32217fe98603dbe20563ce9836eb86813ebc98 (patch)
tree222ca43637ec0f5844a576e30ed54116598465a1
parentf37ae8f1d9743c9c17ccc5714865f5c1e5b9db5c (diff)
downloadpki-fb32217fe98603dbe20563ce9836eb86813ebc98.tar.gz
pki-fb32217fe98603dbe20563ce9836eb86813ebc98.tar.xz
pki-fb32217fe98603dbe20563ce9836eb86813ebc98.zip
Upgrade script to fix JAVA_OPTS
-rw-r--r--base/server/share/conf/tomcat.conf20
-rwxr-xr-xbase/server/upgrade/10.1.0/01-FixJavaOpts39
2 files changed, 49 insertions, 10 deletions
diff --git a/base/server/share/conf/tomcat.conf b/base/server/share/conf/tomcat.conf
index f4070ee81..ce8453c91 100644
--- a/base/server/share/conf/tomcat.conf
+++ b/base/server/share/conf/tomcat.conf
@@ -23,16 +23,16 @@ CATALINA_BASE="[PKI_INSTANCE_PATH]"
#JASPER_HOME="/usr/share/tomcat"
CATALINA_TMPDIR=[PKI_TMPDIR]
-# You can pass some parameters to java here if you wish to
-#JAVA_OPTS="-Xminf0.1 -Xmaxf0.3"
-
-# Use JAVA_OPTS to set java.library.path for libtcnative.so
-#JAVA_OPTS="-Djava.library.path=/usr/lib"
-
-# Enable the following JAVA_OPTS to run a java debugger (e. g. - 'eclipse')
-#JAVA_OPTS="-Xdebug -Xrunjdwp:transport=dt_socket,address=8000,server=y,suspend=n -Djava.awt.headless=true -Xmx128M"
-
-# RESTEasy
+# NOTE: JAVA_OPTS is now only read once. All desired settings must be concatenated
+# into a single line.
+#
+# Some parameters you might want to add are:
+# - parameters to the JVM like
+# -Xminf0.1 -Xmaxf0.3
+# - parameters to set java.library.path for libtcnative.so
+# -Djava.library.path=/usr/lib"
+# - parameters to run a java debugger (e. g. - 'eclipse')
+# -Xdebug -Xrunjdwp:transport=dt_socket,address=8000,server=y,suspend=n -Djava.awt.headless=true -Xmx128M"
JAVA_OPTS="-DRESTEASY_LIB=[PKI_RESTEASY_LIB]"
# What user should run tomcat
diff --git a/base/server/upgrade/10.1.0/01-FixJavaOpts b/base/server/upgrade/10.1.0/01-FixJavaOpts
new file mode 100755
index 000000000..d89f7b425
--- /dev/null
+++ b/base/server/upgrade/10.1.0/01-FixJavaOpts
@@ -0,0 +1,39 @@
+#!/usr/bin/python
+# Authors:
+# Ade Lee <alee@redhat.com>
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; version 2 of the License.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License along
+# with this program; if not, write to the Free Software Foundation, Inc.,
+# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+#
+# Copyright (C) 2013 Red Hat, Inc.
+# All rights reserved.
+#
+
+import os
+import re
+import pki.server.upgrade
+
+
+class FixJavaOpts(pki.server.upgrade.PKIServerUpgradeScriptlet):
+
+ def __init__(self):
+ self.message = 'Fix JAVA_OPTS in tomcat startup'
+
+ def upgrade_instance(self, instance):
+ fname = "/etc/sysconfig/" + instance.name
+ with open(fname, "r") as infile:
+ lines = infile.readlines()
+ with open(fname, "w") as outfile:
+ for line in lines:
+ outfile.write(re.sub(r'\$JAVA_OPTS *', '', line))
+