~ubuntu-branches/ubuntu/precise/kompozer/precise

« back to all changes in this revision

Viewing changes to mozilla/xpinstall/packager/windows/makeuninstallini.pl

  • Committer: Bazaar Package Importer
  • Author(s): Anthony Yarusso
  • Date: 2007-08-27 01:11:03 UTC
  • Revision ID: james.westby@ubuntu.com-20070827011103-2jgf4s6532gqu2ka
Tags: upstream-0.7.10
ImportĀ upstreamĀ versionĀ 0.7.10

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
#!c:\perl\bin\perl
 
2
 
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/
 
7
#  
 
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.
 
12
#  
 
13
# The Original Code is Mozilla Communicator client code, released
 
14
# March 31, 1998.
 
15
 
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
 
19
# Rights Reserved.
 
20
 
21
# Contributor(s): 
 
22
# Sean Su <ssu@netscape.com>
 
23
 
24
 
 
25
#
 
26
# This perl script parses the input file for special variables
 
27
# in the format of $Variable$ and replace it with the appropriate
 
28
# value(s).
 
29
#
 
30
# Input: .it file
 
31
#             - which is a .ini template
 
32
#
 
33
#        version
 
34
#             - version to display on the blue background
 
35
#
 
36
#   ie: perl makeuninstallini.pl uninstall.it 6.0.0.1999120608
 
37
#
 
38
#
 
39
 
 
40
if($#ARGV < 1)
 
41
{
 
42
  die "usage: $0 <.it file> <version>
 
43
 
 
44
       .it file      : input ini template file
 
45
 
 
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.
 
49
 
 
50
                     ie: perl makeuninstallini.pl uninstall.it 6.0.0.1999120608
 
51
                      or perl makeuninstallini.pl uninstall.it 6.0b2
 
52
       \n";
 
53
}
 
54
 
 
55
$inItFile         = $ARGV[0];
 
56
$inVersion        = $ARGV[1];
 
57
 
 
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};
 
70
 
 
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";
 
75
 
 
76
# Open the input file
 
77
open(fpInIt, $inItFile) || die "\ncould not open $ARGV[0]: $!\n";
 
78
 
 
79
# Open the output file
 
80
open(fpOutIni, ">$outIniFile") || die "\nCould not open $outIniFile: $!\n";
 
81
 
 
82
print "\n Making $outIniFile...\n";
 
83
 
 
84
# While loop to read each line from input file
 
85
while($line = <fpInIt>)
 
86
{
 
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;
 
101
}
 
102
 
 
103
print " done!\n";
 
104
 
 
105
# end of script
 
106
exit(0);
 
107
 
 
108
sub ParseUserAgentShort()
 
109
{
 
110
  my($aUserAgent) = @_;
 
111
  my($aUserAgentShort);
 
112
 
 
113
  @spaceSplit = split(/ /, $aUserAgent);
 
114
  if($#spaceSplit >= 0)
 
115
  {
 
116
    $aUserAgentShort = $spaceSplit[0];
 
117
  }
 
118
 
 
119
  return($aUserAgentShort);
 
120
}
 
121