diff options
author | PKI Team <PKI Team@c9f7a03b-bd48-0410-a16d-cbbf54688b0b> | 2008-03-18 22:36:57 +0000 |
---|---|---|
committer | PKI Team <PKI Team@c9f7a03b-bd48-0410-a16d-cbbf54688b0b> | 2008-03-18 22:36:57 +0000 |
commit | d0f2e4efbd3eb0f1d7f5a28e7f97c1fb4ec027bb (patch) | |
tree | 7e7473fae8af5ad7e6cda7eabbef787093fc59a7 /pki/base/migrate/42SP2ToTxt/run.sh | |
parent | 273f8d85df5c31293a908185622b378c8f3cf7e8 (diff) | |
download | pki-d0f2e4efbd3eb0f1d7f5a28e7f97c1fb4ec027bb.tar.gz pki-d0f2e4efbd3eb0f1d7f5a28e7f97c1fb4ec027bb.tar.xz pki-d0f2e4efbd3eb0f1d7f5a28e7f97c1fb4ec027bb.zip |
Initial open source version based upon proprietary Red Hat Certificate System (RHCS) 7.3.
git-svn-id: svn+ssh://svn.fedorahosted.org/svn/pki/trunk@2 c9f7a03b-bd48-0410-a16d-cbbf54688b0b
Diffstat (limited to 'pki/base/migrate/42SP2ToTxt/run.sh')
-rwxr-xr-x | pki/base/migrate/42SP2ToTxt/run.sh | 205 |
1 files changed, 205 insertions, 0 deletions
diff --git a/pki/base/migrate/42SP2ToTxt/run.sh b/pki/base/migrate/42SP2ToTxt/run.sh new file mode 100755 index 00000000..bbb056f0 --- /dev/null +++ b/pki/base/migrate/42SP2ToTxt/run.sh @@ -0,0 +1,205 @@ +#!/bin/sh +# --- BEGIN COPYRIGHT BLOCK --- +# 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) 2007 Red Hat, Inc. +# All rights reserved. +# --- END COPYRIGHT BLOCK --- + +##################################################################### +### ### +### This script converts a pre-existing CMS 4.2 (SP 2) ldif data ### +### file (e. g. - created via a utility such as db2ldif) ### +### into a normalized CMS 4.2 (SP 2) ldif text file. ### +### ### +### This subsequent normalized CMS 4.2 (SP 2) ldif text file ### +### can be migrated into CMS 6.0 or later utilizing ### +### the corresponding TxtTo<Target CMS Version> script which ### +### converts this normalized CMS 4.2 (SP 2) ldif text file into ### +### a <Target CMS Version> ldif data file. ### +### ### +### This <Target CMS Version> ldif data file can then be ### +### imported into the internal database of the desired CMS ### +### server using a utility such as ldif2db. ### +### ### +##################################################################### + + +### +### SERVER_ROOT - fully qualified path of the location of the server +### + +#SERVER_ROOT=/export/home/migrate/cms43 +#export SERVER_ROOT + + +### +### INSTANCE - if the CMS instance directory is called 'cert-ca', +### set the CMS instance to 'ca' +### +### NOTE: When a single SERVER_ROOT contains more than +### one CMS instance, this script must be run multiple +### times. To do this, there is only a need to change +### the INSTANCE parameter. +### + +#INSTANCE=ca +#export INSTANCE + + +############################################################################ +### ### +### *** DON'T CHANGE ANYTHING BELOW THIS LINE *** ### +### ### +############################################################################ + + +### +### Script-defined constants +### + +CMS="CMS 4.2 (SP 2)" +export CMS + + +OS_NAME=`uname` +export OS_NAME + + +## +## Perform a usage check for the appropriate number of arguments: +## + +if [ $# -lt 1 -o $# -gt 2 ] ; then + echo + echo "Usage: $0 input [errors] > output" + echo + echo " where: input - the specified ${CMS} ldif data file," + echo " errors - an optional errors file containing" + echo " skipped attributes, and" + echo " output - the normalized ${CMS} ldif text file." + echo + echo " NOTE: If no redirection is provided to" + echo " 'output', then the normalized" + echo " ${CMS} ldif text will merely" + echo " be echoed to stdout." + echo + exit 1 +fi + + +### +### Check that the specified "input" file exists and is a regular file. +### + +if [ ! -f $1 ] ; then + echo "ERROR: Either the specified 'input' file, '$1', does not exist, " + echo " or it is not a regular file!" + echo + exit 2 +fi + + +### +### Check that the specified "input" file exists and is not empty. +### + +if [ ! -s $1 ] ; then + echo "ERROR: The specified 'input' file, '$1', is empty!" + echo + exit 3 +fi + + +### +### If an "errors" file is specified, then check that it does not already +### exist. +### + +if [ $# -eq 2 ] ; then + if [ -f $2 ] ; then + echo "ERROR: The specified 'errors' file, '$2', already exists!" + echo " Please specify a different file!" + echo + exit 4 + fi +fi + + +### +### Check presence of user-defined variables +### + +if [ -z "${SERVER_ROOT}" -o -z "${INSTANCE}" ] ; then + echo "ERROR: Please specify the SERVER_ROOT and INSTANCE " + echo " environment variables for this script!" + echo + exit 5 +fi + + +### +### Check that the specified SERVER_ROOT exists and is a directory +### + +if [ ! -d "${SERVER_ROOT}" ] ; then + echo "ERROR: Either the specified SERVER_ROOT does not exist, " + echo " or it is not a directory!" + echo + exit 6 +fi + + +### +### Check that the specified INSTANCE exists and is a directory +### + +if [ ! -d "${SERVER_ROOT}/cert-${INSTANCE}" ] ; then + echo "ERROR: Either the specified INSTANCE does not exist, " + echo " or it is not a directory!" + echo + exit 7 +fi + + +### +### Setup the appropriate library path environment variable +### based upon the platform +### + +if [ ${OS_NAME} = "AIX" ] ; then + LIBPATH=${SERVER_ROOT}/bin/cert/lib:${SERVER_ROOT}/bin/cert/jre/lib:${SERVER_ROOT}/bin/cert/jre/lib/aix/native_threads + export LIBPATH +elif [ ${OS_NAME} = "HP-UX" ] ; then + SHLIB_PATH=${SERVER_ROOT}/bin/cert/lib:${SERVER_ROOT}/bin/cert/jre/lib:${SERVER_ROOT}/bin/cert/jre/lib/PA_RISC/native_threads + export SHLIB_PATH +elif [ ${OS_NAME} = "Linux" ] ; then + LD_LIBRARY_PATH=${SERVER_ROOT}/bin/cert/lib:${SERVER_ROOT}/bin/cert/jre/lib:${SERVER_ROOT}/bin/cert/jre/lib/i386/native_threads + export LD_LIBRARY_PATH +elif [ ${OS_NAME} = "OSF1" ] ; then + LD_LIBRARY_PATH=${SERVER_ROOT}/bin/cert/lib:${SERVER_ROOT}/bin/cert/jre/lib:${SERVER_ROOT}/bin/cert/jre/lib/alpha/native_threads + export LD_LIBRARY_PATH +else # SunOS + LD_LIBRARY_PATH=${SERVER_ROOT}/bin/cert/lib:${SERVER_ROOT}/bin/cert/jre/lib:${SERVER_ROOT}/bin/cert/jre/lib/sparc/native_threads + export LD_LIBRARY_PATH +fi + + +### +### Convert the specified ${CMS} ldif data file +### into a normalized ${CMS} ldif text file. +### + +${SERVER_ROOT}/bin/cert/jre/bin/java -classpath ./classes:${SERVER_ROOT}/cert-${INSTANCE}/classes:${SERVER_ROOT}/bin/cert/classes:${SERVER_ROOT}/bin/cert/jars/certsrv.jar:${SERVER_ROOT}/bin/cert/jars/jss21.jar:${SERVER_ROOT}/bin/cert/jre/lib/rt.jar Main $1 $2 + |