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