xref: /AOO41X/main/solenv/bin/modules/installer/parameter.pm (revision cdf0e10c4e3984b49a9502b011690b615761d4a3)
1*cdf0e10cSrcweir#*************************************************************************
2*cdf0e10cSrcweir#
3*cdf0e10cSrcweir# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4*cdf0e10cSrcweir#
5*cdf0e10cSrcweir# Copyright 2000, 2010 Oracle and/or its affiliates.
6*cdf0e10cSrcweir#
7*cdf0e10cSrcweir# OpenOffice.org - a multi-platform office productivity suite
8*cdf0e10cSrcweir#
9*cdf0e10cSrcweir# This file is part of OpenOffice.org.
10*cdf0e10cSrcweir#
11*cdf0e10cSrcweir# OpenOffice.org is free software: you can redistribute it and/or modify
12*cdf0e10cSrcweir# it under the terms of the GNU Lesser General Public License version 3
13*cdf0e10cSrcweir# only, as published by the Free Software Foundation.
14*cdf0e10cSrcweir#
15*cdf0e10cSrcweir# OpenOffice.org is distributed in the hope that it will be useful,
16*cdf0e10cSrcweir# but WITHOUT ANY WARRANTY; without even the implied warranty of
17*cdf0e10cSrcweir# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
18*cdf0e10cSrcweir# GNU Lesser General Public License version 3 for more details
19*cdf0e10cSrcweir# (a copy is included in the LICENSE file that accompanied this code).
20*cdf0e10cSrcweir#
21*cdf0e10cSrcweir# You should have received a copy of the GNU Lesser General Public License
22*cdf0e10cSrcweir# version 3 along with OpenOffice.org.  If not, see
23*cdf0e10cSrcweir# <http://www.openoffice.org/license.html>
24*cdf0e10cSrcweir# for a copy of the LGPLv3 License.
25*cdf0e10cSrcweir#
26*cdf0e10cSrcweir#*************************************************************************
27*cdf0e10cSrcweir
28*cdf0e10cSrcweirpackage installer::parameter;
29*cdf0e10cSrcweir
30*cdf0e10cSrcweiruse Cwd;
31*cdf0e10cSrcweiruse installer::exiter;
32*cdf0e10cSrcweiruse installer::files;
33*cdf0e10cSrcweiruse installer::globals;
34*cdf0e10cSrcweiruse installer::logger;
35*cdf0e10cSrcweiruse installer::remover;
36*cdf0e10cSrcweiruse installer::systemactions;
37*cdf0e10cSrcweir
38*cdf0e10cSrcweir############################################
39*cdf0e10cSrcweir# Parameter Operations
40*cdf0e10cSrcweir############################################
41*cdf0e10cSrcweir
42*cdf0e10cSrcweirsub usage
43*cdf0e10cSrcweir{
44*cdf0e10cSrcweir	if ( $installer::globals::debug ) { installer::logger::debuginfo("installer::parameter::usage"); }
45*cdf0e10cSrcweir
46*cdf0e10cSrcweir	print <<Ende;
47*cdf0e10cSrcweir--------------------------------------------------------------------------------
48*cdf0e10cSrcweir$installer::globals::prog
49*cdf0e10cSrcweirThe following parameter are needed:
50*cdf0e10cSrcweir-f: Path to the product list (required)
51*cdf0e10cSrcweir-s: Path to the setup script (optional, if defined in product list)
52*cdf0e10cSrcweir-i: Install path of the product (/opt/openofficeorg20) (optional)
53*cdf0e10cSrcweir-p: Product from product list to be created (required)
54*cdf0e10cSrcweir-l: Language of the product (comma and hash) (optional, defined in productlist)
55*cdf0e10cSrcweir-b: Build, e.g. srx645 (optional)
56*cdf0e10cSrcweir-m: Minor, e.g. m10 (optional)
57*cdf0e10cSrcweir-simple: Path to do a simple install to
58*cdf0e10cSrcweir-c: Compiler, e.g. wntmsci8, unxlngi5, unxsols4, ... (optional)
59*cdf0e10cSrcweir-u: Path, in which zipfiles are unpacked (optional)
60*cdf0e10cSrcweir-msitemplate: Source of the msi file templates (Windows compiler only)
61*cdf0e10cSrcweir-msilanguage: Source of the msi file templates (Windows compiler only)
62*cdf0e10cSrcweir-javalanguage: Source of the Java language files (opt., non-Windows only)
63*cdf0e10cSrcweir-buildid: Current BuildID (optional)
64*cdf0e10cSrcweir-pro: Product version
65*cdf0e10cSrcweir-format: Package format
66*cdf0e10cSrcweir-debian: Create Debian packages for Linux
67*cdf0e10cSrcweir-dontunzip: do not unzip all files with flag ARCHIVE
68*cdf0e10cSrcweir-dontcallepm : do not call epm to create install sets (opt., non-Windows only)
69*cdf0e10cSrcweir-ispatchedepm : Usage of a patched (non-standard) epm (opt., non-Windows only)
70*cdf0e10cSrcweir-copyproject : is set for projects that are only used for copying (optional)
71*cdf0e10cSrcweir-languagepack : do create a languagepack, no product pack (optional)
72*cdf0e10cSrcweir-patch : do create a patch (optional)
73*cdf0e10cSrcweir-patchinc: Source for the patch include files (Solaris only)
74*cdf0e10cSrcweir-dontstrip: No file stripping (Unix only)
75*cdf0e10cSrcweir-log : Logging all available information (optional)
76*cdf0e10cSrcweir-debug : Collecting debug information
77*cdf0e10cSrcweir
78*cdf0e10cSrcweirExamples for Windows:
79*cdf0e10cSrcweir
80*cdf0e10cSrcweirperl make_epmlist.pl -f zip.lst -p OfficeFAT -l en-US
81*cdf0e10cSrcweir                     -u /export/unpack -buildid 8712
82*cdf0e10cSrcweir                     -msitemplate /export/msi_files
83*cdf0e10cSrcweir                     -msilanguage /export/msi_languages
84*cdf0e10cSrcweir
85*cdf0e10cSrcweirExamples for Non-Windows:
86*cdf0e10cSrcweir
87*cdf0e10cSrcweirperl make_epmlist.pl -f zip.lst -p OfficeFAT -l en-US -format rpm
88*cdf0e10cSrcweir                     -u /export/unpack -buildid 8712 -ispatchedepm
89*cdf0e10cSrcweir--------------------------------------------------------------------------------
90*cdf0e10cSrcweirEnde
91*cdf0e10cSrcweir	exit(-1);
92*cdf0e10cSrcweir}
93*cdf0e10cSrcweir
94*cdf0e10cSrcweir#########################################
95*cdf0e10cSrcweir# Writing all parameter into logfile
96*cdf0e10cSrcweir#########################################
97*cdf0e10cSrcweir
98*cdf0e10cSrcweirsub saveparameter
99*cdf0e10cSrcweir{
100*cdf0e10cSrcweir	if ( $installer::globals::debug ) { installer::logger::debuginfo("installer::parameter::saveparameter"); }
101*cdf0e10cSrcweir
102*cdf0e10cSrcweir	my $include = "";
103*cdf0e10cSrcweir
104*cdf0e10cSrcweir	installer::logger::globallog("Command line arguments:");
105*cdf0e10cSrcweir
106*cdf0e10cSrcweir	for ( my $i = 0; $i <= $#ARGV; $i++ )
107*cdf0e10cSrcweir	{
108*cdf0e10cSrcweir		$include = $ARGV[$i] . "\n";
109*cdf0e10cSrcweir		push(@installer::globals::globallogfileinfo, $include);
110*cdf0e10cSrcweir	}
111*cdf0e10cSrcweir
112*cdf0e10cSrcweir	# also saving global settings:
113*cdf0e10cSrcweir
114*cdf0e10cSrcweir	$include = "Separator: $installer::globals::separator\n";
115*cdf0e10cSrcweir	push(@installer::globals::globallogfileinfo, $include);
116*cdf0e10cSrcweir
117*cdf0e10cSrcweir}
118*cdf0e10cSrcweir
119*cdf0e10cSrcweir#####################################
120*cdf0e10cSrcweir# Reading parameter
121*cdf0e10cSrcweir#####################################
122*cdf0e10cSrcweir
123*cdf0e10cSrcweirsub getparameter
124*cdf0e10cSrcweir{
125*cdf0e10cSrcweir	if ( $installer::globals::debug ) { installer::logger::debuginfo("installer::parameter::getparameter"); }
126*cdf0e10cSrcweir
127*cdf0e10cSrcweir	while ( $#ARGV >= 0 )
128*cdf0e10cSrcweir	{
129*cdf0e10cSrcweir		my $param = shift(@ARGV);
130*cdf0e10cSrcweir
131*cdf0e10cSrcweir		if ($param eq "-f") { $installer::globals::ziplistname = shift(@ARGV); }
132*cdf0e10cSrcweir		elsif ($param eq "-s") { $installer::globals::setupscriptname = shift(@ARGV); }
133*cdf0e10cSrcweir		elsif ($param eq "-p") { $installer::globals::product = shift(@ARGV); }
134*cdf0e10cSrcweir		elsif ($param eq "-l") { $installer::globals::languagelist = shift(@ARGV); }
135*cdf0e10cSrcweir		elsif ($param eq "-b") { $installer::globals::build = shift(@ARGV); }
136*cdf0e10cSrcweir		elsif ($param eq "-m") { $installer::globals::minor = shift(@ARGV); }
137*cdf0e10cSrcweir		elsif ($param eq "-dontunzip") { $installer::globals::dounzip = 0; }
138*cdf0e10cSrcweir		elsif ($param eq "-c") { $installer::globals::compiler = shift(@ARGV); }
139*cdf0e10cSrcweir		elsif ($param eq "-pro") { $installer::globals::pro = 1; }
140*cdf0e10cSrcweir		elsif ($param eq "-format") { $installer::globals::packageformat = shift(@ARGV); }
141*cdf0e10cSrcweir		elsif ($param eq "-log") { $installer::globals::globallogging = 1; }
142*cdf0e10cSrcweir		elsif ($param eq "-quiet") { $installer::globals::quiet = 1; }
143*cdf0e10cSrcweir		elsif ($param eq "-verbose") { $installer::globals::quiet = 0; }
144*cdf0e10cSrcweir		elsif ($param eq "-debug") { $installer::globals::debug = 1; }
145*cdf0e10cSrcweir		elsif ($param eq "-tab") { $installer::globals::tab = 1; }
146*cdf0e10cSrcweir		elsif ($param eq "-u") { $installer::globals::unpackpath = shift(@ARGV); }
147*cdf0e10cSrcweir		elsif ($param eq "-i") { $installer::globals::rootpath = shift(@ARGV); }
148*cdf0e10cSrcweir		elsif ($param eq "-dontcallepm") { $installer::globals::call_epm = 0; }
149*cdf0e10cSrcweir		elsif ($param eq "-msitemplate") { $installer::globals::idttemplatepath = shift(@ARGV); }
150*cdf0e10cSrcweir		elsif ($param eq "-msilanguage") { $installer::globals::idtlanguagepath = shift(@ARGV); }
151*cdf0e10cSrcweir		elsif ($param eq "-patchinc") { $installer::globals::patchincludepath = shift(@ARGV); }
152*cdf0e10cSrcweir		elsif ($param eq "-javalanguage") { $installer::globals::javalanguagepath = shift(@ARGV); }
153*cdf0e10cSrcweir		elsif ($param eq "-buildid") { $installer::globals::buildid = shift(@ARGV); }
154*cdf0e10cSrcweir		elsif ($param eq "-copyproject") { $installer::globals::is_copy_only_project = 1; }
155*cdf0e10cSrcweir		elsif ($param eq "-languagepack") { $installer::globals::languagepack = 1; }
156*cdf0e10cSrcweir		elsif ($param eq "-patch") { $installer::globals::patch = 1; }
157*cdf0e10cSrcweir		elsif ($param eq "-debian") { $installer::globals::debian = 1; }
158*cdf0e10cSrcweir		elsif ($param eq "-dontstrip") { $installer::globals::strip = 0; }
159*cdf0e10cSrcweir		elsif ($param eq "-destdir")	# new parameter for simple installer
160*cdf0e10cSrcweir		{
161*cdf0e10cSrcweir			$installer::globals::rootpath ne "" && die "must set destdir before -i or -simple";
162*cdf0e10cSrcweir			$installer::globals::destdir = shift @ARGV;
163*cdf0e10cSrcweir		}
164*cdf0e10cSrcweir		elsif ($param eq "-simple")		# new parameter for simple installer
165*cdf0e10cSrcweir		{
166*cdf0e10cSrcweir			$installer::globals::simple = 1;
167*cdf0e10cSrcweir			$installer::globals::call_epm = 0;
168*cdf0e10cSrcweir			$installer::globals::makedownload = 0;
169*cdf0e10cSrcweir			$installer::globals::makejds = 0;
170*cdf0e10cSrcweir			$installer::globals::strip = 0;
171*cdf0e10cSrcweir			my $path = shift(@ARGV);
172*cdf0e10cSrcweir			$path =~ s/^\Q$installer::globals::destdir\E//;
173*cdf0e10cSrcweir			$installer::globals::rootpath = $path;
174*cdf0e10cSrcweir		}
175*cdf0e10cSrcweir		else
176*cdf0e10cSrcweir		{
177*cdf0e10cSrcweir			installer::logger::print_error( "unknown parameter: $param" );
178*cdf0e10cSrcweir			usage();
179*cdf0e10cSrcweir			exit(-1);
180*cdf0e10cSrcweir		}
181*cdf0e10cSrcweir	}
182*cdf0e10cSrcweir
183*cdf0e10cSrcweir	# Usage of simple installer (not for Windows):
184*cdf0e10cSrcweir	# $PERL -w $SOLARENV/bin/make_installer.pl \
185*cdf0e10cSrcweir	# -f openoffice.lst -l en-US -p OpenOffice \
186*cdf0e10cSrcweir	# -buildid $BUILD -rpm \
187*cdf0e10cSrcweir	# -destdir /tmp/nurk -simple $INSTALL_PATH
188*cdf0e10cSrcweir}
189*cdf0e10cSrcweir
190*cdf0e10cSrcweir############################################
191*cdf0e10cSrcweir# Controlling  the fundamental parameter
192*cdf0e10cSrcweir# (required for every process)
193*cdf0e10cSrcweir############################################
194*cdf0e10cSrcweir
195*cdf0e10cSrcweirsub control_fundamental_parameter
196*cdf0e10cSrcweir{
197*cdf0e10cSrcweir	if ( $installer::globals::debug ) { installer::logger::debuginfo("installer::parameter::control_fundamental_parameter"); }
198*cdf0e10cSrcweir
199*cdf0e10cSrcweir	if ($installer::globals::product eq "")
200*cdf0e10cSrcweir	{
201*cdf0e10cSrcweir		installer::logger::print_error( "Product name not set!" );
202*cdf0e10cSrcweir		usage();
203*cdf0e10cSrcweir		exit(-1);
204*cdf0e10cSrcweir	}
205*cdf0e10cSrcweir}
206*cdf0e10cSrcweir
207*cdf0e10cSrcweir##########################################################
208*cdf0e10cSrcweir# The path parameters can be relative or absolute.
209*cdf0e10cSrcweir# This function creates absolute pathes.
210*cdf0e10cSrcweir##########################################################
211*cdf0e10cSrcweir
212*cdf0e10cSrcweirsub make_path_absolute
213*cdf0e10cSrcweir{
214*cdf0e10cSrcweir	my ($pathref) = @_;
215*cdf0e10cSrcweir
216*cdf0e10cSrcweir	if ( $installer::globals::debug ) { installer::logger::debuginfo("installer::parameter::make_path_absolute : $$pathref"); }
217*cdf0e10cSrcweir
218*cdf0e10cSrcweir	if ( $installer::globals::isunix )
219*cdf0e10cSrcweir	{
220*cdf0e10cSrcweir		if (!($$pathref =~ /^\s*\//))	# this is a relative unix path
221*cdf0e10cSrcweir		{
222*cdf0e10cSrcweir			$$pathref = cwd() . $installer::globals::separator . $$pathref;
223*cdf0e10cSrcweir		}
224*cdf0e10cSrcweir	}
225*cdf0e10cSrcweir
226*cdf0e10cSrcweir	if ( $installer::globals::iswin )
227*cdf0e10cSrcweir	{
228*cdf0e10cSrcweir		if ( $^O =~ /cygwin/i )
229*cdf0e10cSrcweir		{
230*cdf0e10cSrcweir			if ( $$pathref !~ /^\s*\// && $$pathref !~ /^\s*\w\:/ )	# not an absolute POSIX or DOS path
231*cdf0e10cSrcweir			{
232*cdf0e10cSrcweir				$$pathref = cwd() . $installer::globals::separator . $$pathref;
233*cdf0e10cSrcweir			}
234*cdf0e10cSrcweir			my $p = $$pathref;
235*cdf0e10cSrcweir			chomp( $p );
236*cdf0e10cSrcweir			my $q = '';
237*cdf0e10cSrcweir			# Avoid the $(LANG) problem.
238*cdf0e10cSrcweir			if ($p =~ /(\A.*)(\$\(.*\Z)/) {
239*cdf0e10cSrcweir				$p = $1;
240*cdf0e10cSrcweir				$q = $2;
241*cdf0e10cSrcweir			}
242*cdf0e10cSrcweir			$p =~ s/\\/\\\\/g;
243*cdf0e10cSrcweir			chomp( $p = qx{cygpath -w "$p"} );
244*cdf0e10cSrcweir			$$pathref = $p.$q;
245*cdf0e10cSrcweir			# Use windows paths, but with '/'s.
246*cdf0e10cSrcweir			$$pathref =~ s/\\/\//g;
247*cdf0e10cSrcweir		}
248*cdf0e10cSrcweir		else
249*cdf0e10cSrcweir		{
250*cdf0e10cSrcweir			if (!($$pathref =~ /^\s*\w\:/))	# this is a relative windows path (no dos drive)
251*cdf0e10cSrcweir			{
252*cdf0e10cSrcweir				$$pathref = cwd() . $installer::globals::separator . $$pathref;
253*cdf0e10cSrcweir
254*cdf0e10cSrcweir				$$pathref =~ s/\//\\/g;
255*cdf0e10cSrcweir			}
256*cdf0e10cSrcweir		}
257*cdf0e10cSrcweir	}
258*cdf0e10cSrcweir	$$pathref =~ s/[\/\\]\s*$//;	# removing ending slashes
259*cdf0e10cSrcweir}
260*cdf0e10cSrcweir
261*cdf0e10cSrcweir##################################################
262*cdf0e10cSrcweir# Setting some global parameters
263*cdf0e10cSrcweir# This has to be expanded with furher platforms
264*cdf0e10cSrcweir##################################################
265*cdf0e10cSrcweir
266*cdf0e10cSrcweirsub setglobalvariables
267*cdf0e10cSrcweir{
268*cdf0e10cSrcweir	if ( $installer::globals::debug ) { installer::logger::debuginfo("installer::parameter::setglobalvariables"); }
269*cdf0e10cSrcweir
270*cdf0e10cSrcweir	# Setting the installertype directory corresponding to the environment variable PKGFORMAT
271*cdf0e10cSrcweir	# The global variable $installer::globals::packageformat can only contain one package format.
272*cdf0e10cSrcweir	# If PKGFORMAT cotains more than one format (for example "rpm deb") this is splitted in the
273*cdf0e10cSrcweir	# makefile calling the perl program.
274*cdf0e10cSrcweir	$installer::globals::installertypedir = $installer::globals::packageformat;
275*cdf0e10cSrcweir
276*cdf0e10cSrcweir	if ( $installer::globals::compiler =~ /wnt(msc|gcc)i/ )
277*cdf0e10cSrcweir	{
278*cdf0e10cSrcweir		$installer::globals::iswindowsbuild = 1;
279*cdf0e10cSrcweir	}
280*cdf0e10cSrcweir
281*cdf0e10cSrcweir	if ( $installer::globals::compiler =~ /unxso[lg][siux]/ )
282*cdf0e10cSrcweir	{
283*cdf0e10cSrcweir		$installer::globals::issolarisbuild = 1;
284*cdf0e10cSrcweir		if ( $installer::globals::packageformat eq "pkg" )
285*cdf0e10cSrcweir		{
286*cdf0e10cSrcweir			$installer::globals::issolarispkgbuild = 1;
287*cdf0e10cSrcweir			$installer::globals::epmoutpath = "packages";
288*cdf0e10cSrcweir			$installer::globals::isxpdplatform = 1;
289*cdf0e10cSrcweir		}
290*cdf0e10cSrcweir	}
291*cdf0e10cSrcweir
292*cdf0e10cSrcweir	if (( $installer::globals::compiler =~ /unxmacxi/ ) || ( $installer::globals::compiler =~ /unxmacxp/ ))
293*cdf0e10cSrcweir	{
294*cdf0e10cSrcweir		$installer::globals::ismacbuild = 1;
295*cdf0e10cSrcweir
296*cdf0e10cSrcweir		if ( $installer::globals::packageformat eq "dmg" )
297*cdf0e10cSrcweir		{
298*cdf0e10cSrcweir			$installer::globals::ismacdmgbuild = 1;
299*cdf0e10cSrcweir		}
300*cdf0e10cSrcweir	}
301*cdf0e10cSrcweir
302*cdf0e10cSrcweir	if ( $installer::globals::compiler =~ /unxfbsd/ )
303*cdf0e10cSrcweir	{
304*cdf0e10cSrcweir		$installer::globals::isfreebsdbuild = 1;
305*cdf0e10cSrcweir
306*cdf0e10cSrcweir		if ( $installer::globals::packageformat eq "bsd" )
307*cdf0e10cSrcweir		{
308*cdf0e10cSrcweir			$installer::globals::epmoutpath = "freebsd";
309*cdf0e10cSrcweir			$installer::globals::isfreebsdpkgbuild = 1;
310*cdf0e10cSrcweir		}
311*cdf0e10cSrcweir	}
312*cdf0e10cSrcweir
313*cdf0e10cSrcweir	if ( $installer::globals::compiler =~ /unxso[lg]s/ ) { $installer::globals::issolarissparcbuild = 1; }
314*cdf0e10cSrcweir
315*cdf0e10cSrcweir	if ( $installer::globals::compiler =~ /unxso[lg]i/ ) { $installer::globals::issolarisx86build = 1; }
316*cdf0e10cSrcweir
317*cdf0e10cSrcweir	if ($ENV{OS} eq 'LINUX')
318*cdf0e10cSrcweir	{
319*cdf0e10cSrcweir		$installer::globals::islinuxbuild = 1;
320*cdf0e10cSrcweir		if ( $installer::globals::packageformat eq "rpm" )
321*cdf0e10cSrcweir		{
322*cdf0e10cSrcweir			$installer::globals::islinuxrpmbuild = 1;
323*cdf0e10cSrcweir			$installer::globals::isxpdplatform = 1;
324*cdf0e10cSrcweir			$installer::globals::epmoutpath = "RPMS";
325*cdf0e10cSrcweir			if ( $installer::globals::compiler =~ /unxlngi/ )
326*cdf0e10cSrcweir			{
327*cdf0e10cSrcweir				$installer::globals::islinuxintelrpmbuild = 1;
328*cdf0e10cSrcweir			}
329*cdf0e10cSrcweir			if ( $installer::globals::compiler =~ /unxlngppc/ )
330*cdf0e10cSrcweir			{
331*cdf0e10cSrcweir				$installer::globals::islinuxppcrpmbuild = 1;
332*cdf0e10cSrcweir			}
333*cdf0e10cSrcweir			if ( $installer::globals::compiler =~ /unxlngx/ )
334*cdf0e10cSrcweir			{
335*cdf0e10cSrcweir				$installer::globals::islinuxx86_64rpmbuild = 1;
336*cdf0e10cSrcweir			}
337*cdf0e10cSrcweir
338*cdf0e10cSrcweir			if ( $installer::globals::rpm eq "" ) { installer::exiter::exit_program("ERROR: Environment variable \"\$RPM\" has to be defined!", "setglobalvariables"); }
339*cdf0e10cSrcweir		}
340*cdf0e10cSrcweir
341*cdf0e10cSrcweir		# Creating Debian packages ?
342*cdf0e10cSrcweir		if (( $installer::globals::packageformat eq "deb" ) || ( $installer::globals::debian ))
343*cdf0e10cSrcweir		{
344*cdf0e10cSrcweir			$installer::globals::debian = 1;
345*cdf0e10cSrcweir			$installer::globals::packageformat = "deb";
346*cdf0e10cSrcweir			my $message = "Creating Debian packages";
347*cdf0e10cSrcweir			installer::logger::print_message( $message );
348*cdf0e10cSrcweir			push(@installer::globals::globallogfileinfo, $message);
349*cdf0e10cSrcweir			$installer::globals::islinuxrpmbuild = 0;
350*cdf0e10cSrcweir			$installer::globals::islinuxdebbuild = 1;
351*cdf0e10cSrcweir			$installer::globals::epmoutpath = "DEBS";
352*cdf0e10cSrcweir			if ( $installer::globals::compiler =~ /unxlngi/ )
353*cdf0e10cSrcweir			{
354*cdf0e10cSrcweir				$installer::globals::islinuxinteldebbuild = 1;
355*cdf0e10cSrcweir			}
356*cdf0e10cSrcweir			if ( $installer::globals::compiler =~ /unxlngppc/ )
357*cdf0e10cSrcweir			{
358*cdf0e10cSrcweir				$installer::globals::islinuxppcdebbuild = 1;
359*cdf0e10cSrcweir			}
360*cdf0e10cSrcweir			if ( $installer::globals::compiler =~ /unxlngx/ )
361*cdf0e10cSrcweir			{
362*cdf0e10cSrcweir				$installer::globals::islinuxx86_64debbuild = 1;
363*cdf0e10cSrcweir			}
364*cdf0e10cSrcweir		}
365*cdf0e10cSrcweir	}
366*cdf0e10cSrcweir
367*cdf0e10cSrcweir	# Defaulting to native package format for epm
368*cdf0e10cSrcweir
369*cdf0e10cSrcweir	if ( ! $installer::globals::packageformat ) { $installer::globals::packageformat = "native"; }
370*cdf0e10cSrcweir
371*cdf0e10cSrcweir	# extension, if $installer::globals::pro is set
372*cdf0e10cSrcweir	if ($installer::globals::pro) { $installer::globals::productextension = ".pro"; }
373*cdf0e10cSrcweir
374*cdf0e10cSrcweir	# no languages defined as parameter
375*cdf0e10cSrcweir	if ($installer::globals::languagelist eq "") { $installer::globals::languages_defined_in_productlist = 1; }
376*cdf0e10cSrcweir
377*cdf0e10cSrcweir	# setting and creating the unpackpath
378*cdf0e10cSrcweir
379*cdf0e10cSrcweir	if ($installer::globals::unpackpath eq "")	# unpackpath not set
380*cdf0e10cSrcweir	{
381*cdf0e10cSrcweir		$installer::globals::unpackpath = cwd();
382*cdf0e10cSrcweir		if ( $installer::globals::iswin ) { $installer::globals::unpackpath =~ s/\//\\/g; }
383*cdf0e10cSrcweir	}
384*cdf0e10cSrcweir
385*cdf0e10cSrcweir	if ( $installer::globals::localunpackdir ne "" ) { $installer::globals::unpackpath = $installer::globals::localunpackdir; }
386*cdf0e10cSrcweir
387*cdf0e10cSrcweir	if (!($installer::globals::unpackpath eq ""))
388*cdf0e10cSrcweir	{
389*cdf0e10cSrcweir		make_path_absolute(\$installer::globals::unpackpath);
390*cdf0e10cSrcweir	}
391*cdf0e10cSrcweir
392*cdf0e10cSrcweir	$installer::globals::unpackpath =~ s/\Q$installer::globals::separator\E\s*$//;
393*cdf0e10cSrcweir
394*cdf0e10cSrcweir	if (! -d $installer::globals::unpackpath )	# create unpackpath
395*cdf0e10cSrcweir	{
396*cdf0e10cSrcweir		installer::systemactions::create_directory($installer::globals::unpackpath);
397*cdf0e10cSrcweir	}
398*cdf0e10cSrcweir
399*cdf0e10cSrcweir	# setting jds exclude file list
400*cdf0e10cSrcweir
401*cdf0e10cSrcweir	if ( $installer::globals::islinuxrpmbuild )
402*cdf0e10cSrcweir	{
403*cdf0e10cSrcweir		$installer::globals::jdsexcludefilename = "jds_excludefiles_linux.txt";
404*cdf0e10cSrcweir	}
405*cdf0e10cSrcweir	if ( $installer::globals::issolarissparcbuild )
406*cdf0e10cSrcweir	{
407*cdf0e10cSrcweir		$installer::globals::jdsexcludefilename = "jds_excludefiles_solaris_sparc.txt";
408*cdf0e10cSrcweir	}
409*cdf0e10cSrcweir	if ( $installer::globals::issolarisx86build )
410*cdf0e10cSrcweir	{
411*cdf0e10cSrcweir		$installer::globals::jdsexcludefilename = "jds_excludefiles_solaris_intel.txt";
412*cdf0e10cSrcweir	}
413*cdf0e10cSrcweir
414*cdf0e10cSrcweir	# setting and creating the temppath
415*cdf0e10cSrcweir
416*cdf0e10cSrcweir	if (( $ENV{'TMP'} ) || ( $ENV{'TEMP'} ) || ( $ENV{'TMPDIR'} ))
417*cdf0e10cSrcweir	{
418*cdf0e10cSrcweir		if ( $ENV{'TMP'} ) { $installer::globals::temppath = $ENV{'TMP'}; }
419*cdf0e10cSrcweir		elsif ( $ENV{'TEMP'} )  { $installer::globals::temppath = $ENV{'TEMP'}; }
420*cdf0e10cSrcweir		elsif ( $ENV{'TMPDIR'} )  { $installer::globals::temppath = $ENV{'TMPDIR'}; }
421*cdf0e10cSrcweir		$installer::globals::temppath =~ s/\Q$installer::globals::separator\E\s*$//;	# removing ending slashes and backslashes
422*cdf0e10cSrcweir		$installer::globals::temppath = $installer::globals::temppath . $installer::globals::separator . $installer::globals::globaltempdirname;
423*cdf0e10cSrcweir		installer::systemactions::create_directory_with_privileges($installer::globals::temppath, "777");
424*cdf0e10cSrcweir		my $dirsave = $installer::globals::temppath;
425*cdf0e10cSrcweir
426*cdf0e10cSrcweir		if ( $installer::globals::compiler =~ /^unxmac/ )
427*cdf0e10cSrcweir		{
428*cdf0e10cSrcweir			my $localcall = "chmod 777 $installer::globals::temppath \>\/dev\/null 2\>\&1";
429*cdf0e10cSrcweir			system($localcall);
430*cdf0e10cSrcweir		}
431*cdf0e10cSrcweir
432*cdf0e10cSrcweir		$installer::globals::temppath = $installer::globals::temppath . $installer::globals::separator . "i";
433*cdf0e10cSrcweir		$installer::globals::temppath = installer::systemactions::create_pid_directory($installer::globals::temppath);
434*cdf0e10cSrcweir		push(@installer::globals::removedirs, $installer::globals::temppath);
435*cdf0e10cSrcweir
436*cdf0e10cSrcweir		if ( ! -d $installer::globals::temppath ) { installer::exiter::exit_program("ERROR: Failed to create directory $installer::globals::temppath ! Possible reason: Wrong privileges in directory $dirsave .", "setglobalvariables"); }
437*cdf0e10cSrcweir
438*cdf0e10cSrcweir		$installer::globals::jdstemppath = $installer::globals::temppath;
439*cdf0e10cSrcweir		$installer::globals::jdstemppath =~ s/i_/j_/;
440*cdf0e10cSrcweir		push(@installer::globals::jdsremovedirs, $installer::globals::jdstemppath);
441*cdf0e10cSrcweir		$installer::globals::temppath = $installer::globals::temppath . $installer::globals::separator . $installer::globals::compiler . $installer::globals::productextension;
442*cdf0e10cSrcweir		installer::systemactions::create_directory($installer::globals::temppath);
443*cdf0e10cSrcweir		if ( $^O =~ /cygwin/i )
444*cdf0e10cSrcweir		{
445*cdf0e10cSrcweir			$installer::globals::cyg_temppath = $installer::globals::temppath;
446*cdf0e10cSrcweir			$installer::globals::cyg_temppath =~ s/\\/\\\\/g;
447*cdf0e10cSrcweir			chomp( $installer::globals::cyg_temppath = qx{cygpath -w "$installer::globals::cyg_temppath"} );
448*cdf0e10cSrcweir		}
449*cdf0e10cSrcweir		$installer::globals::temppathdefined = 1;
450*cdf0e10cSrcweir		$installer::globals::jdstemppathdefined = 1;
451*cdf0e10cSrcweir	}
452*cdf0e10cSrcweir	else
453*cdf0e10cSrcweir	{
454*cdf0e10cSrcweir		$installer::globals::temppathdefined = 0;
455*cdf0e10cSrcweir		$installer::globals::jdstemppathdefined = 0;
456*cdf0e10cSrcweir	}
457*cdf0e10cSrcweir
458*cdf0e10cSrcweir	# only one cab file, if Windows msp patches shall be prepared
459*cdf0e10cSrcweir	if ( $installer::globals::prepare_winpatch ) { $installer::globals::number_of_cabfiles = 1; }
460*cdf0e10cSrcweir
461*cdf0e10cSrcweir}
462*cdf0e10cSrcweir
463*cdf0e10cSrcweir############################################
464*cdf0e10cSrcweir# Controlling  the parameter that are
465*cdf0e10cSrcweir# required for special processes
466*cdf0e10cSrcweir############################################
467*cdf0e10cSrcweir
468*cdf0e10cSrcweirsub control_required_parameter
469*cdf0e10cSrcweir{
470*cdf0e10cSrcweir	if ( $installer::globals::debug ) { installer::logger::debuginfo("installer::parameter::control_required_parameter"); }
471*cdf0e10cSrcweir
472*cdf0e10cSrcweir	if (!($installer::globals::is_copy_only_project))
473*cdf0e10cSrcweir	{
474*cdf0e10cSrcweir		##############################################################################################
475*cdf0e10cSrcweir		# idt template path. Only required for Windows build ($installer::globals::compiler =~ /wntmsci/)
476*cdf0e10cSrcweir		# for the creation of the msi database.
477*cdf0e10cSrcweir		##############################################################################################
478*cdf0e10cSrcweir
479*cdf0e10cSrcweir		if (($installer::globals::idttemplatepath eq "") && ($installer::globals::iswindowsbuild))
480*cdf0e10cSrcweir		{
481*cdf0e10cSrcweir			installer::logger::print_error( "idt template path not set (-msitemplate)!" );
482*cdf0e10cSrcweir			usage();
483*cdf0e10cSrcweir			exit(-1);
484*cdf0e10cSrcweir		}
485*cdf0e10cSrcweir
486*cdf0e10cSrcweir		##############################################################################################
487*cdf0e10cSrcweir		# idt language path. Only required for Windows build ($installer::globals::compiler =~ /wntmsci/)
488*cdf0e10cSrcweir		# for the creation of the msi database.
489*cdf0e10cSrcweir		##############################################################################################
490*cdf0e10cSrcweir
491*cdf0e10cSrcweir		if (($installer::globals::idtlanguagepath eq "") && ($installer::globals::iswindowsbuild))
492*cdf0e10cSrcweir		{
493*cdf0e10cSrcweir			installer::logger::print_error( "idt language path not set (-msilanguage)!" );
494*cdf0e10cSrcweir			usage();
495*cdf0e10cSrcweir			exit(-1);
496*cdf0e10cSrcweir		}
497*cdf0e10cSrcweir
498*cdf0e10cSrcweir		# Analyzing the idt template path
499*cdf0e10cSrcweir
500*cdf0e10cSrcweir		if (!($installer::globals::idttemplatepath eq ""))	# idttemplatepath set, relative or absolute?
501*cdf0e10cSrcweir		{
502*cdf0e10cSrcweir			make_path_absolute(\$installer::globals::idttemplatepath);
503*cdf0e10cSrcweir		}
504*cdf0e10cSrcweir
505*cdf0e10cSrcweir		installer::remover::remove_ending_pathseparator(\$installer::globals::idttemplatepath);
506*cdf0e10cSrcweir
507*cdf0e10cSrcweir		# Analyzing the idt language path
508*cdf0e10cSrcweir
509*cdf0e10cSrcweir		if (!($installer::globals::idtlanguagepath eq ""))	# idtlanguagepath set, relative or absolute?
510*cdf0e10cSrcweir		{
511*cdf0e10cSrcweir			make_path_absolute(\$installer::globals::idtlanguagepath);
512*cdf0e10cSrcweir		}
513*cdf0e10cSrcweir
514*cdf0e10cSrcweir		installer::remover::remove_ending_pathseparator(\$installer::globals::idtlanguagepath);
515*cdf0e10cSrcweir
516*cdf0e10cSrcweir		# In the msi template directory a files "codes.txt" has to exist, in which the ProductCode
517*cdf0e10cSrcweir		# and the UpgradeCode for the product are defined.
518*cdf0e10cSrcweir		# The name "codes.txt" can be overwritten in Product definition with CODEFILENAME (msiglobal.pm)
519*cdf0e10cSrcweir
520*cdf0e10cSrcweir		if (( $installer::globals::iswindowsbuild ) && ( $installer::globals::packageformat ne "archive" ) && ( $installer::globals::packageformat ne "installed" ))
521*cdf0e10cSrcweir		{
522*cdf0e10cSrcweir			$installer::globals::codefilename = $installer::globals::idttemplatepath  . $installer::globals::separator . $installer::globals::codefilename;
523*cdf0e10cSrcweir			installer::files::check_file($installer::globals::codefilename);
524*cdf0e10cSrcweir			$installer::globals::componentfilename = $installer::globals::idttemplatepath  . $installer::globals::separator . $installer::globals::componentfilename;
525*cdf0e10cSrcweir			installer::files::check_file($installer::globals::componentfilename);
526*cdf0e10cSrcweir		}
527*cdf0e10cSrcweir
528*cdf0e10cSrcweir	}
529*cdf0e10cSrcweir
530*cdf0e10cSrcweir	#######################################
531*cdf0e10cSrcweir	# Patch currently only available
532*cdf0e10cSrcweir	# for Solaris packages and Linux
533*cdf0e10cSrcweir	#######################################
534*cdf0e10cSrcweir
535*cdf0e10cSrcweir	if (( $installer::globals::patch ) && ( ! $installer::globals::issolarispkgbuild ) && ( ! $installer::globals::islinuxrpmbuild ) && ( ! $installer::globals::islinuxdebbuild ) && ( ! $installer::globals::iswindowsbuild ) && ( ! $installer::globals::ismacdmgbuild ))
536*cdf0e10cSrcweir	{
537*cdf0e10cSrcweir		installer::logger::print_error( "Sorry, Patch flag currently only available for Solaris pkg, Linux RPM and Windows builds!" );
538*cdf0e10cSrcweir		usage();
539*cdf0e10cSrcweir		exit(-1);
540*cdf0e10cSrcweir	}
541*cdf0e10cSrcweir
542*cdf0e10cSrcweir	if (( $installer::globals::patch ) && ( $installer::globals::issolarispkgbuild ) && ( ! $installer::globals::patchincludepath ))
543*cdf0e10cSrcweir	{
544*cdf0e10cSrcweir		installer::logger::print_error( "Solaris patch requires parameter -patchinc !" );
545*cdf0e10cSrcweir		usage();
546*cdf0e10cSrcweir		exit(-1);
547*cdf0e10cSrcweir	}
548*cdf0e10cSrcweir
549*cdf0e10cSrcweir	if (( $installer::globals::patch ) && ( $installer::globals::issolarispkgbuild ) && ( $installer::globals::patchincludepath ))
550*cdf0e10cSrcweir	{
551*cdf0e10cSrcweir		make_path_absolute(\$installer::globals::patchincludepath);
552*cdf0e10cSrcweir		$installer::globals::patchincludepath = installer::converter::make_path_conform($installer::globals::patchincludepath);
553*cdf0e10cSrcweir	}
554*cdf0e10cSrcweir
555*cdf0e10cSrcweir	#######################################
556*cdf0e10cSrcweir	# Testing existence of files
557*cdf0e10cSrcweir	# also for copy-only projects
558*cdf0e10cSrcweir	#######################################
559*cdf0e10cSrcweir
560*cdf0e10cSrcweir	if ($installer::globals::ziplistname eq "")
561*cdf0e10cSrcweir	{
562*cdf0e10cSrcweir		installer::logger::print_error( "ERROR: Zip list file has to be defined (Parameter -f) !" );
563*cdf0e10cSrcweir		usage();
564*cdf0e10cSrcweir		exit(-1);
565*cdf0e10cSrcweir	}
566*cdf0e10cSrcweir	else
567*cdf0e10cSrcweir	{
568*cdf0e10cSrcweir		installer::files::check_file($installer::globals::ziplistname);
569*cdf0e10cSrcweir	}
570*cdf0e10cSrcweir
571*cdf0e10cSrcweir	if ($installer::globals::setupscriptname eq "")	{ $installer::globals::setupscript_defined_in_productlist = 1; }
572*cdf0e10cSrcweir	else { installer::files::check_file($installer::globals::setupscriptname); } # if the setupscript file is defined, it has to exist
573*cdf0e10cSrcweir
574*cdf0e10cSrcweir}
575*cdf0e10cSrcweir
576*cdf0e10cSrcweir################################################
577*cdf0e10cSrcweir# Writing parameter to shell and into logfile
578*cdf0e10cSrcweir################################################
579*cdf0e10cSrcweir
580*cdf0e10cSrcweirsub outputparameter
581*cdf0e10cSrcweir{
582*cdf0e10cSrcweir	if ( $installer::globals::debug ) { installer::logger::debuginfo("installer::parameter::outputparameter"); }
583*cdf0e10cSrcweir
584*cdf0e10cSrcweir	my $element;
585*cdf0e10cSrcweir
586*cdf0e10cSrcweir	my @output = ();
587*cdf0e10cSrcweir
588*cdf0e10cSrcweir	push(@output, "\n########################################################\n");
589*cdf0e10cSrcweir	push(@output, "$installer::globals::prog, version 1.0\n");
590*cdf0e10cSrcweir	push(@output, "Product list file: $installer::globals::ziplistname\n");
591*cdf0e10cSrcweir	if (!($installer::globals::setupscript_defined_in_productlist))
592*cdf0e10cSrcweir	{
593*cdf0e10cSrcweir		push(@output, "Setup script: $installer::globals::setupscriptname\n");
594*cdf0e10cSrcweir	}
595*cdf0e10cSrcweir	else
596*cdf0e10cSrcweir	{
597*cdf0e10cSrcweir		push(@output, "Taking setup script from solver\n");
598*cdf0e10cSrcweir	}
599*cdf0e10cSrcweir	push(@output, "Unpackpath: $installer::globals::unpackpath\n");
600*cdf0e10cSrcweir	push(@output, "Compiler: $installer::globals::compiler\n");
601*cdf0e10cSrcweir	push(@output, "Product: $installer::globals::product\n");
602*cdf0e10cSrcweir	push(@output, "BuildID: $installer::globals::buildid\n");
603*cdf0e10cSrcweir	push(@output, "Build: $installer::globals::build\n");
604*cdf0e10cSrcweir	if ( $installer::globals::minor ) { push(@output, "Minor: $installer::globals::minor\n"); }
605*cdf0e10cSrcweir	else  { push(@output, "No minor set\n"); }
606*cdf0e10cSrcweir	if ( $installer::globals::pro ) { push(@output, "Product version\n"); }
607*cdf0e10cSrcweir	else  { push(@output, "Non-Product version\n"); }
608*cdf0e10cSrcweir	if ( $installer::globals::rootpath eq "" ) { push(@output, "Using default installpath\n"); }
609*cdf0e10cSrcweir	else { push(@output, "Installpath: $installer::globals::rootpath\n"); }
610*cdf0e10cSrcweir	push(@output, "Package format: $installer::globals::packageformat\n");
611*cdf0e10cSrcweir	if (!($installer::globals::idttemplatepath eq ""))	{ push(@output, "msi templatepath: $installer::globals::idttemplatepath\n"); }
612*cdf0e10cSrcweir	if ((!($installer::globals::idttemplatepath eq "")) && (!($installer::globals::iswindowsbuild))) { push(@output, "msi template path will be ignored for non Windows builds!\n"); }
613*cdf0e10cSrcweir	if (!($installer::globals::idtlanguagepath eq ""))	{ push(@output, "msi languagepath: $installer::globals::idtlanguagepath\n"); }
614*cdf0e10cSrcweir	if ((!($installer::globals::idtlanguagepath eq "")) && (!($installer::globals::iswindowsbuild))) { push(@output, "msi language path will be ignored for non Windows builds!\n"); }
615*cdf0e10cSrcweir	if ((!($installer::globals::iswindowsbuild)) && ( $installer::globals::call_epm )) { push(@output, "Calling epm\n"); }
616*cdf0e10cSrcweir	if ((!($installer::globals::iswindowsbuild)) && (!($installer::globals::call_epm))) { push(@output, "Not calling epm\n"); }
617*cdf0e10cSrcweir	if (!($installer::globals::javalanguagepath eq "")) { push(@output, "Java language path: $installer::globals::javalanguagepath\n"); }
618*cdf0e10cSrcweir	if ((!($installer::globals::javalanguagepath eq "")) && ($installer::globals::iswindowsbuild)) { push(@output, "Java language path will be ignored for Windows builds!\n"); }
619*cdf0e10cSrcweir	if ( $installer::globals::patchincludepath ) { push(@output, "Patch include path: $installer::globals::patchincludepath\n"); }
620*cdf0e10cSrcweir	if ( $installer::globals::globallogging ) { push(@output, "Complete logging activated\n"); }
621*cdf0e10cSrcweir	if ( $installer::globals::debug ) { push(@output, "Debug is activated\n"); }
622*cdf0e10cSrcweir	if ( $installer::globals::tab ) { push(@output, "TAB version\n"); }
623*cdf0e10cSrcweir	if ( $installer::globals::strip ) { push(@output, "Stripping files\n"); }
624*cdf0e10cSrcweir	else { push(@output, "No file stripping\n"); }
625*cdf0e10cSrcweir	if ( $installer::globals::debian ) { push(@output, "Linux: Creating Debian packages\n"); }
626*cdf0e10cSrcweir	if ( $installer::globals::dounzip ) { push(@output, "Unzip ARCHIVE files\n"); }
627*cdf0e10cSrcweir	else  { push(@output, "Not unzipping ARCHIVE files\n"); }
628*cdf0e10cSrcweir	if (!($installer::globals::languages_defined_in_productlist))
629*cdf0e10cSrcweir	{
630*cdf0e10cSrcweir		push(@output, "Languages:\n");
631*cdf0e10cSrcweir		foreach $element (@installer::globals::languageproducts) { push(@output, "\t$element\n"); }
632*cdf0e10cSrcweir	}
633*cdf0e10cSrcweir	else
634*cdf0e10cSrcweir	{
635*cdf0e10cSrcweir		push(@output, "Languages defined in $installer::globals::ziplistname\n");
636*cdf0e10cSrcweir	}
637*cdf0e10cSrcweir	if ( $installer::globals::is_copy_only_project ) { push(@output, "This is a copy only project!\n"); }
638*cdf0e10cSrcweir	if ( $installer::globals::languagepack ) { push(@output, "Creating language pack!\n"); }
639*cdf0e10cSrcweir	if ( $installer::globals::patch ) { push(@output, "Creating patch!\n"); }
640*cdf0e10cSrcweir	push(@output, "########################################################\n");
641*cdf0e10cSrcweir
642*cdf0e10cSrcweir	# output into shell and into logfile
643*cdf0e10cSrcweir
644*cdf0e10cSrcweir	for ( my $i = 0; $i <= $#output; $i++ )
645*cdf0e10cSrcweir	{
646*cdf0e10cSrcweir		installer::logger::print_message( $output[$i] );
647*cdf0e10cSrcweir		push(@installer::globals::globallogfileinfo, $output[$i]);
648*cdf0e10cSrcweir	}
649*cdf0e10cSrcweir}
650*cdf0e10cSrcweir
651*cdf0e10cSrcweir1;
652