Version 7.6.3.2-android, tag libreoffice-7.6.3.2-android
[LibreOffice.git] / solenv / bin / modules / installer.pm
bloba22385924b92e82b1df0a3b94f7ee1417b36eec3
2 # This file is part of the LibreOffice project.
4 # This Source Code Form is subject to the terms of the Mozilla Public
5 # License, v. 2.0. If a copy of the MPL was not distributed with this
6 # file, You can obtain one at http://mozilla.org/MPL/2.0/.
8 # This file incorporates work covered by the following license notice:
10 # Licensed to the Apache Software Foundation (ASF) under one or more
11 # contributor license agreements. See the NOTICE file distributed
12 # with this work for additional information regarding copyright
13 # ownership. The ASF licenses this file to you under the Apache
14 # License, Version 2.0 (the "License"); you may not use this file
15 # except in compliance with the License. You may obtain a copy of
16 # the License at http://www.apache.org/licenses/LICENSE-2.0 .
19 package installer;
21 use strict;
22 use warnings;
24 use base 'Exporter';
26 use Cwd;
27 use Data::Dumper;
28 use File::Copy;
29 use List::Util qw(shuffle);
30 use installer::control;
31 use installer::converter;
32 use installer::copyproject;
33 use installer::download;
34 use installer::environment;
35 use installer::epmfile;
36 use installer::files;
37 use installer::filelists;
38 use installer::globals;
39 use installer::helppack;
40 use installer::languagepack;
41 use installer::languages;
42 use installer::logger;
43 use installer::packagelist;
44 use installer::parameter;
45 use installer::pathanalyzer;
46 use installer::profiles;
47 use installer::scpzipfiles;
48 use installer::scriptitems;
49 use installer::setupscript;
50 use installer::simplepackage;
51 use installer::strip qw(strip_libraries);
52 use installer::systemactions;
53 use installer::windows::assembly;
54 use installer::windows::binary;
55 use installer::windows::component;
56 use installer::windows::createfolder;
57 use installer::windows::directory;
58 use installer::windows::feature;
59 use installer::windows::featurecomponent;
60 use installer::windows::file;
61 use installer::windows::font;
62 use installer::windows::icon;
63 use installer::windows::idtglobal;
64 use installer::windows::inifile;
65 use installer::windows::media;
66 use installer::windows::mergemodule;
67 use installer::windows::msiglobal;
68 use installer::windows::msishortcutproperty;
69 use installer::windows::property;
70 use installer::windows::removefile;
71 use installer::windows::registry;
72 use installer::windows::shortcut;
73 use installer::windows::strip;
74 use installer::windows::update;
75 use installer::windows::upgrade;
76 use installer::worker;
77 use installer::ziplist qw(read_ziplist);
79 our @EXPORT_OK = qw(main);
81 sub main {
82 installer::logger::starttime();
84 my $exit_code = 0;
86 eval {
87 run();
89 if ($@) {
90 my $message = "ERROR: $@";
92 warn "ERROR: Failure in installer.pm\n";
93 warn "$message\n";
94 $exit_code = -1;
96 cleanup_on_error($message);
99 installer::logger::stoptime();
101 return $exit_code;
104 sub run {
105 installer::logger::print_message( "... checking environment variables ...\n" );
106 my $environmentvariableshashref = installer::control::check_system_environment();
108 installer::environment::set_global_environment_variables($environmentvariableshashref);
110 #################################
111 # Check and output of parameter
112 #################################
114 installer::parameter::saveparameter();
115 installer::parameter::getparameter();
117 installer::parameter::control_fundamental_parameter();
118 installer::parameter::setglobalvariables();
119 installer::parameter::control_required_parameter();
121 if (!($installer::globals::languages_defined_in_productlist)) { installer::languages::analyze_languagelist(); }
122 installer::parameter::outputparameter();
124 $installer::globals::build = uc($installer::globals::build); # using "SRC680" instead of "src680"
126 ######################################
127 # Creating the log directory
128 ######################################
130 my $empty = "";
131 my $loggingdir = installer::systemactions::create_directories("logging", \$empty);
132 $loggingdir = $loggingdir . $installer::globals::separator;
133 $installer::globals::exitlog = $loggingdir;
135 my $installdir = "";
136 my $currentdir = cwd();
137 my $shipinstalldir = "";
138 my $current_install_number = "";
140 ######################################
141 # Checking the system requirements
142 ######################################
144 installer::logger::print_message( "... checking required files ...\n" );
145 installer::control::check_system_path();
147 my $pathvariableshashref = installer::environment::create_pathvariables($environmentvariableshashref);
149 ###############################################
150 # Checking saved setting for Windows patches
151 ###############################################
153 if (( $installer::globals::iswindowsbuild ) && ( $installer::globals::prepare_winpatch )) { installer::windows::msiglobal::read_saved_mappings(); }
155 ###################################################
156 # Analyzing the settings and variables in zip.lst
157 ###################################################
159 my ($allsettingsarrayref, $allvariableshashref) = read_ziplist($installer::globals::ziplistname);
161 ########################################################
162 # Check if this is simple packaging mechanism
163 ########################################################
165 installer::simplepackage::check_simple_packager_project($allvariableshashref);
167 ####################################################################
168 # setting global variables
169 ####################################################################
171 installer::control::set_addsystemintegration($allvariableshashref);
173 ########################################################
174 # Re-define logging dir, after all variables are set
175 ########################################################
177 my $oldloggingdir = $loggingdir;
178 # FIXME: It would be better to use installer::systemactions::remove_complete_directory
179 # Though, we would need to remove only the lang-specific subdirectory for langpacks and helppacks
180 rmdir $oldloggingdir;
181 $loggingdir = installer::systemactions::create_directories("logging", \$empty);
182 $loggingdir = $loggingdir . $installer::globals::separator;
183 $installer::globals::exitlog = $loggingdir;
185 # checking, whether this is an opensource product
187 if (!($installer::globals::is_copy_only_project)) { installer::ziplist::set_manufacturer($allvariableshashref); }
189 ##############################################
190 # Checking version of makecab.exe
191 ##############################################
193 if ( $installer::globals::iswindowsbuild && (!defined($ENV{'CROSS_COMPILING'}) || $ENV{'CROSS_COMPILING'} ne 'TRUE' || $installer::globals::packageformat eq 'msi')) { installer::control::check_makecab_version(); }
195 ##########################################################
196 # Getting the include path from the settings in zip list
197 ##########################################################
199 my $includepathref = installer::ziplist::getinfofromziplist($allsettingsarrayref, "include");
200 if ( $$includepathref eq "" )
202 die 'Definition for "include" not found in ' . $installer::globals::ziplistname;
205 my $includepatharrayref = installer::converter::convert_stringlist_into_array($includepathref, ",");
207 installer::ziplist::replace_all_variables_in_paths($includepatharrayref, $pathvariableshashref);
209 installer::ziplist::replace_minor_in_paths($includepatharrayref);
211 installer::ziplist::replace_packagetype_in_paths($includepatharrayref);
213 installer::ziplist::resolve_relative_paths($includepatharrayref);
215 installer::ziplist::remove_ending_separator($includepatharrayref);
217 ##############################################
218 # Collecting all files from all include
219 # paths in global hashes.
220 ##############################################
222 installer::worker::collect_all_files_from_includepaths($includepatharrayref);
224 ##############################################
225 # Analyzing languages in zip.lst if required
226 # Probably no longer used.
227 ##############################################
229 if ($installer::globals::languages_defined_in_productlist) { installer::languages::get_info_about_languages($allsettingsarrayref); }
231 #####################################
232 # Windows requires the LCID list
233 #####################################
235 if ( $installer::globals::iswindowsbuild ) { installer::control::read_lcidlist($includepatharrayref); }
237 #####################################################################
238 # Including additional inc files for variable settings, if defined
239 #####################################################################
241 if ( $allvariableshashref->{'ADD_INCLUDE_FILES'} ) { installer::worker::add_variables_from_inc_to_hashref($allvariableshashref, $includepatharrayref); }
243 #####################################
244 # Analyzing the setup script
245 #####################################
247 if ($installer::globals::setupscript_defined_in_productlist) { installer::setupscript::set_setupscript_name($allsettingsarrayref, $includepatharrayref); }
249 installer::logger::globallog("setup script file: $installer::globals::setupscriptname");
251 installer::logger::print_message( "... analyzing script: $installer::globals::setupscriptname ... \n" );
253 my $setupscriptref = installer::files::read_file($installer::globals::setupscriptname); # Reading the setup script file
255 # Resolving variables defined in the zip list file into setup script
256 # All the variables are defined in $allvariablesarrayref
258 installer::scpzipfiles::replace_all_ziplistvariables_in_file($setupscriptref, $allvariableshashref);
260 # Resolving %variables defined in the installation object
262 my $allscriptvariablesref = installer::setupscript::get_all_scriptvariables_from_installation_object($setupscriptref);
264 installer::setupscript::add_lowercase_productname_setupscriptvariable($allscriptvariablesref);
266 installer::setupscript::resolve_lowercase_productname_setupscriptvariable($allscriptvariablesref);
268 $setupscriptref = installer::setupscript::replace_all_setupscriptvariables_in_script($setupscriptref, $allscriptvariablesref);
270 # Adding all variables defined in the installation object into the hash of all variables.
271 # This is needed if variables are defined in the installation object, but not in the zip list file.
272 # If there is a definition in the zip list file and in the installation object, the installation object is more important
274 installer::setupscript::add_installationobject_to_variables($allvariableshashref, $allscriptvariablesref);
276 # Replacing preset properties, not using the default mechanisms (for example for UNIXPRODUCTNAME)
277 installer::setupscript::replace_preset_properties($allvariableshashref);
279 installer::scpzipfiles::replace_all_ziplistvariables_in_file($setupscriptref, $allvariableshashref);
282 installer::logger::log_hashref($allvariableshashref);
284 installer::logger::print_message( "... analyzing directories ... \n" );
286 # Collect all directories in the script to get the destination dirs
288 my $dirsinproductarrayref = installer::setupscript::get_all_items_from_script($setupscriptref, "Directory");
290 if ( $allvariableshashref->{'SHIFT_BASIS_INTO_BRAND_LAYER'} ) { $dirsinproductarrayref = installer::scriptitems::shift_basis_directory_parents($dirsinproductarrayref); }
291 if ( $allvariableshashref->{'OFFICEDIRECTORYNAME'} ) { installer::scriptitems::set_officedirectory_name($dirsinproductarrayref, $allvariableshashref->{'OFFICEDIRECTORYNAME'}); }
294 installer::scriptitems::resolve_all_directory_names($dirsinproductarrayref);
296 installer::logger::print_message( "... analyzing files ... \n" );
298 my $filesinproductarrayref = installer::setupscript::get_all_items_from_script($setupscriptref, "File");
300 if (( ! $installer::globals::iswindowsbuild ) &&
301 ( ! $installer::globals::isrpmbuild ) &&
302 ( ! $installer::globals::isdebbuild ) &&
303 ( ! $installer::globals::issolarispkgbuild ) &&
304 ( $installer::globals::packageformat ne "installed" ) &&
305 ( $installer::globals::packageformat ne "dmg" ) &&
306 ( $installer::globals::packageformat ne "archive" ))
307 { installer::control::check_oxtfiles($filesinproductarrayref); }
309 if (! $installer::globals::languagepack)
311 $filesinproductarrayref = installer::scriptitems::remove_Languagepacklibraries_from_Installset($filesinproductarrayref);
314 if (! $installer::globals::helppack)
316 $filesinproductarrayref = installer::scriptitems::remove_Helppacklibraries_from_Installset($filesinproductarrayref);
319 installer::logger::print_message( "... analyzing scpactions ... \n" );
321 my $scpactionsinproductarrayref = installer::setupscript::get_all_items_from_script($setupscriptref, "ScpAction");
323 if ( $installer::globals::languagepack ) { installer::scriptitems::use_langpack_copy_scpaction($scpactionsinproductarrayref); }
324 elsif ( $installer::globals::helppack ) { installer::scriptitems::use_langpack_copy_scpaction($scpactionsinproductarrayref); }
325 # TODO: why is this not done in scp2 based on the value of $(ENABLE_RELEASE_BUILD)?
326 elsif ( $allvariableshashref->{'PRODUCTNAME'} eq "LibreOfficeDev" ) { installer::scriptitems::use_devversion_copy_scpaction($scpactionsinproductarrayref); }
328 installer::scriptitems::change_keys_of_scpactions($scpactionsinproductarrayref);
330 installer::logger::print_message( "... analyzing shortcuts ... \n" );
332 my $linksinproductarrayref = installer::setupscript::get_all_items_from_script($setupscriptref, "Shortcut");
334 installer::logger::print_message( "... analyzing unix links ... \n" );
336 my $unixlinksinproductarrayref = installer::setupscript::get_all_items_from_script($setupscriptref, "Unixlink");
338 installer::logger::print_message( "... analyzing profile ... \n" );
340 my $profilesinproductarrayref = installer::setupscript::get_all_items_from_script($setupscriptref, "Profile");
342 installer::logger::print_message( "... analyzing profileitems ... \n" );
344 my $profileitemsinproductarrayref = installer::setupscript::get_all_items_from_script($setupscriptref, "ProfileItem");
346 my $folderinproductarrayref;
347 my $folderitemsinproductarrayref;
348 my $folderitempropertiesinproductarrayref;
349 my $registryitemsinproductarrayref;
350 my $windowscustomactionsarrayref;
351 my $mergemodulesarrayref;
353 if ( $installer::globals::iswindowsbuild ) # Windows specific items: Folder, FolderItem, RegistryItem, WindowsCustomAction
355 installer::logger::print_message( "... analyzing folders ... \n" );
357 $folderinproductarrayref = installer::setupscript::get_all_items_from_script($setupscriptref, "Folder");
359 installer::logger::print_message( "... analyzing folderitems ... \n" );
361 $folderitemsinproductarrayref = installer::setupscript::get_all_items_from_script($setupscriptref, "FolderItem");
363 installer::setupscript::add_predefined_folder($folderitemsinproductarrayref, $folderinproductarrayref);
365 installer::logger::print_message( "... analyzing folderitemproperties ... \n" );
367 $folderitempropertiesinproductarrayref = installer::setupscript::get_all_items_from_script($setupscriptref, "FolderItemProperty");
369 installer::setupscript::prepare_non_advertised_files($folderitemsinproductarrayref, $filesinproductarrayref);
371 installer::logger::print_message( "... analyzing registryitems ... \n" );
373 $registryitemsinproductarrayref = installer::setupscript::get_all_items_from_script($setupscriptref, "RegistryItem");
375 $registryitemsinproductarrayref = installer::scriptitems::remove_uninstall_regitems_from_script($registryitemsinproductarrayref);
377 installer::logger::print_message( "... analyzing Windows custom actions ... \n" );
379 $windowscustomactionsarrayref = installer::setupscript::get_all_items_from_script($setupscriptref, "WindowsCustomAction");
381 installer::logger::print_message( "... analyzing Windows merge modules ... \n" );
383 $mergemodulesarrayref = installer::setupscript::get_all_items_from_script($setupscriptref, "MergeModule");
386 my $modulesinproductarrayref;
388 if (!($installer::globals::is_copy_only_project))
390 installer::logger::print_message( "... analyzing modules ... \n" );
392 $modulesinproductarrayref = installer::setupscript::get_all_items_from_script($setupscriptref, "Module");
394 installer::scriptitems::resolve_assigned_modules($modulesinproductarrayref);
396 $modulesinproductarrayref = installer::scriptitems::remove_template_modules($modulesinproductarrayref);
398 installer::scriptitems::set_children_flag($modulesinproductarrayref);
400 installer::scriptitems::collect_all_languagemodules($modulesinproductarrayref);
402 # Assigning the modules to the items
404 installer::scriptitems::assigning_modules_to_items($modulesinproductarrayref, $filesinproductarrayref, "Files");
406 installer::scriptitems::assigning_modules_to_items($modulesinproductarrayref, $unixlinksinproductarrayref, "Unixlinks");
408 installer::scriptitems::assigning_modules_to_items($modulesinproductarrayref, $dirsinproductarrayref, "Dirs");
411 #################################################
412 # Part 1b: The language dependent part
413 # (still platform independent)
414 #################################################
416 # Now starts the language dependent part, if more than one product is defined on the command line
417 # Example -l en-US,de#es,fr,it defines two multilingual products
419 ###############################################################################
420 # Beginning of language dependent part
421 # The for iterates over all products, separated by an # in the language list
422 ###############################################################################
424 for ( my $n = 0; $n <= $#installer::globals::languageproducts; $n++ )
426 my $languagesarrayref = installer::languages::get_all_languages_for_one_product($installer::globals::languageproducts[$n], $allvariableshashref);
427 my @setuplanguagesarray = @{ $languagesarrayref };
429 my $languagestringref = installer::languages::get_language_string($languagesarrayref);
430 installer::logger::print_message( "------------------------------------\n" );
431 installer::logger::print_message( "... languages $$languagestringref ... \n" );
433 if ( $installer::globals::languagepack )
435 $installer::globals::addsystemintegration = 0;
436 $installer::globals::addlicensefile = 0;
437 $installer::globals::makedownload = 1;
440 if ( $installer::globals::helppack )
442 $installer::globals::addsystemintegration = 0;
443 $installer::globals::addlicensefile = 0;
444 $installer::globals::makedownload = 1;
445 @setuplanguagesarray = grep { $_ ne "en-US" } @setuplanguagesarray;
446 unshift(@setuplanguagesarray, "en-US");
449 ############################################################
450 # Beginning of language specific logging mechanism
451 # Until now only global logging into default: logfile.txt
452 ############################################################
454 @installer::globals::logfileinfo = (); # new logfile array and new logfile name
455 installer::logger::copy_globalinfo_into_logfile();
457 my $loglanguagestring = $$languagestringref;
458 my $loglanguagestring_orig = $loglanguagestring;
459 if (length($loglanguagestring) > $installer::globals::max_lang_length)
461 my $number_of_languages = installer::systemactions::get_number_of_langs($loglanguagestring);
462 #replace this in the same it was done in installer/windows/directory.pm
463 #chomp(my $shorter = `echo $loglanguagestring | $ENV{'MD5SUM'} | sed -e "s/ .*//g"`);
464 #my $id = substr($shorter, 0, 8); # taking only the first 8 digits
465 my $id = installer::windows::msiglobal::calculate_id($loglanguagestring, 8); # taking only the first 8 digits
466 $loglanguagestring = "lang_" . $number_of_languages . "_id_" . $id;
469 $installer::globals::logfilename = "log_" . $installer::globals::build;
470 $installer::globals::logfilename .= "_" . $loglanguagestring;
471 $installer::globals::logfilename .= ".log";
472 $loggingdir = $loggingdir . $loglanguagestring . $installer::globals::separator;
473 installer::systemactions::create_directory($loggingdir);
475 if ($loglanguagestring ne $loglanguagestring_orig) {
476 (my $dir = $loggingdir) =~ s!/$!!;
477 open(my $F1, "> $dir.dir");
478 open(my $F2, "> " . $loggingdir . $installer::globals::logfilename . '.file');
479 my @s = map { "$_\n" } split('_', $loglanguagestring_orig);
480 print $F1 @s;
481 print $F2 @s;
484 $installer::globals::exitlog = $loggingdir;
486 ###################################################################
487 # Reading an existing msi database, to prepare update and patch
488 ###################################################################
490 my $refdatabase = "";
491 my $uniquefilename = "";
492 my $revuniquefilename = "";
493 my $revshortfilename = "";
494 my $allupdatesequences = "";
495 my $allupdatecomponents = "";
496 my $allupdatefileorder = "";
497 my $allupdatecomponentorder = "";
498 my $shortdirname = "";
499 my $componentid = "";
500 my $componentidkeypath = "";
501 my $alloldproperties = "";
502 my $allupdatelastsequences = "";
503 my $allupdatediskids = "";
505 if ( $installer::globals::packageformat eq 'msi' )
507 if ( $allvariableshashref->{'UPDATE_DATABASE'} )
509 installer::logger::print_message( "... analyzing update database ...\n" );
510 $refdatabase = installer::windows::update::readdatabase($allvariableshashref, $languagestringref, $includepatharrayref);
512 if ( $installer::globals::updatedatabase )
514 ($uniquefilename, $revuniquefilename, $revshortfilename, $allupdatesequences, $allupdatecomponents, $allupdatefileorder, $allupdatecomponentorder, $shortdirname, $componentid, $componentidkeypath, $alloldproperties, $allupdatelastsequences, $allupdatediskids) = installer::windows::update::create_database_hashes($refdatabase);
518 # Always analyze the merge module.
519 # We need to investigate the directory table in merge module to emit
520 # custom action for directory names that start with standard prefix
521 if ( $mergemodulesarrayref > -1 ) {
522 installer::windows::update::readmergedatabase($mergemodulesarrayref, $languagestringref, $includepatharrayref);
526 ##############################################
527 # Setting global code variables for Windows
528 ##############################################
530 if (!($installer::globals::is_copy_only_project))
532 if ((( $installer::globals::iswindowsbuild ) && ( $installer::globals::packageformat ne "archive" ) && ( $installer::globals::packageformat ne "installed" ) ) || $installer::globals::packageformat eq 'msi' )
534 installer::windows::msiglobal::set_global_code_variables($languagesarrayref, $languagestringref, $allvariableshashref, $alloldproperties);
538 ################################################
539 # Resolving include paths (language dependent)
540 ################################################
542 my $includepatharrayref_lang = installer::ziplist::replace_languages_in_paths($includepatharrayref, \@setuplanguagesarray);
544 if ( $installer::globals::refresh_includepaths ) { installer::worker::collect_all_files_from_includepaths($includepatharrayref_lang); }
546 installer::ziplist::list_all_files_from_include_path($includepatharrayref_lang);
548 ##############################################
549 # Analyzing spellchecker languages
550 ##############################################
552 if ( $allvariableshashref->{'SPELLCHECKERFILE'} ) { installer::worker::set_spellcheckerlanguages($languagesarrayref, $allvariableshashref); }
554 #####################################
555 # Language dependent directory part
556 #####################################
558 my $dirsinproductlanguageresolvedarrayref = installer::scriptitems::resolving_all_languages_in_productlists($dirsinproductarrayref, $languagesarrayref);
560 # A new directory array is needed ($dirsinproductlanguageresolvedarrayref instead of $dirsinproductarrayref)
561 # because $dirsinproductarrayref is needed in get_Destination_Directory_For_Item_From_Directorylist
563 installer::scriptitems::changing_name_of_language_dependent_keys($dirsinproductlanguageresolvedarrayref);
565 installer::scriptitems::checking_directories_with_corrupt_hostname($dirsinproductlanguageresolvedarrayref, $languagesarrayref);
567 installer::scriptitems::set_global_directory_hostnames($dirsinproductlanguageresolvedarrayref, $allvariableshashref);
569 #####################################
570 # files part, language dependent
571 #####################################
573 installer::logger::print_message( "... analyzing files ...\n" );
575 my $filesinproductlanguageresolvedarrayref = installer::scriptitems::resolving_all_languages_in_productlists($filesinproductarrayref, $languagesarrayref);
577 if ( ! $installer::globals::set_office_start_language )
579 $filesinproductlanguageresolvedarrayref = installer::scriptitems::remove_office_start_language_files($filesinproductlanguageresolvedarrayref);
582 installer::scriptitems::changing_name_of_language_dependent_keys($filesinproductlanguageresolvedarrayref);
584 if ( $installer::globals::iswin and $^O =~ /MSWin/i ) { installer::converter::convert_slash_to_backslash($filesinproductlanguageresolvedarrayref); }
586 $filesinproductlanguageresolvedarrayref = installer::scriptitems::remove_non_existent_languages_in_productlists($filesinproductlanguageresolvedarrayref, $languagestringref, "Name", "file");
588 installer::scriptitems::get_Destination_Directory_For_Item_From_Directorylist($filesinproductlanguageresolvedarrayref, $dirsinproductarrayref);
590 installer::scriptitems::get_Source_Directory_For_Files_From_Includepathlist($filesinproductlanguageresolvedarrayref, $includepatharrayref_lang, $dirsinproductlanguageresolvedarrayref, "Files", $allvariableshashref);
592 $filesinproductlanguageresolvedarrayref = installer::scriptitems::remove_Files_Without_Sourcedirectory($filesinproductlanguageresolvedarrayref);
594 if ($installer::globals::languagepack)
596 $filesinproductlanguageresolvedarrayref = installer::scriptitems::remove_Files_For_Languagepacks($filesinproductlanguageresolvedarrayref);
599 if ( ! $allvariableshashref->{'NO_README_IN_ROOTDIR'} )
601 $filesinproductlanguageresolvedarrayref = installer::scriptitems::add_License_Files_into_Installdir($filesinproductlanguageresolvedarrayref, $dirsinproductlanguageresolvedarrayref, $languagesarrayref);
604 installer::scriptitems::make_filename_language_specific($filesinproductlanguageresolvedarrayref);
606 ######################################################################################
607 # Processing files with flag FILELIST and putting listed files into the file list
608 ######################################################################################
610 installer::logger::print_message( "... analyzing files with flag FILELIST ...\n" );
612 ($filesinproductlanguageresolvedarrayref, $unixlinksinproductarrayref) = installer::filelists::resolve_filelist_flag($filesinproductlanguageresolvedarrayref, $unixlinksinproductarrayref, $ENV{'INSTDIR'});
614 # packed files sometimes contain a "$" in their name: HighlightText$1.class. For epm the "$" has to be quoted by "$$"
616 if (!( $installer::globals::iswindowsbuild || $installer::globals::simple ) )
618 installer::scriptitems::quoting_illegal_filenames($filesinproductlanguageresolvedarrayref);
621 #####################################
622 # Files with flag SCPZIP_REPLACE
623 #####################################
625 installer::logger::print_message( "... analyzing files with flag SCPZIP_REPLACE ...\n" );
627 # Editing files with flag SCPZIP_REPLACE.
629 installer::scpzipfiles::resolving_scpzip_replace_flag($filesinproductlanguageresolvedarrayref, $allvariableshashref, "File", $languagestringref);
631 #########################################################
632 # language dependent unix links part
633 #########################################################
635 installer::logger::print_message( "... analyzing unix links ...\n" );
637 my $unixlinksinproductlanguageresolvedarrayref = installer::scriptitems::resolving_all_languages_in_productlists($unixlinksinproductarrayref, $languagesarrayref);
639 installer::scriptitems::changing_name_of_language_dependent_keys($unixlinksinproductlanguageresolvedarrayref);
641 installer::scriptitems::get_Destination_Directory_For_Item_From_Directorylist($unixlinksinproductlanguageresolvedarrayref, $dirsinproductarrayref);
643 ############################################
644 # Collecting directories for epm list file
645 ############################################
647 installer::logger::print_message( "... analyzing all directories for this product ...\n" );
649 # There are two ways for a directory to be included into the epm directory list:
650 # 1. Looking for all destination paths in the files array
651 # 2. Looking for directories with CREATE flag in the directory array
652 # Advantage: Many paths are hidden in zip files, they are not defined in the setup script.
653 # It will be possible, that in the setup script only those directories have to be defined,
654 # that have a CREATE flag. All other directories are created, if they contain at least one file.
656 my $alldirectoryhash = installer::scriptitems::collect_directories_from_filesarray($filesinproductlanguageresolvedarrayref, $unixlinksinproductlanguageresolvedarrayref);
657 my $directoriesforepmarrayref = installer::scriptitems::collect_directories_with_create_flag_from_directoryarray($dirsinproductlanguageresolvedarrayref, $alldirectoryhash);
659 #########################################################
660 # language dependent scpactions part
661 #########################################################
663 my $scpactionsinproductlanguageresolvedarrayref = installer::scriptitems::resolving_all_languages_in_productlists($scpactionsinproductarrayref, $languagesarrayref);
665 installer::scriptitems::changing_name_of_language_dependent_keys($scpactionsinproductlanguageresolvedarrayref);
667 installer::scriptitems::get_Source_Directory_For_Files_From_Includepathlist($scpactionsinproductlanguageresolvedarrayref, $includepatharrayref_lang, $dirsinproductlanguageresolvedarrayref, "ScpActions", $allvariableshashref);
669 # Editing scpactions with flag SCPZIP_REPLACE.
671 installer::scpzipfiles::resolving_scpzip_replace_flag($scpactionsinproductlanguageresolvedarrayref, $allvariableshashref, "ScpAction", $languagestringref);
673 #########################################################
674 # language dependent links part
675 #########################################################
677 installer::logger::print_message( "... analyzing links ...\n" );
679 my $linksinproductlanguageresolvedarrayref = installer::scriptitems::resolving_all_languages_in_productlists($linksinproductarrayref, $languagesarrayref);
681 installer::scriptitems::changing_name_of_language_dependent_keys($linksinproductlanguageresolvedarrayref);
683 installer::scriptitems::get_destination_file_path_for_links($linksinproductlanguageresolvedarrayref, $filesinproductlanguageresolvedarrayref);
685 installer::scriptitems::get_Destination_Directory_For_Item_From_Directorylist($linksinproductlanguageresolvedarrayref, $dirsinproductarrayref);
687 # Now taking all links that have no FileID but a ShortcutID, linking to another link
689 installer::scriptitems::get_destination_link_path_for_links($linksinproductlanguageresolvedarrayref);
691 $linksinproductlanguageresolvedarrayref = installer::scriptitems::remove_workstation_only_items($linksinproductlanguageresolvedarrayref);
693 installer::scriptitems::resolve_links_with_flag_relative($linksinproductlanguageresolvedarrayref);
695 #########################################################
696 # language dependent part for profiles and profileitems
697 #########################################################
699 my $profilesinproductlanguageresolvedarrayref;
700 my $profileitemsinproductlanguageresolvedarrayref;
702 if ((!($installer::globals::is_copy_only_project)) && (!($installer::globals::languagepack)) && (!($installer::globals::helppack)))
704 installer::logger::print_message( "... creating profiles ...\n" );
706 $profilesinproductlanguageresolvedarrayref = installer::scriptitems::resolving_all_languages_in_productlists($profilesinproductarrayref, $languagesarrayref);
708 $profileitemsinproductlanguageresolvedarrayref = installer::scriptitems::resolving_all_languages_in_productlists($profileitemsinproductarrayref, $languagesarrayref);
710 installer::scriptitems::changing_name_of_language_dependent_keys($profilesinproductlanguageresolvedarrayref);
712 installer::scriptitems::changing_name_of_language_dependent_keys($profileitemsinproductlanguageresolvedarrayref);
714 installer::scriptitems::replace_setup_variables($profileitemsinproductlanguageresolvedarrayref, $languagestringref, $allvariableshashref);
716 # Note that patch_user_dir is not related to the killed
717 # ancient (not MSP) "patch" thing, I think.
718 if ( $installer::globals::patch_user_dir )
720 installer::scriptitems::replace_userdir_variable($profileitemsinproductlanguageresolvedarrayref, $allvariableshashref);
723 installer::scriptitems::get_Destination_Directory_For_Item_From_Directorylist($profilesinproductlanguageresolvedarrayref, $dirsinproductarrayref);
725 # Now the Profiles can be created
727 installer::profiles::create_profiles($profilesinproductlanguageresolvedarrayref, $profileitemsinproductlanguageresolvedarrayref, $filesinproductlanguageresolvedarrayref, $languagestringref, $allvariableshashref);
730 my $registryitemsinproductlanguageresolvedarrayref; # cannot be defined in the following "if ( $installer::globals::iswindowsbuild )"
731 my $folderinproductlanguageresolvedarrayref; # cannot be defined in the following "if ( $installer::globals::iswindowsbuild )"
732 my $folderitemsinproductlanguageresolvedarrayref; # cannot be defined in the following "if ( $installer::globals::iswindowsbuild )"
734 if ( $installer::globals::iswindowsbuild ) # Windows specific items: Folder, FolderItem, RegistryItem
736 #########################################################
737 # language dependent part for folder
738 #########################################################
740 installer::logger::print_message( "... analyzing folder ...\n" );
742 $folderinproductlanguageresolvedarrayref = installer::scriptitems::resolving_all_languages_in_productlists($folderinproductarrayref, $languagesarrayref);
744 installer::scriptitems::changing_name_of_language_dependent_keys($folderinproductlanguageresolvedarrayref);
746 #########################################################
747 # language dependent part for folderitems
748 #########################################################
750 installer::logger::print_message( "... analyzing folderitems ...\n" );
752 $folderitemsinproductlanguageresolvedarrayref = installer::scriptitems::resolving_all_languages_in_productlists($folderitemsinproductarrayref, $languagesarrayref);
754 installer::scriptitems::changing_name_of_language_dependent_keys($folderitemsinproductlanguageresolvedarrayref);
756 #########################################################
757 # language dependent part for registryitems
758 #########################################################
760 installer::logger::print_message( "... analyzing registryitems ...\n" );
762 $registryitemsinproductlanguageresolvedarrayref = installer::scriptitems::resolving_all_languages_in_productlists($registryitemsinproductarrayref, $languagesarrayref);
764 installer::scriptitems::changing_name_of_language_dependent_keys($registryitemsinproductlanguageresolvedarrayref);
767 #########################################################
768 # language dependent part for modules
769 #########################################################
771 my $modulesinproductlanguageresolvedarrayref;
773 if (!($installer::globals::is_copy_only_project))
775 installer::logger::print_message( "... analyzing modules ...\n" );
777 $modulesinproductlanguageresolvedarrayref = installer::scriptitems::resolving_all_languages_in_productlists($modulesinproductarrayref, $languagesarrayref);
779 $modulesinproductlanguageresolvedarrayref = installer::scriptitems::remove_not_required_language_modules($modulesinproductlanguageresolvedarrayref, $languagesarrayref);
781 if ( $installer::globals::analyze_spellcheckerlanguage )
783 $modulesinproductlanguageresolvedarrayref = installer::scriptitems::remove_not_required_spellcheckerlanguage_modules($modulesinproductlanguageresolvedarrayref);
785 $filesinproductlanguageresolvedarrayref = installer::scriptitems::remove_not_required_spellcheckerlanguage_files($filesinproductlanguageresolvedarrayref);
786 $directoriesforepmarrayref = installer::scriptitems::remove_not_required_spellcheckerlanguage_files($directoriesforepmarrayref);
789 installer::scriptitems::changing_name_of_language_dependent_keys($modulesinproductlanguageresolvedarrayref);
791 installer::scriptitems::select_required_language_strings($modulesinproductlanguageresolvedarrayref); # using english strings
795 # Copy-only projects can now start to copy all items File and ScpAction
796 if ( $installer::globals::is_copy_only_project ) { installer::copyproject::copy_project($filesinproductlanguageresolvedarrayref, $scpactionsinproductlanguageresolvedarrayref, $loggingdir, $languagestringref, $shipinstalldir, $allsettingsarrayref); }
798 # Language pack projects can now start to select the required information
799 if ( $installer::globals::languagepack )
801 $filesinproductlanguageresolvedarrayref = installer::languagepack::select_language_items($filesinproductlanguageresolvedarrayref, $languagesarrayref, "File");
802 $scpactionsinproductlanguageresolvedarrayref = installer::languagepack::select_language_items($scpactionsinproductlanguageresolvedarrayref, $languagesarrayref, "ScpAction");
803 $linksinproductlanguageresolvedarrayref = installer::languagepack::select_language_items($linksinproductlanguageresolvedarrayref, $languagesarrayref, "Shortcut");
804 $unixlinksinproductlanguageresolvedarrayref = installer::languagepack::select_language_items($unixlinksinproductlanguageresolvedarrayref, $languagesarrayref, "Unixlink");
805 @{$folderitemsinproductlanguageresolvedarrayref} = (); # no folderitems in languagepacks
807 # Collecting the directories again, to include only the language specific directories
808 $alldirectoryhash = installer::scriptitems::collect_directories_from_filesarray($filesinproductlanguageresolvedarrayref, $unixlinksinproductlanguageresolvedarrayref);
809 $directoriesforepmarrayref = installer::scriptitems::collect_directories_with_create_flag_from_directoryarray($dirsinproductlanguageresolvedarrayref, $alldirectoryhash);
810 @$directoriesforepmarrayref = sort { $a->{"HostName"} cmp $b->{"HostName"} } @$directoriesforepmarrayref;
812 if ( $installer::globals::iswindowsbuild )
814 $registryitemsinproductlanguageresolvedarrayref = installer::worker::select_langpack_items($registryitemsinproductlanguageresolvedarrayref, "RegistryItem");
819 # Help pack projects can now start to select the required information
820 if ( $installer::globals::helppack )
822 $filesinproductlanguageresolvedarrayref = installer::helppack::select_help_items($filesinproductlanguageresolvedarrayref, $languagesarrayref, "File");
823 $scpactionsinproductlanguageresolvedarrayref = installer::helppack::select_help_items($scpactionsinproductlanguageresolvedarrayref, $languagesarrayref, "ScpAction");
824 $linksinproductlanguageresolvedarrayref = installer::helppack::select_help_items($linksinproductlanguageresolvedarrayref, $languagesarrayref, "Shortcut");
825 $unixlinksinproductlanguageresolvedarrayref = installer::helppack::select_help_items($unixlinksinproductlanguageresolvedarrayref, $languagesarrayref, "Unixlink");
826 @{$folderitemsinproductlanguageresolvedarrayref} = (); # no folderitems in helppacks
828 # Collecting the directories again, to include only the language specific directories
829 $alldirectoryhash = installer::scriptitems::collect_directories_from_filesarray($filesinproductlanguageresolvedarrayref, $unixlinksinproductlanguageresolvedarrayref);
830 $directoriesforepmarrayref = installer::scriptitems::collect_directories_with_create_flag_from_directoryarray($dirsinproductlanguageresolvedarrayref, $alldirectoryhash);
831 @$directoriesforepmarrayref = sort { $a->{"HostName"} cmp $b->{"HostName"} } @$directoriesforepmarrayref;
833 if ( $installer::globals::iswindowsbuild )
835 $registryitemsinproductlanguageresolvedarrayref = installer::worker::select_helppack_items($registryitemsinproductlanguageresolvedarrayref, "RegistryItem");
840 #########################################################
841 # Collecting all scp actions
842 #########################################################
844 installer::worker::collect_scpactions($scpactionsinproductlanguageresolvedarrayref);
846 ###########################################################
847 # Simple package projects can now start to create the
848 # installation structure by creating Directories, Files
849 # Links and ScpActions. This is the last platform
850 # independent part.
851 ###########################################################
853 if ( $installer::globals::is_simple_packager_project )
855 installer::simplepackage::create_simple_package($filesinproductlanguageresolvedarrayref, $directoriesforepmarrayref, $scpactionsinproductlanguageresolvedarrayref, $linksinproductlanguageresolvedarrayref, $unixlinksinproductlanguageresolvedarrayref, $loggingdir, $languagestringref, $shipinstalldir, $allsettingsarrayref, $allvariableshashref, $includepatharrayref);
856 next; # ! leaving the current loop, because no further packaging required.
859 ###########################################################
860 # Analyzing the package structure
861 ###########################################################
863 installer::logger::print_message( "... analyzing package list ...\n" );
865 my $packages = installer::packagelist::collectpackages($modulesinproductlanguageresolvedarrayref, $languagesarrayref);
866 installer::packagelist::check_packagelist($packages);
868 $packages = installer::packagelist::analyze_list($packages, $modulesinproductlanguageresolvedarrayref);
869 installer::packagelist::remove_multiple_modules_packages($packages);
871 # printing packages content:
872 installer::packagelist::log_packages_content($packages);
873 installer::packagelist::create_module_destination_hash($packages, $allvariableshashref);
875 #################################################
876 # Part 2: The platform dependent part
877 #################################################
879 #################################################
880 # Part 2a: All non-Windows platforms
881 #################################################
883 #########################################################
884 # ... creating epm list file ...
885 # Only for non-Windows platforms
886 #########################################################
888 if (!( $installer::globals::iswindowsbuild ))
890 ####################################################
891 # Writing log file before packages are packed
892 ####################################################
894 installer::logger::print_message( "... creating log file " . $loggingdir . $installer::globals::logfilename . "\n" );
895 installer::files::save_file($loggingdir . $installer::globals::logfilename, \@installer::globals::logfileinfo);
897 ####################################################
898 # Creating directories
899 ####################################################
901 installer::download::set_download_filename($languagestringref, $allvariableshashref);
903 $installdir = installer::worker::create_installation_directory($shipinstalldir, $languagestringref, \$current_install_number);
905 my $listfiledir = installer::systemactions::create_directories("listfile", $languagestringref);
906 my $installlogdir = installer::systemactions::create_directory_next_to_directory($installdir, "log");
908 ####################################################
909 # Reading for Solaris all package descriptions
910 # from file defined in property PACKAGEMAP
911 ####################################################
913 if ( $installer::globals::issolarisbuild ) { installer::epmfile::read_packagemap($allvariableshashref, $includepatharrayref, $languagesarrayref); }
915 ###########################################
916 # Checking epm state
917 ###########################################
919 my $epmexecutable = "";
920 if ( $installer::globals::call_epm )
922 $epmexecutable = installer::epmfile::find_epm_on_system($includepatharrayref);
923 installer::epmfile::set_patch_state($epmexecutable); # setting $installer::globals::is_special_epm
926 # shuffle array to reduce parallel packaging process in pool
927 @{$packages} = shuffle @{$packages}
928 unless $installer::globals::simple;
930 # iterating over all packages
931 for my $onepackage ( @{$packages} )
933 # checking, if this is a language pack or a project pack.
934 # Creating language packs only, if $installer::globals::languagepack is set. Parameter: -languagepack
936 if ( $installer::globals::languagepack ) { installer::languagepack::replace_languagestring_variable($onepackage, $languagestringref); }
938 # checking, if this is a help pack
939 # Creating help packs only, if $installer::globals::helppack is set. Parameter: -helppack
941 if ( $installer::globals::helppack ) { installer::helppack::replace_languagestring_variable($onepackage, $languagestringref); }
943 my $onepackagename = $onepackage->{'module'}; # name of the top module (required)
945 my $shellscriptsfilename = "";
946 if ( $onepackage->{'script'} ) { $shellscriptsfilename = $onepackage->{'script'}; }
948 ###########################
949 # package name
950 ###########################
952 my $packagename = "";
954 if ( $installer::globals::issolarisbuild ) # only for Solaris
956 if ( $onepackage->{'solarispackagename'} ) { $packagename = $onepackage->{'solarispackagename'}; }
958 else # not Solaris
960 if ( $onepackage->{'packagename'} ) { $packagename = $onepackage->{'packagename'}; }
963 if (!($packagename eq ""))
965 installer::packagelist::resolve_packagevariables(\$packagename, $allvariableshashref, 0);
968 # Debian allows no underline in package name
969 if ( $installer::globals::debian ) { $packagename =~ s/_/-/g; }
971 ####################################################
972 # Header for this package into log file
973 ####################################################
975 installer::logger::include_header_into_logfile("Creating package: $packagename");
977 ###########################################
978 # Root path, can be defined as parameter
979 ###########################################
981 my $packagerootpath = "";
983 if ($installer::globals::rootpath eq "")
985 $packagerootpath = $onepackage->{'destpath'};
986 installer::packagelist::resolve_packagevariables(\$packagerootpath, $allvariableshashref, 1);
987 # we put branding and common stuff into the same prefix on unixes => $packagerootpath must be the whole prefix, including the product name
988 if ($installer::globals::isunix) { $packagerootpath .= "/$allvariableshashref->{'UNIXBASISROOTNAME'}"; }
989 if ( $^O =~ /darwin/i ) { $packagerootpath =~ s/\/opt\//\/Applications\//; }
991 else
993 $packagerootpath = $installer::globals::rootpath;
996 #################################
997 # collecting items for package
998 #################################
1000 my $filesinpackage = installer::packagelist::find_files_for_package($filesinproductlanguageresolvedarrayref, $onepackage);
1001 my $unixlinksinpackage = installer::packagelist::find_files_for_package($unixlinksinproductlanguageresolvedarrayref, $onepackage);
1002 my $linksinpackage = installer::packagelist::find_links_for_package($linksinproductlanguageresolvedarrayref, $onepackage);
1003 my $dirsinpackage = installer::packagelist::find_dirs_for_package($directoriesforepmarrayref, $onepackage);
1005 #############################################
1006 # copying the collectors for each package
1007 #############################################
1009 $filesinpackage = installer::converter::copy_collector($filesinpackage);
1010 $linksinpackage = installer::converter::copy_collector($linksinpackage);
1011 $unixlinksinpackage = installer::converter::copy_collector($unixlinksinpackage);
1012 $dirsinpackage = installer::converter::copy_collector($dirsinpackage);
1014 ###########################################
1015 # setting the root path for the packages
1016 ###########################################
1018 installer::scriptitems::add_rootpath_to_directories($dirsinpackage, $packagerootpath);
1019 installer::scriptitems::add_rootpath_to_files($filesinpackage, $packagerootpath);
1020 installer::scriptitems::add_rootpath_to_links($linksinpackage, $packagerootpath);
1021 installer::scriptitems::add_rootpath_to_files($unixlinksinpackage, $packagerootpath);
1023 ###############################################
1024 # nothing to do, if $filesinpackage is empty
1025 ###############################################
1027 if ( ! ( $#{$filesinpackage} > -1 ))
1029 my $infoline = "\n\nNo file in package: $packagename \-\> Skipping\n\n";
1030 push(@installer::globals::logfileinfo, $infoline);
1031 next; # next package, end of loop !
1034 ###########################################
1035 # Stripping libraries
1036 ###########################################
1038 # Building for non Windows platforms in cws requires, that all files are stripped before packaging:
1039 # 1. copy all files that need to be stripped locally
1040 # 2. strip all these files
1042 if ( $installer::globals::strip )
1044 strip_libraries($filesinpackage, $languagestringref);
1047 if ( $installer::globals::simple ) {
1048 installer::worker::install_simple($onepackagename, $$languagestringref, $dirsinpackage, $filesinpackage, $linksinpackage, $unixlinksinpackage);
1050 else {
1051 # epm list file format:
1052 # type mode owner group destination source options
1053 # Example for a file: f 755 root sys /usr/bin/foo foo
1054 # Example for a directory: d 755 root sys /var/spool/foo -
1055 # Example for a link: l 000 root sys /usr/bin/linkname filename
1056 # The source field specifies the file to link to
1058 my $epmfilename = "epm_" . $onepackagename . ".lst";
1060 installer::logger::print_message( "... creating epm list file $epmfilename ... \n" );
1062 my $completeepmfilename = $listfiledir . $installer::globals::separator . $epmfilename;
1064 my @epmfile = ();
1066 my $epmheaderref = installer::epmfile::create_epm_header($allvariableshashref, $filesinproductlanguageresolvedarrayref, $languagesarrayref, $onepackage);
1067 installer::epmfile::adding_header_to_epm_file(\@epmfile, $epmheaderref);
1069 # adding directories, files and links into epm file
1071 installer::epmfile::put_directories_into_epmfile($dirsinpackage, \@epmfile, $allvariableshashref, $packagerootpath);
1072 installer::epmfile::put_files_into_epmfile($filesinpackage, \@epmfile );
1073 installer::epmfile::put_links_into_epmfile($linksinpackage, \@epmfile );
1074 installer::epmfile::put_unixlinks_into_epmfile($unixlinksinpackage, \@epmfile );
1076 if ((!( $shellscriptsfilename eq "" )) && (!($installer::globals::iswindowsbuild))) { installer::epmfile::adding_shellscripts_to_epm_file(\@epmfile, $shellscriptsfilename, $packagerootpath, $allvariableshashref, $filesinpackage); }
1078 installer::files::save_file($completeepmfilename ,\@epmfile);
1080 # ... splitting the rootpath into a relocatable part and a static part, if possible
1082 my $staticpath = "";
1083 my $relocatablepath = "";
1084 # relocatable path can be defined in package list
1085 if ( $onepackage->{'relocatablepath'} ) { $relocatablepath = $onepackage->{'relocatablepath'}; }
1086 # setting fix part and variable part of destination path
1087 installer::epmfile::analyze_rootpath($packagerootpath, \$staticpath, \$relocatablepath, $allvariableshashref);
1089 # ... replacing the variable PRODUCTDIRECTORYNAME in the shellscriptfile by $staticpath
1091 installer::epmfile::resolve_path_in_epm_list_before_packaging(\@epmfile, $completeepmfilename, "PRODUCTDIRECTORYNAME", $staticpath);
1092 installer::epmfile::resolve_path_in_epm_list_before_packaging(\@epmfile, $completeepmfilename, "SOLSUREPACKAGEPREFIX", $allvariableshashref->{'SOLSUREPACKAGEPREFIX'});
1093 installer::epmfile::resolve_path_in_epm_list_before_packaging(\@epmfile, $completeepmfilename, "UREPACKAGEPREFIX", $allvariableshashref->{'UREPACKAGEPREFIX'});
1094 installer::files::save_file($completeepmfilename ,\@epmfile);
1097 # changing into the "install" directory to create installation sets
1099 $currentdir = cwd(); # $currentdir is global in this file
1101 chdir($installdir); # changing into install directory ($installdir is global in this file)
1103 ###########################################
1104 # Starting epm
1105 ###########################################
1107 # With a patched epm, it is now possible to set the relocatable directory, change
1108 # the directory in which the packages are created, setting "requires" and "provides"
1109 # (Linux) or creating the "depend" file (Solaris) and finally to begin
1110 # the packaging process with standard tooling and standard parameter
1111 # Linux: Adding into the spec file: Prefix: /opt
1112 # Solaris: Adding into the pkginfo file: BASEDIR=/opt
1113 # Attention: Changing of the path can influence the shell scripts
1115 if (( $installer::globals::is_special_epm ) && ( ($installer::globals::isrpmbuild) || ($installer::globals::issolarispkgbuild) )) # special handling only for Linux RPMs and Solaris Packages
1117 if ( $installer::globals::call_epm ) # only do something, if epm is really executed
1119 # ... now epm can be started, to create the installation sets
1121 installer::logger::print_message( "... starting patched epm ... \n" );
1123 installer::epmfile::call_epm($epmexecutable, $completeepmfilename, $packagename, $includepatharrayref);
1125 my $newepmdir = installer::epmfile::prepare_packages($loggingdir, $packagename, $staticpath, $relocatablepath, $onepackage, $allvariableshashref, $filesinpackage, $languagestringref); # adding the line for Prefix / Basedir, include rpmdir
1127 installer::epmfile::create_packages_without_epm($newepmdir, $packagename, $includepatharrayref, $allvariableshashref, $languagestringref); # start to package
1129 # finally removing all temporary files
1131 installer::epmfile::remove_temporary_epm_files($newepmdir, $loggingdir, $packagename);
1133 # Installation:
1134 # Install: pkgadd -a myAdminfile -d ./SUNWso8m34.pkg
1135 # Install: rpm -i --prefix=/opt/special --nodeps so8m35.rpm
1137 installer::epmfile::create_new_directory_structure($newepmdir);
1138 $installer::globals::postprocess_specialepm = 1;
1140 # solaris patch not needed anymore
1144 else # this is the standard epm (not relocatable) or ( nonlinux and nonsolaris )
1146 installer::epmfile::resolve_path_in_epm_list_before_packaging(\@epmfile, $completeepmfilename, "\$\$PRODUCTINSTALLLOCATION", $relocatablepath);
1147 installer::files::save_file($completeepmfilename ,\@epmfile); # Warning for pool, content of epm file is changed.
1149 if ( $installer::globals::call_epm )
1151 # ... now epm can be started, to create the installation sets
1153 if ( $installer::globals::is_special_epm )
1155 installer::logger::print_message( "... starting patched epm ... \n" );
1157 else
1159 installer::logger::print_message( "... starting unpatched epm ... \n" );
1162 if ( $installer::globals::call_epm ) { installer::epmfile::call_epm($epmexecutable, $completeepmfilename, $packagename, $includepatharrayref); }
1164 if (($installer::globals::isrpmbuild) || ($installer::globals::issolarispkgbuild) || ($installer::globals::debian))
1166 $installer::globals::postprocess_standardepm = 1;
1171 chdir($currentdir); # changing back into start directory
1175 } # end of "if ( ! $installer::globals::simple )
1177 } # end of "for ( @{$packages} )"
1179 ##############################################################
1180 # Post epm functionality, after the last package is packed
1181 ##############################################################
1183 if ( $installer::globals::postprocess_specialepm )
1185 installer::logger::include_header_into_logfile("Post EPM processes (Patched EPM):");
1187 chdir($installdir);
1189 # Copying the cde, kde and gnome packages into the installation set
1190 if ( $installer::globals::addsystemintegration ) { installer::epmfile::put_systemintegration_into_installset($installer::globals::epmoutpath, $includepatharrayref, $allvariableshashref, $modulesinproductarrayref); }
1192 # Adding license and readme into installation set
1193 if ($installer::globals::addlicensefile) { installer::worker::put_scpactions_into_installset("."); }
1195 # Adding license file into setup
1196 if ( $allvariableshashref->{'PUT_LICENSE_INTO_SETUP'} ) { installer::worker::put_license_into_setup(".", $includepatharrayref); }
1198 # Creating installation set for Unix language packs, that are not part of multi lingual installation sets
1199 if ( ( $installer::globals::languagepack ) && ( ! $installer::globals::debian ) && ( ! $installer::globals::makedownload ) ) { installer::languagepack::build_installer_for_languagepack($installer::globals::epmoutpath, $allvariableshashref, $includepatharrayref, $languagesarrayref, $languagestringref); }
1201 # Creating installation set for Unix help packs, that are not part of multi lingual installation sets
1202 if ( ( $installer::globals::helppack ) && ( ! $installer::globals::debian ) && ( ! $installer::globals::makedownload ) ) { installer::helppack::build_installer_for_helppack($installer::globals::epmoutpath, $allvariableshashref, $includepatharrayref, $languagesarrayref, $languagestringref); }
1204 chdir($currentdir); # changing back into start directory
1207 if ( $installer::globals::postprocess_standardepm )
1209 installer::logger::include_header_into_logfile("Post EPM processes (Standard EPM):");
1211 chdir($installdir);
1213 # determine the destination directory
1214 my $newepmdir = installer::epmfile::determine_installdir_ooo();
1216 # Copying the cde, kde and gnome packages into the installation set
1217 if ( $installer::globals::addsystemintegration ) { installer::epmfile::put_systemintegration_into_installset($newepmdir, $includepatharrayref, $allvariableshashref, $modulesinproductarrayref); }
1219 # Adding license and readme into installation set
1220 if ($installer::globals::addlicensefile) { installer::worker::put_scpactions_into_installset("."); }
1222 # Adding license file into setup
1223 if ( $allvariableshashref->{'PUT_LICENSE_INTO_SETUP'} ) { installer::worker::put_license_into_setup(".", $includepatharrayref); }
1225 # Creating installation set for Unix language packs, that are not part of multi lingual installation sets
1226 if ( ( $installer::globals::languagepack ) && ( ! $installer::globals::debian ) && ( ! $installer::globals::makedownload ) ) { installer::languagepack::build_installer_for_languagepack($newepmdir, $allvariableshashref, $includepatharrayref, $languagesarrayref, $languagestringref); }
1228 # Creating installation set for Unix help packs, that are not part of multi lingual installation sets
1229 if ( ( $installer::globals::helppack ) && ( ! $installer::globals::debian ) && ( ! $installer::globals::makedownload ) ) { installer::helppack::build_installer_for_helpepack($newepmdir, $allvariableshashref, $includepatharrayref, $languagesarrayref, $languagestringref); }
1231 chdir($currentdir); # changing back into start directory
1234 if (( $installer::globals::issolarispkgbuild ) && ( $allvariableshashref->{'COLLECT_PKGMAP'} )) { installer::worker::collectpackagemaps($installdir, $languagestringref, $allvariableshashref); }
1236 #######################################################
1237 # Analyzing the log file
1238 #######################################################
1240 my $is_success = 0;
1241 my $finalinstalldir = "";
1243 installer::worker::clean_output_tree(); # removing directories created in the output tree
1244 ($is_success, $finalinstalldir) = installer::worker::analyze_and_save_logfile($loggingdir, $installdir, $installlogdir, $allsettingsarrayref, $languagestringref, $current_install_number);
1245 my $downloadname = installer::ziplist::getinfofromziplist($allsettingsarrayref, "downloadname");
1247 #######################################################
1248 # Creating download installation set
1249 #######################################################
1251 if ( $installer::globals::makedownload )
1253 my $create_download = 0;
1254 if ( $$downloadname ne "" ) { $create_download = 1; }
1255 if ( $installer::globals::iswindowsbuild ) { $create_download = 0; }
1256 if (( $is_success ) && ( $create_download ) && ( $ENV{'ENABLE_DOWNLOADSETS'} ))
1258 my $downloaddir = installer::download::create_download_sets($finalinstalldir, $includepatharrayref, $allvariableshashref, $$downloadname, $languagestringref, $languagesarrayref);
1259 installer::worker::analyze_and_save_logfile($loggingdir, $downloaddir, $installlogdir, $allsettingsarrayref, $languagestringref, $current_install_number);
1262 } # end of "if (!( $installer::globals::iswindowsbuild ))"
1264 #################################################
1265 # Part 2b: The Windows platform
1266 #################################################
1268 #####################################################################
1269 # ... creating idt files ...
1270 # Only for Windows builds
1271 #####################################################################
1273 if ( $installer::globals::iswindowsbuild )
1275 ###########################################
1276 # Stripping libraries
1277 ###########################################
1279 # Building for gcc build in cws requires, that all files are stripped before packaging:
1280 # 1. copy all files that need to be stripped locally
1281 # 2. strip all these files
1283 if ( $installer::globals::com eq 'GCC')
1285 installer::windows::strip::strip_binaries($filesinproductlanguageresolvedarrayref, $languagestringref);
1288 $installdir = installer::worker::create_installation_directory($shipinstalldir, $languagestringref, \$current_install_number);
1290 my $idtdirbase = installer::systemactions::create_directories("idt_files", $languagestringref);
1291 $installer::globals::infodirectory = installer::systemactions::create_directories("info_files", $languagestringref);
1292 my $installlogdir = installer::systemactions::create_directory_next_to_directory($installdir, "log");
1294 #################################################################################
1295 # Preparing cabinet files from package definitions
1296 #################################################################################
1298 installer::packagelist::prepare_cabinet_files($packages, $allvariableshashref);
1299 # printing packages content:
1300 installer::packagelist::log_cabinet_assignments();
1302 #################################################################################
1303 # Begin of functions that are used for the creation of idt files (Windows only)
1304 #################################################################################
1306 installer::logger::print_message( "... creating idt files ...\n" );
1308 installer::logger::include_header_into_logfile("Creating idt files:");
1310 my $newidtdir = $idtdirbase . $installer::globals::separator . "00"; # new files into language independent directory "00"
1311 installer::systemactions::create_directory($newidtdir);
1313 my @allfilecomponents = ();
1314 my @allregistrycomponents = ();
1316 # Collecting all files with flag "BINARYTABLE"
1317 my $binarytablefiles = installer::worker::collect_all_items_with_special_flag($filesinproductlanguageresolvedarrayref ,"BINARYTABLE");
1319 # Removing all files with flag "BINARYTABLE_ONLY"
1320 @installer::globals::binarytableonlyfiles = ();
1321 $filesinproductlanguageresolvedarrayref = installer::worker::remove_all_items_with_special_flag($filesinproductlanguageresolvedarrayref ,"BINARYTABLE_ONLY");
1323 # Collecting all profileitems with flag "INIFILETABLE" for table "IniFile"
1324 my $inifiletableentries = installer::worker::collect_all_items_with_special_flag($profileitemsinproductlanguageresolvedarrayref ,"INIFILETABLE");
1326 # Creating the important dynamic idt files
1327 installer::windows::msiglobal::set_msiproductversion($allvariableshashref);
1328 installer::windows::msiglobal::put_msiproductversion_into_bootstrapfile($filesinproductlanguageresolvedarrayref);
1330 # Add cabinet assignments to files
1331 installer::windows::file::assign_cab_to_files($filesinproductlanguageresolvedarrayref);
1332 installer::windows::file::assign_sequencenumbers_to_files($filesinproductlanguageresolvedarrayref);
1334 # Collection all available directory trees
1335 installer::windows::directory::collectdirectorytrees($directoriesforepmarrayref);
1337 # Attention: The table "Director.idt" contains language specific strings -> parameter: \@setuplanguagesarray !
1338 installer::windows::directory::create_directory_table($directoriesforepmarrayref, \@setuplanguagesarray, $newidtdir, $allvariableshashref, $shortdirname, $loggingdir);
1340 $filesinproductlanguageresolvedarrayref = installer::windows::file::create_files_table($filesinproductlanguageresolvedarrayref, $directoriesforepmarrayref, \@allfilecomponents, $newidtdir, $allvariableshashref, $uniquefilename, $allupdatesequences, $allupdatecomponents, $allupdatefileorder);
1341 if ( $installer::globals::updatedatabase ) { installer::windows::file::check_file_sequences($allupdatefileorder, $allupdatecomponentorder); }
1343 # Attention: The table "Registry.idt" contains language specific strings -> parameter: \@setuplanguagesarray !
1344 installer::windows::registry::create_registry_table($registryitemsinproductlanguageresolvedarrayref, \@allregistrycomponents, $newidtdir, \@setuplanguagesarray, $allvariableshashref);
1346 installer::windows::component::create_component_table($filesinproductlanguageresolvedarrayref, $registryitemsinproductlanguageresolvedarrayref, $directoriesforepmarrayref, \@allfilecomponents, \@allregistrycomponents, $newidtdir, $componentid, $componentidkeypath, $allvariableshashref);
1348 # Attention: The table "Feature.idt" contains language specific strings -> parameter: \@setuplanguagesarray !
1349 installer::windows::feature::add_uniquekey($modulesinproductlanguageresolvedarrayref);
1350 $modulesinproductlanguageresolvedarrayref = installer::windows::feature::sort_feature($modulesinproductlanguageresolvedarrayref);
1351 installer::windows::feature::create_feature_table($modulesinproductlanguageresolvedarrayref, $newidtdir, \@setuplanguagesarray, $allvariableshashref);
1353 installer::windows::featurecomponent::create_featurecomponent_table($filesinproductlanguageresolvedarrayref, $registryitemsinproductlanguageresolvedarrayref, $newidtdir);
1355 installer::windows::media::create_media_table($filesinproductlanguageresolvedarrayref, $newidtdir, $allvariableshashref, $allupdatelastsequences, $allupdatediskids);
1357 installer::windows::font::create_font_table($filesinproductlanguageresolvedarrayref, $newidtdir);
1359 # Attention: The table "Shortcut.idt" contains language specific strings -> parameter: \@setuplanguagesarray !
1360 # Attention: Shortcuts (Folderitems) have icon files, that have to be copied into the Icon directory (last parameter)
1361 my @iconfilecollector = ();
1363 installer::windows::shortcut::create_shortcut_table($filesinproductlanguageresolvedarrayref, $linksinproductlanguageresolvedarrayref, $folderinproductlanguageresolvedarrayref, $folderitemsinproductlanguageresolvedarrayref, $directoriesforepmarrayref, $newidtdir, \@setuplanguagesarray, $includepatharrayref, \@iconfilecollector);
1365 installer::windows::inifile::create_inifile_table($inifiletableentries, $filesinproductlanguageresolvedarrayref, $newidtdir);
1367 installer::windows::icon::create_icon_table(\@iconfilecollector, $newidtdir); # creating the icon table with all iconfiles used as shortcuts (FolderItems)
1369 installer::windows::createfolder::create_createfolder_table($directoriesforepmarrayref, $filesinproductlanguageresolvedarrayref, $newidtdir, $allvariableshashref);
1371 installer::windows::upgrade::create_upgrade_table($newidtdir, $allvariableshashref);
1373 installer::windows::msishortcutproperty::create_msishortcutproperty_table($folderitempropertiesinproductarrayref, $folderitemsinproductarrayref, $newidtdir);
1375 if (( ! $installer::globals::languagepack ) && ( ! $installer::globals::helppack )) # the following tables not for language packs or help packs
1377 installer::windows::removefile::create_removefile_table($folderitemsinproductlanguageresolvedarrayref, $newidtdir);
1379 # Adding Assemblies into the tables MsiAssembly and MsiAssemblyName dynamically
1380 installer::windows::assembly::create_msiassembly_table($filesinproductlanguageresolvedarrayref, $newidtdir);
1381 installer::windows::assembly::create_msiassemblyname_table($filesinproductlanguageresolvedarrayref, $newidtdir);
1382 installer::windows::assembly::add_assembly_condition_into_component_table($filesinproductlanguageresolvedarrayref, $newidtdir);
1385 my $infoline = "\n";
1386 push(@installer::globals::logfileinfo, $infoline);
1388 # Localizing the language dependent idt files
1389 # For every language there will be a localized msi database
1390 # For multilingual installation sets, the differences of this
1391 # databases have to be stored in transforms.
1393 for ( my $m = 0; $m <= $#{\@setuplanguagesarray}; $m++ )
1395 my $onelanguage = ${\@setuplanguagesarray}[$m];
1397 my $is_rtl = 0;
1398 my @rtllanguages = ("ar", "fa", "he", "ug", "ky-CN");
1399 if ( grep {$_ eq $onelanguage} @rtllanguages ) { $is_rtl = 1; }
1401 my $languageidtdir = $idtdirbase . $installer::globals::separator . $onelanguage;
1402 if ( -d $languageidtdir ) { installer::systemactions::remove_complete_directory($languageidtdir, 1); }
1403 installer::systemactions::create_directory($languageidtdir);
1405 # Copy the template idt files and the new created idt files into this language directory
1407 installer::logger::print_message( "... copying idt files ...\n" );
1409 installer::logger::include_header_into_logfile("Copying idt files to $languageidtdir:");
1411 installer::windows::idtglobal::prepare_language_idt_directory($languageidtdir, $newidtdir, $onelanguage, $filesinproductlanguageresolvedarrayref, \@iconfilecollector, $binarytablefiles, $allvariableshashref);
1413 # Now all files are copied into a language specific directory
1414 # The template idt files can be translated
1416 installer::logger::print_message( "... localizing idt files (language: $onelanguage) ...\n" );
1418 installer::logger::include_header_into_logfile("Localizing idt files (Language: $onelanguage):");
1420 my @translationfiles = (); # all idt files, that need a translation
1421 push(@translationfiles, "ActionTe.idt");
1422 push(@translationfiles, "Control.idt");
1423 push(@translationfiles, "CustomAc.idt");
1424 push(@translationfiles, "Error.idt");
1425 push(@translationfiles, "LaunchCo.idt");
1426 push(@translationfiles, "RadioBut.idt");
1427 push(@translationfiles, "Property.idt");
1428 push(@translationfiles, "UIText.idt");
1430 my $oneidtfilename;
1431 my $oneidtfile;
1433 foreach $oneidtfilename (@translationfiles)
1435 my $languagefilename = installer::windows::idtglobal::get_languagefilename($oneidtfilename, $installer::globals::idtlanguagepath);
1436 my $languagefile = installer::files::read_file($languagefilename);
1438 $oneidtfilename = $languageidtdir . $installer::globals::separator . $oneidtfilename;
1439 $oneidtfile = installer::files::read_file($oneidtfilename);
1441 # Now the substitution can start
1442 installer::windows::idtglobal::translate_idtfile($oneidtfile, $languagefile, $onelanguage);
1444 installer::files::save_file($oneidtfilename, $oneidtfile);
1446 $infoline = "Translated idt file: $oneidtfilename into language $onelanguage\n";
1447 push(@installer::globals::logfileinfo, $infoline);
1448 $infoline = "Used languagefile: $languagefilename\n";
1449 push(@installer::globals::logfileinfo, $infoline);
1452 # setting bidi attributes, if required
1453 if ( $is_rtl ) { installer::windows::idtglobal::setbidiattributes($languageidtdir, $onelanguage); }
1455 # setting the condition, that at least one module is selected
1456 installer::windows::idtglobal::set_multilanguageonly_condition($languageidtdir);
1458 # include the license text into the table Control.idt
1460 if ( ! $allvariableshashref->{'HIDELICENSEDIALOG'} )
1462 my $licensefilesource = installer::windows::idtglobal::get_rtflicensefilesource($onelanguage, $includepatharrayref_lang);
1463 my $licensefile = installer::files::read_file($licensefilesource);
1464 installer::scpzipfiles::replace_all_ziplistvariables_in_rtffile($licensefile, $allvariableshashref);
1465 my $controltablename = $languageidtdir . $installer::globals::separator . "Control.idt";
1466 my $controltable = installer::files::read_file($controltablename);
1467 installer::windows::idtglobal::add_licensefile_to_database($licensefile, $controltable);
1468 installer::files::save_file($controltablename, $controltable);
1470 $infoline = "Added licensefile $licensefilesource into database $controltablename\n";
1471 push(@installer::globals::logfileinfo, $infoline);
1474 # include a component into environment table if required
1476 installer::windows::component::set_component_in_environment_table($languageidtdir, $filesinproductlanguageresolvedarrayref);
1478 # include the ProductCode and the UpgradeCode from codes-file into the Property.idt
1480 installer::windows::property::set_codes_in_property_table($languageidtdir);
1482 # the language specific properties can now be set in the Property.idt
1484 installer::windows::property::update_property_table($languageidtdir, $onelanguage, $allvariableshashref, $languagestringref);
1486 # replacing variables in RegLocat.idt
1488 installer::windows::msiglobal::update_reglocat_table($languageidtdir, $allvariableshashref);
1490 # replacing variables in RemoveRe.idt (RemoveRegistry.idt)
1492 installer::windows::msiglobal::update_removere_table($languageidtdir);
1494 # adding language specific properties for multilingual installation sets
1496 installer::windows::property::set_languages_in_property_table($languageidtdir, \@setuplanguagesarray);
1498 # adding settings into CheckBox.idt
1499 installer::windows::property::update_checkbox_table($languageidtdir, $allvariableshashref);
1501 # adding the files from the binary directory into the binary table
1502 installer::windows::binary::update_binary_table($languageidtdir, $filesinproductlanguageresolvedarrayref, $binarytablefiles);
1504 # Adding Windows Installer CustomActions
1506 installer::windows::idtglobal::addcustomactions($languageidtdir, $windowscustomactionsarrayref, $filesinproductlanguageresolvedarrayref);
1508 installer::logger::print_message( "... Analyze if custom action table must be patched with merge module directory names ...\n" );
1510 my @customactions = ();
1511 for my $e (keys %installer::globals::merge_directory_hash) {
1512 my $var;
1513 installer::logger::print_message( "... analyzing directory from merge module: $e\n");
1514 if (installer::windows::directory::has_standard_directory_prefix($e, \$var)) {
1515 installer::logger::print_message( "... emitting custom action to set the var $e to directory: $var\n");
1516 push(@customactions, installer::windows::idtglobal::emit_custom_action_for_standard_directory($e, $var));
1520 if (@customactions) {
1521 installer::logger::print_message( "... Patching custom action table with merge module directory names ...\n" );
1522 #print Dumper(@customactions);
1523 installer::windows::idtglobal::addcustomactions($languageidtdir, \@customactions, $filesinproductlanguageresolvedarrayref);
1526 # Then the language specific msi database can be created
1528 if ( $installer::globals::iswin || $installer::globals::packageformat eq 'msi' )
1530 my $msidatabasename = installer::windows::msiglobal::get_msidatabasename($allvariableshashref, $onelanguage);
1531 my $msifilename = $languageidtdir . $installer::globals::separator . $msidatabasename;
1533 installer::logger::print_message( "... creating msi database (language $onelanguage) ... \n" );
1535 installer::windows::msiglobal::set_uuid_into_component_table($languageidtdir, $allvariableshashref); # setting new GUID for the components using the tool uuidgen.exe
1536 installer::windows::msiglobal::prepare_64bit_database($languageidtdir, $allvariableshashref); # making last 64 bit changes
1537 installer::windows::msiglobal::create_msi_database($languageidtdir ,$msifilename);
1539 # validating the database # ToDo
1541 installer::windows::msiglobal::write_summary_into_msi_database($msifilename, $onelanguage, $allvariableshashref);
1543 # copy msi database into installation directory
1545 my $msidestfilename = $installdir . $installer::globals::separator . $msidatabasename;
1546 installer::systemactions::copy_one_file($msifilename, $msidestfilename);
1550 # Creating transforms, if the installation set has more than one language
1551 # renaming the msi database
1553 my $defaultlanguage = installer::languages::get_default_language(\@setuplanguagesarray);
1555 if ( $installer::globals::iswin || $installer::globals::packageformat eq 'msi' )
1557 if ( $#{\@setuplanguagesarray} > 0 )
1559 installer::windows::msiglobal::create_transforms(\@setuplanguagesarray, $defaultlanguage, $installdir, $allvariableshashref);
1561 # if there are Merge Modules, they have to be integrated now
1562 my $mergedbname = installer::windows::msiglobal::get_msidatabasename($allvariableshashref, $defaultlanguage);
1563 my $mergeidtdir = $idtdirbase . $installer::globals::separator . "mergemodules";
1564 if ( -d $mergeidtdir ) { installer::systemactions::remove_complete_directory($mergeidtdir, 1); }
1565 installer::systemactions::create_directory($mergeidtdir);
1566 installer::systemactions::copy_one_file($installdir . $installer::globals::separator . $mergedbname, $mergeidtdir . $installer::globals::separator . $mergedbname);
1567 $filesinproductlanguageresolvedarrayref = installer::windows::mergemodule::merge_mergemodules_into_msi_database($mergemodulesarrayref, $filesinproductlanguageresolvedarrayref, $mergeidtdir . $installer::globals::separator . $mergedbname, $languagestringref, $allvariableshashref, $includepatharrayref, $allupdatesequences, $allupdatelastsequences, $allupdatediskids);
1568 installer::systemactions::copy_one_file($mergeidtdir . $installer::globals::separator . $mergedbname, $installdir . $installer::globals::separator . $mergedbname);
1570 installer::windows::msiglobal::rename_msi_database_in_installset($defaultlanguage, $installdir, $allvariableshashref);
1573 # Analyzing the ScpActions and copying the files into the installation set
1575 installer::logger::print_message( "... copying files into installation set ...\n" );
1577 installer::worker::put_scpactions_into_installset($installdir);
1579 # ... copying MergeModules into installation set
1581 if ( ! $installer::globals::fix_number_of_cab_files ) { installer::windows::msiglobal::copy_merge_modules_into_installset($installdir); }
1583 installer::logger::print_message( "... creating ddf files ...\n" );
1585 # Creating all needed ddf files and generating a list
1586 # for the package process containing all system calls
1588 my $ddfdir = installer::systemactions::create_directories("ddf", $languagestringref);
1590 my $packjobref = installer::windows::msiglobal::generate_cab_file_list($filesinproductlanguageresolvedarrayref, $installdir, $ddfdir, $allvariableshashref);
1592 # Update and patch reasons the pack order needs to be saved
1593 installer::windows::msiglobal::save_packorder();
1595 $infoline = "\n";
1596 push(@installer::globals::logfileinfo, $infoline);
1598 ####################################
1599 # Writing log file
1600 # before cab files are packed
1601 ####################################
1603 installer::logger::print_message( "... creating log file $installer::globals::logfilename \n" );
1605 installer::files::save_file($loggingdir . $installer::globals::logfilename, \@installer::globals::logfileinfo);
1607 #######################################################
1608 # Finally really create the installation packages,
1609 # Only for Windows and only on a windows platform.
1610 #######################################################
1612 if ( $installer::globals::iswin || $installer::globals::packageformat eq 'msi' )
1614 installer::logger::print_message( "... packaging installation set ... \n" );
1615 installer::windows::msiglobal::execute_packaging($packjobref, $loggingdir, $allvariableshashref);
1616 if ( $installer::globals::include_cab_in_msi ) { installer::windows::msiglobal::include_cabs_into_msi($installdir); }
1618 ####################################
1619 # Writing log file
1620 # after cab files are packed
1621 ####################################
1623 installer::logger::print_message( "\n... creating log file $installer::globals::logfilename \n" );
1624 installer::files::save_file($loggingdir . $installer::globals::logfilename, \@installer::globals::logfileinfo);
1627 #######################################################
1628 # Analyzing the log file
1629 #######################################################
1631 my $is_success = 0;
1632 my $finalinstalldir = "";
1633 installer::worker::clean_output_tree(); # removing directories created in the output tree
1634 ($is_success, $finalinstalldir) = installer::worker::analyze_and_save_logfile($loggingdir, $installdir, $installlogdir, $allsettingsarrayref, $languagestringref, $current_install_number);
1636 #######################################################
1637 # Creating download installation set
1638 #######################################################
1640 my $create_download = 0;
1641 my $downloadname = installer::ziplist::getinfofromziplist($allsettingsarrayref, "downloadname");
1642 if ( $installer::globals::languagepack ) { $downloadname = installer::ziplist::getinfofromziplist($allsettingsarrayref, "langpackdownloadname"); }
1643 if ( $installer::globals::helppack ) { $downloadname = installer::ziplist::getinfofromziplist($allsettingsarrayref, "helppackdownloadname"); }
1645 if ( $$downloadname ne "" ) { $create_download = 1; }
1646 if ( $installer::globals::iswindowsbuild )
1648 $create_download = 0;
1649 $$downloadname = installer::download::set_download_filename($languagestringref, $allvariableshashref);
1650 installer::systemactions::rename_one_file( $finalinstalldir . $installer::globals::separator . $installer::globals::shortmsidatabasename, $finalinstalldir . $installer::globals::separator . $$downloadname . ".msi" );
1652 if (( $is_success ) && ( $create_download ) && ( $ENV{'ENABLE_DOWNLOADSETS'} ))
1654 my $downloaddir = installer::download::create_download_sets($finalinstalldir, $includepatharrayref, $allvariableshashref, $$downloadname, $languagestringref, $languagesarrayref);
1655 installer::worker::analyze_and_save_logfile($loggingdir, $downloaddir, $installlogdir, $allsettingsarrayref, $languagestringref, $current_install_number);
1658 } # end of "if ( $installer::globals::iswindowsbuild )"
1660 # saving file_info file for later analysis
1661 my $speciallogfilename = $loggingdir . "fileinfo_" . $installer::globals::product . "\.log";
1662 open my $log_fh, '>', $speciallogfilename
1663 or die "Could not open $speciallogfilename for writing: $!";
1664 print $log_fh Dumper($filesinproductlanguageresolvedarrayref);
1666 } # end of iteration for one language group
1669 sub cleanup_on_error {
1670 my $message = shift;
1672 # If an installation set is currently created, the directory name
1673 # is saved in $installer::globals::saveinstalldir. If this
1674 # directory name contains "_inprogress", it has to be renamed to
1675 # "_witherror".
1676 if ( $installer::globals::saveinstalldir =~ /_inprogress/ ) {
1677 installer::systemactions::rename_string_in_directory($installer::globals::saveinstalldir, "_inprogress", "_witherror");
1680 # Removing directories created in the output tree.
1681 installer::worker::clean_output_tree();
1683 $installer::globals::logfilename = $installer::globals::exitlog . $installer::globals::logfilename;
1685 my @log = (@installer::globals::logfileinfo, @installer::globals::globallogfileinfo);
1687 push(@log, "\n" . '*' x 65 . "\n");
1688 push(@log, $message);
1689 push(@log, '*' x 65 . "\n");
1691 installer::files::save_file($installer::globals::logfilename, \@log);
1693 print("ERROR, saved logfile $installer::globals::logfilename is:\n");
1694 open(my $log, "<", $installer::globals::logfilename);
1695 print ": $_" while (<$log>);
1696 print "\n";
1697 close($log);