summaryrefslogtreecommitdiffstats
path: root/ldap/cm/newinst/fixINF.pl
blob: fbc53021d7b74357504a7d0288cdf05372d0cbeb (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
#
# BEGIN COPYRIGHT BLOCK
# Copyright (C) 2001 Sun Microsystems, Inc. Used by permission.
# Copyright (C) 2005 Red Hat, Inc.
# All rights reserved.
# END COPYRIGHT BLOCK
#
# parameters: BUILD_MODULE versionString buildnum.dat input security name isdirLite output [expDefine]

$module = shift;
$version = shift;
$buildFile = shift;
$input = shift;
$security = shift;
$name = shift;
$isdirLite = shift;
$instanceNamePrefix = shift;
$output = shift;
$expDefine = shift;
if ($expDefine) {
	( $junk, $expires ) = split( /=/, $expDefine );
	if ( ! $expires ) {
		$expires = 0;
	}
} else {
	$expires = 0;
}

# get the build number
open( FILE, $buildFile );
while ( <FILE> ) {
    last if ( $buildNum ) = /\\"(.*)\\"/;
}
close( FILE );

# copy the input file to the output file changing stuff along the way
open( FILE, $input );
open( OUT, ">$output" );
while ( <FILE> ) {
    s/%%%INSTANCE_NAME_PREFIX%%%/$instanceNamePrefix/;
    s/%%%SERVER_NAME%%%/$name/;
    s/%%%SERVER_VERSION%%%/$version/;
    s/%%%SERVER_BUILD_NUM%%%/$buildNum/;
    s/%%%PUMPKIN_HOUR%%%/$expires/;
    s/%%%SECURITY%%%/$security/;
    s/%%%IS_DIR_LITE%%%/$isdirLite/;
	print OUT;
}
close( OUT );
close( FILE );