From 55e4a3de4a60c68babf6791ac70285da1a3b475e Mon Sep 17 00:00:00 2001 From: "Endi S. Dewata" Date: Wed, 10 Jul 2013 11:09:00 -0400 Subject: Moved script to remove JNI_JAR_DIR to 10.0.3 folder. The redundant JNI_JAR_DIR will be removed from /etc/pki/pki.conf starting from version 10.0.4. Empty folders need be created for each released version number to allow proper upgrade and revert operations. --- base/common/upgrade/10.0.2/.gitignore | 4 ++ base/common/upgrade/10.0.2/01-RemoveJniJarDir | 77 --------------------------- base/common/upgrade/10.0.3/01-RemoveJniJarDir | 77 +++++++++++++++++++++++++++ 3 files changed, 81 insertions(+), 77 deletions(-) create mode 100644 base/common/upgrade/10.0.2/.gitignore delete mode 100755 base/common/upgrade/10.0.2/01-RemoveJniJarDir create mode 100755 base/common/upgrade/10.0.3/01-RemoveJniJarDir (limited to 'base/common/upgrade') diff --git a/base/common/upgrade/10.0.2/.gitignore b/base/common/upgrade/10.0.2/.gitignore new file mode 100644 index 000000000..5e7d2734c --- /dev/null +++ b/base/common/upgrade/10.0.2/.gitignore @@ -0,0 +1,4 @@ +# Ignore everything in this directory +* +# Except this file +!.gitignore diff --git a/base/common/upgrade/10.0.2/01-RemoveJniJarDir b/base/common/upgrade/10.0.2/01-RemoveJniJarDir deleted file mode 100755 index 4efbfc6b6..000000000 --- a/base/common/upgrade/10.0.2/01-RemoveJniJarDir +++ /dev/null @@ -1,77 +0,0 @@ -#!/usr/bin/python -# Authors: -# Endi S. Dewata -# -# 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/common/upgrade/10.0.3/01-RemoveJniJarDir b/base/common/upgrade/10.0.3/01-RemoveJniJarDir new file mode 100755 index 000000000..4efbfc6b6 --- /dev/null +++ b/base/common/upgrade/10.0.3/01-RemoveJniJarDir @@ -0,0 +1,77 @@ +#!/usr/bin/python +# Authors: +# Endi S. Dewata +# +# 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) -- cgit