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