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