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