3
# The contents of this file are subject to the Netscape Public
4
# License Version 1.1 (the "License"); you may not use this file
5
# except in compliance with the License. You may obtain a copy of
6
# the License at http://www.mozilla.org/NPL/
8
# Software distributed under the License is distributed on an "AS
9
# IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
10
# implied. See the License for the specific language governing
11
# rights and limitations under the License.
13
# The Original Code is Mozilla Communicator client code, released
16
# The Initial Developer of the Original Code is Netscape
17
# Communications Corporation. Portions created by Netscape are
18
# Copyright (C) 1998-1999 Netscape Communications Corporation. All
22
# Sean Su <ssu@netscape.com>
26
# This perl script parses the input file for special variables
27
# in the format of $Variable$ and replace it with the appropriate
31
# - which is a .ini template
34
# - version to display on the blue background
36
# ie: perl makeuninstallini.pl uninstall.it 6.0.0.1999120608
42
die "usage: $0 <.it file> <version>
44
.it file : input ini template file
46
version : version to be shown in setup. Typically the same version
47
as show in mozilla.exe. This version string will be shown
48
on the title of the main dialog.
50
ie: perl makeuninstallini.pl uninstall.it 6.0.0.1999120608
51
or perl makeuninstallini.pl uninstall.it 6.0b2
56
$inVersion = $ARGV[1];
58
# get environment vars
59
$userAgent = $ENV{WIZ_userAgent};
60
$userAgentShort = $ENV{WIZ_userAgentShort};
61
$xpinstallVersion = $ENV{WIZ_xpinstallVersion};
62
$nameCompany = $ENV{WIZ_nameCompany};
63
$nameProduct = $ENV{WIZ_nameProduct};
64
$nameProductInternal = $ENV{WIZ_nameProductInternal};
65
$fileMainExe = $ENV{WIZ_fileMainExe};
66
$fileUninstall = $ENV{WIZ_fileUninstall};
67
$greBuildID = $ENV{WIZ_greBuildID};
68
$greFileVersion = $ENV{WIZ_greFileVersion};
69
$greUniqueID = $ENV{WIZ_greUniqueID};
71
# Get the name of the file replacing the .it extension with a .ini extension
72
@inItFileSplit = split(/\./,$inItFile);
73
$outIniFile = $inItFileSplit[0];
74
$outIniFile .= ".ini";
77
open(fpInIt, $inItFile) || die "\ncould not open $ARGV[0]: $!\n";
79
# Open the output file
80
open(fpOutIni, ">$outIniFile") || die "\nCould not open $outIniFile: $!\n";
82
print "\n Making $outIniFile...\n";
84
# While loop to read each line from input file
85
while($line = <fpInIt>)
87
# For each line read, search and replace $Version$ with the version passed in
88
$line =~ s/\$Version\$/$inVersion/gi;
89
$line =~ s/\$UserAgent\$/$userAgent/gi;
90
$line =~ s/\$UserAgentShort\$/$userAgentShort/gi;
91
$line =~ s/\$XPInstallVersion\$/$xpinstallVersion/gi;
92
$line =~ s/\$CompanyName\$/$nameCompany/gi;
93
$line =~ s/\$ProductName\$/$nameProduct/gi;
94
$line =~ s/\$ProductNameInternal\$/$nameProductInternal/gi;
95
$line =~ s/\$MainExeFile\$/$fileMainExe/gi;
96
$line =~ s/\$UninstallFile\$/$fileUninstall/gi;
97
$line =~ s/\$GreBuildID\$/$greBuildID/gi;
98
$line =~ s/\$GreFileVersion\$/$greFileVersion/gi;
99
$line =~ s/\$GreUniqueID\$/$greUniqueID/gi;
100
print fpOutIni $line;
108
sub ParseUserAgentShort()
110
my($aUserAgent) = @_;
111
my($aUserAgentShort);
113
@spaceSplit = split(/ /, $aUserAgent);
114
if($#spaceSplit >= 0)
116
$aUserAgentShort = $spaceSplit[0];
119
return($aUserAgentShort);