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