xref: /trunk/main/solenv/bin/make_installer.pl (revision dba1a2e4)
1#**************************************************************
2#
3#  Licensed to the Apache Software Foundation (ASF) under one
4#  or more contributor license agreements.  See the NOTICE file
5#  distributed with this work for additional information
6#  regarding copyright ownership.  The ASF licenses this file
7#  to you under the Apache License, Version 2.0 (the
8#  "License"); you may not use this file except in compliance
9#  with the License.  You may obtain a copy of the License at
10#
11#    http://www.apache.org/licenses/LICENSE-2.0
12#
13#  Unless required by applicable law or agreed to in writing,
14#  software distributed under the License is distributed on an
15#  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16#  KIND, either express or implied.  See the License for the
17#  specific language governing permissions and limitations
18#  under the License.
19#
20#**************************************************************
21
22
23
24#################
25# use
26#################
27
28use lib ("$ENV{SOLARENV}/bin/modules");
29
30use Cwd;
31use File::Copy;
32use installer::archivefiles;
33use installer::control;
34use installer::converter;
35use installer::copyproject;
36use installer::download;
37use installer::environment;
38use installer::epmfile;
39use installer::exiter;
40use installer::files;
41use installer::followme;
42use installer::globals;
43use installer::javainstaller;
44use installer::languagepack;
45use installer::languages;
46use installer::logger;
47use installer::mail;
48use installer::packagelist;
49use installer::packagepool;
50use installer::parameter;
51use installer::pathanalyzer;
52use installer::profiles;
53use installer::scppatchsoname;
54use installer::scpzipfiles;
55use installer::scriptitems;
56use installer::setupscript;
57use installer::simplepackage;
58use installer::sorter;
59use installer::strip;
60use installer::substfilenamefiles;
61use installer::upx;
62use installer::systemactions;
63use installer::windows::assembly;
64use installer::windows::binary;
65use installer::windows::component;
66use installer::windows::createfolder;
67use installer::windows::directory;
68use installer::windows::feature;
69use installer::windows::featurecomponent;
70use installer::windows::file;
71use installer::windows::font;
72use installer::windows::icon;
73use installer::windows::idtglobal;
74use installer::windows::inifile;
75use installer::windows::java;
76use installer::windows::media;
77use installer::windows::msiglobal;
78use installer::windows::patch;
79use installer::windows::property;
80use installer::windows::removefile;
81use installer::windows::registry;
82use installer::windows::selfreg;
83use installer::windows::shortcut;
84use installer::windows::strip;
85use installer::windows::upgrade;
86use installer::worker;
87use installer::xpdinstaller;
88use installer::ziplist;
89
90use strict;
91
92sub GetSetupScriptLines ($$$)
93{
94    my ($allsettingsarrayref, $allvariableshashref, $includepatharrayref) = @_;
95
96    if ($installer::globals::setupscript_defined_in_productlist)
97    {
98        installer::setupscript::set_setupscript_name($allsettingsarrayref, $includepatharrayref);
99    }
100
101    $installer::logger::Info->print( "... analyzing script: $installer::globals::setupscriptname ... \n" );
102    installer::logger::globallog("setup script file: $installer::globals::setupscriptname");
103    $installer::logger::Info->print( "... analyzing script: $installer::globals::setupscriptname ... \n" );
104
105    # Reading the setup script file
106    my $setupscriptref = installer::files::read_file($installer::globals::setupscriptname);
107
108    # Resolving variables defined in the zip list file into setup
109    # script.  All the variables are defined in $allvariablesarrayref
110    installer::scpzipfiles::replace_all_ziplistvariables_in_file($setupscriptref, $allvariableshashref);
111
112    # Resolving %variables defined in the installation object
113    my $allscriptvariablesref = installer::setupscript::get_all_scriptvariables_from_installation_object(
114        $setupscriptref,
115        $installer::globals::setupscriptname);
116    installer::setupscript::add_lowercase_productname_setupscriptvariable($allscriptvariablesref);
117    installer::setupscript::resolve_lowercase_productname_setupscriptvariable($allscriptvariablesref);
118
119    $setupscriptref = installer::setupscript::replace_all_setupscriptvariables_in_script(
120        $setupscriptref,
121        $allscriptvariablesref);
122
123    # Adding all variables defined in the installation object into the
124    # hash of all variables.  This is needed if variables are defined
125    # in the installation object, but not in the zip list file.  If
126    # there is a definition in the zip list file and in the
127    # installation object, the installation object is more important
128    installer::setupscript::add_installationobject_to_variables($allvariableshashref, $allscriptvariablesref);
129
130    # Adding also all variables, that must be included into the $allvariableshashref.
131    installer::setupscript::add_forced_properties($allvariableshashref);
132
133    # Replacing preset properties, not using the default mechanisms (for example for UNIXPRODUCTNAME)
134    installer::setupscript::replace_preset_properties($allvariableshashref);
135
136    # We did this already.  Can this or the other one be removed.
137    installer::scpzipfiles::replace_all_ziplistvariables_in_file($setupscriptref, $allvariableshashref);
138
139    return $setupscriptref;
140}
141
142
143
144=head2 MakeWindowsBuild (...)
145
146	Create an MSI installation set for Windows that is based on IDT tables.
147
148=cut
149sub MakeWindowsBuild ($$$$$$$$$$$$$$$$$$$$)
150{
151    my (
152        $allvariableshashref,
153        $allsettingsarrayref,
154        $current_install_number,
155        $directoriesforepmarrayref,
156        $filesinproductlanguageresolvedarrayref,
157        $folderitemsinproductlanguageresolvedarrayref,
158        $includepatharrayref,
159        $includepatharrayref_lang,
160        $installdir,
161        $languagesarrayref,
162        $languagestringref,
163        $linksinproductlanguageresolvedarrayref,
164        $loggingdir,
165        $modulesinproductlanguageresolvedarrayref,
166        $packages,
167        $profileitemsinproductlanguageresolvedarrayref,
168        $registryitemsinproductlanguageresolvedarrayref,
169        $shipinstalldir,
170        $windowscustomactionsarrayref,
171        $folderinproductlanguageresolvedarrayref) = @_;
172
173    ###########################################
174    # Stripping libraries
175    ###########################################
176
177    # Building for gcc build in cws requires, that all files are stripped before packaging:
178    # 1. copy all files that need to be stripped locally
179    # 2. strip all these files
180
181    if ( $installer::globals::compiler =~ /wntgcci/ )
182    {
183        installer::windows::strip::strip_binaries($filesinproductlanguageresolvedarrayref, $languagestringref);
184    }
185
186    $installdir = installer::worker::create_installation_directory($shipinstalldir, $languagestringref, \$current_install_number);
187
188    my $idtdirbase = installer::systemactions::create_directories("idt_files", $languagestringref);
189    $installer::globals::infodirectory = installer::systemactions::create_directories("info_files", $languagestringref);
190    my $installlogdir = installer::systemactions::create_directory_next_to_directory($installdir, "log");
191    # my $installchecksumdir = installer::systemactions::create_directory_next_to_directory($installdir, "checksum");
192
193    #################################################################################
194    # Preparing cabinet files from package definitions
195    #################################################################################
196
197    # installer::packagelist::prepare_cabinet_files($packages, $allvariableshashref, $$languagestringref);
198    installer::packagelist::prepare_cabinet_files($packages, $allvariableshashref);
199    # printing packages content:
200    installer::packagelist::log_cabinet_assignments();
201
202    #################################################################################
203    # Begin of functions that are used for the creation of idt files (Windows only)
204    #################################################################################
205
206    $installer::logger::Info->print( "... creating idt files ...\n" );
207
208    installer::logger::include_header_into_logfile("Creating idt files:");
209
210    my $newidtdir = $idtdirbase . $installer::globals::separator . "00";	# new files into language independent directory "00"
211    installer::systemactions::create_directory($newidtdir);
212
213    my @allfilecomponents = ();
214    my @allregistrycomponents = ();
215
216    # Collecting all files with flag "BINARYTABLE"
217    my $binarytablefiles = installer::worker::collect_all_items_with_special_flag($filesinproductlanguageresolvedarrayref ,"BINARYTABLE");
218
219    # Removing all files with flag "BINARYTABLE_ONLY"
220    @installer::globals::binarytableonlyfiles = ();
221    $filesinproductlanguageresolvedarrayref = installer::worker::remove_all_items_with_special_flag($filesinproductlanguageresolvedarrayref ,"BINARYTABLE_ONLY");
222
223    # Collecting all profileitems with flag "INIFILETABLE" for table "IniFile"
224    my $inifiletableentries = installer::worker::collect_all_items_with_special_flag($profileitemsinproductlanguageresolvedarrayref ,"INIFILETABLE");
225
226    # Creating the important dynamic idt files
227    installer::windows::msiglobal::set_msiproductversion($allvariableshashref);
228    installer::windows::msiglobal::put_msiproductversion_into_bootstrapfile($filesinproductlanguageresolvedarrayref);
229
230    # Add cabinet assignments to files
231    installer::windows::file::assign_cab_to_files($filesinproductlanguageresolvedarrayref);
232    installer::windows::file::assign_sequencenumbers_to_files($filesinproductlanguageresolvedarrayref);
233
234    # Collection all available directory trees
235    installer::windows::directory::collectdirectorytrees($directoriesforepmarrayref);
236
237    $filesinproductlanguageresolvedarrayref = installer::windows::file::create_files_table(
238        $filesinproductlanguageresolvedarrayref,
239        \@allfilecomponents,
240        $newidtdir,
241        $allvariableshashref);
242
243    installer::windows::directory::create_directory_table(
244        $directoriesforepmarrayref,
245        $newidtdir,
246        $allvariableshashref,
247        $loggingdir);
248
249    # Attention: The table "Registry.idt" contains language specific strings -> parameter: $languagesarrayref !
250    installer::windows::registry::create_registry_table($registryitemsinproductlanguageresolvedarrayref, \@allregistrycomponents, $newidtdir, $languagesarrayref, $allvariableshashref);
251
252    installer::windows::component::create_component_table($filesinproductlanguageresolvedarrayref, $registryitemsinproductlanguageresolvedarrayref, $directoriesforepmarrayref, \@allfilecomponents, \@allregistrycomponents, $newidtdir, $allvariableshashref);
253
254    # Attention: The table "Feature.idt" contains language specific strings -> parameter: $languagesarrayref !
255    installer::windows::feature::add_uniquekey($modulesinproductlanguageresolvedarrayref);
256    $modulesinproductlanguageresolvedarrayref = installer::windows::feature::sort_feature($modulesinproductlanguageresolvedarrayref);
257    installer::windows::feature::create_feature_table($modulesinproductlanguageresolvedarrayref, $newidtdir, $languagesarrayref, $allvariableshashref);
258
259    installer::windows::featurecomponent::create_featurecomponent_table($filesinproductlanguageresolvedarrayref, $registryitemsinproductlanguageresolvedarrayref, $newidtdir);
260
261    installer::windows::media::create_media_table($filesinproductlanguageresolvedarrayref, $newidtdir, $allvariableshashref);
262
263    installer::windows::font::create_font_table($filesinproductlanguageresolvedarrayref, $newidtdir);
264
265    # Attention: The table "Shortcut.idt" contains language specific strings -> parameter: $languagesarrayref !
266    # Attention: Shortcuts (Folderitems) have icon files, that have to be copied into the Icon directory (last parameter)
267    my @iconfilecollector = ();
268
269    installer::windows::shortcut::create_shortcut_table($filesinproductlanguageresolvedarrayref, $linksinproductlanguageresolvedarrayref, $folderinproductlanguageresolvedarrayref, $folderitemsinproductlanguageresolvedarrayref, $directoriesforepmarrayref, $newidtdir, $languagesarrayref, $includepatharrayref, \@iconfilecollector);
270
271    installer::windows::inifile::create_inifile_table($inifiletableentries, $filesinproductlanguageresolvedarrayref, $newidtdir);
272
273    installer::windows::icon::create_icon_table(\@iconfilecollector, $newidtdir);	 # creating the icon table with all iconfiles used as shortcuts (FolderItems)
274
275    installer::windows::createfolder::create_createfolder_table($directoriesforepmarrayref, $filesinproductlanguageresolvedarrayref, $newidtdir, $allvariableshashref);
276
277    installer::windows::upgrade::create_upgrade_table($newidtdir, $allvariableshashref);
278
279    if ( ! $installer::globals::languagepack )	 # the following tables not for language packs
280    {
281        installer::windows::removefile::create_removefile_table($folderitemsinproductlanguageresolvedarrayref, $newidtdir);
282
283        installer::windows::selfreg::create_selfreg_table($filesinproductlanguageresolvedarrayref, $newidtdir);
284
285        # Adding Assemblies into the tables MsiAssembly and MsiAssemblyName dynamically
286        installer::windows::assembly::create_msiassembly_table($filesinproductlanguageresolvedarrayref, $newidtdir);
287        installer::windows::assembly::create_msiassemblyname_table($filesinproductlanguageresolvedarrayref, $newidtdir);
288        installer::windows::assembly::add_assembly_condition_into_component_table($filesinproductlanguageresolvedarrayref, $newidtdir);
289    }
290
291    $installer::logger::Lang->print("\n");
292
293    # Localizing the language dependent idt files
294    # For every language there will be a localized msi database
295    # For multilingual installation sets, the differences of this
296    # databases have to be stored in transforms.
297
298    for ( my $m = 0; $m <= $#{$languagesarrayref}; $m++ )
299    {
300        my $onelanguage = ${$languagesarrayref}[$m];
301
302        my $is_bidi = 0;
303        if ( installer::existence::exists_in_array($onelanguage, \@installer::globals::bidilanguages) ) { $is_bidi = 1; }
304
305        my $languageidtdir = $idtdirbase . $installer::globals::separator . $onelanguage;
306        if ( -d $languageidtdir ) { installer::systemactions::remove_complete_directory($languageidtdir, 1); }
307        installer::systemactions::create_directory($languageidtdir);
308
309        # Copy the template idt files and the new created idt files into this language directory
310
311        $installer::logger::Info->print( "... copying idt files ...\n" );
312
313        installer::logger::include_header_into_logfile("Copying idt files to $languageidtdir:");
314
315        installer::windows::idtglobal::prepare_language_idt_directory($languageidtdir, $newidtdir, $onelanguage, $filesinproductlanguageresolvedarrayref, \@iconfilecollector, $binarytablefiles, $allvariableshashref);
316
317        if (( ! $installer::globals::languagepack ) && ( ! $allvariableshashref->{'NOLANGUAGESELECTIONPRODUCT'} ))
318        {
319            # For multilingual installation sets, the dialog for the language selection can now be prepared, with
320            # a checkbox for each available language. This has to happen before the following translation.
321            # The new controls have to be added into the Control.idt
322
323            my $controlidttablename = $languageidtdir . $installer::globals::separator . "Control.idt";
324            my $controlidttable = installer::files::read_file($controlidttablename);
325            installer::windows::idtglobal::add_language_checkboxes_to_database($controlidttable, $languagesarrayref);
326            installer::files::save_file($controlidttablename, $controlidttable);
327            $installer::logger::Lang->printf("Added checkboxes for language selection dialog into table %s\n",
328                $controlidttablename);
329        }
330
331        # Now all files are copied into a language specific directory
332        # The template idt files can be translated
333
334        $installer::logger::Info->print( "... localizing idt files (language: $onelanguage) ...\n" );
335
336        installer::logger::include_header_into_logfile("Localizing idt files (Language: $onelanguage):");
337
338        my @translationfiles = ();			# all idt files, that need a translation
339        push(@translationfiles, "ActionTe.idt");
340        push(@translationfiles, "Control.idt");
341        push(@translationfiles, "CustomAc.idt");
342        push(@translationfiles, "Error.idt");
343        push(@translationfiles, "LaunchCo.idt");
344        push(@translationfiles, "RadioBut.idt");
345        push(@translationfiles, "Property.idt");
346        push(@translationfiles, "UIText.idt");
347
348        my $oneidtfilename;
349        my $oneidtfile;
350
351        foreach $oneidtfilename (@translationfiles)
352        {
353            my $languagefilename = installer::windows::idtglobal::get_languagefilename($oneidtfilename, $installer::globals::idtlanguagepath);
354            my $languagefile = installer::files::read_file($languagefilename);
355
356            $oneidtfilename = $languageidtdir . $installer::globals::separator . $oneidtfilename;
357            $oneidtfile = installer::files::read_file($oneidtfilename);
358
359            # Now the substitution can start
360            installer::windows::idtglobal::translate_idtfile($oneidtfile, $languagefile, $onelanguage);
361
362            installer::files::save_file($oneidtfilename, $oneidtfile);
363
364            $installer::logger::Lang->printf("Translated idt file: %s into language %s\n",
365                $oneidtfilename,
366                $onelanguage);
367            $installer::logger::Lang->printf("Used languagefile: %s\n", $languagefilename);
368        }
369
370        # setting the encoding in every table (replacing WINDOWSENCODINGTEMPLATE)
371
372        installer::windows::idtglobal::setencoding($languageidtdir, $onelanguage);
373
374        # setting bidi attributes, if required
375
376        if ( $is_bidi ) { installer::windows::idtglobal::setbidiattributes($languageidtdir, $onelanguage); }
377
378        # setting the encoding in every table (replacing WINDOWSENCODINGTEMPLATE)
379        installer::windows::idtglobal::set_multilanguageonly_condition($languageidtdir);
380
381        # include the license text into the table Control.idt
382
383        if ( ! $allvariableshashref->{'HIDELICENSEDIALOG'} )
384        {
385            my $licensefilesource = installer::windows::idtglobal::get_rtflicensefilesource($onelanguage, $includepatharrayref_lang);
386            my $licensefile = installer::files::read_file($licensefilesource);
387            installer::scpzipfiles::replace_all_ziplistvariables_in_rtffile($licensefile, $allvariableshashref);
388            my $controltablename = $languageidtdir . $installer::globals::separator . "Control.idt";
389            my $controltable = installer::files::read_file($controltablename);
390            installer::windows::idtglobal::add_licensefile_to_database($licensefile, $controltable);
391            installer::files::save_file($controltablename, $controltable);
392
393            $installer::logger::Lang->printf("Added licensefile %s into database %s\n",
394                $licensefilesource,
395                $controltablename);
396        }
397
398        # include a component into environment table if required
399
400        installer::windows::component::set_component_in_environment_table($languageidtdir, $filesinproductlanguageresolvedarrayref);
401
402        # include the ProductCode and the UpgradeCode from codes-file into the Property.idt
403
404        installer::windows::property::set_codes_in_property_table($languageidtdir);
405
406        # the language specific properties can now be set in the Property.idt
407
408        installer::windows::property::update_property_table($languageidtdir, $onelanguage, $allvariableshashref, $languagestringref);
409
410        # replacing variables in RegLocat.idt
411
412        installer::windows::msiglobal::update_reglocat_table($languageidtdir, $allvariableshashref);
413
414        # replacing variables in RemoveRe.idt (RemoveRegistry.idt)
415
416        installer::windows::msiglobal::update_removere_table($languageidtdir);
417
418        # adding language specific properties for multilingual installation sets
419
420        installer::windows::property::set_languages_in_property_table($languageidtdir, $languagesarrayref);
421
422        # adding settings into CheckBox.idt
423        installer::windows::property::update_checkbox_table($languageidtdir, $allvariableshashref);
424
425        # adding the files from the binary directory into the binary table
426        installer::windows::binary::update_binary_table($languageidtdir, $filesinproductlanguageresolvedarrayref, $binarytablefiles);
427
428        # setting patch codes to detect installed products
429
430        if (( $installer::globals::patch ) || ( $installer::globals::languagepack ) || ( $allvariableshashref->{'PDFCONVERTER'} )) { installer::windows::patch::update_patch_tables($languageidtdir, $allvariableshashref); }
431
432        # Adding Windows Installer CustomActions
433
434        installer::windows::idtglobal::addcustomactions($languageidtdir, $windowscustomactionsarrayref, $filesinproductlanguageresolvedarrayref);
435
436        # Adding child projects if specified
437
438        if ($installer::globals::addchildprojects)
439        {
440            # Adding child projects to installation dynamically (also in feature table)
441            installer::windows::idtglobal::add_childprojects($languageidtdir, $filesinproductlanguageresolvedarrayref, $allvariableshashref);
442            # setting Java variables for Java products
443            if ( $allvariableshashref->{'JAVAPRODUCT'} ) { installer::windows::java::update_java_tables($languageidtdir, $allvariableshashref); }
444        }
445
446        # Then the language specific msi database can be created
447
448        if ( $installer::globals::iswin )	# only possible on a Windows platform
449        {
450            my $msidatabasename = installer::windows::msiglobal::get_msidatabasename($allvariableshashref, $onelanguage);
451            my $msifilename = $languageidtdir . $installer::globals::separator . $msidatabasename;
452
453            $installer::logger::Info->print( "... creating msi database (language $onelanguage) ... \n" );
454
455            installer::windows::msiglobal::set_uuid_into_component_table($languageidtdir, $allvariableshashref);	# setting new GUID for the components using the tool uuidgen.exe
456            installer::windows::msiglobal::prepare_64bit_database($languageidtdir, $allvariableshashref);	# making last 64 bit changes
457            installer::windows::msiglobal::create_msi_database($languageidtdir ,$msifilename);
458
459            # validating the database 	# ToDo
460
461            my $languagefile = installer::files::read_file($installer::globals::idtlanguagepath . $installer::globals::separator . "SIS.mlf");
462            # my $languagefile = installer::files::read_file($installer::globals::idtlanguagepath . $installer::globals::separator . "SIS.ulf");
463
464            installer::windows::msiglobal::write_summary_into_msi_database($msifilename, $onelanguage, $languagefile, $allvariableshashref);
465
466            # copy msi database into installation directory
467
468            my $msidestfilename = $installdir . $installer::globals::separator . $msidatabasename;
469            installer::systemactions::copy_one_file($msifilename, $msidestfilename);
470        }
471    }
472
473    # Creating transforms, if the installation set has more than one language
474    # renaming the msi database and generating the setup.ini file
475
476    my $defaultlanguage = installer::languages::get_default_language($languagesarrayref);
477
478    if ( $installer::globals::iswin )	# only possible on a Windows platform
479    {
480        if  ( $#{$languagesarrayref} > 0 )
481        {
482            installer::windows::msiglobal::create_transforms($languagesarrayref, $defaultlanguage, $installdir, $allvariableshashref);
483        }
484
485        installer::windows::msiglobal::rename_msi_database_in_installset($defaultlanguage, $installdir, $allvariableshashref);
486
487        if ( $allvariableshashref->{'ADDLANGUAGEINDATABASENAME'} ) { installer::windows::msiglobal::add_language_to_msi_database($defaultlanguage, $installdir, $allvariableshashref); }
488
489        $installer::logger::Info->print( "... generating setup.ini ...\n" );
490
491        if ( ! $allvariableshashref->{'NOLOADERREQUIRED'} ) { installer::windows::msiglobal::create_setup_ini($languagesarrayref, $defaultlanguage, $installdir, $allvariableshashref); }
492    }
493
494    # Analyzing the ScpActions and copying the files into the installation set
495    # At least the loader.exe
496
497    $installer::logger::Info->print( "... copying files into installation set ...\n" );
498
499    # installer::windows::msiglobal::copy_scpactions_into_installset($defaultlanguage, $installdir, $scpactionsinproductlanguageresolvedarrayref);
500    installer::worker::put_scpactions_into_installset($installdir);
501
502    # ... copying the setup.exe
503
504    installer::windows::msiglobal::copy_windows_installer_files_into_installset($installdir, $includepatharrayref, $allvariableshashref);
505
506    # ... copying the child projects
507
508    if ($installer::globals::addchildprojects)
509    {
510        installer::windows::msiglobal::copy_child_projects_into_installset($installdir, $allvariableshashref);
511    }
512
513    $installer::logger::Info->print( "... creating ddf files ...\n" );
514
515    # Creating all needed ddf files and generating a list
516    # for the package process containing all system calls
517
518    my $ddfdir = installer::systemactions::create_directories("ddf", $languagestringref);
519
520    $installer::globals::packjobref = installer::windows::msiglobal::generate_cab_file_list($filesinproductlanguageresolvedarrayref, $installdir, $ddfdir, $allvariableshashref);
521
522    # Update and patch reasons the pack order needs to be saved
523    installer::windows::msiglobal::save_packorder();
524
525    $installer::logger::Info->print("\n");
526
527    #######################################################
528    # Finally really create the installation packages,
529    # Only for Windows and only on a windows platform.
530    #######################################################
531
532    if ( $installer::globals::iswin )	# only possible on a Windows platform
533    {
534        $installer::logger::Info->print( "... packaging installation set ... \n" );
535        installer::windows::msiglobal::execute_packaging($installer::globals::packjobref, $loggingdir, $allvariableshashref);
536        if ( $installer::globals::include_cab_in_msi ) { installer::windows::msiglobal::include_cabs_into_msi($installdir); }
537    }
538
539    #######################################################
540    # Analyzing the log file
541    #######################################################
542
543    my $is_success = 0;
544    my $finalinstalldir = "";
545    installer::worker::clean_output_tree();	# removing directories created in the output tree
546    ($is_success, $finalinstalldir) = installer::worker::analyze_and_save_logfile($loggingdir, $installdir, $installlogdir, $allsettingsarrayref, $languagestringref, $current_install_number);
547
548
549    #######################################################
550    # Creating download installation set
551    #######################################################
552
553    my $create_download = 0;
554    my $downloadname = installer::ziplist::getinfofromziplist($allsettingsarrayref, "downloadname");
555    if ( $installer::globals::languagepack ) { $downloadname = installer::ziplist::getinfofromziplist($allsettingsarrayref, "langpackdownloadname"); }
556    if ( $installer::globals::patch ) { $downloadname = installer::ziplist::getinfofromziplist($allsettingsarrayref, "patchdownloadname"); }
557
558    if ( $is_success ) { installer::followme::save_followme_info($finalinstalldir, $includepatharrayref, $allvariableshashref, $$downloadname, $languagestringref, $languagesarrayref, $current_install_number, $loggingdir, $installlogdir); }
559
560    if ( $$downloadname ne "" ) { $create_download = 1; }
561    if (( $is_success ) && ( $create_download ) && ( $ENV{'ENABLE_DOWNLOADSETS'} ))
562    {
563        my $downloaddir = installer::download::create_download_sets($finalinstalldir, $includepatharrayref, $allvariableshashref, $$downloadname, $languagestringref, $languagesarrayref);
564        installer::worker::analyze_and_save_logfile($loggingdir, $downloaddir, $installlogdir, $allsettingsarrayref, $languagestringref, $current_install_number);
565    }
566}
567
568
569
570
571=head2 MakeNonWindowsBuild (...)
572
573	Create an installation set for non-windows platforms based on EPM files.
574
575=cut
576sub MakeNonWindowsBuild ($$$$$$$$$$$$$$$)
577{
578    my (
579        $allvariableshashref,
580        $allsettingsarrayref,
581        $current_install_number,
582        $directoriesforepmarrayref,
583        $filesinproductlanguageresolvedarrayref,
584        $includepatharrayref,
585        $languagesarrayref,
586        $languagestringref,
587        $linksinproductlanguageresolvedarrayref,
588        $unixlinksinproductlanguageresolvedarrayref,
589        $loggingdir,
590        $modulesinproductarrayref,
591        $packages,
592        $shipinstalldir,
593        $currentdir
594        ) = @_;
595
596    ####################################################
597    # Creating directories
598    ####################################################
599
600    my $installdir = installer::worker::create_installation_directory($shipinstalldir, $languagestringref, \$current_install_number);
601
602    my $listfiledir = installer::systemactions::create_directories("listfile", $languagestringref);
603    my $installlogdir = installer::systemactions::create_directory_next_to_directory($installdir, "log");
604
605    ####################################################
606    # Reading for Solaris all package descriptions
607    # from file defined in property PACKAGEMAP
608    ####################################################
609
610    if (  $installer::globals::issolarisbuild ) { installer::epmfile::read_packagemap($allvariableshashref, $includepatharrayref, $languagesarrayref); }
611
612    my $epmexecutable = "";
613    my $found_epm = 0;
614
615    # shuffle array to reduce parallel packaging process in pool
616    installer::worker::shuffle_array($packages);
617
618    # iterating over all packages
619    for ( my $k = 0; $k <= $#{$packages}; $k++ )
620    {
621        my $onepackage = ${$packages}[$k];
622
623        # checking, if this is a language pack or a project pack.
624        # Creating language packs only, if $installer::globals::languagepack is set. Parameter: -languagepack
625
626        if ( $installer::globals::languagepack ) { installer::languagepack::replace_languagestring_variable($onepackage, $languagestringref); }
627
628        my $onepackagename = $onepackage->{'module'};			# name of the top module (required)
629
630        my $shellscriptsfilename = "";
631        if ( $onepackage->{'script'} ) { $shellscriptsfilename = $onepackage->{'script'}; }
632        # no scripts for Solaris patches!
633        if (( $installer::globals::patch ) && ( $installer::globals::issolarispkgbuild )) { $shellscriptsfilename = ""; }
634
635        ###########################
636        # package name
637        ###########################
638
639        my $packagename = "";
640
641        if ( $installer::globals::issolarisbuild )	 # only for Solaris
642        {
643            if ( $onepackage->{'solarispackagename'} ) { $packagename = $onepackage->{'solarispackagename'}; }
644        }
645        else # not Solaris
646        {
647            if ( $onepackage->{'packagename'} ) { $packagename = $onepackage->{'packagename'}; }
648        }
649
650        if (!($packagename eq ""))
651        {
652            installer::packagelist::resolve_packagevariables(\$packagename, $allvariableshashref, 0);
653        }
654
655        # Debian allows no underline in package name
656        if ( $installer::globals::debian ) { $packagename =~ s/_/-/g; }
657
658        # Debian allows no underline in package name
659        if ( $installer::globals::debian ) { $packagename =~ s/_/-/g; }
660
661        my $linkaddon = "";
662        my $linkpackage = 0;
663        $installer::globals::add_required_package = "";
664        $installer::globals::linuxlinkrpmprocess = 0;
665
666        if ( $installer::globals::makelinuxlinkrpm )
667        {
668            my $oldpackagename = $packagename;
669            $installer::globals::add_required_package = $oldpackagename;	# the link rpm requires the non-linked version
670            if ( $installer::globals::languagepack ) { $packagename = $packagename . "_u"; }
671            else { $packagename = $packagename . "u"; }
672            my $savestring = $oldpackagename . "\t" . $packagename;
673            push(@installer::globals::linkrpms, $savestring);
674            $linkaddon = "_links";
675            $installer::globals::linuxlinkrpmprocess = 1;
676            $linkpackage = 1;
677        }
678
679        ####################################################
680        # Header for this package into log file
681        ####################################################
682
683        installer::logger::include_header_into_logfile("Creating package: $packagename ($k)");
684
685        ####################################################
686        # Pool check: If package is created at the moment
687        # try it again later.
688        ####################################################
689
690        if (( $installer::globals::patch ) ||
691            ( $installer::globals::languagepack ) ||
692            ( $installer::globals::packageformat eq "native" ) ||
693            ( $installer::globals::packageformat eq "portable" ) ||
694            ( $installer::globals::packageformat eq "osx" )) { $allvariableshashref->{'POOLPRODUCT'} = 0; }
695
696        if ( $allvariableshashref->{'POOLPRODUCT'} )
697        {
698            if ( ! $installer::globals::sessionidset ) { installer::packagepool::set_sessionid(); }
699            if ( ! $installer::globals::poolpathset ) { installer::packagepool::set_pool_path(); }
700            if (( ! $installer::globals::getuidpathset ) && ( $installer::globals::issolarisbuild )) { installer::worker::set_getuid_path($includepatharrayref); }
701
702            my $package_is_creatable = installer::packagepool::check_package_availability($packagename);
703
704            if (( ! $package_is_creatable ) && ( ! exists($installer::globals::poolshiftedpackages{$packagename}) ))
705            {
706                splice(@{$packages}, $k, 1);	# removing package ...
707                push(@{$packages}, $onepackage);  # ... and adding it to the end
708                $installer::globals::poolshiftedpackages{$packagename} = 1;	# only shifting each package once
709                $k--;														# decreasing the counter
710                $installer::logger::Info->printf("Pool: Package \"%s\" cannot be created at the moment. Trying again later (1).\n", $packagename);
711                $installer::logger::Lang->printf("Pool: Package \"%s\" cannot be created at the moment. Trying again later (1).\n", $packagename);
712                next;														# repeating this iteration with new package
713            }
714        }
715
716        ###########################################
717        # Root path, can be defined as parameter
718        ###########################################
719
720        my $packagerootpath = "";
721
722        if ($installer::globals::rootpath eq "")
723        {
724            $packagerootpath = $onepackage->{'destpath'};
725            installer::packagelist::resolve_packagevariables(\$packagerootpath, $allvariableshashref, 1);
726            if ( $^O =~ /darwin/i ) { $packagerootpath =~ s/\/opt\//\/Applications\//; }
727        }
728        else
729        {
730            $packagerootpath = $installer::globals::rootpath;
731        }
732
733        #############################################
734        # copying the collectors for each package
735        #############################################
736
737        my $filesinpackage = installer::converter::copy_collector($filesinproductlanguageresolvedarrayref);
738        my $linksinpackage = installer::converter::copy_collector($linksinproductlanguageresolvedarrayref);
739        my $unixlinksinpackage = installer::converter::copy_collector($unixlinksinproductlanguageresolvedarrayref);
740        my $dirsinpackage = installer::converter::copy_collector($directoriesforepmarrayref);
741
742        ###########################################
743        # setting the root path for the packages
744        ###########################################
745
746        installer::scriptitems::add_rootpath_to_directories($dirsinpackage, $packagerootpath);
747        installer::scriptitems::add_rootpath_to_files($filesinpackage, $packagerootpath);
748        installer::scriptitems::add_rootpath_to_links($linksinpackage, $packagerootpath);
749        installer::scriptitems::add_rootpath_to_files($unixlinksinpackage, $packagerootpath);
750
751        #################################
752        # collecting items for package
753        #################################
754
755        $filesinpackage = installer::packagelist::find_files_for_package($filesinpackage, $onepackage);
756        $unixlinksinpackage = installer::packagelist::find_files_for_package($unixlinksinpackage, $onepackage);
757        $linksinpackage = installer::packagelist::find_links_for_package($linksinpackage, $filesinpackage);
758        $dirsinpackage = installer::packagelist::find_dirs_for_package($dirsinpackage, $onepackage);
759
760        ###############################################
761        # nothing to do, if $filesinpackage is empty
762        ###############################################
763
764        if ( ! ( $#{$filesinpackage} > -1 ))
765        {
766            push(@installer::globals::emptypackages, $packagename);
767            $installer::logger::Lang->print("\n");
768            $installer::logger::Lang->print("\n");
769            $installer::logger::Lang->print("No file in package: %s \-\> Skipping\n\n", $packagename);
770            next;	# next package, end of loop !
771        }
772
773        #################################################################
774        # nothing to do for Linux patches, if no file has flag PATCH
775        #################################################################
776
777        # Linux Patch: The complete RPM has to be built, if one file in the RPM has the flag PATCH (also for DEBs)
778        if (( $installer::globals::patch ) && (( $installer::globals::islinuxrpmbuild ) || ( $installer::globals::islinuxdebbuild )))
779        {
780            my $patchfiles = installer::worker::collect_all_items_with_special_flag($filesinpackage ,"PATCH");
781            if ( ! ( $#{$patchfiles} > -1 ))
782            {
783                $installer::logger::Lang->print("\n");
784                $installer::logger::Lang->print("\n");
785                $installer::logger::Lang->print("Linux Patch: No patch file in package: %s \-\> Skipping\n\n",
786                    $packagename);
787                next;
788            }
789        }
790
791        ###########################################
792        # Stripping libraries
793        ###########################################
794
795        # Building for non Windows platforms in cws requires, that all files are stripped before packaging:
796        # 1. copy all files that need to be stripped locally
797        # 2. strip all these files
798
799        if ( $installer::globals::strip )
800        {
801            installer::strip::strip_libraries($filesinpackage, $languagestringref);
802        }
803
804        ###############################################################
805        # Searching for files in $filesinpackage with flag LINUXLINK
806        ###############################################################
807
808        if (( $installer::globals::islinuxbuild ) && ( ! $installer::globals::simple ))	# for rpms and debian packages
809        {
810            # special handling for all RPMs in $installer::globals::linuxlinkrpms
811
812            # if (( $installer::globals::linuxlinkrpms =~ /\b$onepackagename\b/ ) || ( $installer::globals::languagepack ))
813            if ( $installer::globals::linuxlinkrpms =~ /\b$onepackagename\b/ )
814            {
815                my $run = 0;
816
817                if (( $installer::globals::makelinuxlinkrpm ) && ( ! $run ))
818                {
819                    $filesinpackage = \@installer::globals::linuxpatchfiles;
820                    $linksinpackage = \@installer::globals::linuxlinks;
821                    $installer::globals::makelinuxlinkrpm = 0;
822                    if ( $installer::globals::patch ) { $installer::globals::call_epm = 1; }	 # enabling packing again
823                    $run = 1;
824
825                }
826
827                if (( ! $installer::globals::makelinuxlinkrpm ) && ( ! $run ))
828                {
829                    $filesinpackage = installer::worker::prepare_linuxlinkfiles($filesinpackage);
830                    $linksinpackage = installer::worker::prepare_forced_linuxlinkfiles($linksinpackage);
831                    $installer::globals::makelinuxlinkrpm = 1;
832                    if ( $allvariableshashref->{'OPENSOURCE'} ) { $installer::globals::add_required_package = $packagename . "u"; }
833                    if ( $installer::globals::patch ) { $installer::globals::call_epm = 0; }	 # no packing of core module in patch
834                    $shellscriptsfilename = "";	# shell scripts only need to be included into the link rpm
835                    $run = 1;
836
837                }
838            }
839        }
840
841        ###########################################
842        # Simple installation mechanism
843        ###########################################
844
845        if ( $installer::globals::simple ) { installer::worker::install_simple($onepackagename, $$languagestringref, $dirsinpackage, $filesinpackage, $linksinpackage, $unixlinksinpackage); }
846
847        ###########################################
848        # Checking epm state
849        ###########################################
850
851        if (( $installer::globals::call_epm ) && ( ! $found_epm ))
852        {
853            $epmexecutable = installer::epmfile::find_epm_on_system($includepatharrayref);
854            installer::epmfile::set_patch_state($epmexecutable);	# setting $installer::globals::is_special_epm
855            $found_epm = 1;	# searching only once
856        }
857
858        ###########################################
859        # Creating epm list file
860        ###########################################
861
862        if ( ! $installer::globals::simple )
863        {
864            # epm list file format:
865            # type mode owner group destination source options
866            # Example for a file: f 755 root sys /usr/bin/foo foo
867            # Example for a directory: d 755 root sys /var/spool/foo -
868            # Example for a link: l 000 root sys /usr/bin/linkname filename
869            # The source field specifies the file to link to
870
871            my $epmfilename = "epm_" . $onepackagename . $linkaddon . ".lst";
872
873            $installer::logger::Info->print( "... creating epm list file $epmfilename ... \n" );
874
875            my $completeepmfilename = $listfiledir . $installer::globals::separator . $epmfilename;
876
877            my @epmfile = ();
878
879            my $epmheaderref = installer::epmfile::create_epm_header($allvariableshashref, $filesinproductlanguageresolvedarrayref, $languagesarrayref, $onepackage);
880            installer::epmfile::adding_header_to_epm_file(\@epmfile, $epmheaderref);
881
882            if (( $installer::globals::patch ) && ( $installer::globals::issolarispkgbuild ))
883            {
884                $filesinpackage = installer::worker::analyze_patch_files($filesinpackage);
885
886                if ( ! ( $#{$filesinpackage} > -1 ))
887                {
888                    push(@installer::globals::emptypackages, $packagename);
889                    $installer::logger::Lang->print("\n");
890                    $installer::logger::Lang->print("No file in package: %s \-\> Skipping\n", $packagename);
891                    next;	# next package, end of loop !
892                }
893            }
894
895            # adding directories, files and links into epm file
896
897            installer::epmfile::put_directories_into_epmfile($dirsinpackage, \@epmfile, $allvariableshashref, $packagerootpath);
898            installer::epmfile::put_files_into_epmfile($filesinpackage, \@epmfile );
899            installer::epmfile::put_links_into_epmfile($linksinpackage, \@epmfile );
900            installer::epmfile::put_unixlinks_into_epmfile($unixlinksinpackage, \@epmfile );
901
902            if ((!( $shellscriptsfilename eq "" )) && (!($installer::globals::iswindowsbuild))) { installer::epmfile::adding_shellscripts_to_epm_file(\@epmfile, $shellscriptsfilename, $packagerootpath, $allvariableshashref, $filesinpackage); }
903
904            installer::files::save_file($completeepmfilename ,\@epmfile);
905
906            # ... splitting the rootpath into a relocatable part and a static part, if possible
907
908            my $staticpath = "";
909            my $relocatablepath = "";
910            # relocatable path can be defined in package list
911            if ( $onepackage->{'relocatablepath'} ) { $relocatablepath = $onepackage->{'relocatablepath'}; }
912            # setting fix part and variable part of destination path
913            installer::epmfile::analyze_rootpath($packagerootpath, \$staticpath, \$relocatablepath, $allvariableshashref);
914
915            # ... replacing the variable PRODUCTDIRECTORYNAME in the shellscriptfile by $staticpath
916
917            installer::epmfile::resolve_path_in_epm_list_before_packaging(\@epmfile, $completeepmfilename, "PRODUCTDIRECTORYNAME", $staticpath);
918            installer::epmfile::resolve_path_in_epm_list_before_packaging(\@epmfile, $completeepmfilename, "SOLSUREPACKAGEPREFIX", $allvariableshashref->{'SOLSUREPACKAGEPREFIX'});
919            installer::epmfile::resolve_path_in_epm_list_before_packaging(\@epmfile, $completeepmfilename, "UREPACKAGEPREFIX", $allvariableshashref->{'UREPACKAGEPREFIX'});
920            # installer::epmfile::resolve_path_in_epm_list_before_packaging(\@epmfile, $completeepmfilename, "BASISDIRECTORYVERSION", $allvariableshashref->{'OOOBASEVERSION'});
921            installer::files::save_file($completeepmfilename ,\@epmfile);
922
923            #######################################################
924            # Now the complete content of the package is known,
925            # including variables and shell scripts.
926            # Create the package or using the package pool?
927            #######################################################
928
929            my $use_package_from_pool = 0;
930            if ( $allvariableshashref->{'POOLPRODUCT'} ) { $use_package_from_pool = installer::packagepool::package_is_up_to_date($allvariableshashref, $onepackage, $packagename, \@epmfile, $filesinpackage, $installdir, $installer::globals::epmoutpath, $languagestringref); }
931
932            if ( $use_package_from_pool == 3 ) # repeat this package later
933            {
934                my $package_is_creatable = installer::packagepool::check_package_availability($packagename);
935
936                if (( ! $package_is_creatable ) && ( ! exists($installer::globals::poolshiftedpackages{$packagename}) ))
937                {
938                    splice(@{$packages}, $k, 1);	# removing package ...
939                    push(@{$packages}, $onepackage);  # ... and adding it to the end
940                    $installer::globals::poolshiftedpackages{$packagename} = 1;	# only shifting each package once
941                    $k--;														# decreasing the counter
942                    $installer::logger::Info->print("\n");
943                    $installer::logger::Info->print("Pool: Package \"%s\" cannot be created at the moment. Trying again later (2).\n", $packagename);
944                    $installer::logger::Lang->print("\n");
945                    $installer::logger::Lang->print("Pool: Package \"%s\" cannot be created at the moment. Trying again later (2).\n", $packagename);
946                    next;														# repeating this iteration with new package
947                }
948            }
949
950            if ( $use_package_from_pool == 4 ) # There was a problem with pooling. Repeat this package immediately.
951            {
952                $k--;														# decreasing the counter
953                $installer::logger::Info->print("\n");
954                $installer::logger::Info->print("Pool: Package \"%s\" had pooling problems. Repeating packaging immediately (3).\n", $packagename);
955                $installer::logger::Lang->print("\n");
956                $installer::logger::Lang->print("Pool: Package \"%s\" had pooling problems. Repeating packaging immediately (3).\n", $packagename);
957                next;														# repeating this iteration
958            }
959
960            if ( $use_package_from_pool == 0 )
961            {
962                # changing into the "install" directory to create installation sets
963
964                $currentdir = cwd();	# $currentdir is global in this file
965
966                chdir($installdir);		# changing into install directory ($installdir is global in this file)
967
968                ###########################################
969                # Starting epm
970                ###########################################
971
972                # With a patched epm, it is now possible to set the relocatable directory, change
973                # the directory in which the packages are created, setting "requires" and "provides"
974                # (Linux) or creating the "depend" file (Solaris) and finally to begin
975                # the packaging process with standard tooling and standard parameter
976                # Linux: Adding into the spec file: Prefix: /opt
977                # Solaris: Adding into the pkginfo file: BASEDIR=/opt
978                # Attention: Changing of the path can influence the shell scripts
979
980                if (( $installer::globals::is_special_epm ) && ( ($installer::globals::islinuxrpmbuild) || ($installer::globals::issolarispkgbuild) ))	# special handling only for Linux RPMs and Solaris Packages
981                {
982                    if ( $installer::globals::call_epm )	# only do something, if epm is really executed
983                    {
984                        # ... now epm can be started, to create the installation sets
985
986                        $installer::logger::Info->print( "... starting patched epm ... \n" );
987
988                        installer::epmfile::call_epm($epmexecutable, $completeepmfilename, $packagename, $includepatharrayref);
989
990                        my $newepmdir = installer::epmfile::prepare_packages($loggingdir, $packagename, $staticpath, $relocatablepath, $onepackage, $allvariableshashref, $filesinpackage, $languagestringref);	# adding the line for Prefix / Basedir, include rpmdir
991
992                        installer::epmfile::create_packages_without_epm($newepmdir, $packagename, $includepatharrayref, $allvariableshashref, $languagestringref);	# start to package
993
994                        # finally removing all temporary files
995
996                        installer::epmfile::remove_temporary_epm_files($newepmdir, $loggingdir, $packagename);
997
998                        # Installation:
999                        # Install: pkgadd -a myAdminfile -d ./SUNWso8m34.pkg
1000                        # Install: rpm -i --prefix=/opt/special --nodeps so8m35.rpm
1001
1002                        installer::epmfile::create_new_directory_structure($newepmdir);
1003                        $installer::globals::postprocess_specialepm = 1;
1004
1005                        # solaris patch not needed anymore
1006                        # if (( $installer::globals::patch ) && ( $installer::globals::issolarisx86build )) { installer::worker::fix2_solaris_x86_patch($packagename, $installer::globals::epmoutpath); }
1007                    }
1008                }
1009                else	# this is the standard epm (not relocatable) or ( nonlinux and nonsolaris )
1010                {
1011                    installer::epmfile::resolve_path_in_epm_list_before_packaging(\@epmfile, $completeepmfilename, "\$\$PRODUCTINSTALLLOCATION", $relocatablepath);
1012                    installer::files::save_file($completeepmfilename ,\@epmfile);	# Warning for pool, content of epm file is changed.
1013
1014                    if ( $installer::globals::call_epm )
1015                    {
1016                        # ... now epm can be started, to create the installation sets
1017
1018                        $installer::logger::Info->print( "... starting unpatched epm ... \n" );
1019
1020                        if ( $installer::globals::call_epm ) { installer::epmfile::call_epm($epmexecutable, $completeepmfilename, $packagename, $includepatharrayref); }
1021
1022                        if (($installer::globals::islinuxrpmbuild) || ($installer::globals::issolarispkgbuild) || ($installer::globals::debian))
1023                        {
1024                            $installer::globals::postprocess_standardepm = 1;
1025                        }
1026                    }
1027                }
1028
1029                if ( $allvariableshashref->{'POOLPRODUCT'} ) { installer::packagepool::put_content_into_pool($packagename, $installdir, $installer::globals::epmoutpath, $filesinpackage, \@epmfile); }
1030
1031                chdir($currentdir);	# changing back into start directory
1032
1033            } # end of "if ( ! $use_package_from_pool )
1034
1035        } # end of "if ( ! $installer::globals::simple )
1036
1037        ###########################################
1038        # xpd installation mechanism
1039        ###########################################
1040
1041        # Creating the xpd file for the package. This has to happen always, not determined by $use_package_from_pool
1042
1043        if ( $installer::globals::isxpdplatform )
1044        {
1045            if (( ! $installer::globals::languagepack ) && ( ! $installer::globals::patch ))
1046            {
1047                if (( $allvariableshashref->{'XPDINSTALLER'} ) && ( $installer::globals::call_epm != 0 ))
1048                {
1049                    installer::xpdinstaller::create_xpd_file($onepackage, $packages, $languagestringref, $allvariableshashref, $modulesinproductarrayref, $installdir, $installer::globals::epmoutpath, $linkpackage, \%installer::globals::xpdpackageinfo);
1050                    $installer::globals::xpd_files_prepared = 1;
1051                    %installer::globals::xpdpackageinfo = ();
1052                }
1053            }
1054        }
1055
1056        if ( $installer::globals::makelinuxlinkrpm ) { $k--; }	# decreasing the counter to create the link rpm!
1057
1058    }	# end of "for ( my $k = 0; $k <= $#{$packages}; $k++ )"
1059
1060    installer::packagepool::log_pool_statistics();
1061
1062    ##############################################################
1063    # Post epm functionality, after the last package is packed
1064    ##############################################################
1065
1066    if ( $installer::globals::postprocess_specialepm )
1067    {
1068        installer::logger::include_header_into_logfile("Post EPM processes (Patched EPM):");
1069
1070        chdir($installdir);
1071
1072        # Copying the cde, kde and gnome packages into the installation set
1073        if ( $installer::globals::addsystemintegration ) { installer::epmfile::put_systemintegration_into_installset($installer::globals::epmoutpath, $includepatharrayref, $allvariableshashref, $modulesinproductarrayref); }
1074
1075        # Adding license and readme into installation set
1076        # if ($installer::globals::addlicensefile) { installer::epmfile::put_installsetfiles_into_installset($installer::globals::epmoutpath); }
1077        if ($installer::globals::addlicensefile) { installer::worker::put_scpactions_into_installset("."); }
1078
1079        # Adding child projects to installation dynamically
1080        if ($installer::globals::addchildprojects) { installer::epmfile::put_childprojects_into_installset($installer::globals::epmoutpath, $allvariableshashref, $modulesinproductarrayref, $includepatharrayref); }
1081
1082        # Adding license file into setup
1083        if ( $allvariableshashref->{'PUT_LICENSE_INTO_SETUP'} ) { installer::worker::put_license_into_setup(".", $includepatharrayref); }
1084
1085        # Creating installation set for Unix language packs, that are not part of multi lingual installation sets
1086        if ( ( $installer::globals::languagepack ) && ( ! $installer::globals::debian ) && ( ! $installer::globals::makedownload ) ) { installer::languagepack::build_installer_for_languagepack($installer::globals::epmoutpath, $allvariableshashref, $includepatharrayref, $languagesarrayref, $languagestringref); }
1087
1088        # Finalizing patch installation sets
1089        if (( $installer::globals::patch ) && ( $installer::globals::issolarispkgbuild )) { installer::epmfile::finalize_patch($installer::globals::epmoutpath, $allvariableshashref); }
1090        if (( $installer::globals::patch ) && ( $installer::globals::islinuxrpmbuild )) { installer::epmfile::finalize_linux_patch($installer::globals::epmoutpath, $allvariableshashref, $includepatharrayref); }
1091
1092        # Copying the xpd installer into the installation set
1093        if (( $allvariableshashref->{'XPDINSTALLER'} ) && ( $installer::globals::isxpdplatform ) && ( $installer::globals::xpd_files_prepared ))
1094        {
1095            installer::xpdinstaller::create_xpd_installer($installdir, $allvariableshashref, $languagestringref);
1096            $installer::globals::addjavainstaller = 0;	# only one java installer possible
1097        }
1098
1099        # Copying the java installer into the installation set
1100        chdir($currentdir);	# changing back into start directory
1101        if ( $installer::globals::addjavainstaller ) { installer::javainstaller::create_java_installer($installdir, $installer::globals::epmoutpath, $languagestringref, $languagesarrayref, $allvariableshashref, $includepatharrayref, $modulesinproductarrayref); }
1102    }
1103
1104    if ( $installer::globals::postprocess_standardepm )
1105    {
1106        installer::logger::include_header_into_logfile("Post EPM processes (Standard EPM):");
1107
1108        chdir($installdir);
1109
1110        # determine the destination directory
1111        my $newepmdir = installer::epmfile::determine_installdir_ooo();
1112
1113        # Copying the cde, kde and gnome packages into the installation set
1114        if ( $installer::globals::addsystemintegration ) { installer::epmfile::put_systemintegration_into_installset($newepmdir, $includepatharrayref, $allvariableshashref, $modulesinproductarrayref); }
1115
1116        # Adding license and readme into installation set
1117        # if ($installer::globals::addlicensefile) { installer::epmfile::put_installsetfiles_into_installset($newepmdir); }
1118        if ($installer::globals::addlicensefile) { installer::worker::put_scpactions_into_installset("."); }
1119
1120        # Adding license file into setup
1121        if ( $allvariableshashref->{'PUT_LICENSE_INTO_SETUP'} ) { installer::worker::put_license_into_setup(".", $includepatharrayref); }
1122
1123        # Creating installation set for Unix language packs, that are not part of multi lingual installation sets
1124        if ( ( $installer::globals::languagepack ) && ( ! $installer::globals::debian ) && ( ! $installer::globals::makedownload ) ) { installer::languagepack::build_installer_for_languagepack($newepmdir, $allvariableshashref, $includepatharrayref, $languagesarrayref, $languagestringref); }
1125
1126        chdir($currentdir);	# changing back into start directory
1127    }
1128
1129    if (( $installer::globals::issolarispkgbuild ) && ( $allvariableshashref->{'COLLECT_PKGMAP'} )) { installer::worker::collectpackagemaps($installdir, $languagestringref, $allvariableshashref); }
1130
1131    #######################################################
1132    # Analyzing the log file
1133    #######################################################
1134
1135    my $is_success = 0;
1136    my $finalinstalldir = "";
1137
1138    installer::worker::clean_output_tree();	# removing directories created in the output tree
1139    ($is_success, $finalinstalldir) = installer::worker::analyze_and_save_logfile($loggingdir, $installdir, $installlogdir, $allsettingsarrayref, $languagestringref, $current_install_number);
1140    my $downloadname = installer::ziplist::getinfofromziplist($allsettingsarrayref, "downloadname");
1141    if ( $is_success ) { installer::followme::save_followme_info($finalinstalldir, $includepatharrayref, $allvariableshashref, $$downloadname, $languagestringref, $languagesarrayref, $current_install_number, $loggingdir, $installlogdir); }
1142
1143    #######################################################
1144    # Creating download installation set
1145    #######################################################
1146
1147    if ( $installer::globals::makedownload )
1148    {
1149        my $create_download = 0;
1150        if ( $$downloadname ne "" ) { $create_download = 1; }
1151        if (( $is_success ) && ( $create_download ) && ( $ENV{'ENABLE_DOWNLOADSETS'} ))
1152        {
1153            my $downloaddir = installer::download::create_download_sets($finalinstalldir, $includepatharrayref, $allvariableshashref, $$downloadname, $languagestringref, $languagesarrayref);
1154            installer::worker::analyze_and_save_logfile($loggingdir, $downloaddir, $installlogdir, $allsettingsarrayref, $languagestringref, $current_install_number);
1155        }
1156    }
1157
1158    #######################################################
1159    # Creating jds installation set
1160    #######################################################
1161
1162    if ( $installer::globals::makejds )
1163    {
1164        my $create_jds = 0;
1165
1166        if ( $allvariableshashref->{'JDSBUILD'} ) { $create_jds = 1; }
1167        if (! $installer::globals::issolarispkgbuild ) { $create_jds = 0; }
1168
1169        if (( $is_success ) && ( $create_jds ))
1170        {
1171            if ( ! $installer::globals::jds_language_controlled )
1172            {
1173                my $correct_language = installer::worker::check_jds_language($allvariableshashref, $languagestringref);
1174                $installer::globals::correct_jds_language = $correct_language;
1175                $installer::globals::jds_language_controlled = 1;
1176            }
1177
1178            if ( $installer::globals::correct_jds_language )
1179            {
1180                my $jdsdir = installer::worker::create_jds_sets($finalinstalldir, $allvariableshashref, $languagestringref, $languagesarrayref, $includepatharrayref);
1181                installer::worker::clean_jds_temp_dirs();
1182                installer::worker::analyze_and_save_logfile($loggingdir, $jdsdir, $installlogdir, $allsettingsarrayref, $languagestringref, $current_install_number);
1183            }
1184        }
1185    }
1186}
1187
1188
1189
1190
1191#################################################
1192# Main program
1193#################################################
1194
1195#################################################
1196# Part 1: The platform independent part
1197#################################################
1198
1199#################################################
1200# Part 1a: The language independent part
1201#################################################
1202
1203installer::logger::starttime();
1204$installer::logger::Global->add_timestamp("starting logging");
1205
1206# While there is no language set and logger::Lang is not yet tied to a log file,
1207# forward its output to logger::Global.
1208$installer::logger::Lang->set_forward($installer::logger::Global);
1209
1210#########################################
1211# Checking the environment and setting
1212# most important variables
1213#########################################
1214
1215$installer::logger::Info->print( "... checking environment variables ...\n" );
1216my $environmentvariableshashref = installer::control::check_system_environment();
1217
1218installer::environment::set_global_environment_variables($environmentvariableshashref);
1219
1220#################################
1221# Check and output of parameter
1222#################################
1223
1224installer::parameter::saveparameter();
1225installer::parameter::getparameter();
1226
1227# debugging can start after function "getparameter"
1228
1229installer::parameter::control_fundamental_parameter();
1230installer::parameter::setglobalvariables();
1231installer::parameter::control_required_parameter();
1232
1233if (!($installer::globals::languages_defined_in_productlist)) { installer::languages::analyze_languagelist(); }
1234installer::parameter::outputparameter();
1235
1236installer::control::check_updatepack();
1237
1238$installer::globals::build = uc($installer::globals::build);	# using "SRC680" instead of "src680"
1239
1240######################################
1241# Creating the log directory
1242######################################
1243
1244my $loggingdir = installer::systemactions::create_directories("logging", "");
1245$loggingdir = $loggingdir . $installer::globals::separator;
1246$installer::globals::exitlog = $loggingdir;
1247
1248my $installdir = "";
1249my $currentdir = cwd();
1250my $shipinstalldir = "";
1251my $current_install_number = "";
1252
1253######################################
1254# Checking the system requirements
1255######################################
1256
1257$installer::logger::Info->print( "... checking required files ...\n" );
1258installer::control::check_system_path();
1259
1260my $pathvariableshashref = installer::environment::create_pathvariables($environmentvariableshashref);
1261
1262###############################################
1263# Checking saved setting for Windows patches
1264###############################################
1265
1266if (( $installer::globals::iswindowsbuild ) &&	( $installer::globals::prepare_winpatch )) { installer::windows::msiglobal::read_saved_mappings(); }
1267
1268###################################################
1269# Analyzing the settings and variables in zip.lst
1270###################################################
1271
1272installer::logger::globallog("zip list file: $installer::globals::ziplistname");
1273
1274my $ziplistref = installer::files::read_file($installer::globals::ziplistname);
1275
1276$installer::logger::Info->print( "... analyzing $installer::globals::ziplistname ... \n" );
1277
1278my ($productblockref, $parent) = installer::ziplist::getproductblock($ziplistref, $installer::globals::product, 1);		# product block from zip.lst
1279
1280my ($settingsblockref, undef) = installer::ziplist::getproductblock($productblockref, "Settings", 0);		# settings block from zip.lst
1281
1282$settingsblockref = installer::ziplist::analyze_settings_block($settingsblockref);				# select data from settings block in zip.lst
1283
1284my $allsettingsarrayref = installer::ziplist::get_settings_from_ziplist($settingsblockref);
1285
1286my $allvariablesarrayref = installer::ziplist::get_variables_from_ziplist($settingsblockref);
1287
1288my ($globalproductblockref, undef) = installer::ziplist::getproductblock($ziplistref, $installer::globals::globalblock, 0);		# global product block from zip.lst
1289
1290while (defined $parent)
1291{
1292    my $parentproductblockref;
1293    ($parentproductblockref, $parent) = installer::ziplist::getproductblock(
1294		$ziplistref, $parent, 1);
1295    my ($parentsettingsblockref, undef) = installer::ziplist::getproductblock(
1296		$parentproductblockref, "Settings", 0);
1297    $parentsettingsblockref = installer::ziplist::analyze_settings_block(
1298		$parentsettingsblockref);
1299    my $allparentsettingsarrayref =
1300		installer::ziplist::get_settings_from_ziplist($parentsettingsblockref);
1301    my $allparentvariablesarrayref =
1302		installer::ziplist::get_variables_from_ziplist($parentsettingsblockref);
1303	$allsettingsarrayref =
1304		installer::converter::combine_arrays_from_references_first_win(
1305			$allsettingsarrayref, $allparentsettingsarrayref)
1306		if $#{$allparentsettingsarrayref} > -1;
1307    $allvariablesarrayref =
1308		installer::converter::combine_arrays_from_references_first_win(
1309			$allvariablesarrayref, $allparentvariablesarrayref)
1310		if $#{$allparentvariablesarrayref} > -1;
1311}
1312
1313if ( $#{$globalproductblockref} > -1 )
1314{
1315    my ($globalsettingsblockref, undef) = installer::ziplist::getproductblock($globalproductblockref, "Settings", 0);		# settings block from zip.lst
1316
1317    $globalsettingsblockref = installer::ziplist::analyze_settings_block($globalsettingsblockref);				# select data from settings block in zip.lst
1318
1319    my $allglobalsettingsarrayref = installer::ziplist::get_settings_from_ziplist($globalsettingsblockref);
1320
1321    my $allglobalvariablesarrayref = installer::ziplist::get_variables_from_ziplist($globalsettingsblockref);
1322
1323    if ( $#{$allglobalsettingsarrayref} > -1 ) { $allsettingsarrayref = installer::converter::combine_arrays_from_references_first_win($allsettingsarrayref, $allglobalsettingsarrayref); }
1324    if ( $#{$allglobalvariablesarrayref} > -1 ) { $allvariablesarrayref = installer::converter::combine_arrays_from_references_first_win($allvariablesarrayref, $allglobalvariablesarrayref); }
1325}
1326
1327$allsettingsarrayref = installer::ziplist::remove_multiples_from_ziplist($allsettingsarrayref); # the settings from the zip.lst
1328
1329$allvariablesarrayref = installer::ziplist::remove_multiples_from_ziplist($allvariablesarrayref);
1330
1331installer::ziplist::replace_variables_in_ziplist_variables($allvariablesarrayref);
1332
1333my $allvariableshashref = installer::converter::convert_array_to_hash($allvariablesarrayref);	# the variables from the zip.lst
1334
1335installer::ziplist::set_default_productversion_if_required($allvariableshashref);
1336
1337installer::ziplist::add_variables_to_allvariableshashref($allvariableshashref);
1338
1339installer::ziplist::overwrite_ooovendor( $allvariableshashref );
1340
1341########################################################
1342# Check if this is simple packaging mechanism
1343########################################################
1344
1345installer::simplepackage::check_simple_packager_project($allvariableshashref);
1346
1347####################################################################
1348# setting global variables
1349####################################################################
1350
1351installer::control::set_addchildprojects($allvariableshashref);
1352installer::control::set_addjavainstaller($allvariableshashref);
1353installer::control::set_addsystemintegration($allvariableshashref);
1354
1355########################################################
1356# Re-define logging dir, after all variables are set
1357########################################################
1358
1359my $oldloggingdir = $loggingdir;
1360installer::systemactions::remove_empty_directory($oldloggingdir);
1361$loggingdir = installer::systemactions::create_directories("logging", "");
1362$loggingdir = $loggingdir . $installer::globals::separator;
1363$installer::globals::exitlog = $loggingdir;
1364
1365# checking, whether this is an opensource product
1366
1367if (!($installer::globals::is_copy_only_project)) { installer::ziplist::set_manufacturer($allvariableshashref); }
1368
1369##############################################
1370# Checking version of makecab.exe
1371##############################################
1372
1373if ( $installer::globals::iswindowsbuild ) { installer::control::check_makecab_version(); }
1374
1375##########################################################
1376# Getting the include path from the settings in zip list
1377##########################################################
1378
1379my $includepathref = installer::ziplist::getinfofromziplist($allsettingsarrayref, "include");
1380if ( $$includepathref eq "" )
1381{
1382	installer::exiter::exit_program("ERROR: Definition for \"include\" not found in $installer::globals::ziplistname", "Main");
1383}
1384
1385my $includepatharrayref = installer::converter::convert_stringlist_into_array($includepathref, ",");
1386
1387installer::ziplist::replace_all_variables_in_pathes($includepatharrayref, $pathvariableshashref);
1388
1389installer::ziplist::replace_minor_in_pathes($includepatharrayref);
1390
1391installer::ziplist::replace_packagetype_in_pathes($includepatharrayref);
1392
1393installer::ziplist::resolve_relative_pathes($includepatharrayref);
1394
1395installer::ziplist::remove_ending_separator($includepatharrayref);
1396
1397##############################################
1398# Collecting all files from all include
1399# pathes in global hashes.
1400##############################################
1401
1402installer::worker::collect_all_files_from_includepathes($includepatharrayref);
1403
1404##############################################
1405# Analyzing languages in zip.lst if required
1406# Probably no longer used.
1407##############################################
1408
1409if ($installer::globals::languages_defined_in_productlist) { installer::languages::get_info_about_languages($allsettingsarrayref); }
1410
1411#####################################
1412# Windows requires the encoding list
1413#####################################
1414
1415if ( $installer::globals::iswindowsbuild ) { installer::control::read_encodinglist($includepatharrayref); }
1416
1417####################################################################
1418# MacOS dmg build requires special DS_Store file to arrange icons
1419####################################################################
1420if (($installer::globals::ismacdmgbuild) && ($installer::globals::product =~ /OpenOffice_Dev/)) { $installer::globals::devsnapshotbuild = 1; }
1421
1422#####################################################################
1423# Including additional inc files for variable settings, if defined
1424#####################################################################
1425
1426if ( $allvariableshashref->{'ADD_INCLUDE_FILES'} ) { installer::worker::add_variables_from_inc_to_hashref($allvariableshashref, $includepatharrayref); }
1427
1428################################################
1429# Disable xpd installer, if SOLAR_JAVA not set
1430################################################
1431
1432installer::control::check_java_for_xpd($allvariableshashref);
1433
1434#####################################
1435# Analyzing the setup script
1436#####################################
1437
1438my $setupscriptref = GetSetupScriptLines($allsettingsarrayref, $allvariableshashref, $includepatharrayref);
1439
1440installer::logger::log_hashref($allvariableshashref);
1441
1442$installer::logger::Info->print( "... analyzing directories ... \n" );
1443
1444# Collect all directories in the script to get the destination dirs
1445
1446my $dirsinproductarrayref = installer::setupscript::get_all_items_from_script($setupscriptref, "Directory");
1447
1448if ( $installer::globals::languagepack ) { installer::scriptitems::use_langpack_hostname($dirsinproductarrayref); }
1449if ( $installer::globals::patch ) { installer::scriptitems::use_patch_hostname($dirsinproductarrayref); }
1450
1451if ( $allvariableshashref->{'SHIFT_BASIS_INTO_BRAND_LAYER'} ) { $dirsinproductarrayref = installer::scriptitems::shift_basis_directory_parents($dirsinproductarrayref); }
1452if ( $allvariableshashref->{'OFFICEDIRECTORYNAME'} ) { installer::scriptitems::set_officedirectory_name($dirsinproductarrayref, $allvariableshashref->{'OFFICEDIRECTORYNAME'}); }
1453
1454
1455installer::scriptitems::resolve_all_directory_names($dirsinproductarrayref);
1456
1457$installer::logger::Info->print( "... analyzing files ... \n" );
1458
1459my $filesinproductarrayref = installer::setupscript::get_all_items_from_script($setupscriptref, "File");
1460
1461$filesinproductarrayref = installer::scriptitems::remove_delete_only_files_from_productlists($filesinproductarrayref);
1462
1463if (( ! $installer::globals::iswindowsbuild ) &&
1464	( ! $installer::globals::islinuxrpmbuild ) &&
1465	( ! $installer::globals::islinuxdebbuild ) &&
1466	( ! $installer::globals::issolarispkgbuild ) &&
1467	( $installer::globals::packageformat ne "installed" ) &&
1468	( $installer::globals::packageformat ne "dmg" ) &&
1469	( $installer::globals::packageformat ne "archive" ))
1470	{ installer::control::check_oxtfiles($filesinproductarrayref); }
1471
1472if ($installer::globals::product =~ /suite/i ) { $filesinproductarrayref = installer::scriptitems::remove_notinsuite_files_from_productlists($filesinproductarrayref); }
1473
1474if (! $installer::globals::languagepack)
1475{
1476	$filesinproductarrayref = installer::scriptitems::remove_Languagepacklibraries_from_Installset($filesinproductarrayref);
1477}
1478
1479if (! $installer::globals::patch)
1480{
1481	$filesinproductarrayref = installer::scriptitems::remove_patchonlyfiles_from_Installset($filesinproductarrayref);
1482}
1483
1484if (! $installer::globals::tab)
1485{
1486	$filesinproductarrayref = installer::scriptitems::remove_tabonlyfiles_from_Installset($filesinproductarrayref);
1487}
1488
1489if (( $installer::globals::packageformat ne "installed" ) && ( $installer::globals::packageformat ne "archive" ))
1490{
1491	$filesinproductarrayref = installer::scriptitems::remove_installedproductonlyfiles_from_Installset($filesinproductarrayref);
1492}
1493
1494$installer::logger::Info->print( "... analyzing scpactions ... \n" );
1495
1496my $scpactionsinproductarrayref = installer::setupscript::get_all_items_from_script($setupscriptref, "ScpAction");
1497
1498if (( ! $allvariableshashref->{'XPDINSTALLER'} ) || ( ! $installer::globals::isxpdplatform ))
1499{
1500	$scpactionsinproductarrayref = installer::scriptitems::remove_Xpdonly_Items($scpactionsinproductarrayref);
1501}
1502
1503if ( $installer::globals::languagepack ) { installer::scriptitems::use_langpack_copy_scpaction($scpactionsinproductarrayref); }
1504if ( $installer::globals::patch ) { installer::scriptitems::use_patch_copy_scpaction($scpactionsinproductarrayref); }
1505if (($installer::globals::devsnapshotbuild)) { installer::scriptitems::use_dev_copy_scpaction($scpactionsinproductarrayref); }
1506
1507# $scpactionsinproductarrayref = installer::scriptitems::remove_scpactions_without_name($scpactionsinproductarrayref);
1508
1509installer::scriptitems::change_keys_of_scpactions($scpactionsinproductarrayref);
1510
1511$installer::logger::Info->print( "... analyzing shortcuts ... \n" );
1512
1513my $linksinproductarrayref = installer::setupscript::get_all_items_from_script($setupscriptref, "Shortcut");
1514
1515$installer::logger::Info->print( "... analyzing unix links ... \n" );
1516
1517my $unixlinksinproductarrayref = installer::setupscript::get_all_items_from_script($setupscriptref, "Unixlink");
1518
1519# $unixlinksinproductarrayref = installer::scriptitems::filter_layerlinks_from_unixlinks($unixlinksinproductarrayref);
1520
1521$installer::logger::Info->print( "... analyzing profile ... \n" );
1522
1523my $profilesinproductarrayref = installer::setupscript::get_all_items_from_script($setupscriptref, "Profile");
1524
1525$installer::logger::Info->print( "... analyzing profileitems ... \n" );
1526
1527my $profileitemsinproductarrayref = installer::setupscript::get_all_items_from_script($setupscriptref, "ProfileItem");
1528
1529my $folderinproductarrayref;
1530my $folderitemsinproductarrayref;
1531my $registryitemsinproductarrayref;
1532my $windowscustomactionsarrayref;
1533
1534if ( $installer::globals::iswindowsbuild )	# Windows specific items: Folder, FolderItem, RegistryItem, WindowsCustomAction
1535{
1536	$installer::logger::Info->print( "... analyzing folders ... \n" );
1537
1538	$folderinproductarrayref = installer::setupscript::get_all_items_from_script($setupscriptref, "Folder");
1539
1540	$installer::logger::Info->print( "... analyzing folderitems ... \n" );
1541
1542	$folderitemsinproductarrayref = installer::setupscript::get_all_items_from_script($setupscriptref, "FolderItem");
1543
1544	installer::setupscript::add_predefined_folder($folderitemsinproductarrayref, $folderinproductarrayref);
1545
1546	installer::setupscript::prepare_non_advertised_files($folderitemsinproductarrayref, $filesinproductarrayref);
1547
1548	$installer::logger::Info->print( "... analyzing registryitems ... \n" );
1549
1550	$registryitemsinproductarrayref = installer::setupscript::get_all_items_from_script($setupscriptref, "RegistryItem");
1551
1552	$registryitemsinproductarrayref = installer::scriptitems::remove_uninstall_regitems_from_script($registryitemsinproductarrayref);
1553
1554	$installer::logger::Info->print( "... analyzing Windows custom actions ... \n" );
1555
1556	$windowscustomactionsarrayref = installer::setupscript::get_all_items_from_script($setupscriptref, "WindowsCustomAction");
1557}
1558
1559my $modulesinproductarrayref;
1560
1561if (!($installer::globals::is_copy_only_project))
1562{
1563	$installer::logger::Info->print( "... analyzing modules ... \n" );
1564
1565	$modulesinproductarrayref = installer::setupscript::get_all_items_from_script($setupscriptref, "Module");
1566
1567	if (( ! $allvariableshashref->{'XPDINSTALLER'} ) || ( ! $installer::globals::isxpdplatform ))
1568	{
1569		$modulesinproductarrayref = installer::scriptitems::remove_Xpdonly_Items($modulesinproductarrayref);
1570	}
1571
1572	installer::scriptitems::resolve_assigned_modules($modulesinproductarrayref);
1573
1574	$modulesinproductarrayref = installer::scriptitems::remove_template_modules($modulesinproductarrayref);
1575
1576	installer::scriptitems::set_children_flag($modulesinproductarrayref);
1577
1578	installer::scriptitems::collect_all_languagemodules($modulesinproductarrayref);
1579
1580	# Assigning the modules to the items
1581
1582	installer::scriptitems::assigning_modules_to_items($modulesinproductarrayref, $filesinproductarrayref, "Files");
1583
1584	installer::scriptitems::assigning_modules_to_items($modulesinproductarrayref, $unixlinksinproductarrayref, "Unixlinks");
1585
1586	installer::scriptitems::assigning_modules_to_items($modulesinproductarrayref, $dirsinproductarrayref, "Dirs");
1587}
1588
1589
1590# saving debug info, before staring part 1b
1591if ( $installer::globals::debug ) { installer::logger::savedebug($installer::globals::exitlog); }
1592
1593#################################################
1594# Part 1b: The language dependent part
1595# (still platform independent)
1596#################################################
1597
1598# Now starts the language dependent part, if more than one product is defined on the command line
1599# Example -l en-US,de#es,fr,it defines two multilingual products
1600
1601###############################################################################
1602# Beginning of language dependent part
1603# The for iterates over all products, separated by an # in the language list
1604###############################################################################
1605
1606
1607# Run the following code block exactly once.
1608# This strange version of a do{}while(false) loop exists only to allow (legacy) next statements.
1609for (;1;last)
1610{
1611	my $languagesarrayref = installer::languages::get_all_languages_for_one_product($installer::globals::languageproduct, $allvariableshashref);
1612
1613	$installer::globals::alllanguagesinproductarrayref = $languagesarrayref;
1614	my $languagestringref = installer::languages::get_language_string($languagesarrayref);
1615	$installer::logger::Info->print( "------------------------------------\n" );
1616	$installer::logger::Info->print( "... languages $$languagestringref ... \n" );
1617
1618	if ( $installer::globals::patch )
1619	{
1620		$installer::globals::addlicensefile = 0;	# no license files for patches
1621		$installer::globals::makedownload = 0;
1622		$installer::globals::makejds = 0;
1623	}
1624
1625	if ( $installer::globals::languagepack )
1626	{
1627		$installer::globals::addchildprojects = 0;
1628		$installer::globals::addsystemintegration = 0;
1629		$installer::globals::makejds = 0;
1630		$installer::globals::addlicensefile = 0;
1631
1632		if ( $allvariableshashref->{'OPENSOURCE'} ) { $installer::globals::makedownload = 1; }
1633		else { $installer::globals::makedownload = 0; }
1634	}
1635
1636	############################################################
1637	# Beginning of language specific logging mechanism
1638	# Until now only global logging into default: logfile.txt
1639	############################################################
1640
1641	installer::logger::copy_globalinfo_into_logfile();
1642	$installer::globals::globalinfo_copied = 1;
1643
1644	my $logminor = "";
1645	if ( $installer::globals::updatepack ) { $logminor = $installer::globals::lastminor; }
1646	else { $logminor = $installer::globals::minor; }
1647
1648	my $loglanguagestring = $$languagestringref;
1649	my $loglanguagestring_orig = $loglanguagestring;
1650	if (length($loglanguagestring) > $installer::globals::max_lang_length)
1651	{
1652		my $number_of_languages = installer::systemactions::get_number_of_langs($loglanguagestring);
1653	    chomp(my $shorter = `echo $loglanguagestring | md5sum | sed -e "s/ .*//g"`);
1654		my $id = substr($shorter, 0, 8); # taking only the first 8 digits
1655		$loglanguagestring = "lang_" . $number_of_languages . "_id_" . $id;
1656	}
1657
1658    # Setup the directory where the language dependent log file will be stored.
1659	$loggingdir = $loggingdir . $loglanguagestring . $installer::globals::separator;
1660	installer::systemactions::create_directory($loggingdir);
1661
1662    # Set language dependent logging.
1663    $installer::globals::logfilename = sprintf("log_%s%s_%s.log",
1664        $installer::globals::build,
1665        $logminor ne "" ? "_" . $logminor : "",
1666        $loglanguagestring);
1667    $installer::logger::Lang->set_filename($loggingdir . $installer::globals::logfilename);
1668    $installer::logger::Lang->copy_lines_from($installer::logger::Global);
1669    $installer::logger::Lang->set_filter(\&installer::control::filter_log_error);
1670    installer::control::prepare_error_processing();
1671    # All logging to the console is also forwarded to the language dependen log.
1672    $installer::logger::Lang->set_forward(undef);
1673    $installer::logger::Info->set_forward($installer::logger::Lang);
1674    # Scan all log lines for error messages.
1675    $installer::logger::Lang->add_timestamp("starting log for language ".$loglanguagestring);
1676
1677	if ($loglanguagestring ne $loglanguagestring_orig) {
1678	    (my $dir = $loggingdir) =~ s!/$!!;
1679	    open(my $F1, "> $dir.dir");
1680	    open(my $F2, "> " . $loggingdir . $installer::globals::logfilename . '.file');
1681	    my @s = map { "$_\n" } split('_', $loglanguagestring_orig);
1682	    print $F1 @s;
1683	    print $F2 @s;
1684	}
1685
1686	$installer::globals::exitlog = $loggingdir;
1687
1688	##############################################################
1689	# Determining the ship location, if this is an update pack
1690	##############################################################
1691
1692	if ( $installer::globals::updatepack ) { $shipinstalldir = installer::control::determine_ship_directory($languagestringref); }
1693
1694	###################################################################
1695	# Reading an existing msi database, to prepare update and patch
1696	###################################################################
1697
1698	##############################################
1699	# Setting global code variables for Windows
1700	##############################################
1701
1702	if (!($installer::globals::is_copy_only_project))
1703	{
1704		if (( $installer::globals::iswindowsbuild ) && ( $installer::globals::packageformat ne "archive" ) && ( $installer::globals::packageformat ne "installed" ))
1705		{
1706			installer::windows::msiglobal::set_global_code_variables($languagesarrayref, $allvariableshashref);
1707		}
1708	}
1709
1710	################################################
1711	# Resolving include paths (language dependent)
1712	################################################
1713
1714	my $includepatharrayref_lang = installer::ziplist::replace_languages_in_pathes($includepatharrayref, $languagesarrayref);
1715
1716	if ( $installer::globals::refresh_includepathes ) { installer::worker::collect_all_files_from_includepathes($includepatharrayref_lang); }
1717
1718	installer::ziplist::list_all_files_from_include_path($includepatharrayref_lang);
1719
1720	##############################################
1721	# Analyzing spellchecker languages
1722	##############################################
1723
1724	if ( $allvariableshashref->{'SPELLCHECKERFILE'} ) { installer::worker::set_spellcheckerlanguages($languagesarrayref, $allvariableshashref); }
1725
1726	#####################################
1727	# Language dependent directory part
1728	#####################################
1729
1730	my $dirsinproductlanguageresolvedarrayref = installer::scriptitems::resolving_all_languages_in_productlists($dirsinproductarrayref, $languagesarrayref);
1731
1732	# A new directory array is needed ($dirsinproductlanguageresolvedarrayref instead of $dirsinproductarrayref)
1733	# because $dirsinproductarrayref is needed in get_Destination_Directory_For_Item_From_Directorylist
1734
1735	installer::scriptitems::changing_name_of_language_dependent_keys($dirsinproductlanguageresolvedarrayref);
1736
1737	installer::scriptitems::checking_directories_with_corrupt_hostname($dirsinproductlanguageresolvedarrayref, $languagesarrayref);
1738
1739	installer::scriptitems::set_global_directory_hostnames($dirsinproductlanguageresolvedarrayref, $allvariableshashref);
1740
1741	#####################################
1742	# files part, language dependent
1743	#####################################
1744
1745	$installer::logger::Info->print( "... analyzing files ...\n" );
1746
1747	my $filesinproductlanguageresolvedarrayref = installer::scriptitems::resolving_all_languages_in_productlists($filesinproductarrayref, $languagesarrayref);
1748
1749	if ( ! $installer::globals::set_office_start_language )
1750	{
1751		$filesinproductlanguageresolvedarrayref = installer::scriptitems::remove_office_start_language_files($filesinproductlanguageresolvedarrayref);
1752	}
1753
1754	installer::scriptitems::changing_name_of_language_dependent_keys($filesinproductlanguageresolvedarrayref);
1755
1756	if ( $installer::globals::iswin and $^O =~ /MSWin/i ) { installer::converter::convert_slash_to_backslash($filesinproductlanguageresolvedarrayref); }
1757
1758	$filesinproductlanguageresolvedarrayref = installer::scriptitems::remove_non_existent_languages_in_productlists($filesinproductlanguageresolvedarrayref, $languagestringref, "Name", "file");
1759
1760	installer::scriptitems::get_Source_Directory_For_Files_From_Includepathlist($filesinproductlanguageresolvedarrayref, $includepatharrayref_lang, $dirsinproductlanguageresolvedarrayref, "Files");
1761
1762	$filesinproductlanguageresolvedarrayref = installer::scriptitems::add_bundled_extension_blobs( $filesinproductlanguageresolvedarrayref);
1763    ($filesinproductlanguageresolvedarrayref,$dirsinproductarrayref) = installer::scriptitems::add_bundled_prereg_extensions(
1764        $filesinproductlanguageresolvedarrayref, $dirsinproductarrayref);
1765
1766	installer::scriptitems::get_Destination_Directory_For_Item_From_Directorylist($filesinproductlanguageresolvedarrayref, $dirsinproductarrayref);
1767
1768	$filesinproductlanguageresolvedarrayref = installer::scriptitems::remove_Files_Without_Sourcedirectory($filesinproductlanguageresolvedarrayref);
1769
1770	if ($installer::globals::languagepack)
1771	{
1772		$filesinproductlanguageresolvedarrayref = installer::scriptitems::remove_Files_For_Languagepacks($filesinproductlanguageresolvedarrayref);
1773	}
1774
1775
1776	if ( ! $allvariableshashref->{'NO_README_IN_ROOTDIR'} )
1777	{
1778		$filesinproductlanguageresolvedarrayref = installer::scriptitems::add_License_Files_into_Installdir($filesinproductlanguageresolvedarrayref, $dirsinproductlanguageresolvedarrayref, $languagesarrayref);
1779	}
1780
1781	$filesinproductlanguageresolvedarrayref = installer::scriptitems::remove_onlyasialanguage_files_from_productlists($filesinproductlanguageresolvedarrayref);
1782
1783	$filesinproductlanguageresolvedarrayref = installer::scriptitems::remove_onlywesternlanguage_files_from_productlists($filesinproductlanguageresolvedarrayref);
1784
1785	installer::scriptitems::make_filename_language_specific($filesinproductlanguageresolvedarrayref);
1786
1787	######################################################################################
1788	# Unzipping files with flag ARCHIVE and putting all included files into the file list
1789	######################################################################################
1790
1791	$installer::logger::Info->print( "... analyzing files with flag ARCHIVE ...\n" );
1792
1793	my @additional_paths_from_zipfiles = ();
1794
1795	$filesinproductlanguageresolvedarrayref = installer::archivefiles::resolving_archive_flag($filesinproductlanguageresolvedarrayref, \@additional_paths_from_zipfiles, $languagestringref, $loggingdir);
1796
1797	# packed files sometimes contain a "$" in their name: HighlightText$1.class. For epm the "$" has to be quoted by "$$"
1798
1799	if (!( $installer::globals::iswindowsbuild || $installer::globals::simple ) )
1800	{
1801		installer::scriptitems::quoting_illegal_filenames($filesinproductlanguageresolvedarrayref);
1802	}
1803
1804	#####################################
1805	# Files with flag SUBST_FILENAME
1806	#####################################
1807
1808	$installer::logger::Info->print( "... analyzing files with flag SUBST_FILENAME ...\n" );
1809
1810	installer::substfilenamefiles::resolving_subst_filename_flag($filesinproductlanguageresolvedarrayref, $allvariableshashref, $languagestringref);
1811
1812	#####################################
1813	# Files with flag SCPZIP_REPLACE
1814	#####################################
1815
1816	$installer::logger::Info->print( "... analyzing files with flag SCPZIP_REPLACE ...\n" );
1817
1818	# Editing files with flag SCPZIP_REPLACE.
1819
1820	installer::scpzipfiles::resolving_scpzip_replace_flag($filesinproductlanguageresolvedarrayref, $allvariableshashref, "File", $languagestringref);
1821
1822	#####################################
1823	# Files with flag PATCH_SO_NAME
1824	#####################################
1825
1826	$installer::logger::Info->print( "... analyzing files with flag PATCH_SO_NAME ...\n" );
1827
1828	# Editing files with flag PATCH_SO_NAME.
1829
1830	installer::scppatchsoname::resolving_patchsoname_flag($filesinproductlanguageresolvedarrayref, $allvariableshashref, "File", $languagestringref);
1831
1832	#####################################
1833	# Files with flag HIDDEN
1834	#####################################
1835
1836	$installer::logger::Info->print( "... analyzing files with flag HIDDEN ...\n" );
1837
1838	installer::worker::resolving_hidden_flag($filesinproductlanguageresolvedarrayref, $allvariableshashref, "File", $languagestringref);
1839
1840	############################################
1841	# Collecting directories for epm list file
1842	############################################
1843
1844	$installer::logger::Info->print( "... analyzing all directories for this product ...\n" );
1845
1846	# There are two ways for a directory to be included into the epm directory list:
1847	# 1. Looking for all destination paths in the files array
1848	# 2. Looking for directories with CREATE flag in the directory array
1849	# Advantage: Many pathes are hidden in zip files, they are not defined in the setup script.
1850	# It will be possible, that in the setup script only those directoies have to be defined,
1851	# that have a CREATE flag. All other directories are created, if they contain at least one file.
1852
1853	my ($directoriesforepmarrayref, $alldirectoryhash) = installer::scriptitems::collect_directories_from_filesarray($filesinproductlanguageresolvedarrayref);
1854
1855	($directoriesforepmarrayref, $alldirectoryhash) = installer::scriptitems::collect_directories_with_create_flag_from_directoryarray($dirsinproductlanguageresolvedarrayref, $alldirectoryhash);
1856
1857	# installer::sorter::sorting_array_of_hashes($directoriesforepmarrayref, "HostName");
1858
1859	#########################################################
1860	# language dependent scpactions part
1861	#########################################################
1862
1863	my $scpactionsinproductlanguageresolvedarrayref = installer::scriptitems::resolving_all_languages_in_productlists($scpactionsinproductarrayref, $languagesarrayref);
1864
1865	installer::scriptitems::changing_name_of_language_dependent_keys($scpactionsinproductlanguageresolvedarrayref);
1866
1867	installer::scriptitems::get_Source_Directory_For_Files_From_Includepathlist($scpactionsinproductlanguageresolvedarrayref, $includepatharrayref_lang, $dirsinproductlanguageresolvedarrayref, "ScpActions");
1868
1869	# Editing scpactions with flag SCPZIP_REPLACE and PATCH_SO_NAME.
1870
1871	installer::scpzipfiles::resolving_scpzip_replace_flag($scpactionsinproductlanguageresolvedarrayref, $allvariableshashref, "ScpAction", $languagestringref);
1872
1873	installer::scppatchsoname::resolving_patchsoname_flag($scpactionsinproductlanguageresolvedarrayref, $allvariableshashref, "ScpAction", $languagestringref);
1874
1875	#########################################################
1876	# language dependent links part
1877	#########################################################
1878
1879	$installer::logger::Info->print( "... analyzing links ...\n" );
1880
1881	my $linksinproductlanguageresolvedarrayref = installer::scriptitems::resolving_all_languages_in_productlists($linksinproductarrayref, $languagesarrayref);
1882
1883	installer::scriptitems::changing_name_of_language_dependent_keys($linksinproductlanguageresolvedarrayref);
1884
1885	installer::scriptitems::get_destination_file_path_for_links($linksinproductlanguageresolvedarrayref, $filesinproductlanguageresolvedarrayref);
1886
1887	installer::scriptitems::get_Destination_Directory_For_Item_From_Directorylist($linksinproductlanguageresolvedarrayref, $dirsinproductarrayref);
1888
1889	# Now taking all links that have no FileID but a ShortcutID, linking to another link
1890
1891	installer::scriptitems::get_destination_link_path_for_links($linksinproductlanguageresolvedarrayref);
1892
1893	$linksinproductlanguageresolvedarrayref = installer::scriptitems::remove_workstation_only_items($linksinproductlanguageresolvedarrayref);
1894
1895	installer::scriptitems::resolve_links_with_flag_relative($linksinproductlanguageresolvedarrayref);
1896
1897	#########################################################
1898	# language dependent unix links part
1899	#########################################################
1900
1901	$installer::logger::Info->print( "... analyzing unix links ...\n" );
1902
1903	my $unixlinksinproductlanguageresolvedarrayref = installer::scriptitems::resolving_all_languages_in_productlists($unixlinksinproductarrayref, $languagesarrayref);
1904
1905	installer::scriptitems::changing_name_of_language_dependent_keys($unixlinksinproductlanguageresolvedarrayref);
1906
1907	installer::scriptitems::get_Destination_Directory_For_Item_From_Directorylist($unixlinksinproductlanguageresolvedarrayref, $dirsinproductarrayref);
1908
1909	#########################################################
1910	# language dependent part for profiles and profileitems
1911	#########################################################
1912
1913	my $profilesinproductlanguageresolvedarrayref;
1914	my $profileitemsinproductlanguageresolvedarrayref;
1915
1916	if ((!($installer::globals::is_copy_only_project)) && (!($installer::globals::product =~ /ada/i )) && (!($installer::globals::languagepack)))
1917	{
1918		$installer::logger::Info->print( "... creating profiles ...\n" );
1919
1920		$profilesinproductlanguageresolvedarrayref = installer::scriptitems::resolving_all_languages_in_productlists($profilesinproductarrayref, $languagesarrayref);
1921
1922		$profileitemsinproductlanguageresolvedarrayref = installer::scriptitems::resolving_all_languages_in_productlists($profileitemsinproductarrayref, $languagesarrayref);
1923
1924		installer::scriptitems::changing_name_of_language_dependent_keys($profilesinproductlanguageresolvedarrayref);
1925
1926		installer::scriptitems::changing_name_of_language_dependent_keys($profileitemsinproductlanguageresolvedarrayref);
1927
1928		installer::scriptitems::replace_setup_variables($profileitemsinproductlanguageresolvedarrayref, $languagestringref, $allvariableshashref);
1929
1930		if ( $installer::globals::patch_user_dir )
1931		{
1932			installer::scriptitems::replace_userdir_variable(
1933                $profileitemsinproductlanguageresolvedarrayref,
1934                $allvariableshashref);
1935		}
1936
1937		installer::scriptitems::get_Destination_Directory_For_Item_From_Directorylist($profilesinproductlanguageresolvedarrayref, $dirsinproductarrayref);
1938
1939		# Now the Profiles can be created
1940
1941		installer::profiles::create_profiles($profilesinproductlanguageresolvedarrayref, $profileitemsinproductlanguageresolvedarrayref, $filesinproductlanguageresolvedarrayref, $languagestringref, $allvariableshashref);
1942	}
1943
1944	my $registryitemsinproductlanguageresolvedarrayref; # cannot be defined in the following "if ( $installer::globals::iswindowsbuild )"
1945	my $folderinproductlanguageresolvedarrayref;		# cannot be defined in the following "if ( $installer::globals::iswindowsbuild )"
1946	my $folderitemsinproductlanguageresolvedarrayref;	# cannot be defined in the following "if ( $installer::globals::iswindowsbuild )"
1947
1948	if ( $installer::globals::iswindowsbuild )	# Windows specific items: Folder, FolderItem, RegistryItem
1949	{
1950		#########################################################
1951		# language dependent part for folder
1952		#########################################################
1953
1954		$installer::logger::Info->print( "... analyzing folder ...\n" );
1955
1956		$folderinproductlanguageresolvedarrayref = installer::scriptitems::resolving_all_languages_in_productlists($folderinproductarrayref, $languagesarrayref);
1957
1958		installer::scriptitems::changing_name_of_language_dependent_keys($folderinproductlanguageresolvedarrayref);
1959
1960		#########################################################
1961		# language dependent part for folderitems
1962		#########################################################
1963
1964		$installer::logger::Info->print( "... analyzing folderitems ...\n" );
1965
1966		$folderitemsinproductlanguageresolvedarrayref = installer::scriptitems::resolving_all_languages_in_productlists($folderitemsinproductarrayref, $languagesarrayref);
1967
1968		installer::scriptitems::changing_name_of_language_dependent_keys($folderitemsinproductlanguageresolvedarrayref);
1969
1970		#########################################################
1971		# language dependent part for registryitems
1972		#########################################################
1973
1974		$installer::logger::Info->print( "... analyzing registryitems ...\n" );
1975
1976		$registryitemsinproductlanguageresolvedarrayref = installer::scriptitems::resolving_all_languages_in_productlists($registryitemsinproductarrayref, $languagesarrayref);
1977
1978		installer::scriptitems::changing_name_of_language_dependent_keys($registryitemsinproductlanguageresolvedarrayref);
1979	}
1980
1981	#########################################################
1982	# language dependent part for modules
1983	#########################################################
1984
1985	my $modulesinproductlanguageresolvedarrayref;
1986
1987	if (!($installer::globals::is_copy_only_project))
1988	{
1989		$installer::logger::Info->print( "... analyzing modules ...\n" );
1990
1991		$modulesinproductlanguageresolvedarrayref = installer::scriptitems::resolving_all_languages_in_productlists($modulesinproductarrayref, $languagesarrayref);
1992
1993		$modulesinproductlanguageresolvedarrayref = installer::scriptitems::remove_not_required_language_modules($modulesinproductlanguageresolvedarrayref, $languagesarrayref);
1994
1995		installer::scriptitems::changing_name_of_language_dependent_keys($modulesinproductlanguageresolvedarrayref);
1996
1997		# installer::scriptitems::collect_language_specific_names($modulesinproductlanguageresolvedarrayref);
1998		installer::scriptitems::select_required_language_strings($modulesinproductlanguageresolvedarrayref);	# using english strings
1999	}
2000
2001	# Copy-only projects can now start to copy all items File and ScpAction
2002	if ( $installer::globals::is_copy_only_project ) { installer::copyproject::copy_project($filesinproductlanguageresolvedarrayref, $scpactionsinproductlanguageresolvedarrayref, $loggingdir, $languagestringref, $shipinstalldir, $allsettingsarrayref); }
2003
2004	# Language pack projects can now start to select the required information
2005	if ( $installer::globals::languagepack )
2006	{
2007		$filesinproductlanguageresolvedarrayref = installer::languagepack::select_language_items($filesinproductlanguageresolvedarrayref, $languagesarrayref, "File");
2008		$scpactionsinproductlanguageresolvedarrayref = installer::languagepack::select_language_items($scpactionsinproductlanguageresolvedarrayref, $languagesarrayref, "ScpAction");
2009		$linksinproductlanguageresolvedarrayref = installer::languagepack::select_language_items($linksinproductlanguageresolvedarrayref, $languagesarrayref, "Shortcut");
2010		$unixlinksinproductlanguageresolvedarrayref = installer::languagepack::select_language_items($unixlinksinproductlanguageresolvedarrayref, $languagesarrayref, "Unixlink");
2011		@{$folderitemsinproductlanguageresolvedarrayref} = (); # no folderitems in languagepacks
2012
2013		# Collecting the directories again, to include only the language specific directories
2014		($directoriesforepmarrayref, $alldirectoryhash) = installer::scriptitems::collect_directories_from_filesarray($filesinproductlanguageresolvedarrayref);
2015		($directoriesforepmarrayref, $alldirectoryhash) = installer::scriptitems::collect_directories_with_create_flag_from_directoryarray($dirsinproductlanguageresolvedarrayref, $alldirectoryhash);
2016		installer::sorter::sorting_array_of_hashes($directoriesforepmarrayref, "HostName");
2017
2018		if ( $installer::globals::iswindowsbuild )
2019		{
2020			$registryitemsinproductlanguageresolvedarrayref = installer::worker::select_langpack_items($registryitemsinproductlanguageresolvedarrayref, "RegistryItem");
2021		}
2022
2023	}
2024
2025	# Collecting all files without flag PATCH (for maintenance reasons)
2026	if ( $installer::globals::patch ) { installer::worker::collect_all_files_without_patch_flag($filesinproductlanguageresolvedarrayref); }
2027
2028	# Patch projects can now start to select the required information
2029	if (( $installer::globals::patch ) && (( $installer::globals::issolarispkgbuild ) || ( $installer::globals::iswindowsbuild )))
2030	{
2031		$filesinproductlanguageresolvedarrayref = installer::worker::select_patch_items($filesinproductlanguageresolvedarrayref, "File");
2032		$scpactionsinproductlanguageresolvedarrayref = installer::worker::select_patch_items($scpactionsinproductlanguageresolvedarrayref, "ScpAction");
2033		$linksinproductlanguageresolvedarrayref = installer::worker::select_patch_items($linksinproductlanguageresolvedarrayref, "Shortcut");
2034		$unixlinksinproductlanguageresolvedarrayref = installer::worker::select_patch_items($unixlinksinproductlanguageresolvedarrayref, "Unixlink");
2035		$folderitemsinproductlanguageresolvedarrayref = installer::worker::select_patch_items($folderitemsinproductlanguageresolvedarrayref, "FolderItem");
2036		# @{$folderitemsinproductlanguageresolvedarrayref} = (); # no folderitems in languagepacks
2037
2038		if ( $installer::globals::iswindowsbuild )
2039		{
2040			$registryitemsinproductlanguageresolvedarrayref = installer::worker::select_patch_items_without_name($registryitemsinproductlanguageresolvedarrayref, "RegistryItem");
2041
2042			installer::worker::prepare_windows_patchfiles($filesinproductlanguageresolvedarrayref, $languagestringref, $allvariableshashref);
2043
2044			# For Windows patches, the directories can now be collected again
2045			($directoriesforepmarrayref, $alldirectoryhash) = installer::scriptitems::collect_directories_from_filesarray($filesinproductlanguageresolvedarrayref);
2046
2047			installer::sorter::sorting_array_of_hashes($directoriesforepmarrayref, "HostName");
2048		}
2049	}
2050
2051	#########################################################
2052	# Collecting all scp actions
2053	#########################################################
2054
2055	installer::worker::collect_scpactions($scpactionsinproductlanguageresolvedarrayref);
2056
2057	#########################################################
2058	# creating inf files for user system integration
2059	#########################################################
2060
2061	if (( $installer::globals::iswindowsbuild ) && ( ! $installer::globals::patch ))	# Windows specific items: Folder, FolderItem, RegistryItem
2062	{
2063		$installer::logger::Info->print( "... creating inf files ...\n" );
2064		installer::worker::create_inf_file($filesinproductlanguageresolvedarrayref, $registryitemsinproductlanguageresolvedarrayref, $folderinproductlanguageresolvedarrayref, $folderitemsinproductlanguageresolvedarrayref, $modulesinproductlanguageresolvedarrayref, $languagesarrayref, $languagestringref, $allvariableshashref);
2065	}
2066
2067	###########################################
2068	# Using upx, to decrease file size
2069	# Currently only for Windows.
2070	###########################################
2071
2072	if ( $allvariableshashref->{'UPXPRODUCT'} )
2073	{
2074		installer::upx::upx_on_libraries($filesinproductlanguageresolvedarrayref, $languagestringref);
2075	}
2076
2077	###########################################################
2078	# Simple package projects can now start to create the
2079	# installation structure by creating Directories, Files
2080	# Links and ScpActions. This is the last platform
2081	# independent part.
2082	###########################################################
2083
2084	if ( $installer::globals::is_simple_packager_project )
2085	{
2086		installer::simplepackage::create_simple_package($filesinproductlanguageresolvedarrayref, $directoriesforepmarrayref, $scpactionsinproductlanguageresolvedarrayref, $linksinproductlanguageresolvedarrayref, $unixlinksinproductlanguageresolvedarrayref, $loggingdir, $languagestringref, $shipinstalldir, $allsettingsarrayref, $allvariableshashref, $includepatharrayref);
2087		next; # ! leaving the current loop, because no further packaging required.
2088	}
2089
2090	###########################################################
2091	# Analyzing the package structure
2092	###########################################################
2093
2094	$installer::logger::Info->print( "... analyzing package list ...\n" );
2095
2096	my $packages = installer::packagelist::collectpackages($modulesinproductlanguageresolvedarrayref, $languagesarrayref);
2097	installer::packagelist::check_packagelist($packages);
2098
2099	$packages = installer::packagelist::analyze_list($packages, $modulesinproductlanguageresolvedarrayref);
2100	installer::packagelist::remove_multiple_modules_packages($packages);
2101
2102	# printing packages content:
2103	installer::packagelist::log_packages_content($packages);
2104	installer::packagelist::create_module_destination_hash($packages, $allvariableshashref);
2105
2106
2107	# saving debug info, before starting part 2
2108	if ( $installer::globals::debug ) { installer::logger::savedebug($installer::globals::exitlog); }
2109
2110	#################################################
2111	# Part 2: The platform dependent part
2112	#################################################
2113
2114	if ($installer::globals::iswindowsbuild)
2115    {
2116        MakeWindowsBuild(
2117            $allvariableshashref,
2118            $allsettingsarrayref,
2119            $current_install_number,
2120            $directoriesforepmarrayref,
2121            $filesinproductlanguageresolvedarrayref,
2122            $folderitemsinproductlanguageresolvedarrayref,
2123            $includepatharrayref,
2124            $includepatharrayref_lang,
2125            $installdir,
2126            $languagesarrayref,
2127            $languagestringref,
2128            $linksinproductlanguageresolvedarrayref,
2129            $loggingdir,
2130            $modulesinproductlanguageresolvedarrayref,
2131            $packages,
2132            $profileitemsinproductlanguageresolvedarrayref,
2133            $registryitemsinproductlanguageresolvedarrayref,
2134            $shipinstalldir,
2135            $windowscustomactionsarrayref,
2136            $folderinproductlanguageresolvedarrayref);
2137    }
2138    else
2139    {
2140        MakeNonWindowsBuild(
2141            $allvariableshashref,
2142            $allsettingsarrayref,
2143            $current_install_number,
2144            $directoriesforepmarrayref,
2145            $filesinproductlanguageresolvedarrayref,
2146            $includepatharrayref,
2147            $languagesarrayref,
2148            $languagestringref,
2149            $linksinproductlanguageresolvedarrayref,
2150            $unixlinksinproductlanguageresolvedarrayref,
2151            $loggingdir,
2152            $modulesinproductarrayref,
2153            $packages,
2154            $shipinstalldir,
2155            $currentdir);
2156    }
2157
2158	# saving file_info file for later analysis
2159	my $speciallogfilename = "fileinfo_" . $installer::globals::product . "\.log";
2160	installer::files::save_array_of_hashes($loggingdir . $speciallogfilename, $filesinproductlanguageresolvedarrayref);
2161}
2162
2163# saving debug info at end
2164if ( $installer::globals::debug ) { installer::logger::savedebug($installer::globals::exitlog); }
2165
2166#######################################################
2167# Stopping time
2168#######################################################
2169
2170installer::logger::stoptime();
2171
2172####################################
2173# Main program end
2174####################################
2175