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