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