summaryrefslogtreecommitdiffstats
path: root/base
diff options
context:
space:
mode:
authorEndi Sukma Dewata <edewata@redhat.com>2013-05-09 11:21:03 -0400
committerEndi Sukma Dewata <edewata@redhat.com>2013-05-15 15:47:32 -0400
commitae9454394bcfcd77361cead6f77c9dda80612b04 (patch)
tree43a12e9bf915ed44b324f253837a4d2d00088d73 /base
parentaaf6e899f28ecfc5d75bc378a7dc6ccee5b2249e (diff)
downloadpki-ae9454394bcfcd77361cead6f77c9dda80612b04.tar.gz
pki-ae9454394bcfcd77361cead6f77c9dda80612b04.tar.xz
pki-ae9454394bcfcd77361cead6f77c9dda80612b04.zip
Removing JNI_JAR_DIR from /etc/pki/pki.conf.
Recently the JNI_JAR_DIR was moved into /usr/share/pki/etc/pki.conf. A new upgrade script has been added to remove the unused JNI_JAR_DIR from /etc/pki/pki.conf.
Diffstat (limited to 'base')
-rwxr-xr-xbase/common/upgrade/10.0.2/01-RemoveJniJarDir77
-rw-r--r--base/server/upgrade/10.0.2/.gitignore4
2 files changed, 81 insertions, 0 deletions
diff --git a/base/common/upgrade/10.0.2/01-RemoveJniJarDir b/base/common/upgrade/10.0.2/01-RemoveJniJarDir
new file mode 100755
index 000000000..4efbfc6b6
--- /dev/null
+++ b/base/common/upgrade/10.0.2/01-RemoveJniJarDir
@@ -0,0 +1,77 @@
+#!/usr/bin/python
+# Authors:
+# Endi S. Dewata <edewata@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 pki
+import pki.upgrade
+
+
+class RemoveJniJarDir(pki.upgrade.PKIUpgradeScriptlet):
+
+ def __init__(self):
+
+ self.message = 'Remove JNI_JAR_DIR from /etc/pki/pki.conf'
+
+ def upgrade_system(self):
+
+ file = os.path.join(pki.CONF_DIR, 'pki.conf')
+ self.backup(file)
+
+ # read pki.conf
+ conf = pki.PropertyFile(file)
+ conf.read()
+
+ self.update_system_config(conf)
+
+ # update pki.conf
+ conf.write()
+
+ def update_system_config(self, conf):
+
+ # find JNI_JAR_DIR
+ index = conf.index('JNI_JAR_DIR')
+
+ if index < 0:
+ return
+
+ # remove JNI_JAR_DIR
+ conf.remove_line(index)
+
+ if index == 0:
+ return
+
+ index = index - 1
+ if conf.lines[index] != '# JNI jar file location':
+ return
+
+ # remove comment
+ conf.remove_line(index)
+
+ if index == 0:
+ return
+
+ index = index - 1
+ if conf.lines[index] != '':
+ return
+
+ # remove blank line
+ conf.remove_line(index)
diff --git a/base/server/upgrade/10.0.2/.gitignore b/base/server/upgrade/10.0.2/.gitignore
new file mode 100644
index 000000000..5e7d2734c
--- /dev/null
+++ b/base/server/upgrade/10.0.2/.gitignore
@@ -0,0 +1,4 @@
+# Ignore everything in this directory
+*
+# Except this file
+!.gitignore