xref: /trunk/main/solenv/bin/make_installer.pl (revision 6661e287)
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$installer::logger::Lang->printf("variables:\n");
1383foreach my $key (sort keys %$allvariableshashref)
1384{
1385    $installer::logger::Global->printf("    %s -> %s\n", $key, $allvariableshashref->{$key});
1386}
1387
1388
1389# When we are building a release (-release option was given on the command line)
1390# then we need additional information.
1391if ($installer::globals::is_release)
1392{
1393    $installer::logger::Info->print("...  building a release, checking required values  ... \n");
1394    $installer::globals::target_version = $allvariableshashref->{'PRODUCTVERSION'};
1395    $installer::globals::source_version = $allvariableshashref->{'PREVIOUS_VERSION'};
1396    if ( ! defined $installer::globals::source_version)
1397    {
1398        $installer::globals::source_version = installer::patch::ReleasesList::GetPreviousVersion(
1399            $installer::globals::target_version);
1400    }
1401    if ( ! defined $installer::globals::source_version)
1402    {
1403        installer::exiter::exit_program(
1404            "can not detect the previous version number.  Please add a 'PREVIOUS_VERSION' variable to openoffice.lst",
1405            "make_installer.pl");
1406    }
1407
1408    # Determine if we are building a new major release, ie if target_version is ?.0.0
1409    $installer::globals::is_major_release
1410        = installer::patch::Version::IsMajorVersion($installer::globals::target_version);
1411
1412    $installer::logger::Info->printf("    building version %s\n", $installer::globals::target_version);
1413    $installer::logger::Info->printf("        which is %sa major version\n",
1414        $installer::globals::is_major_release
1415            ? ""
1416            : "not ");
1417    $installer::logger::Info->printf("    previous version is %s\n", $installer::globals::source_version);
1418}
1419
1420
1421########################################################
1422# Check if this is simple packaging mechanism
1423########################################################
1424
1425installer::simplepackage::check_simple_packager_project($allvariableshashref);
1426
1427####################################################################
1428# setting global variables
1429####################################################################
1430
1431installer::control::set_addchildprojects($allvariableshashref);
1432installer::control::set_addjavainstaller($allvariableshashref);
1433installer::control::set_addsystemintegration($allvariableshashref);
1434
1435########################################################
1436# Re-define logging dir, after all variables are set
1437########################################################
1438
1439my $oldloggingdir = $loggingdir;
1440installer::systemactions::remove_empty_directory($oldloggingdir);
1441$loggingdir = installer::systemactions::create_directories("logging", "");
1442$loggingdir = $loggingdir . $installer::globals::separator;
1443$installer::globals::exitlog = $loggingdir;
1444
1445# checking, whether this is an opensource product
1446
1447if (!($installer::globals::is_copy_only_project)) { installer::ziplist::set_manufacturer($allvariableshashref); }
1448
1449##############################################
1450# Checking version of makecab.exe
1451##############################################
1452
1453if ( $installer::globals::iswindowsbuild ) { installer::control::check_makecab_version(); }
1454
1455##########################################################
1456# Getting the include path from the settings in zip list
1457##########################################################
1458
1459my $includepathref = installer::ziplist::getinfofromziplist($allsettingsarrayref, "include");
1460if ( $$includepathref eq "" )
1461{
1462	installer::exiter::exit_program("ERROR: Definition for \"include\" not found in $installer::globals::ziplistname", "Main");
1463}
1464
1465my $includepatharrayref = installer::converter::convert_stringlist_into_array($includepathref, ",");
1466
1467installer::ziplist::replace_all_variables_in_pathes($includepatharrayref, $pathvariableshashref);
1468
1469installer::ziplist::replace_minor_in_pathes($includepatharrayref);
1470
1471installer::ziplist::replace_packagetype_in_pathes($includepatharrayref);
1472
1473installer::ziplist::resolve_relative_pathes($includepatharrayref);
1474
1475installer::ziplist::remove_ending_separator($includepatharrayref);
1476
1477##############################################
1478# Collecting all files from all include
1479# paths in global hashes.
1480##############################################
1481
1482installer::worker::collect_all_files_from_includepathes($includepatharrayref);
1483
1484##############################################
1485# Analyzing languages in zip.lst if required
1486# Probably no longer used.
1487##############################################
1488
1489if ($installer::globals::languages_defined_in_productlist) { installer::languages::get_info_about_languages($allsettingsarrayref); }
1490
1491#####################################
1492# Windows requires the encoding list
1493#####################################
1494
1495if ( $installer::globals::iswindowsbuild ) { installer::control::read_encodinglist($includepatharrayref); }
1496
1497####################################################################
1498# MacOS dmg build requires special DS_Store file to arrange icons
1499####################################################################
1500if (($installer::globals::ismacdmgbuild) && ($installer::globals::product =~ /Apache_OpenOffice_Dev/)) { $installer::globals::devsnapshotbuild = 1; }
1501
1502if (($installer::globals::ismacdmgbuild) && ($installer::globals::product =~ /Apache_OpenOffice_Beta/)) { $installer::globals::betabuild = 1; }
1503
1504#####################################################################
1505# Including additional inc files for variable settings, if defined
1506#####################################################################
1507
1508if ( $allvariableshashref->{'ADD_INCLUDE_FILES'} ) { installer::worker::add_variables_from_inc_to_hashref($allvariableshashref, $includepatharrayref); }
1509
1510################################################
1511# Disable xpd installer, if SOLAR_JAVA not set
1512################################################
1513
1514installer::control::check_java_for_xpd($allvariableshashref);
1515
1516#####################################
1517# Analyzing the setup script
1518#####################################
1519
1520my $setupscriptref = GetSetupScriptLines($allsettingsarrayref, $allvariableshashref, $includepatharrayref);
1521
1522installer::logger::log_hashref($allvariableshashref);
1523
1524$installer::logger::Info->print( "... analyzing directories ... \n" );
1525
1526# Collect all directories in the script to get the destination dirs
1527
1528my $dirsinproductarrayref = installer::setupscript::get_all_items_from_script($setupscriptref, "Directory");
1529
1530if ( $installer::globals::languagepack ) { installer::scriptitems::use_langpack_hostname($dirsinproductarrayref); }
1531if ( $installer::globals::patch ) { installer::scriptitems::use_patch_hostname($dirsinproductarrayref); }
1532
1533if ( $allvariableshashref->{'SHIFT_BASIS_INTO_BRAND_LAYER'} ) { $dirsinproductarrayref = installer::scriptitems::shift_basis_directory_parents($dirsinproductarrayref); }
1534if ( $allvariableshashref->{'OFFICEDIRECTORYNAME'} ) { installer::scriptitems::set_officedirectory_name($dirsinproductarrayref, $allvariableshashref->{'OFFICEDIRECTORYNAME'}); }
1535
1536
1537installer::scriptitems::resolve_all_directory_names($dirsinproductarrayref);
1538
1539$installer::logger::Info->print( "... analyzing files ... \n" );
1540
1541my $filesinproductarrayref = installer::setupscript::get_all_items_from_script($setupscriptref, "File");
1542
1543$filesinproductarrayref = installer::scriptitems::remove_delete_only_files_from_productlists($filesinproductarrayref);
1544
1545if (( ! $installer::globals::iswindowsbuild ) &&
1546	( ! $installer::globals::islinuxrpmbuild ) &&
1547	( ! $installer::globals::islinuxdebbuild ) &&
1548	( ! $installer::globals::issolarispkgbuild ) &&
1549	( $installer::globals::packageformat ne "installed" ) &&
1550	( $installer::globals::packageformat ne "dmg" ) &&
1551	( $installer::globals::packageformat ne "archive" ))
1552	{ installer::control::check_oxtfiles($filesinproductarrayref); }
1553
1554if ($installer::globals::product =~ /suite/i ) { $filesinproductarrayref = installer::scriptitems::remove_notinsuite_files_from_productlists($filesinproductarrayref); }
1555
1556if (! $installer::globals::languagepack)
1557{
1558	$filesinproductarrayref = installer::scriptitems::remove_Languagepacklibraries_from_Installset($filesinproductarrayref);
1559}
1560
1561if (! $installer::globals::patch)
1562{
1563	$filesinproductarrayref = installer::scriptitems::remove_patchonlyfiles_from_Installset($filesinproductarrayref);
1564}
1565
1566if (! $installer::globals::tab)
1567{
1568	$filesinproductarrayref = installer::scriptitems::remove_tabonlyfiles_from_Installset($filesinproductarrayref);
1569}
1570
1571if (( $installer::globals::packageformat ne "installed" ) && ( $installer::globals::packageformat ne "archive" ))
1572{
1573	$filesinproductarrayref = installer::scriptitems::remove_installedproductonlyfiles_from_Installset($filesinproductarrayref);
1574}
1575
1576$installer::logger::Info->print( "... analyzing scpactions ... \n" );
1577
1578my $scpactionsinproductarrayref = installer::setupscript::get_all_items_from_script($setupscriptref, "ScpAction");
1579
1580if (( ! $allvariableshashref->{'XPDINSTALLER'} ) || ( ! $installer::globals::isxpdplatform ))
1581{
1582	$scpactionsinproductarrayref = installer::scriptitems::remove_Xpdonly_Items($scpactionsinproductarrayref);
1583}
1584
1585if ( $installer::globals::languagepack ) { installer::scriptitems::use_langpack_copy_scpaction($scpactionsinproductarrayref); }
1586if ( $installer::globals::patch ) { installer::scriptitems::use_patch_copy_scpaction($scpactionsinproductarrayref); }
1587if ($installer::globals::devsnapshotbuild) { installer::scriptitems::use_dev_copy_scpaction($scpactionsinproductarrayref); }
1588if ($installer::globals::betabuild) { installer::scriptitems::use_beta_copy_scpaction($scpactionsinproductarrayref); }
1589
1590if ($installer::globals::betabuild && $installer::globals::languagepack) { installer::scriptitems::use_langbeta_copy_scpaction($scpactionsinproductarrayref); }
1591
1592# $scpactionsinproductarrayref = installer::scriptitems::remove_scpactions_without_name($scpactionsinproductarrayref);
1593
1594installer::scriptitems::change_keys_of_scpactions($scpactionsinproductarrayref);
1595
1596$installer::logger::Info->print( "... analyzing shortcuts ... \n" );
1597
1598my $linksinproductarrayref = installer::setupscript::get_all_items_from_script($setupscriptref, "Shortcut");
1599
1600$installer::logger::Info->print( "... analyzing unix links ... \n" );
1601
1602my $unixlinksinproductarrayref = installer::setupscript::get_all_items_from_script($setupscriptref, "Unixlink");
1603
1604# $unixlinksinproductarrayref = installer::scriptitems::filter_layerlinks_from_unixlinks($unixlinksinproductarrayref);
1605
1606$installer::logger::Info->print( "... analyzing profile ... \n" );
1607
1608my $profilesinproductarrayref = installer::setupscript::get_all_items_from_script($setupscriptref, "Profile");
1609
1610$installer::logger::Info->print( "... analyzing profileitems ... \n" );
1611
1612my $profileitemsinproductarrayref = installer::setupscript::get_all_items_from_script($setupscriptref, "ProfileItem");
1613
1614my $folderinproductarrayref;
1615my $folderitemsinproductarrayref;
1616my $registryitemsinproductarrayref;
1617my $windowscustomactionsarrayref;
1618
1619if ( $installer::globals::iswindowsbuild )	# Windows specific items: Folder, FolderItem, RegistryItem, WindowsCustomAction
1620{
1621	$installer::logger::Info->print( "... analyzing folders ... \n" );
1622
1623	$folderinproductarrayref = installer::setupscript::get_all_items_from_script($setupscriptref, "Folder");
1624
1625	$installer::logger::Info->print( "... analyzing folderitems ... \n" );
1626
1627	$folderitemsinproductarrayref = installer::setupscript::get_all_items_from_script($setupscriptref, "FolderItem");
1628
1629	installer::setupscript::add_predefined_folder($folderitemsinproductarrayref, $folderinproductarrayref);
1630
1631	installer::setupscript::prepare_non_advertised_files($folderitemsinproductarrayref, $filesinproductarrayref);
1632
1633	$installer::logger::Info->print( "... analyzing registryitems ... \n" );
1634
1635	$registryitemsinproductarrayref = installer::setupscript::get_all_items_from_script($setupscriptref, "RegistryItem");
1636
1637	$registryitemsinproductarrayref = installer::scriptitems::remove_uninstall_regitems_from_script($registryitemsinproductarrayref);
1638
1639	$installer::logger::Info->print( "... analyzing Windows custom actions ... \n" );
1640
1641	$windowscustomactionsarrayref = installer::setupscript::get_all_items_from_script($setupscriptref, "WindowsCustomAction");
1642}
1643
1644my $modulesinproductarrayref;
1645
1646if (!($installer::globals::is_copy_only_project))
1647{
1648	$installer::logger::Info->print( "... analyzing modules ... \n" );
1649
1650	$modulesinproductarrayref = installer::setupscript::get_all_items_from_script($setupscriptref, "Module");
1651
1652	if (( ! $allvariableshashref->{'XPDINSTALLER'} ) || ( ! $installer::globals::isxpdplatform ))
1653	{
1654		$modulesinproductarrayref = installer::scriptitems::remove_Xpdonly_Items($modulesinproductarrayref);
1655	}
1656
1657	installer::scriptitems::resolve_assigned_modules($modulesinproductarrayref);
1658
1659	$modulesinproductarrayref = installer::scriptitems::remove_template_modules($modulesinproductarrayref);
1660
1661	installer::scriptitems::set_children_flag($modulesinproductarrayref);
1662
1663	installer::scriptitems::collect_all_languagemodules($modulesinproductarrayref);
1664
1665	# Assigning the modules to the items
1666
1667	installer::scriptitems::assigning_modules_to_items($modulesinproductarrayref, $filesinproductarrayref, "Files");
1668
1669	installer::scriptitems::assigning_modules_to_items($modulesinproductarrayref, $unixlinksinproductarrayref, "Unixlinks");
1670
1671	installer::scriptitems::assigning_modules_to_items($modulesinproductarrayref, $dirsinproductarrayref, "Dirs");
1672}
1673
1674
1675# saving debug info, before staring part 1b
1676if ( $installer::globals::debug ) { installer::logger::savedebug($installer::globals::exitlog); }
1677
1678#################################################
1679# Part 1b: The language dependent part
1680# (still platform independent)
1681#################################################
1682
1683# Now starts the language dependent part, if more than one product is defined on the command line
1684# Example -l en-US,de#es,fr,it defines two multilingual products
1685
1686###############################################################################
1687# Beginning of language dependent part
1688# The for iterates over all products, separated by an # in the language list
1689###############################################################################
1690
1691
1692# Run the following code block exactly once.
1693# This strange version of a do{}while(false) loop exists only to allow (legacy) next statements.
1694for (;1;last)
1695{
1696	my $languagesarrayref = installer::languages::get_all_languages_for_one_product($installer::globals::languageproduct, $allvariableshashref);
1697
1698	$installer::globals::alllanguagesinproductarrayref = $languagesarrayref;
1699	my $languagestringref = installer::languages::get_language_string($languagesarrayref);
1700	$installer::logger::Info->print( "------------------------------------\n" );
1701	$installer::logger::Info->print( "... languages $$languagestringref ... \n" );
1702
1703	if ( $installer::globals::patch )
1704	{
1705		$installer::globals::addlicensefile = 0;	# no license files for patches
1706		$installer::globals::makedownload = 0;
1707		$installer::globals::makejds = 0;
1708	}
1709
1710	if ( $installer::globals::languagepack )
1711	{
1712		$installer::globals::addchildprojects = 0;
1713		$installer::globals::addsystemintegration = 0;
1714		$installer::globals::makejds = 0;
1715		$installer::globals::addlicensefile = 0;
1716
1717		if ( $allvariableshashref->{'OPENSOURCE'} ) { $installer::globals::makedownload = 1; }
1718		else { $installer::globals::makedownload = 0; }
1719	}
1720
1721    # Set up an MSI object for the source version.
1722    if ($installer::globals::is_release
1723        && $installer::globals::iswindowsbuild)
1724    {
1725        my $releases = installer::patch::ReleasesList::Instance()->{$installer::globals::source_version};
1726        if ( ! defined $releases)
1727        {
1728            $installer::logger::Info->printf(
1729                "there is no recorded information about previous version %s\n",
1730                $installer::globals::source_version);
1731            $installer::logger::Info->printf("    reverting to non-release build\n");
1732            $installer::globals::is_release = 0;
1733        }
1734        elsif ( ! defined $releases->{'msi'}->{installer::languages::get_normalized_language($$languagestringref)})
1735        {
1736            $installer::logger::Info->printf(
1737                "there is no recorded information about language '%s' in previous version %s\n",
1738                $$languagestringref,
1739                $installer::globals::source_version);
1740            $installer::logger::Info->printf("    reverting to non-release build\n");
1741            $installer::globals::is_release = 0;
1742        }
1743        else
1744        {
1745            $installer::logger::Info->printf("preparing MSI object for source version %s\n",
1746                $installer::globals::source_version);
1747            my $source_version_string = join(
1748                "",
1749                installer::patch::Version::StringToNumberArray($installer::globals::source_version));
1750            $installer::globals::source_msi = installer::patch::Msi->FindAndCreate(
1751                $installer::globals::source_version,
1752                0,
1753                $$languagestringref,
1754                $installer::globals::product);
1755        }
1756    }
1757
1758	############################################################
1759	# Beginning of language specific logging mechanism
1760	# Until now only global logging into default: logfile.txt
1761	############################################################
1762
1763	installer::logger::copy_globalinfo_into_logfile();
1764	$installer::globals::globalinfo_copied = 1;
1765
1766	my $logminor = "";
1767	if ( $installer::globals::updatepack ) { $logminor = $installer::globals::lastminor; }
1768	else { $logminor = $installer::globals::minor; }
1769
1770    my $loglanguagestring_orig = $$languagestringref;
1771	my $loglanguagestring = installer::languages::get_language_directory_name($$languagestringref);
1772
1773    # Setup the directory where the language dependent log file will be stored.
1774	$loggingdir = $loggingdir . $loglanguagestring . $installer::globals::separator;
1775	installer::systemactions::create_directory($loggingdir);
1776
1777    # Set language dependent logging.
1778    $installer::globals::logfilename = sprintf("log_%s%s_%s.log",
1779        $installer::globals::build,
1780        $logminor ne "" ? "_" . $logminor : "",
1781        $loglanguagestring);
1782    $installer::logger::Lang->set_filename($loggingdir . $installer::globals::logfilename);
1783    $installer::logger::Lang->copy_lines_from($installer::logger::Global);
1784    $installer::logger::Lang->set_filter(\&installer::control::filter_log_error);
1785    installer::control::prepare_error_processing();
1786    # All logging to the console is also forwarded to the language dependen log.
1787    $installer::logger::Lang->set_forward(undef);
1788    $installer::logger::Info->set_forward($installer::logger::Lang);
1789    # Scan all log lines for error messages.
1790    $installer::logger::Lang->add_timestamp("starting log for language ".$loglanguagestring);
1791
1792	if ($loglanguagestring ne $loglanguagestring_orig) {
1793	    (my $dir = $loggingdir) =~ s!/$!!;
1794	    open(my $F1, "> $dir.dir");
1795	    open(my $F2, "> " . $loggingdir . $installer::globals::logfilename . '.file');
1796	    my @s = map { "$_\n" } split('_', $loglanguagestring_orig);
1797	    print $F1 @s;
1798	    print $F2 @s;
1799	}
1800
1801	$installer::globals::exitlog = $loggingdir;
1802
1803	##############################################################
1804	# Determining the ship location, if this is an update pack
1805	##############################################################
1806
1807	if ( $installer::globals::updatepack ) { $shipinstalldir = installer::control::determine_ship_directory($languagestringref); }
1808
1809	##############################################
1810	# Setting global code variables for Windows
1811	##############################################
1812
1813	if (!($installer::globals::is_copy_only_project))
1814	{
1815		if (( $installer::globals::iswindowsbuild )
1816            && ( $installer::globals::packageformat ne "archive" )
1817            && ( $installer::globals::packageformat ne "installed" ))
1818		{
1819			installer::windows::msiglobal::set_global_code_variables(
1820                $languagesarrayref,
1821                $allvariableshashref);
1822		}
1823	}
1824
1825	################################################
1826	# Resolving include paths (language dependent)
1827	################################################
1828
1829	my $includepatharrayref_lang = installer::ziplist::replace_languages_in_pathes($includepatharrayref, $languagesarrayref);
1830
1831	if ( $installer::globals::refresh_includepathes ) { installer::worker::collect_all_files_from_includepathes($includepatharrayref_lang); }
1832
1833	installer::ziplist::list_all_files_from_include_path($includepatharrayref_lang);
1834
1835	##############################################
1836	# Analyzing spellchecker languages
1837	##############################################
1838
1839	if ( $allvariableshashref->{'SPELLCHECKERFILE'} ) { installer::worker::set_spellcheckerlanguages($languagesarrayref, $allvariableshashref); }
1840
1841	#####################################
1842	# Language dependent directory part
1843	#####################################
1844
1845	my $dirsinproductlanguageresolvedarrayref = installer::scriptitems::resolving_all_languages_in_productlists($dirsinproductarrayref, $languagesarrayref);
1846
1847	# A new directory array is needed ($dirsinproductlanguageresolvedarrayref instead of $dirsinproductarrayref)
1848	# because $dirsinproductarrayref is needed in get_Destination_Directory_For_Item_From_Directorylist
1849
1850	installer::scriptitems::changing_name_of_language_dependent_keys($dirsinproductlanguageresolvedarrayref);
1851
1852	installer::scriptitems::checking_directories_with_corrupt_hostname($dirsinproductlanguageresolvedarrayref, $languagesarrayref);
1853
1854	installer::scriptitems::set_global_directory_hostnames($dirsinproductlanguageresolvedarrayref, $allvariableshashref);
1855
1856	#####################################
1857	# files part, language dependent
1858	#####################################
1859
1860	$installer::logger::Info->print( "... analyzing files ...\n" );
1861
1862	my $filesinproductlanguageresolvedarrayref = installer::scriptitems::resolving_all_languages_in_productlists($filesinproductarrayref, $languagesarrayref);
1863
1864	if ( ! $installer::globals::set_office_start_language )
1865	{
1866		$filesinproductlanguageresolvedarrayref = installer::scriptitems::remove_office_start_language_files($filesinproductlanguageresolvedarrayref);
1867	}
1868
1869	installer::scriptitems::changing_name_of_language_dependent_keys($filesinproductlanguageresolvedarrayref);
1870	if ( $installer::globals::iswin and $^O =~ /MSWin/i ) { installer::converter::convert_slash_to_backslash($filesinproductlanguageresolvedarrayref); }
1871
1872	$filesinproductlanguageresolvedarrayref = installer::scriptitems::remove_non_existent_languages_in_productlists($filesinproductlanguageresolvedarrayref, $languagestringref, "Name", "file");
1873
1874	installer::scriptitems::get_Source_Directory_For_Files_From_Includepathlist($filesinproductlanguageresolvedarrayref, $includepatharrayref_lang, $dirsinproductlanguageresolvedarrayref, "Files");
1875
1876	$filesinproductlanguageresolvedarrayref = installer::scriptitems::add_bundled_extension_blobs( $filesinproductlanguageresolvedarrayref);
1877    ($filesinproductlanguageresolvedarrayref,$dirsinproductarrayref) = installer::scriptitems::add_bundled_prereg_extensions(
1878        $filesinproductlanguageresolvedarrayref, $dirsinproductarrayref);
1879
1880	installer::scriptitems::get_Destination_Directory_For_Item_From_Directorylist($filesinproductlanguageresolvedarrayref, $dirsinproductarrayref);
1881
1882	$filesinproductlanguageresolvedarrayref = installer::scriptitems::remove_Files_Without_Sourcedirectory($filesinproductlanguageresolvedarrayref);
1883
1884	if ($installer::globals::languagepack)
1885	{
1886		$filesinproductlanguageresolvedarrayref = installer::scriptitems::remove_Files_For_Languagepacks($filesinproductlanguageresolvedarrayref);
1887	}
1888
1889
1890	if ( ! $allvariableshashref->{'NO_README_IN_ROOTDIR'} )
1891	{
1892		$filesinproductlanguageresolvedarrayref = installer::scriptitems::add_License_Files_into_Installdir($filesinproductlanguageresolvedarrayref, $dirsinproductlanguageresolvedarrayref, $languagesarrayref);
1893	}
1894
1895	$filesinproductlanguageresolvedarrayref = installer::scriptitems::remove_onlyasialanguage_files_from_productlists($filesinproductlanguageresolvedarrayref);
1896
1897	$filesinproductlanguageresolvedarrayref = installer::scriptitems::remove_onlywesternlanguage_files_from_productlists($filesinproductlanguageresolvedarrayref);
1898
1899	installer::scriptitems::make_filename_language_specific($filesinproductlanguageresolvedarrayref);
1900
1901	######################################################################################
1902	# Unzipping files with flag ARCHIVE and putting all included files into the file list
1903	######################################################################################
1904
1905	$installer::logger::Info->print( "... analyzing files with flag ARCHIVE ...\n" );
1906
1907	my @additional_paths_from_zipfiles = ();
1908
1909	$filesinproductlanguageresolvedarrayref = installer::archivefiles::resolving_archive_flag($filesinproductlanguageresolvedarrayref, \@additional_paths_from_zipfiles, $languagestringref, $loggingdir);
1910
1911	# packed files sometimes contain a "$" in their name: HighlightText$1.class. For epm the "$" has to be quoted by "$$"
1912
1913	if (!( $installer::globals::iswindowsbuild || $installer::globals::simple ) )
1914	{
1915		installer::scriptitems::quoting_illegal_filenames($filesinproductlanguageresolvedarrayref);
1916	}
1917
1918	#####################################
1919	# Files with flag SUBST_FILENAME
1920	#####################################
1921
1922	$installer::logger::Info->print( "... analyzing files with flag SUBST_FILENAME ...\n" );
1923
1924	installer::substfilenamefiles::resolving_subst_filename_flag($filesinproductlanguageresolvedarrayref, $allvariableshashref, $languagestringref);
1925
1926	#####################################
1927	# Files with flag SCPZIP_REPLACE
1928	#####################################
1929
1930	$installer::logger::Info->print( "... analyzing files with flag SCPZIP_REPLACE ...\n" );
1931
1932	# Editing files with flag SCPZIP_REPLACE.
1933
1934	installer::scpzipfiles::resolving_scpzip_replace_flag($filesinproductlanguageresolvedarrayref, $allvariableshashref, "File", $languagestringref);
1935
1936	#####################################
1937	# Files with flag PATCH_SO_NAME
1938	#####################################
1939
1940	$installer::logger::Info->print( "... analyzing files with flag PATCH_SO_NAME ...\n" );
1941
1942	# Editing files with flag PATCH_SO_NAME.
1943
1944	installer::scppatchsoname::resolving_patchsoname_flag($filesinproductlanguageresolvedarrayref, $allvariableshashref, "File", $languagestringref);
1945
1946	#####################################
1947	# Files with flag HIDDEN
1948	#####################################
1949
1950	$installer::logger::Info->print( "... analyzing files with flag HIDDEN ...\n" );
1951
1952	installer::worker::resolving_hidden_flag($filesinproductlanguageresolvedarrayref, $allvariableshashref, "File", $languagestringref);
1953
1954	############################################
1955	# Collecting directories for epm list file
1956	############################################
1957
1958	$installer::logger::Info->print( "... analyzing all directories for this product ...\n" );
1959
1960	# There are two ways for a directory to be included into the epm directory list:
1961	# 1. Looking for all destination paths in the files array
1962	# 2. Looking for directories with CREATE flag in the directory array
1963	# Advantage: Many paths are hidden in zip files, they are not defined in the setup script.
1964	# It will be possible, that in the setup script only those directoies have to be defined,
1965	# that have a CREATE flag. All other directories are created, if they contain at least one file.
1966
1967	my ($directoriesforepmarrayref, $alldirectoryhash) = installer::scriptitems::collect_directories_from_filesarray($filesinproductlanguageresolvedarrayref);
1968
1969	($directoriesforepmarrayref, $alldirectoryhash) = installer::scriptitems::collect_directories_with_create_flag_from_directoryarray($dirsinproductlanguageresolvedarrayref, $alldirectoryhash);
1970
1971	# installer::sorter::sorting_array_of_hashes($directoriesforepmarrayref, "HostName");
1972	# if ( $installer::globals::globallogging ) { installer::files::save_array_of_hashes($loggingdir . "directoriesforepmlist3.log", $directoriesforepmarrayref); }
1973
1974	#########################################################
1975	# language dependent scpactions part
1976	#########################################################
1977
1978	my $scpactionsinproductlanguageresolvedarrayref = installer::scriptitems::resolving_all_languages_in_productlists($scpactionsinproductarrayref, $languagesarrayref);
1979
1980	installer::scriptitems::changing_name_of_language_dependent_keys($scpactionsinproductlanguageresolvedarrayref);
1981
1982	installer::scriptitems::get_Source_Directory_For_Files_From_Includepathlist($scpactionsinproductlanguageresolvedarrayref, $includepatharrayref_lang, $dirsinproductlanguageresolvedarrayref, "ScpActions");
1983
1984	# Editing scpactions with flag SCPZIP_REPLACE and PATCH_SO_NAME.
1985
1986	installer::scpzipfiles::resolving_scpzip_replace_flag($scpactionsinproductlanguageresolvedarrayref, $allvariableshashref, "ScpAction", $languagestringref);
1987
1988	installer::scppatchsoname::resolving_patchsoname_flag($scpactionsinproductlanguageresolvedarrayref, $allvariableshashref, "ScpAction", $languagestringref);
1989
1990	#########################################################
1991	# language dependent links part
1992	#########################################################
1993
1994	$installer::logger::Info->print( "... analyzing links ...\n" );
1995
1996	my $linksinproductlanguageresolvedarrayref = installer::scriptitems::resolving_all_languages_in_productlists($linksinproductarrayref, $languagesarrayref);
1997
1998	installer::scriptitems::changing_name_of_language_dependent_keys($linksinproductlanguageresolvedarrayref);
1999
2000	installer::scriptitems::get_destination_file_path_for_links($linksinproductlanguageresolvedarrayref, $filesinproductlanguageresolvedarrayref);
2001
2002	installer::scriptitems::get_Destination_Directory_For_Item_From_Directorylist($linksinproductlanguageresolvedarrayref, $dirsinproductarrayref);
2003
2004	# Now taking all links that have no FileID but a ShortcutID, linking to another link
2005
2006	installer::scriptitems::get_destination_link_path_for_links($linksinproductlanguageresolvedarrayref);
2007
2008	$linksinproductlanguageresolvedarrayref = installer::scriptitems::remove_workstation_only_items($linksinproductlanguageresolvedarrayref);
2009
2010	installer::scriptitems::resolve_links_with_flag_relative($linksinproductlanguageresolvedarrayref);
2011
2012	#########################################################
2013	# language dependent unix links part
2014	#########################################################
2015
2016	$installer::logger::Info->print( "... analyzing unix links ...\n" );
2017
2018	my $unixlinksinproductlanguageresolvedarrayref = installer::scriptitems::resolving_all_languages_in_productlists($unixlinksinproductarrayref, $languagesarrayref);
2019
2020	installer::scriptitems::changing_name_of_language_dependent_keys($unixlinksinproductlanguageresolvedarrayref);
2021
2022	installer::scriptitems::get_Destination_Directory_For_Item_From_Directorylist($unixlinksinproductlanguageresolvedarrayref, $dirsinproductarrayref);
2023
2024	#########################################################
2025	# language dependent part for profiles and profileitems
2026	#########################################################
2027
2028	my $profilesinproductlanguageresolvedarrayref;
2029	my $profileitemsinproductlanguageresolvedarrayref;
2030
2031	if ((!($installer::globals::is_copy_only_project)) && (!($installer::globals::product =~ /ada/i )) && (!($installer::globals::languagepack)))
2032	{
2033		$installer::logger::Info->print( "... creating profiles ...\n" );
2034
2035		$profilesinproductlanguageresolvedarrayref = installer::scriptitems::resolving_all_languages_in_productlists($profilesinproductarrayref, $languagesarrayref);
2036
2037		$profileitemsinproductlanguageresolvedarrayref = installer::scriptitems::resolving_all_languages_in_productlists($profileitemsinproductarrayref, $languagesarrayref);
2038
2039		installer::scriptitems::changing_name_of_language_dependent_keys($profilesinproductlanguageresolvedarrayref);
2040
2041		installer::scriptitems::changing_name_of_language_dependent_keys($profileitemsinproductlanguageresolvedarrayref);
2042
2043		installer::scriptitems::replace_setup_variables($profileitemsinproductlanguageresolvedarrayref, $languagestringref, $allvariableshashref);
2044
2045		if ( $installer::globals::patch_user_dir )
2046		{
2047			installer::scriptitems::replace_userdir_variable(
2048                $profileitemsinproductlanguageresolvedarrayref,
2049                $allvariableshashref);
2050		}
2051
2052		installer::scriptitems::get_Destination_Directory_For_Item_From_Directorylist($profilesinproductlanguageresolvedarrayref, $dirsinproductarrayref);
2053
2054		# Now the Profiles can be created
2055
2056		installer::profiles::create_profiles($profilesinproductlanguageresolvedarrayref, $profileitemsinproductlanguageresolvedarrayref, $filesinproductlanguageresolvedarrayref, $languagestringref, $allvariableshashref);
2057	}
2058
2059	my $registryitemsinproductlanguageresolvedarrayref; # cannot be defined in the following "if ( $installer::globals::iswindowsbuild )"
2060	my $folderinproductlanguageresolvedarrayref;		# cannot be defined in the following "if ( $installer::globals::iswindowsbuild )"
2061	my $folderitemsinproductlanguageresolvedarrayref;	# cannot be defined in the following "if ( $installer::globals::iswindowsbuild )"
2062
2063	if ( $installer::globals::iswindowsbuild )	# Windows specific items: Folder, FolderItem, RegistryItem
2064	{
2065		#########################################################
2066		# language dependent part for folder
2067		#########################################################
2068
2069		$installer::logger::Info->print( "... analyzing folder ...\n" );
2070
2071		$folderinproductlanguageresolvedarrayref = installer::scriptitems::resolving_all_languages_in_productlists($folderinproductarrayref, $languagesarrayref);
2072
2073		installer::scriptitems::changing_name_of_language_dependent_keys($folderinproductlanguageresolvedarrayref);
2074
2075		#########################################################
2076		# language dependent part for folderitems
2077		#########################################################
2078
2079		$installer::logger::Info->print( "... analyzing folderitems ...\n" );
2080
2081		$folderitemsinproductlanguageresolvedarrayref = installer::scriptitems::resolving_all_languages_in_productlists($folderitemsinproductarrayref, $languagesarrayref);
2082
2083		installer::scriptitems::changing_name_of_language_dependent_keys($folderitemsinproductlanguageresolvedarrayref);
2084
2085		#########################################################
2086		# language dependent part for registryitems
2087		#########################################################
2088
2089		$installer::logger::Info->print( "... analyzing registryitems ...\n" );
2090
2091		$registryitemsinproductlanguageresolvedarrayref = installer::scriptitems::resolving_all_languages_in_productlists($registryitemsinproductarrayref, $languagesarrayref);
2092
2093		installer::scriptitems::changing_name_of_language_dependent_keys($registryitemsinproductlanguageresolvedarrayref);
2094	}
2095
2096	#########################################################
2097	# language dependent part for modules
2098	#########################################################
2099
2100	my $modulesinproductlanguageresolvedarrayref;
2101
2102	if (!($installer::globals::is_copy_only_project))
2103	{
2104		$installer::logger::Info->print( "... analyzing modules ...\n" );
2105
2106		$modulesinproductlanguageresolvedarrayref = installer::scriptitems::resolving_all_languages_in_productlists($modulesinproductarrayref, $languagesarrayref);
2107
2108		$modulesinproductlanguageresolvedarrayref = installer::scriptitems::remove_not_required_language_modules($modulesinproductlanguageresolvedarrayref, $languagesarrayref);
2109
2110		installer::scriptitems::changing_name_of_language_dependent_keys($modulesinproductlanguageresolvedarrayref);
2111
2112		# installer::scriptitems::collect_language_specific_names($modulesinproductlanguageresolvedarrayref);
2113		installer::scriptitems::select_required_language_strings($modulesinproductlanguageresolvedarrayref);	# using english strings
2114	}
2115
2116	# Copy-only projects can now start to copy all items File and ScpAction
2117	if ( $installer::globals::is_copy_only_project ) { installer::copyproject::copy_project($filesinproductlanguageresolvedarrayref, $scpactionsinproductlanguageresolvedarrayref, $loggingdir, $languagestringref, $shipinstalldir, $allsettingsarrayref); }
2118
2119	# Language pack projects can now start to select the required information
2120	if ( $installer::globals::languagepack )
2121	{
2122		$filesinproductlanguageresolvedarrayref = installer::languagepack::select_language_items($filesinproductlanguageresolvedarrayref, $languagesarrayref, "File");
2123		$scpactionsinproductlanguageresolvedarrayref = installer::languagepack::select_language_items($scpactionsinproductlanguageresolvedarrayref, $languagesarrayref, "ScpAction");
2124		$linksinproductlanguageresolvedarrayref = installer::languagepack::select_language_items($linksinproductlanguageresolvedarrayref, $languagesarrayref, "Shortcut");
2125		$unixlinksinproductlanguageresolvedarrayref = installer::languagepack::select_language_items($unixlinksinproductlanguageresolvedarrayref, $languagesarrayref, "Unixlink");
2126		@{$folderitemsinproductlanguageresolvedarrayref} = (); # no folderitems in languagepacks
2127
2128		# Collecting the directories again, to include only the language specific directories
2129		($directoriesforepmarrayref, $alldirectoryhash) = installer::scriptitems::collect_directories_from_filesarray($filesinproductlanguageresolvedarrayref);
2130		($directoriesforepmarrayref, $alldirectoryhash) = installer::scriptitems::collect_directories_with_create_flag_from_directoryarray($dirsinproductlanguageresolvedarrayref, $alldirectoryhash);
2131		installer::sorter::sorting_array_of_hashes($directoriesforepmarrayref, "HostName");
2132
2133		if ( $installer::globals::iswindowsbuild )
2134		{
2135			$registryitemsinproductlanguageresolvedarrayref = installer::worker::select_langpack_items($registryitemsinproductlanguageresolvedarrayref, "RegistryItem");
2136		}
2137
2138	}
2139
2140	# Collecting all files without flag PATCH (for maintenance reasons)
2141	if ( $installer::globals::patch ) { installer::worker::collect_all_files_without_patch_flag($filesinproductlanguageresolvedarrayref); }
2142
2143	# Patch projects can now start to select the required information
2144	if (( $installer::globals::patch ) && (( $installer::globals::issolarispkgbuild ) || ( $installer::globals::iswindowsbuild )))
2145	{
2146		$filesinproductlanguageresolvedarrayref = installer::worker::select_patch_items($filesinproductlanguageresolvedarrayref, "File");
2147		$scpactionsinproductlanguageresolvedarrayref = installer::worker::select_patch_items($scpactionsinproductlanguageresolvedarrayref, "ScpAction");
2148		$linksinproductlanguageresolvedarrayref = installer::worker::select_patch_items($linksinproductlanguageresolvedarrayref, "Shortcut");
2149		$unixlinksinproductlanguageresolvedarrayref = installer::worker::select_patch_items($unixlinksinproductlanguageresolvedarrayref, "Unixlink");
2150		$folderitemsinproductlanguageresolvedarrayref = installer::worker::select_patch_items($folderitemsinproductlanguageresolvedarrayref, "FolderItem");
2151		# @{$folderitemsinproductlanguageresolvedarrayref} = (); # no folderitems in languagepacks
2152
2153		if ( $installer::globals::iswindowsbuild )
2154		{
2155			$registryitemsinproductlanguageresolvedarrayref = installer::worker::select_patch_items_without_name($registryitemsinproductlanguageresolvedarrayref, "RegistryItem");
2156
2157			installer::worker::prepare_windows_patchfiles($filesinproductlanguageresolvedarrayref, $languagestringref, $allvariableshashref);
2158
2159			# For Windows patches, the directories can now be collected again
2160			($directoriesforepmarrayref, $alldirectoryhash) = installer::scriptitems::collect_directories_from_filesarray($filesinproductlanguageresolvedarrayref);
2161
2162			installer::sorter::sorting_array_of_hashes($directoriesforepmarrayref, "HostName");
2163		}
2164	}
2165
2166	#########################################################
2167	# Collecting all scp actions
2168	#########################################################
2169
2170	installer::worker::collect_scpactions($scpactionsinproductlanguageresolvedarrayref);
2171
2172	#########################################################
2173	# creating inf files for user system integration
2174	#########################################################
2175
2176	if (( $installer::globals::iswindowsbuild ) && ( ! $installer::globals::patch ))	# Windows specific items: Folder, FolderItem, RegistryItem
2177	{
2178		$installer::logger::Info->print( "... creating inf files ...\n" );
2179		installer::worker::create_inf_file(
2180            $filesinproductlanguageresolvedarrayref,
2181            $registryitemsinproductlanguageresolvedarrayref,
2182            $folderinproductlanguageresolvedarrayref,
2183            $folderitemsinproductlanguageresolvedarrayref,
2184            $modulesinproductlanguageresolvedarrayref,
2185            $languagesarrayref,
2186            $languagestringref,
2187            $allvariableshashref);
2188	}
2189
2190	###########################################
2191	# Using upx, to decrease file size
2192	# Currently only for Windows.
2193	###########################################
2194
2195	if ( $allvariableshashref->{'UPXPRODUCT'} )
2196	{
2197		installer::upx::upx_on_libraries($filesinproductlanguageresolvedarrayref, $languagestringref);
2198	}
2199
2200	###########################################################
2201	# Simple package projects can now start to create the
2202	# installation structure by creating Directories, Files
2203	# Links and ScpActions. This is the last platform
2204	# independent part.
2205	###########################################################
2206
2207	if ( $installer::globals::is_simple_packager_project )
2208	{
2209		installer::simplepackage::create_simple_package($filesinproductlanguageresolvedarrayref, $directoriesforepmarrayref, $scpactionsinproductlanguageresolvedarrayref, $linksinproductlanguageresolvedarrayref, $unixlinksinproductlanguageresolvedarrayref, $loggingdir, $languagestringref, $shipinstalldir, $allsettingsarrayref, $allvariableshashref, $includepatharrayref);
2210		next; # ! leaving the current loop, because no further packaging required.
2211	}
2212
2213	###########################################################
2214	# Analyzing the package structure
2215	###########################################################
2216
2217	$installer::logger::Info->print( "... analyzing package list ...\n" );
2218
2219	my $packages = installer::packagelist::collectpackages($modulesinproductlanguageresolvedarrayref, $languagesarrayref);
2220	installer::packagelist::check_packagelist($packages);
2221
2222	$packages = installer::packagelist::analyze_list($packages, $modulesinproductlanguageresolvedarrayref);
2223	installer::packagelist::remove_multiple_modules_packages($packages);
2224
2225	# printing packages content:
2226	installer::packagelist::log_packages_content($packages);
2227	installer::packagelist::create_module_destination_hash($packages, $allvariableshashref);
2228
2229	#################################################
2230	# Part 2: The platform dependent part
2231	#################################################
2232
2233	if ( $installer::globals::iswindowsbuild )
2234    {
2235        # Create .idt tables and a .msi file.
2236        MakeWindowsBuild(
2237            $allvariableshashref,
2238            $allsettingsarrayref,
2239            $current_install_number,
2240            $directoriesforepmarrayref,
2241            $filesinproductlanguageresolvedarrayref,
2242            $folderitemsinproductlanguageresolvedarrayref,
2243            $includepatharrayref,
2244            $includepatharrayref_lang,
2245            $installdir,
2246            $languagesarrayref,
2247            $languagestringref,
2248            $linksinproductlanguageresolvedarrayref,
2249            $loggingdir,
2250            $modulesinproductlanguageresolvedarrayref,
2251            $packages,
2252            $profileitemsinproductlanguageresolvedarrayref,
2253            $registryitemsinproductlanguageresolvedarrayref,
2254            $shipinstalldir,
2255            $windowscustomactionsarrayref,
2256            $folderinproductlanguageresolvedarrayref);
2257    }
2258    else
2259    {
2260        # Creating epm list file.
2261        MakeNonWindowsBuild(
2262            $allvariableshashref,
2263            $allsettingsarrayref,
2264            $current_install_number,
2265            $directoriesforepmarrayref,
2266            $filesinproductlanguageresolvedarrayref,
2267            $includepatharrayref,
2268            $languagesarrayref,
2269            $languagestringref,
2270            $linksinproductlanguageresolvedarrayref,
2271            $unixlinksinproductlanguageresolvedarrayref,
2272            $loggingdir,
2273            $modulesinproductarrayref,
2274            $packages,
2275            $shipinstalldir,
2276            $currentdir);
2277    }
2278
2279	# saving file_info file for later analysis
2280	my $speciallogfilename = "fileinfo_" . $installer::globals::product . "\.log";
2281	installer::files::save_array_of_hashes($loggingdir . $speciallogfilename, $filesinproductlanguageresolvedarrayref);
2282}
2283
2284# saving debug info at end
2285if ( $installer::globals::debug ) { installer::logger::savedebug($installer::globals::exitlog); }
2286
2287#######################################################
2288# Stopping time
2289#######################################################
2290
2291installer::logger::stoptime();
2292
2293####################################
2294# Main program end
2295####################################
2296