summaryrefslogtreecommitdiffstats
path: root/pki/base/migrate/71ToTxt/run.bat
blob: 4dbe2f5cdc73c4d9061913bff9266b4ca30b0e58 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
@ECHO OFF
REM  --- BEGIN COPYRIGHT BLOCK ---
REM  This program is free software; you can redistribute it and/or modify
REM  it under the terms of the GNU General Public License as published by
REM  the Free Software Foundation; version 2 of the License.
REM
REM  This program is distributed in the hope that it will be useful,
REM  but WITHOUT ANY WARRANTY; without even the implied warranty of
REM  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
REM  GNU General Public License for more details.
REM
REM  You should have received a copy of the GNU General Public License along
REM  with this program; if not, write to the Free Software Foundation, Inc.,
REM  51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
REM
REM  Copyright (C) 2007 Red Hat, Inc.
REM  All rights reserved.
REM  --- END COPYRIGHT BLOCK ---

REM
REM  This script converts a pre-existing CS 7.1 ldif data
REM  file (e. g. - created via a utility such as db2ldif)
REM  into a normalized CS 7.1 ldif text file.
REM
REM  This subsequent normalized CS 7.1 ldif text file
REM  can be migrated into CS 7.1 or later utilizing
REM  the corresponding TxtTo<Target CS Version> script which
REM  converts this normalized CS 7.1 ldif text file into
REM  a <Target CS Version> ldif data file.
REM
REM  This <Target CS Version> ldif data file can then be
REM  imported into the internal database of the desired CS
REM  server using a utility such as ldif2db.
REM


SETLOCAL


REM
REM  SERVER_ROOT - fully qualified path of the location of the server
REM

REM SET SERVER_ROOT=C:\cs71


REM
REM  INSTANCE  - if the CS instance directory is called 'cert-ca',
REM              set the CS instance to 'ca'
REM
REM              NOTE:  When a single SERVER_ROOT contains more than
REM                     one CS instance, this script must be run multiple
REM                     times.  To do this, there is only a need to change
REM                     the INSTANCE parameter.
REM

REM SET INSTANCE=ca


REM
REM             *** DON'T CHANGE ANYTHING BELOW THIS LINE ***
REM


REM
REM  Script-defined constants
REM

SET CS="CS 7.1"


REM
REM  Perform a usage check for the appropriate number of arguments:
REM

IF "%1" == "" GOTO USAGE
IF "%3" == "" GOTO CHECK_INPUT_FILE


:USAGE
ECHO.
ECHO Usage:  "%0 input [errors] > output"
ECHO.
ECHO         where:  input  - the specified %CS% ldif data file,
ECHO                 errors - an optional errors file containing
ECHO                          skipped attributes, and
ECHO                 output - the normalized %CS% ldif text file.
ECHO.
ECHO                 NOTE:  If no redirection is provided to
ECHO                        'output', then the normalized
ECHO                        %CS% ldif text will merely
ECHO                        be echoed to stdout.
ECHO.
GOTO EXIT_PROCESS


REM
REM  Check that the specified "input" file exists
REM

:CHECK_INPUT_FILE
IF EXIST %1 GOTO CHECK_ERRORS_FILE


ECHO ERROR:  The specified input file, %1, does not exist!
ECHO.
GOTO EXIT_PROCESS


REM
REM  If an "errors" file is specified, then check that it does not already
REM  exist.
REM

:CHECK_ERRORS_FILE
IF "%2" == "" GOTO CHECK_ENVIRONMENT_VARIABLES
IF EXIST %2 GOTO ERRORS_FILE_ERROR
GOTO CHECK_ENVIRONMENT_VARIABLES


:ERRORS_FILE_ERROR
ECHO ERROR:  The specified errors file, %2, already exists!
ECHO         Please specify a different file!
ECHO.
GOTO EXIT_PROCESS


REM
REM  Check presence of user-defined variables
REM

:CHECK_ENVIRONMENT_VARIABLES
IF !%SERVER_ROOT%==! GOTO ENVIRONMENT_VARIABLES_ERROR
IF !%INSTANCE%==! GOTO ENVIRONMENT_VARIABLES_ERROR
GOTO CHECK_SERVER_ROOT


:ENVIRONMENT_VARIABLES_ERROR
ECHO ERROR:  Please specify the SERVER_ROOT and INSTANCE
ECHO         environment variables for this script!
ECHO.
GOTO EXIT_PROCESS


REM
REM  Check that the specified SERVER_ROOT exists
REM

:CHECK_SERVER_ROOT
IF EXIST %SERVER_ROOT% GOTO CHECK_INSTANCE


ECHO ERROR:  The specified SERVER_ROOT does not exist!
ECHO.
GOTO EXIT_PROCESS


REM
REM  Check that the specified INSTANCE exists
REM

:CHECK_INSTANCE
IF EXIST %SERVER_ROOT%\cert-%INSTANCE% GOTO SET_LIBRARY_PATH


ECHO ERROR:  The specified INSTANCE does not exist!
ECHO.
GOTO EXIT_PROCESS


REM
REM  Setup the appropriate library path environment variable
REM  based upon the platform (WINNT)
REM

:SET_LIBRARY_PATH
SET PATH=%SERVER_ROOT%\bin\cert\lib;%SERVER_ROOT%\bin\cert\jre\bin;%SERVER_ROOT\bin\cert\jre\bin\server;%PATH%


REM
REM  Convert the specified %CS% ldif data file
REM  into a normalized %CS% ldif text file.
REM

%SERVER_ROOT%\bin\cert\jre\bin\java.exe -classpath .\classes;%SERVER_ROOT%\cert-%INSTANCE%\classes;%SERVER_ROOT%\bin\cert\classes;%SERVER_ROOT%\bin\cert\jars\certsrv.jar;%SERVER_ROOT%\bin\cert\jars\cmscore.jar;%SERVER_ROOT%\bin\cert\jars\nsutil.jar;%SERVER_ROOT%\bin\cert\jars\jss3.jar;%SERVER_ROOT%\bin\cert\jre\lib\rt.jar Main %1 %2


:EXIT_PROCESS


ENDLOCAL