Version 4.2.0.1, tag libreoffice-4.2.0.1
[LibreOffice.git] / solenv / bin / modules / installer.pm
bloba081456bed0babad163eea684ec67e768dc4575c
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 base 'Exporter';
23 use Cwd;
24 use Data::Dumper;
25 use File::Copy;
26 use List::Util qw(shuffle);
27 use installer::archivefiles;
28 use installer::control;
29 use installer::converter;
30 use installer::copyproject;
31 use installer::download;
32 use installer::environment;
33 use installer::epmfile;
34 use installer::files;
35 use installer::filelists;
36 use installer::globals;
37 use installer::helppack;
38 use installer::languagepack;
39 use installer::languages;
40 use installer::logger;
41 use installer::packagelist;
42 use installer::parameter;
43 use installer::pathanalyzer;
44 use installer::profiles;
45 use installer::scpzipfiles;
46 use installer::scriptitems;
47 use installer::setupscript;
48 use installer::simplepackage;
49 use installer::strip qw(strip_libraries);
50 use installer::systemactions;
51 use installer::windows::assembly;
52 use installer::windows::binary;
53 use installer::windows::component;
54 use installer::windows::createfolder;
55 use installer::windows::directory;
56 use installer::windows::feature;
57 use installer::windows::featurecomponent;
58 use installer::windows::file;
59 use installer::windows::font;
60 use installer::windows::icon;
61 use installer::windows::idtglobal;
62 use installer::windows::inifile;
63 use installer::windows::media;
64 use installer::windows::mergemodule;
65 use installer::windows::msiglobal;
66 use installer::windows::msishortcutproperty;
67 use installer::windows::msp;
68 use installer::windows::property;
69 use installer::windows::removefile;
70 use installer::windows::registry;
71 use installer::windows::shortcut;
72 use installer::windows::strip;
73 use installer::windows::update;
74 use installer::windows::upgrade;
75 use installer::worker;
76 use installer::ziplist qw(read_ziplist);
78 our @EXPORT_OK = qw(main);
80 sub main {
81 installer::logger::starttime();
83 my $exit_code = 0;
85 eval {
86 run();
88 if ($@) {
89 my $message = "ERROR: $@";
91 warn "ERROR: Failure in installer.pm\n";
92 warn "$message\n";
93 $exit_code = -1;
95 cleanup_on_error($message);
98 installer::logger::stoptime();
100 return $exit_code;
103 sub run {
104 installer::logger::print_message( "... checking environment variables ...\n" );
105 my $environmentvariableshashref = installer::control::check_system_environment();
107 installer::environment::set_global_environment_variables($environmentvariableshashref);
109 #################################
110 # Check and output of parameter
111 #################################
113 installer::parameter::saveparameter();
114 installer::parameter::getparameter();
116 installer::parameter::control_fundamental_parameter();
117 installer::parameter::setglobalvariables();
118 installer::parameter::control_required_parameter();
120 if (!($installer::globals::languages_defined_in_productlist)) { installer::languages::analyze_languagelist(); }
121 installer::parameter::outputparameter();
123 $installer::globals::build = uc($installer::globals::build); # using "SRC680" instead of "src680"
125 ######################################
126 # Creating the log directory
127 ######################################
129 my $empty = "";
130 my $loggingdir = installer::systemactions::create_directories("logging", \$empty);
131 $loggingdir = $loggingdir . $installer::globals::separator;
132 $installer::globals::exitlog = $loggingdir;
134 my $installdir = "";
135 my $currentdir = cwd();
136 my $shipinstalldir = "";
137 my $current_install_number = "";
139 ######################################
140 # Checking the system requirements
141 ######################################
143 installer::logger::print_message( "... checking required files ...\n" );
144 installer::control::check_system_path();
146 my $pathvariableshashref = installer::environment::create_pathvariables($environmentvariableshashref);
148 ###############################################
149 # Checking saved setting for Windows patches
150 ###############################################
152 if (( $installer::globals::iswindowsbuild ) && ( $installer::globals::prepare_winpatch )) { installer::windows::msiglobal::read_saved_mappings(); }
154 ###################################################
155 # Analyzing the settings and variables in zip.lst
156 ###################################################
158 my ($allsettingsarrayref, $allvariableshashref) = read_ziplist($installer::globals::ziplistname);
160 ########################################################
161 # Check if this is simple packaging mechanism
162 ########################################################
164 installer::simplepackage::check_simple_packager_project($allvariableshashref);
166 ####################################################################
167 # setting global variables
168 ####################################################################
170 installer::control::set_addsystemintegration($allvariableshashref);
172 ########################################################
173 # Re-define logging dir, after all variables are set
174 ########################################################
176 my $oldloggingdir = $loggingdir;
177 # FIXME: It would be better to use installer::systemactions::remove_complete_directory
178 # Though, we would need to remove only the lang-specific subdirectory for langpacks and helppacks
179 rmdir $oldloggingdir;
180 $loggingdir = installer::systemactions::create_directories("logging", \$empty);
181 $loggingdir = $loggingdir . $installer::globals::separator;
182 $installer::globals::exitlog = $loggingdir;
184 # checking, whether this is an opensource product
186 if (!($installer::globals::is_copy_only_project)) { installer::ziplist::set_manufacturer($allvariableshashref); }
188 ##############################################
189 # Checking version of makecab.exe
190 ##############################################
192 if ( $installer::globals::iswindowsbuild && (!defined($ENV{'CROSS_COMPILING'}) || $ENV{'CROSS_COMPILING'} ne 'YES' || $installer::globals::packageformat eq 'msi')) { installer::control::check_makecab_version(); }
194 ##########################################################
195 # Getting the include path from the settings in zip list
196 ##########################################################
198 my $includepathref = installer::ziplist::getinfofromziplist($allsettingsarrayref, "include");
199 if ( $$includepathref eq "" )
201 die 'Definition for "include" not found in ' . $installer::globals::ziplistname;
204 my $includepatharrayref = installer::converter::convert_stringlist_into_array($includepathref, ",");
206 installer::ziplist::replace_all_variables_in_paths($includepatharrayref, $pathvariableshashref);
208 installer::ziplist::replace_minor_in_paths($includepatharrayref);
210 installer::ziplist::replace_packagetype_in_paths($includepatharrayref);
212 installer::ziplist::resolve_relative_paths($includepatharrayref);
214 installer::ziplist::remove_ending_separator($includepatharrayref);
216 ##############################################
217 # Collecting all files from all include
218 # paths in global hashes.
219 ##############################################
221 installer::worker::collect_all_files_from_includepaths($includepatharrayref);
223 ##############################################
224 # Analyzing languages in zip.lst if required
225 # Probably no longer used.
226 ##############################################
228 if ($installer::globals::languages_defined_in_productlist) { installer::languages::get_info_about_languages($allsettingsarrayref); }
230 #####################################
231 # Windows requires the LCID list
232 #####################################
234 if ( $installer::globals::iswindowsbuild ) { installer::control::read_lcidlist($includepatharrayref); }
236 ####################################################################
237 # MacOS dmg build requires special DS_Store file to arrange icons
238 ####################################################################
239 # if (($installer::globals::ismacdmgbuild) && ($installer::globals::product eq "OpenOffice_Dev")) { $installer::globals::devsnapshotbuild = 1; }
241 #####################################################################
242 # Including additional inc files for variable settings, if defined
243 #####################################################################
245 if ( $allvariableshashref->{'ADD_INCLUDE_FILES'} ) { installer::worker::add_variables_from_inc_to_hashref($allvariableshashref, $includepatharrayref); }
247 #####################################
248 # Analyzing the setup script
249 #####################################
251 if ($installer::globals::setupscript_defined_in_productlist) { installer::setupscript::set_setupscript_name($allsettingsarrayref, $includepatharrayref); }
253 installer::logger::globallog("setup script file: $installer::globals::setupscriptname");
255 installer::logger::print_message( "... analyzing script: $installer::globals::setupscriptname ... \n" );
257 my $setupscriptref = installer::files::read_file($installer::globals::setupscriptname); # Reading the setup script file
259 # Resolving variables defined in the zip list file into setup script
260 # All the variables are defined in $allvariablesarrayref
262 installer::scpzipfiles::replace_all_ziplistvariables_in_file($setupscriptref, $allvariableshashref);
264 # Resolving %variables defined in the installation object
266 my $allscriptvariablesref = installer::setupscript::get_all_scriptvariables_from_installation_object($setupscriptref);
268 installer::setupscript::add_lowercase_productname_setupscriptvariable($allscriptvariablesref);
270 installer::setupscript::resolve_lowercase_productname_setupscriptvariable($allscriptvariablesref);
272 $setupscriptref = installer::setupscript::replace_all_setupscriptvariables_in_script($setupscriptref, $allscriptvariablesref);
274 # Adding all variables defined in the installation object into the hash of all variables.
275 # This is needed if variables are defined in the installation object, but not in the zip list file.
276 # If there is a definition in the zip list file and in the installation object, the installation object is more important
278 installer::setupscript::add_installationobject_to_variables($allvariableshashref, $allscriptvariablesref);
280 # Replacing preset properties, not using the default mechanisms (for example for UNIXPRODUCTNAME)
281 installer::setupscript::replace_preset_properties($allvariableshashref);
283 installer::scpzipfiles::replace_all_ziplistvariables_in_file($setupscriptref, $allvariableshashref);
286 installer::logger::log_hashref($allvariableshashref);
288 installer::logger::print_message( "... analyzing directories ... \n" );
290 # Collect all directories in the script to get the destination dirs
292 my $dirsinproductarrayref = installer::setupscript::get_all_items_from_script($setupscriptref, "Directory");
294 if ( $installer::globals::languagepack ) { installer::scriptitems::use_langpack_hostname($dirsinproductarrayref); }
296 if ( $allvariableshashref->{'SHIFT_BASIS_INTO_BRAND_LAYER'} ) { $dirsinproductarrayref = installer::scriptitems::shift_basis_directory_parents($dirsinproductarrayref); }
297 if ( $allvariableshashref->{'OFFICEDIRECTORYNAME'} ) { installer::scriptitems::set_officedirectory_name($dirsinproductarrayref, $allvariableshashref->{'OFFICEDIRECTORYNAME'}); }
300 installer::scriptitems::resolve_all_directory_names($dirsinproductarrayref);
302 installer::logger::print_message( "... analyzing files ... \n" );
304 my $filesinproductarrayref = installer::setupscript::get_all_items_from_script($setupscriptref, "File");
306 if (( ! $installer::globals::iswindowsbuild ) &&
307 ( ! $installer::globals::isrpmbuild ) &&
308 ( ! $installer::globals::isdebbuild ) &&
309 ( ! $installer::globals::issolarispkgbuild ) &&
310 ( $installer::globals::packageformat ne "installed" ) &&
311 ( $installer::globals::packageformat ne "dmg" ) &&
312 ( $installer::globals::packageformat ne "archive" ))
313 { installer::control::check_oxtfiles($filesinproductarrayref); }
315 if (! $installer::globals::languagepack)
317 $filesinproductarrayref = installer::scriptitems::remove_Languagepacklibraries_from_Installset($filesinproductarrayref);
320 if (! $installer::globals::helppack)
322 $filesinproductarrayref = installer::scriptitems::remove_Helppacklibraries_from_Installset($filesinproductarrayref);
325 installer::logger::print_message( "... analyzing scpactions ... \n" );
327 my $scpactionsinproductarrayref = installer::setupscript::get_all_items_from_script($setupscriptref, "ScpAction");
329 if ( $installer::globals::languagepack ) { installer::scriptitems::use_langpack_copy_scpaction($scpactionsinproductarrayref); }
330 if ( $installer::globals::helppack ) { installer::scriptitems::use_langpack_copy_scpaction($scpactionsinproductarrayref); }
331 # if (($installer::globals::devsnapshotbuild)) { installer::scriptitems::use_dev_copy_scpaction($scpactionsinproductarrayref); }
332 # TODO: why is this not done in scp2 based on the value of $(ENABLE_RELEASE_BUILD)?
333 if ( $allvariableshashref->{'PRODUCTNAME'} eq "LibreOfficeDev" ) { installer::scriptitems::use_devversion_copy_scpaction($scpactionsinproductarrayref); }
335 installer::scriptitems::change_keys_of_scpactions($scpactionsinproductarrayref);
337 installer::logger::print_message( "... analyzing shortcuts ... \n" );
339 my $linksinproductarrayref = installer::setupscript::get_all_items_from_script($setupscriptref, "Shortcut");
341 installer::logger::print_message( "... analyzing unix links ... \n" );
343 my $unixlinksinproductarrayref = installer::setupscript::get_all_items_from_script($setupscriptref, "Unixlink");
345 installer::logger::print_message( "... analyzing profile ... \n" );
347 my $profilesinproductarrayref = installer::setupscript::get_all_items_from_script($setupscriptref, "Profile");
349 installer::logger::print_message( "... analyzing profileitems ... \n" );
351 my $profileitemsinproductarrayref = installer::setupscript::get_all_items_from_script($setupscriptref, "ProfileItem");
353 my $folderinproductarrayref;
354 my $folderitemsinproductarrayref;
355 my $folderitempropertiesinproductarrayref;
356 my $registryitemsinproductarrayref;
357 my $windowscustomactionsarrayref;
358 my $mergemodulesarrayref;
360 if ( $installer::globals::iswindowsbuild ) # Windows specific items: Folder, FolderItem, RegistryItem, WindowsCustomAction
362 installer::logger::print_message( "... analyzing folders ... \n" );
364 $folderinproductarrayref = installer::setupscript::get_all_items_from_script($setupscriptref, "Folder");
366 installer::logger::print_message( "... analyzing folderitems ... \n" );
368 $folderitemsinproductarrayref = installer::setupscript::get_all_items_from_script($setupscriptref, "FolderItem");
370 installer::setupscript::add_predefined_folder($folderitemsinproductarrayref, $folderinproductarrayref);
372 installer::logger::print_message( "... analyzing folderitemproperties ... \n" );
374 $folderitempropertiesinproductarrayref = installer::setupscript::get_all_items_from_script($setupscriptref, "FolderItemProperty");
376 installer::setupscript::prepare_non_advertised_files($folderitemsinproductarrayref, $filesinproductarrayref);
378 installer::logger::print_message( "... analyzing registryitems ... \n" );
380 $registryitemsinproductarrayref = installer::setupscript::get_all_items_from_script($setupscriptref, "RegistryItem");
382 $registryitemsinproductarrayref = installer::scriptitems::remove_uninstall_regitems_from_script($registryitemsinproductarrayref);
384 installer::logger::print_message( "... analyzing Windows custom actions ... \n" );
386 $windowscustomactionsarrayref = installer::setupscript::get_all_items_from_script($setupscriptref, "WindowsCustomAction");
388 installer::logger::print_message( "... analyzing Windows merge modules ... \n" );
390 $mergemodulesarrayref = installer::setupscript::get_all_items_from_script($setupscriptref, "MergeModule");
393 my $modulesinproductarrayref;
395 if (!($installer::globals::is_copy_only_project))
397 installer::logger::print_message( "... analyzing modules ... \n" );
399 $modulesinproductarrayref = installer::setupscript::get_all_items_from_script($setupscriptref, "Module");
401 installer::scriptitems::resolve_assigned_modules($modulesinproductarrayref);
403 $modulesinproductarrayref = installer::scriptitems::remove_template_modules($modulesinproductarrayref);
405 installer::scriptitems::set_children_flag($modulesinproductarrayref);
407 installer::scriptitems::collect_all_languagemodules($modulesinproductarrayref);
409 # Assigning the modules to the items
411 installer::scriptitems::assigning_modules_to_items($modulesinproductarrayref, $filesinproductarrayref, "Files");
413 installer::scriptitems::assigning_modules_to_items($modulesinproductarrayref, $unixlinksinproductarrayref, "Unixlinks");
415 installer::scriptitems::assigning_modules_to_items($modulesinproductarrayref, $dirsinproductarrayref, "Dirs");
418 #################################################
419 # Part 1b: The language dependent part
420 # (still platform independent)
421 #################################################
423 # Now starts the language dependent part, if more than one product is defined on the command line
424 # Example -l en-US,de#es,fr,it defines two multilingual products
426 ###############################################################################
427 # Beginning of language dependent part
428 # The for iterates over all products, separated by an # in the language list
429 ###############################################################################
431 for ( my $n = 0; $n <= $#installer::globals::languageproducts; $n++ )
433 my $languagesarrayref = installer::languages::get_all_languages_for_one_product($installer::globals::languageproducts[$n], $allvariableshashref);
434 my @setuplanguagesarray = @{ $languagesarrayref };
436 my $languagestringref = installer::languages::get_language_string($languagesarrayref);
437 installer::logger::print_message( "------------------------------------\n" );
438 installer::logger::print_message( "... languages $$languagestringref ... \n" );
440 if ( $installer::globals::languagepack )
442 $installer::globals::addsystemintegration = 0;
443 $installer::globals::addlicensefile = 0;
444 $installer::globals::makedownload = 1;
447 if ( $installer::globals::helppack )
449 $installer::globals::addsystemintegration = 0;
450 $installer::globals::addlicensefile = 0;
451 $installer::globals::makedownload = 1;
452 @setuplanguagesarray = grep { $_ ne "en-US" } @setuplanguagesarray;
453 unshift(@setuplanguagesarray, "en-US");
456 ############################################################
457 # Beginning of language specific logging mechanism
458 # Until now only global logging into default: logfile.txt
459 ############################################################
461 @installer::globals::logfileinfo = (); # new logfile array and new logfile name
462 installer::logger::copy_globalinfo_into_logfile();
464 my $logminor = "";
465 $logminor = $installer::globals::minor;
467 my $loglanguagestring = $$languagestringref;
468 my $loglanguagestring_orig = $loglanguagestring;
469 if (length($loglanguagestring) > $installer::globals::max_lang_length)
471 my $number_of_languages = installer::systemactions::get_number_of_langs($loglanguagestring);
472 chomp(my $shorter = `echo $loglanguagestring | $ENV{'MD5SUM'} | sed -e "s/ .*//g"`);
473 my $id = substr($shorter, 0, 8); # taking only the first 8 digits
474 $loglanguagestring = "lang_" . $number_of_languages . "_id_" . $id;
477 $installer::globals::logfilename = "log_" . $installer::globals::build;
478 if ( $logminor ne "" ) { $installer::globals::logfilename .= "_" . $logminor; }
479 $installer::globals::logfilename .= "_" . $loglanguagestring;
480 $installer::globals::logfilename .= ".log";
481 $loggingdir = $loggingdir . $loglanguagestring . $installer::globals::separator;
482 installer::systemactions::create_directory($loggingdir);
484 if ($loglanguagestring ne $loglanguagestring_orig) {
485 (my $dir = $loggingdir) =~ s!/$!!;
486 open(my $F1, "> $dir.dir");
487 open(my $F2, "> " . $loggingdir . $installer::globals::logfilename . '.file');
488 my @s = map { "$_\n" } split('_', $loglanguagestring_orig);
489 print $F1 @s;
490 print $F2 @s;
493 $installer::globals::exitlog = $loggingdir;
495 ###################################################################
496 # Reading an existing msi database, to prepare update and patch
497 ###################################################################
499 my $refdatabase = "";
500 my $uniquefilename = "";
501 my $revuniquefilename = "";
502 my $revshortfilename = "";
503 my $allupdatesequences = "";
504 my $allupdatecomponents = "";
505 my $allupdatefileorder = "";
506 my $allupdatecomponentorder = "";
507 my $shortdirname = "";
508 my $componentid = "";
509 my $componentidkeypath = "";
510 my $alloldproperties = "";
511 my $allupdatelastsequences = "";
512 my $allupdatediskids = "";
514 if ( $installer::globals::iswindowsbuild || $installer::globals::packageformat eq 'msi' )
516 if ( $allvariableshashref->{'UPDATE_DATABASE'} )
518 installer::logger::print_message( "... analyzing update database ...\n" );
519 $refdatabase = installer::windows::update::readdatabase($allvariableshashref, $languagestringref, $includepatharrayref);
521 if ( $installer::globals::updatedatabase )
523 ($uniquefilename, $revuniquefilename, $revshortfilename, $allupdatesequences, $allupdatecomponents, $allupdatefileorder, $allupdatecomponentorder, $shortdirname, $componentid, $componentidkeypath, $alloldproperties, $allupdatelastsequences, $allupdatediskids) = installer::windows::update::create_database_hashes($refdatabase);
524 if ( $mergemodulesarrayref > -1 ) { installer::windows::update::readmergedatabase($mergemodulesarrayref, $languagestringref, $includepatharrayref); }
529 ##############################################
530 # Setting global code variables for Windows
531 ##############################################
533 if (!($installer::globals::is_copy_only_project))
535 if ((( $installer::globals::iswindowsbuild ) && ( $installer::globals::packageformat ne "archive" ) && ( $installer::globals::packageformat ne "installed" ) ) || $installer::globals::packageformat eq 'msi' )
537 installer::windows::msiglobal::set_global_code_variables($languagesarrayref, $languagestringref, $allvariableshashref, $alloldproperties);
541 ################################################
542 # Resolving include paths (language dependent)
543 ################################################
545 $includepatharrayref_lang = installer::ziplist::replace_languages_in_paths($includepatharrayref, \@setuplanguagesarray);
547 if ( $installer::globals::refresh_includepaths ) { installer::worker::collect_all_files_from_includepaths($includepatharrayref_lang); }
549 installer::ziplist::list_all_files_from_include_path($includepatharrayref_lang);
551 ##############################################
552 # Analyzing spellchecker languages
553 ##############################################
555 if ( $allvariableshashref->{'SPELLCHECKERFILE'} ) { installer::worker::set_spellcheckerlanguages($languagesarrayref, $allvariableshashref); }
557 #####################################
558 # Language dependent directory part
559 #####################################
561 my $dirsinproductlanguageresolvedarrayref = installer::scriptitems::resolving_all_languages_in_productlists($dirsinproductarrayref, $languagesarrayref);
563 # A new directory array is needed ($dirsinproductlanguageresolvedarrayref instead of $dirsinproductarrayref)
564 # because $dirsinproductarrayref is needed in get_Destination_Directory_For_Item_From_Directorylist
566 installer::scriptitems::changing_name_of_language_dependent_keys($dirsinproductlanguageresolvedarrayref);
568 installer::scriptitems::checking_directories_with_corrupt_hostname($dirsinproductlanguageresolvedarrayref, $languagesarrayref);
570 installer::scriptitems::set_global_directory_hostnames($dirsinproductlanguageresolvedarrayref, $allvariableshashref);
572 #####################################
573 # files part, language dependent
574 #####################################
576 installer::logger::print_message( "... analyzing files ...\n" );
578 my $filesinproductlanguageresolvedarrayref = installer::scriptitems::resolving_all_languages_in_productlists($filesinproductarrayref, $languagesarrayref);
580 if ( ! $installer::globals::set_office_start_language )
582 $filesinproductlanguageresolvedarrayref = installer::scriptitems::remove_office_start_language_files($filesinproductlanguageresolvedarrayref);
585 installer::scriptitems::changing_name_of_language_dependent_keys($filesinproductlanguageresolvedarrayref);
587 if ( $installer::globals::iswin and $^O =~ /MSWin/i ) { installer::converter::convert_slash_to_backslash($filesinproductlanguageresolvedarrayref); }
589 $filesinproductlanguageresolvedarrayref = installer::scriptitems::remove_non_existent_languages_in_productlists($filesinproductlanguageresolvedarrayref, $languagestringref, "Name", "file");
591 installer::scriptitems::get_Destination_Directory_For_Item_From_Directorylist($filesinproductlanguageresolvedarrayref, $dirsinproductarrayref);
593 installer::scriptitems::get_Source_Directory_For_Files_From_Includepathlist($filesinproductlanguageresolvedarrayref, $includepatharrayref_lang, $dirsinproductlanguageresolvedarrayref, "Files", $allvariableshashref);
595 $filesinproductlanguageresolvedarrayref = installer::scriptitems::remove_Files_Without_Sourcedirectory($filesinproductlanguageresolvedarrayref);
597 if ($installer::globals::languagepack)
599 $filesinproductlanguageresolvedarrayref = installer::scriptitems::remove_Files_For_Languagepacks($filesinproductlanguageresolvedarrayref);
602 if ( ! $allvariableshashref->{'NO_README_IN_ROOTDIR'} )
604 $filesinproductlanguageresolvedarrayref = installer::scriptitems::add_License_Files_into_Installdir($filesinproductlanguageresolvedarrayref, $dirsinproductlanguageresolvedarrayref, $languagesarrayref);
607 installer::scriptitems::make_filename_language_specific($filesinproductlanguageresolvedarrayref);
609 ######################################################################################
610 # Unzipping files with flag ARCHIVE and putting all included files into the file list
611 ######################################################################################
613 installer::logger::print_message( "... analyzing files with flag ARCHIVE ...\n" );
615 my @additional_paths_from_zipfiles = ();
617 $filesinproductlanguageresolvedarrayref = installer::archivefiles::resolving_archive_flag($filesinproductlanguageresolvedarrayref, \@additional_paths_from_zipfiles, $languagestringref, $loggingdir);
619 ######################################################################################
620 # Processing files with flag FILELIST and putting listed files into the file list
621 ######################################################################################
623 installer::logger::print_message( "... analyzing files with flag FILELIST ...\n" );
625 ($filesinproductlanguageresolvedarrayref, $unixlinksinproductarrayref) = installer::filelists::resolve_filelist_flag($filesinproductlanguageresolvedarrayref, $unixlinksinproductarrayref, $ENV{'INSTDIR'});
627 # packed files sometimes contain a "$" in their name: HighlightText$1.class. For epm the "$" has to be quoted by "$$"
629 if (!( $installer::globals::iswindowsbuild || $installer::globals::simple ) )
631 installer::scriptitems::quoting_illegal_filenames($filesinproductlanguageresolvedarrayref);
634 #####################################
635 # Files with flag SCPZIP_REPLACE
636 #####################################
638 installer::logger::print_message( "... analyzing files with flag SCPZIP_REPLACE ...\n" );
640 # Editing files with flag SCPZIP_REPLACE.
642 installer::scpzipfiles::resolving_scpzip_replace_flag($filesinproductlanguageresolvedarrayref, $allvariableshashref, "File", $languagestringref);
644 ############################################
645 # Collecting directories for epm list file
646 ############################################
648 installer::logger::print_message( "... analyzing all directories for this product ...\n" );
650 # There are two ways for a directory to be included into the epm directory list:
651 # 1. Looking for all destination paths in the files array
652 # 2. Looking for directories with CREATE flag in the directory array
653 # Advantage: Many paths are hidden in zip files, they are not defined in the setup script.
654 # It will be possible, that in the setup script only those directoies have to be defined,
655 # that have a CREATE flag. All other directories are created, if they contain at least one file.
657 my ($directoriesforepmarrayref, $alldirectoryhash) = installer::scriptitems::collect_directories_from_filesarray($filesinproductlanguageresolvedarrayref);
659 ($directoriesforepmarrayref, $alldirectoryhash) = installer::scriptitems::collect_directories_with_create_flag_from_directoryarray($dirsinproductlanguageresolvedarrayref, $alldirectoryhash);
661 #########################################################
662 # language dependent scpactions part
663 #########################################################
665 my $scpactionsinproductlanguageresolvedarrayref = installer::scriptitems::resolving_all_languages_in_productlists($scpactionsinproductarrayref, $languagesarrayref);
667 installer::scriptitems::changing_name_of_language_dependent_keys($scpactionsinproductlanguageresolvedarrayref);
669 installer::scriptitems::get_Source_Directory_For_Files_From_Includepathlist($scpactionsinproductlanguageresolvedarrayref, $includepatharrayref_lang, $dirsinproductlanguageresolvedarrayref, "ScpActions", $allvariableshashref);
671 # Editing scpactions with flag SCPZIP_REPLACE.
673 installer::scpzipfiles::resolving_scpzip_replace_flag($scpactionsinproductlanguageresolvedarrayref, $allvariableshashref, "ScpAction", $languagestringref);
675 #########################################################
676 # language dependent links part
677 #########################################################
679 installer::logger::print_message( "... analyzing links ...\n" );
681 my $linksinproductlanguageresolvedarrayref = installer::scriptitems::resolving_all_languages_in_productlists($linksinproductarrayref, $languagesarrayref);
683 installer::scriptitems::changing_name_of_language_dependent_keys($linksinproductlanguageresolvedarrayref);
685 installer::scriptitems::get_destination_file_path_for_links($linksinproductlanguageresolvedarrayref, $filesinproductlanguageresolvedarrayref);
687 installer::scriptitems::get_Destination_Directory_For_Item_From_Directorylist($linksinproductlanguageresolvedarrayref, $dirsinproductarrayref);
689 # Now taking all links that have no FileID but a ShortcutID, linking to another link
691 installer::scriptitems::get_destination_link_path_for_links($linksinproductlanguageresolvedarrayref);
693 $linksinproductlanguageresolvedarrayref = installer::scriptitems::remove_workstation_only_items($linksinproductlanguageresolvedarrayref);
695 installer::scriptitems::resolve_links_with_flag_relative($linksinproductlanguageresolvedarrayref);
697 #########################################################
698 # language dependent unix links part
699 #########################################################
701 installer::logger::print_message( "... analyzing unix links ...\n" );
703 my $unixlinksinproductlanguageresolvedarrayref = installer::scriptitems::resolving_all_languages_in_productlists($unixlinksinproductarrayref, $languagesarrayref);
705 installer::scriptitems::changing_name_of_language_dependent_keys($unixlinksinproductlanguageresolvedarrayref);
707 installer::scriptitems::get_Destination_Directory_For_Item_From_Directorylist($unixlinksinproductlanguageresolvedarrayref, $dirsinproductarrayref);
709 #########################################################
710 # language dependent part for profiles and profileitems
711 #########################################################
713 my $profilesinproductlanguageresolvedarrayref;
714 my $profileitemsinproductlanguageresolvedarrayref;
716 if ((!($installer::globals::is_copy_only_project)) && (!($installer::globals::languagepack)) && (!($installer::globals::helppack)))
718 installer::logger::print_message( "... creating profiles ...\n" );
720 $profilesinproductlanguageresolvedarrayref = installer::scriptitems::resolving_all_languages_in_productlists($profilesinproductarrayref, $languagesarrayref);
722 $profileitemsinproductlanguageresolvedarrayref = installer::scriptitems::resolving_all_languages_in_productlists($profileitemsinproductarrayref, $languagesarrayref);
724 installer::scriptitems::changing_name_of_language_dependent_keys($profilesinproductlanguageresolvedarrayref);
726 installer::scriptitems::changing_name_of_language_dependent_keys($profileitemsinproductlanguageresolvedarrayref);
728 installer::scriptitems::replace_setup_variables($profileitemsinproductlanguageresolvedarrayref, $languagestringref, $allvariableshashref);
730 # Note that patch_user_dir is not related to the killed
731 # ancient (not MSP) "patch" thing, I think.
732 if ( $installer::globals::patch_user_dir )
734 installer::scriptitems::replace_userdir_variable($profileitemsinproductlanguageresolvedarrayref);
737 installer::scriptitems::get_Destination_Directory_For_Item_From_Directorylist($profilesinproductlanguageresolvedarrayref, $dirsinproductarrayref);
739 # Now the Profiles can be created
741 installer::profiles::create_profiles($profilesinproductlanguageresolvedarrayref, $profileitemsinproductlanguageresolvedarrayref, $filesinproductlanguageresolvedarrayref, $languagestringref, $allvariableshashref);
744 my $registryitemsinproductlanguageresolvedarrayref; # cannot be defined in the following "if ( $installer::globals::iswindowsbuild )"
745 my $folderinproductlanguageresolvedarrayref; # cannot be defined in the following "if ( $installer::globals::iswindowsbuild )"
746 my $folderitemsinproductlanguageresolvedarrayref; # cannot be defined in the following "if ( $installer::globals::iswindowsbuild )"
748 if ( $installer::globals::iswindowsbuild ) # Windows specific items: Folder, FolderItem, RegistryItem
750 #########################################################
751 # language dependent part for folder
752 #########################################################
754 installer::logger::print_message( "... analyzing folder ...\n" );
756 $folderinproductlanguageresolvedarrayref = installer::scriptitems::resolving_all_languages_in_productlists($folderinproductarrayref, $languagesarrayref);
758 installer::scriptitems::changing_name_of_language_dependent_keys($folderinproductlanguageresolvedarrayref);
760 #########################################################
761 # language dependent part for folderitems
762 #########################################################
764 installer::logger::print_message( "... analyzing folderitems ...\n" );
766 $folderitemsinproductlanguageresolvedarrayref = installer::scriptitems::resolving_all_languages_in_productlists($folderitemsinproductarrayref, $languagesarrayref);
768 installer::scriptitems::changing_name_of_language_dependent_keys($folderitemsinproductlanguageresolvedarrayref);
770 #########################################################
771 # language dependent part for registryitems
772 #########################################################
774 installer::logger::print_message( "... analyzing registryitems ...\n" );
776 $registryitemsinproductlanguageresolvedarrayref = installer::scriptitems::resolving_all_languages_in_productlists($registryitemsinproductarrayref, $languagesarrayref);
778 installer::scriptitems::changing_name_of_language_dependent_keys($registryitemsinproductlanguageresolvedarrayref);
781 #########################################################
782 # language dependent part for modules
783 #########################################################
785 my $modulesinproductlanguageresolvedarrayref;
787 if (!($installer::globals::is_copy_only_project))
789 installer::logger::print_message( "... analyzing modules ...\n" );
791 $modulesinproductlanguageresolvedarrayref = installer::scriptitems::resolving_all_languages_in_productlists($modulesinproductarrayref, $languagesarrayref);
793 $modulesinproductlanguageresolvedarrayref = installer::scriptitems::remove_not_required_language_modules($modulesinproductlanguageresolvedarrayref, $languagesarrayref);
795 if ( $installer::globals::analyze_spellcheckerlanguage )
797 $modulesinproductlanguageresolvedarrayref = installer::scriptitems::remove_not_required_spellcheckerlanguage_modules($modulesinproductlanguageresolvedarrayref);
799 $filesinproductlanguageresolvedarrayref = installer::scriptitems::remove_not_required_spellcheckerlanguage_files($filesinproductlanguageresolvedarrayref);
802 installer::scriptitems::changing_name_of_language_dependent_keys($modulesinproductlanguageresolvedarrayref);
804 installer::scriptitems::select_required_language_strings($modulesinproductlanguageresolvedarrayref); # using english strings
808 # Copy-only projects can now start to copy all items File and ScpAction
809 if ( $installer::globals::is_copy_only_project ) { installer::copyproject::copy_project($filesinproductlanguageresolvedarrayref, $scpactionsinproductlanguageresolvedarrayref, $loggingdir, $languagestringref, $shipinstalldir, $allsettingsarrayref); }
811 # Language pack projects can now start to select the required information
812 if ( $installer::globals::languagepack )
814 $filesinproductlanguageresolvedarrayref = installer::languagepack::select_language_items($filesinproductlanguageresolvedarrayref, $languagesarrayref, "File");
815 $scpactionsinproductlanguageresolvedarrayref = installer::languagepack::select_language_items($scpactionsinproductlanguageresolvedarrayref, $languagesarrayref, "ScpAction");
816 $linksinproductlanguageresolvedarrayref = installer::languagepack::select_language_items($linksinproductlanguageresolvedarrayref, $languagesarrayref, "Shortcut");
817 $unixlinksinproductlanguageresolvedarrayref = installer::languagepack::select_language_items($unixlinksinproductlanguageresolvedarrayref, $languagesarrayref, "Unixlink");
818 @{$folderitemsinproductlanguageresolvedarrayref} = (); # no folderitems in languagepacks
820 # Collecting the directories again, to include only the language specific directories
821 ($directoriesforepmarrayref, $alldirectoryhash) = installer::scriptitems::collect_directories_from_filesarray($filesinproductlanguageresolvedarrayref);
822 ($directoriesforepmarrayref, $alldirectoryhash) = installer::scriptitems::collect_directories_with_create_flag_from_directoryarray($dirsinproductlanguageresolvedarrayref, $alldirectoryhash);
823 @$directoriesforepmarrayref = sort { $a->{"HostName"} cmp $b->{"HostName"} } @$directoriesforepmarrayref;
825 if ( $installer::globals::iswindowsbuild )
827 $registryitemsinproductlanguageresolvedarrayref = installer::worker::select_langpack_items($registryitemsinproductlanguageresolvedarrayref, "RegistryItem");
832 # Help pack projects can now start to select the required information
833 if ( $installer::globals::helppack )
835 $filesinproductlanguageresolvedarrayref = installer::helppack::select_help_items($filesinproductlanguageresolvedarrayref, $languagesarrayref, "File");
836 $scpactionsinproductlanguageresolvedarrayref = installer::helppack::select_help_items($scpactionsinproductlanguageresolvedarrayref, $languagesarrayref, "ScpAction");
837 $linksinproductlanguageresolvedarrayref = installer::helppack::select_help_items($linksinproductlanguageresolvedarrayref, $languagesarrayref, "Shortcut");
838 $unixlinksinproductlanguageresolvedarrayref = installer::helppack::select_help_items($unixlinksinproductlanguageresolvedarrayref, $languagesarrayref, "Unixlink");
839 @{$folderitemsinproductlanguageresolvedarrayref} = (); # no folderitems in helppacks
841 # Collecting the directories again, to include only the language specific directories
842 ($directoriesforepmarrayref, $alldirectoryhash) = installer::scriptitems::collect_directories_from_filesarray($filesinproductlanguageresolvedarrayref);
843 ($directoriesforepmarrayref, $alldirectoryhash) = installer::scriptitems::collect_directories_with_create_flag_from_directoryarray($dirsinproductlanguageresolvedarrayref, $alldirectoryhash);
844 @$directoriesforepmarrayref = sort { $a->{"HostName"} cmp $b->{"HostName"} } @$directoriesforepmarrayref;
846 if ( $installer::globals::iswindowsbuild )
848 $registryitemsinproductlanguageresolvedarrayref = installer::worker::select_helppack_items($registryitemsinproductlanguageresolvedarrayref, "RegistryItem");
853 #########################################################
854 # Collecting all scp actions
855 #########################################################
857 installer::worker::collect_scpactions($scpactionsinproductlanguageresolvedarrayref);
859 ###########################################################
860 # Simple package projects can now start to create the
861 # installation structure by creating Directories, Files
862 # Links and ScpActions. This is the last platform
863 # independent part.
864 ###########################################################
866 if ( $installer::globals::is_simple_packager_project )
868 installer::simplepackage::create_simple_package($filesinproductlanguageresolvedarrayref, $directoriesforepmarrayref, $scpactionsinproductlanguageresolvedarrayref, $linksinproductlanguageresolvedarrayref, $unixlinksinproductlanguageresolvedarrayref, $loggingdir, $languagestringref, $shipinstalldir, $allsettingsarrayref, $allvariableshashref, $includepatharrayref);
869 next; # ! leaving the current loop, because no further packaging required.
872 ###########################################################
873 # Analyzing the package structure
874 ###########################################################
876 installer::logger::print_message( "... analyzing package list ...\n" );
878 my $packages = installer::packagelist::collectpackages($modulesinproductlanguageresolvedarrayref, $languagesarrayref);
879 installer::packagelist::check_packagelist($packages);
881 $packages = installer::packagelist::analyze_list($packages, $modulesinproductlanguageresolvedarrayref);
882 installer::packagelist::remove_multiple_modules_packages($packages);
884 # printing packages content:
885 installer::packagelist::log_packages_content($packages);
886 installer::packagelist::create_module_destination_hash($packages, $allvariableshashref);
888 #################################################
889 # Part 2: The platform dependent part
890 #################################################
892 #################################################
893 # Part 2a: All non-Windows platforms
894 #################################################
896 #########################################################
897 # ... creating epm list file ...
898 # Only for non-Windows platforms
899 #########################################################
901 if (!( $installer::globals::iswindowsbuild ))
903 ####################################################
904 # Writing log file before packages are packed
905 ####################################################
907 installer::logger::print_message( "... creating log file " . $loggingdir . $installer::globals::logfilename . "\n" );
908 installer::files::save_file($loggingdir . $installer::globals::logfilename, \@installer::globals::logfileinfo);
910 ####################################################
911 # Creating directories
912 ####################################################
914 if ( $allvariableshashref->{'OOODOWNLOADNAME'} ) { installer::download::set_download_filename($languagestringref, $allvariableshashref); }
915 else { installer::download::resolve_variables_in_downloadname($allvariableshashref, "", $languagestringref); }
917 $installdir = installer::worker::create_installation_directory($shipinstalldir, $languagestringref, \$current_install_number);
919 my $listfiledir = installer::systemactions::create_directories("listfile", $languagestringref);
920 my $installlogdir = installer::systemactions::create_directory_next_to_directory($installdir, "log");
922 ####################################################
923 # Reading for Solaris all package descriptions
924 # from file defined in property PACKAGEMAP
925 ####################################################
927 if ( $installer::globals::issolarisbuild ) { installer::epmfile::read_packagemap($allvariableshashref, $includepatharrayref, $languagesarrayref); }
929 ###########################################
930 # Checking epm state
931 ###########################################
933 my $epmexecutable = "";
934 if ( $installer::globals::call_epm )
936 $epmexecutable = installer::epmfile::find_epm_on_system($includepatharrayref);
937 installer::epmfile::set_patch_state($epmexecutable); # setting $installer::globals::is_special_epm
940 # shuffle array to reduce parallel packaging process in pool
941 @{$packages} = shuffle @{$packages}
942 unless $installer::globals::simple;
944 # iterating over all packages
945 for my $onepackage ( @{$packages} )
947 # checking, if this is a language pack or a project pack.
948 # Creating language packs only, if $installer::globals::languagepack is set. Parameter: -languagepack
950 if ( $installer::globals::languagepack ) { installer::languagepack::replace_languagestring_variable($onepackage, $languagestringref); }
952 # checking, if this is a help pack
953 # Creating help packs only, if $installer::globals::helppack is set. Parameter: -helppack
955 if ( $installer::globals::helppack ) { installer::helppack::replace_languagestring_variable($onepackage, $languagestringref); }
957 my $onepackagename = $onepackage->{'module'}; # name of the top module (required)
959 my $shellscriptsfilename = "";
960 if ( $onepackage->{'script'} ) { $shellscriptsfilename = $onepackage->{'script'}; }
962 ###########################
963 # package name
964 ###########################
966 my $packagename = "";
968 if ( $installer::globals::issolarisbuild ) # only for Solaris
970 if ( $onepackage->{'solarispackagename'} ) { $packagename = $onepackage->{'solarispackagename'}; }
972 else # not Solaris
974 if ( $onepackage->{'packagename'} ) { $packagename = $onepackage->{'packagename'}; }
977 if (!($packagename eq ""))
979 installer::packagelist::resolve_packagevariables(\$packagename, $allvariableshashref, 0);
982 # Debian allows no underline in package name
983 if ( $installer::globals::debian ) { $packagename =~ s/_/-/g; }
985 ####################################################
986 # Header for this package into log file
987 ####################################################
989 installer::logger::include_header_into_logfile("Creating package: $packagename");
991 ###########################################
992 # Root path, can be defined as parameter
993 ###########################################
995 my $packagerootpath = "";
997 if ($installer::globals::rootpath eq "")
999 $packagerootpath = $onepackage->{'destpath'};
1000 installer::packagelist::resolve_packagevariables(\$packagerootpath, $allvariableshashref, 1);
1001 # we put branding and common stuff into the same prefix on unixes => $packagerootpath must be the whole prefix, including the product name
1002 if ($installer::globals::isunix) { $packagerootpath .= "/$allvariableshashref->{'UNIXBASISROOTNAME'}"; }
1003 if ( $^O =~ /darwin/i ) { $packagerootpath =~ s/\/opt\//\/Applications\//; }
1005 else
1007 $packagerootpath = $installer::globals::rootpath;
1010 #############################################
1011 # copying the collectors for each package
1012 #############################################
1014 my $filesinpackage = installer::converter::copy_collector($filesinproductlanguageresolvedarrayref);
1015 my $linksinpackage = installer::converter::copy_collector($linksinproductlanguageresolvedarrayref);
1016 my $unixlinksinpackage = installer::converter::copy_collector($unixlinksinproductlanguageresolvedarrayref);
1017 my $dirsinpackage = installer::converter::copy_collector($directoriesforepmarrayref);
1019 ###########################################
1020 # setting the root path for the packages
1021 ###########################################
1023 installer::scriptitems::add_rootpath_to_directories($dirsinpackage, $packagerootpath);
1024 installer::scriptitems::add_rootpath_to_files($filesinpackage, $packagerootpath);
1025 installer::scriptitems::add_rootpath_to_links($linksinpackage, $packagerootpath);
1026 installer::scriptitems::add_rootpath_to_files($unixlinksinpackage, $packagerootpath);
1028 #################################
1029 # collecting items for package
1030 #################################
1032 $filesinpackage = installer::packagelist::find_files_for_package($filesinpackage, $onepackage);
1033 $unixlinksinpackage = installer::packagelist::find_files_for_package($unixlinksinpackage, $onepackage);
1034 $linksinpackage = installer::packagelist::find_links_for_package($linksinpackage, $filesinpackage);
1035 $dirsinpackage = installer::packagelist::find_dirs_for_package($dirsinpackage, $onepackage);
1037 ###############################################
1038 # nothing to do, if $filesinpackage is empty
1039 ###############################################
1041 if ( ! ( $#{$filesinpackage} > -1 ))
1043 $infoline = "\n\nNo file in package: $packagename \-\> Skipping\n\n";
1044 push(@installer::globals::logfileinfo, $infoline);
1045 next; # next package, end of loop !
1048 ###########################################
1049 # Stripping libraries
1050 ###########################################
1052 # Building for non Windows platforms in cws requires, that all files are stripped before packaging:
1053 # 1. copy all files that need to be stripped locally
1054 # 2. strip all these files
1056 if ( $installer::globals::strip )
1058 strip_libraries($filesinpackage, $languagestringref);
1061 if ( $installer::globals::simple ) {
1062 installer::worker::install_simple($onepackagename, $$languagestringref, $dirsinpackage, $filesinpackage, $linksinpackage, $unixlinksinpackage);
1064 else {
1065 # epm list file format:
1066 # type mode owner group destination source options
1067 # Example for a file: f 755 root sys /usr/bin/foo foo
1068 # Example for a directory: d 755 root sys /var/spool/foo -
1069 # Example for a link: l 000 root sys /usr/bin/linkname filename
1070 # The source field specifies the file to link to
1072 my $epmfilename = "epm_" . $onepackagename . ".lst";
1074 installer::logger::print_message( "... creating epm list file $epmfilename ... \n" );
1076 my $completeepmfilename = $listfiledir . $installer::globals::separator . $epmfilename;
1078 my @epmfile = ();
1080 my $epmheaderref = installer::epmfile::create_epm_header($allvariableshashref, $filesinproductlanguageresolvedarrayref, $languagesarrayref, $onepackage);
1081 installer::epmfile::adding_header_to_epm_file(\@epmfile, $epmheaderref);
1083 # adding directories, files and links into epm file
1085 installer::epmfile::put_directories_into_epmfile($dirsinpackage, \@epmfile, $allvariableshashref, $packagerootpath);
1086 installer::epmfile::put_files_into_epmfile($filesinpackage, \@epmfile );
1087 installer::epmfile::put_links_into_epmfile($linksinpackage, \@epmfile );
1088 installer::epmfile::put_unixlinks_into_epmfile($unixlinksinpackage, \@epmfile );
1090 if ((!( $shellscriptsfilename eq "" )) && (!($installer::globals::iswindowsbuild))) { installer::epmfile::adding_shellscripts_to_epm_file(\@epmfile, $shellscriptsfilename, $packagerootpath, $allvariableshashref, $filesinpackage); }
1092 installer::files::save_file($completeepmfilename ,\@epmfile);
1094 # ... splitting the rootpath into a relocatable part and a static part, if possible
1096 my $staticpath = "";
1097 my $relocatablepath = "";
1098 # relocatable path can be defined in package list
1099 if ( $onepackage->{'relocatablepath'} ) { $relocatablepath = $onepackage->{'relocatablepath'}; }
1100 # setting fix part and variable part of destination path
1101 installer::epmfile::analyze_rootpath($packagerootpath, \$staticpath, \$relocatablepath, $allvariableshashref);
1103 # ... replacing the variable PRODUCTDIRECTORYNAME in the shellscriptfile by $staticpath
1105 installer::epmfile::resolve_path_in_epm_list_before_packaging(\@epmfile, $completeepmfilename, "PRODUCTDIRECTORYNAME", $staticpath);
1106 installer::epmfile::resolve_path_in_epm_list_before_packaging(\@epmfile, $completeepmfilename, "SOLSUREPACKAGEPREFIX", $allvariableshashref->{'SOLSUREPACKAGEPREFIX'});
1107 installer::epmfile::resolve_path_in_epm_list_before_packaging(\@epmfile, $completeepmfilename, "UREPACKAGEPREFIX", $allvariableshashref->{'UREPACKAGEPREFIX'});
1108 installer::files::save_file($completeepmfilename ,\@epmfile);
1111 # changing into the "install" directory to create installation sets
1113 $currentdir = cwd(); # $currentdir is global in this file
1115 chdir($installdir); # changing into install directory ($installdir is global in this file)
1117 ###########################################
1118 # Starting epm
1119 ###########################################
1121 # With a patched epm, it is now possible to set the relocatable directory, change
1122 # the directory in which the packages are created, setting "requires" and "provides"
1123 # (Linux) or creating the "depend" file (Solaris) and finally to begin
1124 # the packaging process with standard tooling and standard parameter
1125 # Linux: Adding into the spec file: Prefix: /opt
1126 # Solaris: Adding into the pkginfo file: BASEDIR=/opt
1127 # Attention: Changing of the path can influence the shell scripts
1129 if (( $installer::globals::is_special_epm ) && ( ($installer::globals::isrpmbuild) || ($installer::globals::issolarispkgbuild) )) # special handling only for Linux RPMs and Solaris Packages
1131 if ( $installer::globals::call_epm ) # only do something, if epm is really executed
1133 # ... now epm can be started, to create the installation sets
1135 installer::logger::print_message( "... starting patched epm ... \n" );
1137 installer::epmfile::call_epm($epmexecutable, $completeepmfilename, $packagename, $includepatharrayref);
1139 my $newepmdir = installer::epmfile::prepare_packages($loggingdir, $packagename, $staticpath, $relocatablepath, $onepackage, $allvariableshashref, $filesinpackage, $languagestringref); # adding the line for Prefix / Basedir, include rpmdir
1141 installer::epmfile::create_packages_without_epm($newepmdir, $packagename, $includepatharrayref, $allvariableshashref, $languagestringref); # start to package
1143 # finally removing all temporary files
1145 installer::epmfile::remove_temporary_epm_files($newepmdir, $loggingdir, $packagename);
1147 # Installation:
1148 # Install: pkgadd -a myAdminfile -d ./SUNWso8m34.pkg
1149 # Install: rpm -i --prefix=/opt/special --nodeps so8m35.rpm
1151 installer::epmfile::create_new_directory_structure($newepmdir);
1152 $installer::globals::postprocess_specialepm = 1;
1154 # solaris patch not needed anymore
1158 else # this is the standard epm (not relocatable) or ( nonlinux and nonsolaris )
1160 installer::epmfile::resolve_path_in_epm_list_before_packaging(\@epmfile, $completeepmfilename, "\$\$PRODUCTINSTALLLOCATION", $relocatablepath);
1161 installer::files::save_file($completeepmfilename ,\@epmfile); # Warning for pool, content of epm file is changed.
1163 if ( $installer::globals::call_epm )
1165 # ... now epm can be started, to create the installation sets
1167 installer::logger::print_message( "... starting unpatched epm ... \n" );
1169 if ( $installer::globals::call_epm ) { installer::epmfile::call_epm($epmexecutable, $completeepmfilename, $packagename, $includepatharrayref); }
1171 if (($installer::globals::isrpmbuild) || ($installer::globals::issolarispkgbuild) || ($installer::globals::debian))
1173 $installer::globals::postprocess_standardepm = 1;
1178 chdir($currentdir); # changing back into start directory
1182 } # end of "if ( ! $installer::globals::simple )
1184 } # end of "for ( @{$packages} )"
1186 ##############################################################
1187 # Post epm functionality, after the last package is packed
1188 ##############################################################
1190 if ( $installer::globals::postprocess_specialepm )
1192 installer::logger::include_header_into_logfile("Post EPM processes (Patched EPM):");
1194 chdir($installdir);
1196 # Copying the cde, kde and gnome packages into the installation set
1197 if ( $installer::globals::addsystemintegration ) { installer::epmfile::put_systemintegration_into_installset($installer::globals::epmoutpath, $includepatharrayref, $allvariableshashref, $modulesinproductarrayref); }
1199 # Adding license and readme into installation set
1200 if ($installer::globals::addlicensefile) { installer::worker::put_scpactions_into_installset("."); }
1202 # Adding license file into setup
1203 if ( $allvariableshashref->{'PUT_LICENSE_INTO_SETUP'} ) { installer::worker::put_license_into_setup(".", $includepatharrayref); }
1205 # Creating installation set for Unix language packs, that are not part of multi lingual installation sets
1206 if ( ( $installer::globals::languagepack ) && ( ! $installer::globals::debian ) && ( ! $installer::globals::makedownload ) ) { installer::languagepack::build_installer_for_languagepack($installer::globals::epmoutpath, $allvariableshashref, $includepatharrayref, $languagesarrayref, $languagestringref); }
1208 # Creating installation set for Unix help packs, that are not part of multi lingual installation sets
1209 if ( ( $installer::globals::helppack ) && ( ! $installer::globals::debian ) && ( ! $installer::globals::makedownload ) ) { installer::helppack::build_installer_for_helppack($installer::globals::epmoutpath, $allvariableshashref, $includepatharrayref, $languagesarrayref, $languagestringref); }
1211 chdir($currentdir); # changing back into start directory
1214 if ( $installer::globals::postprocess_standardepm )
1216 installer::logger::include_header_into_logfile("Post EPM processes (Standard EPM):");
1218 chdir($installdir);
1220 # determine the destination directory
1221 my $newepmdir = installer::epmfile::determine_installdir_ooo();
1223 # Copying the cde, kde and gnome packages into the installation set
1224 if ( $installer::globals::addsystemintegration ) { installer::epmfile::put_systemintegration_into_installset($newepmdir, $includepatharrayref, $allvariableshashref, $modulesinproductarrayref); }
1226 # Adding license and readme into installation set
1227 if ($installer::globals::addlicensefile) { installer::worker::put_scpactions_into_installset("."); }
1229 # Adding license file into setup
1230 if ( $allvariableshashref->{'PUT_LICENSE_INTO_SETUP'} ) { installer::worker::put_license_into_setup(".", $includepatharrayref); }
1232 # Creating installation set for Unix language packs, that are not part of multi lingual installation sets
1233 if ( ( $installer::globals::languagepack ) && ( ! $installer::globals::debian ) && ( ! $installer::globals::makedownload ) ) { installer::languagepack::build_installer_for_languagepack($newepmdir, $allvariableshashref, $includepatharrayref, $languagesarrayref, $languagestringref); }
1235 # Creating installation set for Unix help packs, that are not part of multi lingual installation sets
1236 if ( ( $installer::globals::helppack ) && ( ! $installer::globals::debian ) && ( ! $installer::globals::makedownload ) ) { installer::helppack::build_installer_for_helpepack($newepmdir, $allvariableshashref, $includepatharrayref, $languagesarrayref, $languagestringref); }
1238 chdir($currentdir); # changing back into start directory
1241 if (( $installer::globals::issolarispkgbuild ) && ( $allvariableshashref->{'COLLECT_PKGMAP'} )) { installer::worker::collectpackagemaps($installdir, $languagestringref, $allvariableshashref); }
1243 #######################################################
1244 # Analyzing the log file
1245 #######################################################
1247 my $is_success = 0;
1248 my $finalinstalldir = "";
1250 installer::worker::clean_output_tree(); # removing directories created in the output tree
1251 ($is_success, $finalinstalldir) = installer::worker::analyze_and_save_logfile($loggingdir, $installdir, $installlogdir, $allsettingsarrayref, $languagestringref, $current_install_number);
1252 my $downloadname = installer::ziplist::getinfofromziplist($allsettingsarrayref, "downloadname");
1254 #######################################################
1255 # Creating download installation set
1256 #######################################################
1258 if ( $installer::globals::makedownload )
1260 my $create_download = 0;
1261 if ( $$downloadname ne "" ) { $create_download = 1; }
1262 if ( $installer::globals::iswindowsbuild ) { $create_download = 0; }
1263 if (( $is_success ) && ( $create_download ) && ( $ENV{'ENABLE_DOWNLOADSETS'} ))
1265 my $downloaddir = installer::download::create_download_sets($finalinstalldir, $includepatharrayref, $allvariableshashref, $$downloadname, $languagestringref, $languagesarrayref);
1266 installer::worker::analyze_and_save_logfile($loggingdir, $downloaddir, $installlogdir, $allsettingsarrayref, $languagestringref, $current_install_number);
1269 } # end of "if (!( $installer::globals::iswindowsbuild ))"
1271 #################################################
1272 # Part 2b: The Windows platform
1273 #################################################
1275 #####################################################################
1276 # ... creating idt files ...
1277 # Only for Windows builds ($installer::globals::compiler is wntmsci)
1278 #####################################################################
1280 if ( $installer::globals::iswindowsbuild )
1282 ###########################################
1283 # Stripping libraries
1284 ###########################################
1286 # Building for gcc build in cws requires, that all files are stripped before packaging:
1287 # 1. copy all files that need to be stripped locally
1288 # 2. strip all these files
1290 if ( $installer::globals::compiler =~ /wntgcci/ || $installer::globals::compiler =~ /wntgccx/ )
1292 installer::windows::strip::strip_binaries($filesinproductlanguageresolvedarrayref, $languagestringref);
1295 $installdir = installer::worker::create_installation_directory($shipinstalldir, $languagestringref, \$current_install_number);
1297 my $idtdirbase = installer::systemactions::create_directories("idt_files", $languagestringref);
1298 $installer::globals::infodirectory = installer::systemactions::create_directories("info_files", $languagestringref);
1299 my $installlogdir = installer::systemactions::create_directory_next_to_directory($installdir, "log");
1301 #################################################################################
1302 # Preparing cabinet files from package definitions
1303 #################################################################################
1305 installer::packagelist::prepare_cabinet_files($packages, $allvariableshashref);
1306 # printing packages content:
1307 installer::packagelist::log_cabinet_assignments();
1309 #################################################################################
1310 # Begin of functions that are used for the creation of idt files (Windows only)
1311 #################################################################################
1313 installer::logger::print_message( "... creating idt files ...\n" );
1315 installer::logger::include_header_into_logfile("Creating idt files:");
1317 my $newidtdir = $idtdirbase . $installer::globals::separator . "00"; # new files into language independent directory "00"
1318 installer::systemactions::create_directory($newidtdir);
1320 my @allfilecomponents = ();
1321 my @allregistrycomponents = ();
1323 # Collecting all files with flag "BINARYTABLE"
1324 my $binarytablefiles = installer::worker::collect_all_items_with_special_flag($filesinproductlanguageresolvedarrayref ,"BINARYTABLE");
1326 # Removing all files with flag "BINARYTABLE_ONLY"
1327 @installer::globals::binarytableonlyfiles = ();
1328 $filesinproductlanguageresolvedarrayref = installer::worker::remove_all_items_with_special_flag($filesinproductlanguageresolvedarrayref ,"BINARYTABLE_ONLY");
1330 # Collecting all profileitems with flag "INIFILETABLE" for table "IniFile"
1331 my $inifiletableentries = installer::worker::collect_all_items_with_special_flag($profileitemsinproductlanguageresolvedarrayref ,"INIFILETABLE");
1333 # Creating the important dynamic idt files
1334 installer::windows::msiglobal::set_msiproductversion($allvariableshashref);
1335 installer::windows::msiglobal::put_msiproductversion_into_bootstrapfile($filesinproductlanguageresolvedarrayref);
1337 # Add cabinet assignments to files
1338 installer::windows::file::assign_cab_to_files($filesinproductlanguageresolvedarrayref);
1339 installer::windows::file::assign_sequencenumbers_to_files($filesinproductlanguageresolvedarrayref);
1341 # Collection all available directory trees
1342 installer::windows::directory::collectdirectorytrees($directoriesforepmarrayref);
1344 # Attention: The table "Director.idt" contains language specific strings -> parameter: \@setuplanguagesarray !
1345 installer::windows::directory::create_directory_table($directoriesforepmarrayref, \@setuplanguagesarray, $newidtdir, $allvariableshashref, $shortdirname, $loggingdir);
1347 $filesinproductlanguageresolvedarrayref = installer::windows::file::create_files_table($filesinproductlanguageresolvedarrayref, $directoriesforepmarrayref, \@allfilecomponents, $newidtdir, $allvariableshashref, $uniquefilename, $allupdatesequences, $allupdatecomponents, $allupdatefileorder);
1348 if ( $installer::globals::updatedatabase ) { installer::windows::file::check_file_sequences($allupdatefileorder, $allupdatecomponentorder); }
1350 # Attention: The table "Registry.idt" contains language specific strings -> parameter: \@setuplanguagesarray !
1351 installer::windows::registry::create_registry_table($registryitemsinproductlanguageresolvedarrayref, \@allregistrycomponents, $newidtdir, \@setuplanguagesarray, $allvariableshashref);
1353 installer::windows::component::create_component_table($filesinproductlanguageresolvedarrayref, $registryitemsinproductlanguageresolvedarrayref, $directoriesforepmarrayref, \@allfilecomponents, \@allregistrycomponents, $newidtdir, $componentid, $componentidkeypath, $allvariableshashref);
1355 # Attention: The table "Feature.idt" contains language specific strings -> parameter: \@setuplanguagesarray !
1356 installer::windows::feature::add_uniquekey($modulesinproductlanguageresolvedarrayref);
1357 $modulesinproductlanguageresolvedarrayref = installer::windows::feature::sort_feature($modulesinproductlanguageresolvedarrayref);
1358 installer::windows::feature::create_feature_table($modulesinproductlanguageresolvedarrayref, $newidtdir, \@setuplanguagesarray, $allvariableshashref);
1360 installer::windows::featurecomponent::create_featurecomponent_table($filesinproductlanguageresolvedarrayref, $registryitemsinproductlanguageresolvedarrayref, $newidtdir);
1362 installer::windows::media::create_media_table($filesinproductlanguageresolvedarrayref, $newidtdir, $allvariableshashref, $allupdatelastsequences, $allupdatediskids);
1364 installer::windows::font::create_font_table($filesinproductlanguageresolvedarrayref, $newidtdir);
1366 # Attention: The table "Shortcut.idt" contains language specific strings -> parameter: \@setuplanguagesarray !
1367 # Attention: Shortcuts (Folderitems) have icon files, that have to be copied into the Icon directory (last parameter)
1368 my @iconfilecollector = ();
1370 installer::windows::shortcut::create_shortcut_table($filesinproductlanguageresolvedarrayref, $linksinproductlanguageresolvedarrayref, $folderinproductlanguageresolvedarrayref, $folderitemsinproductlanguageresolvedarrayref, $directoriesforepmarrayref, $newidtdir, \@setuplanguagesarray, $includepatharrayref, \@iconfilecollector);
1372 installer::windows::inifile::create_inifile_table($inifiletableentries, $filesinproductlanguageresolvedarrayref, $newidtdir);
1374 installer::windows::icon::create_icon_table(\@iconfilecollector, $newidtdir); # creating the icon table with all iconfiles used as shortcuts (FolderItems)
1376 installer::windows::createfolder::create_createfolder_table($directoriesforepmarrayref, $filesinproductlanguageresolvedarrayref, $newidtdir, $allvariableshashref);
1378 installer::windows::upgrade::create_upgrade_table($newidtdir, $allvariableshashref);
1380 installer::windows::msishortcutproperty::create_msishortcutproperty_table($folderitempropertiesinproductarrayref, $folderitemsinproductarrayref, $newidtdir);
1382 if (( ! $installer::globals::languagepack ) && ( ! $installer::globals::helppack )) # the following tables not for language packs or help packs
1384 installer::windows::removefile::create_removefile_table($folderitemsinproductlanguageresolvedarrayref, $newidtdir);
1386 # Adding Assemblies into the tables MsiAssembly and MsiAssemblyName dynamically
1387 installer::windows::assembly::create_msiassembly_table($filesinproductlanguageresolvedarrayref, $newidtdir);
1388 installer::windows::assembly::create_msiassemblyname_table($filesinproductlanguageresolvedarrayref, $newidtdir);
1389 installer::windows::assembly::add_assembly_condition_into_component_table($filesinproductlanguageresolvedarrayref, $newidtdir);
1392 $infoline = "\n";
1393 push(@installer::globals::logfileinfo, $infoline);
1395 # Localizing the language dependent idt files
1396 # For every language there will be a localized msi database
1397 # For multilingual installation sets, the differences of this
1398 # databases have to be stored in transforms.
1400 for ( my $m = 0; $m <= $#{\@setuplanguagesarray}; $m++ )
1402 my $onelanguage = ${\@setuplanguagesarray}[$m];
1404 my $is_rtl = 0;
1405 my @rtllanguages = ("ar", "fa", "he", "ug", "ky-CN");
1406 if ( grep {$_ eq $onelanguage} @rtllanguages ) { $is_rtl = 1; }
1408 my $languageidtdir = $idtdirbase . $installer::globals::separator . $onelanguage;
1409 if ( -d $languageidtdir ) { installer::systemactions::remove_complete_directory($languageidtdir, 1); }
1410 installer::systemactions::create_directory($languageidtdir);
1412 # Copy the template idt files and the new created idt files into this language directory
1414 installer::logger::print_message( "... copying idt files ...\n" );
1416 installer::logger::include_header_into_logfile("Copying idt files to $languageidtdir:");
1418 installer::windows::idtglobal::prepare_language_idt_directory($languageidtdir, $newidtdir, $onelanguage, $filesinproductlanguageresolvedarrayref, \@iconfilecollector, $binarytablefiles, $allvariableshashref);
1420 # Now all files are copied into a language specific directory
1421 # The template idt files can be translated
1423 installer::logger::print_message( "... localizing idt files (language: $onelanguage) ...\n" );
1425 installer::logger::include_header_into_logfile("Localizing idt files (Language: $onelanguage):");
1427 my @translationfiles = (); # all idt files, that need a translation
1428 push(@translationfiles, "ActionTe.idt");
1429 push(@translationfiles, "Control.idt");
1430 push(@translationfiles, "CustomAc.idt");
1431 push(@translationfiles, "Error.idt");
1432 push(@translationfiles, "LaunchCo.idt");
1433 push(@translationfiles, "RadioBut.idt");
1434 push(@translationfiles, "Property.idt");
1435 push(@translationfiles, "UIText.idt");
1437 my $oneidtfilename;
1438 my $oneidtfile;
1440 foreach $oneidtfilename (@translationfiles)
1442 my $languagefilename = installer::windows::idtglobal::get_languagefilename($oneidtfilename, $installer::globals::idtlanguagepath);
1443 my $languagefile = installer::files::read_file($languagefilename);
1445 $oneidtfilename = $languageidtdir . $installer::globals::separator . $oneidtfilename;
1446 $oneidtfile = installer::files::read_file($oneidtfilename);
1448 # Now the substitution can start
1449 installer::windows::idtglobal::translate_idtfile($oneidtfile, $languagefile, $onelanguage);
1451 installer::files::save_file($oneidtfilename, $oneidtfile);
1453 $infoline = "Translated idt file: $oneidtfilename into language $onelanguage\n";
1454 push(@installer::globals::logfileinfo, $infoline);
1455 $infoline = "Used languagefile: $languagefilename\n";
1456 push(@installer::globals::logfileinfo, $infoline);
1459 # setting bidi attributes, if required
1460 if ( $is_rtl ) { installer::windows::idtglobal::setbidiattributes($languageidtdir, $onelanguage); }
1462 # setting the condition, that at least one module is selected
1463 installer::windows::idtglobal::set_multilanguageonly_condition($languageidtdir);
1465 # include the license text into the table Control.idt
1467 if ( ! $allvariableshashref->{'HIDELICENSEDIALOG'} )
1469 my $licensefilesource = installer::windows::idtglobal::get_rtflicensefilesource($onelanguage, $includepatharrayref_lang);
1470 my $licensefile = installer::files::read_file($licensefilesource);
1471 installer::scpzipfiles::replace_all_ziplistvariables_in_rtffile($licensefile, $allvariableshashref);
1472 my $controltablename = $languageidtdir . $installer::globals::separator . "Control.idt";
1473 my $controltable = installer::files::read_file($controltablename);
1474 installer::windows::idtglobal::add_licensefile_to_database($licensefile, $controltable);
1475 installer::files::save_file($controltablename, $controltable);
1477 $infoline = "Added licensefile $licensefilesource into database $controltablename\n";
1478 push(@installer::globals::logfileinfo, $infoline);
1481 # include a component into environment table if required
1483 installer::windows::component::set_component_in_environment_table($languageidtdir, $filesinproductlanguageresolvedarrayref);
1485 # include the ProductCode and the UpgradeCode from codes-file into the Property.idt
1487 installer::windows::property::set_codes_in_property_table($languageidtdir);
1489 # the language specific properties can now be set in the Property.idt
1491 installer::windows::property::update_property_table($languageidtdir, $onelanguage, $allvariableshashref, $languagestringref);
1493 # replacing variables in RegLocat.idt
1495 installer::windows::msiglobal::update_reglocat_table($languageidtdir, $allvariableshashref);
1497 # replacing variables in RemoveRe.idt (RemoveRegistry.idt)
1499 installer::windows::msiglobal::update_removere_table($languageidtdir);
1501 # adding language specific properties for multilingual installation sets
1503 installer::windows::property::set_languages_in_property_table($languageidtdir, \@setuplanguagesarray);
1505 # adding settings into CheckBox.idt
1506 installer::windows::property::update_checkbox_table($languageidtdir, $allvariableshashref);
1508 # adding the files from the binary directory into the binary table
1509 installer::windows::binary::update_binary_table($languageidtdir, $filesinproductlanguageresolvedarrayref, $binarytablefiles);
1511 # Adding Windows Installer CustomActions
1513 installer::windows::idtglobal::addcustomactions($languageidtdir, $windowscustomactionsarrayref, $filesinproductlanguageresolvedarrayref);
1515 # Then the language specific msi database can be created
1517 if ( $installer::globals::iswin || $installer::globals::packageformat eq 'msi' )
1519 my $msidatabasename = installer::windows::msiglobal::get_msidatabasename($allvariableshashref, $onelanguage);
1520 my $msifilename = $languageidtdir . $installer::globals::separator . $msidatabasename;
1522 installer::logger::print_message( "... creating msi database (language $onelanguage) ... \n" );
1524 installer::windows::msiglobal::set_uuid_into_component_table($languageidtdir, $allvariableshashref); # setting new GUID for the components using the tool uuidgen.exe
1525 installer::windows::msiglobal::prepare_64bit_database($languageidtdir, $allvariableshashref); # making last 64 bit changes
1526 installer::windows::msiglobal::create_msi_database($languageidtdir ,$msifilename);
1528 # validating the database # ToDo
1530 installer::windows::msiglobal::write_summary_into_msi_database($msifilename, $onelanguage, $languagefile, $allvariableshashref);
1532 # copy msi database into installation directory
1534 my $msidestfilename = $installdir . $installer::globals::separator . $msidatabasename;
1535 installer::systemactions::copy_one_file($msifilename, $msidestfilename);
1539 # Creating transforms, if the installation set has more than one language
1540 # renaming the msi database
1542 my $defaultlanguage = installer::languages::get_default_language(\@setuplanguagesarray);
1544 if ( $installer::globals::iswin || $installer::globals::packageformat eq 'msi' )
1546 if ( $#{\@setuplanguagesarray} > 0 )
1548 installer::windows::msiglobal::create_transforms(\@setuplanguagesarray, $defaultlanguage, $installdir, $allvariableshashref);
1550 # if there are Merge Modules, they have to be integrated now
1551 my $mergedbname = installer::windows::msiglobal::get_msidatabasename($allvariableshashref, $defaultlanguage);
1552 my $mergeidtdir = $idtdirbase . $installer::globals::separator . "mergemodules";
1553 if ( -d $mergeidtdir ) { installer::systemactions::remove_complete_directory($mergeidtdir, 1); }
1554 installer::systemactions::create_directory($mergeidtdir);
1555 installer::systemactions::copy_one_file($installdir . $installer::globals::separator . $mergedbname, $mergeidtdir . $installer::globals::separator . $mergedbname);
1556 $filesinproductlanguageresolvedarrayref = installer::windows::mergemodule::merge_mergemodules_into_msi_database($mergemodulesarrayref, $filesinproductlanguageresolvedarrayref, $mergeidtdir . $installer::globals::separator . $mergedbname, $languagestringref, $allvariableshashref, $includepatharrayref, $allupdatesequences, $allupdatelastsequences, $allupdatediskids);
1557 installer::systemactions::copy_one_file($mergeidtdir . $installer::globals::separator . $mergedbname, $installdir . $installer::globals::separator . $mergedbname);
1559 installer::windows::msiglobal::rename_msi_database_in_installset($defaultlanguage, $installdir, $allvariableshashref);
1562 # Analyzing the ScpActions and copying the files into the installation set
1564 installer::logger::print_message( "... copying files into installation set ...\n" );
1566 installer::worker::put_scpactions_into_installset($installdir);
1568 # ... copying MergeModules into installation set
1570 if ( ! $installer::globals::fix_number_of_cab_files ) { installer::windows::msiglobal::copy_merge_modules_into_installset($installdir); }
1572 installer::logger::print_message( "... creating ddf files ...\n" );
1574 # Creating all needed ddf files and generating a list
1575 # for the package process containing all system calls
1577 my $ddfdir = installer::systemactions::create_directories("ddf", $languagestringref);
1579 my $packjobref = installer::windows::msiglobal::generate_cab_file_list($filesinproductlanguageresolvedarrayref, $installdir, $ddfdir, $allvariableshashref);
1581 # Update and patch reasons the pack order needs to be saved
1582 installer::windows::msiglobal::save_packorder();
1584 $infoline = "\n";
1585 push(@installer::globals::logfileinfo, $infoline);
1587 ####################################
1588 # Writing log file
1589 # before cab files are packed
1590 ####################################
1592 installer::logger::print_message( "... creating log file $installer::globals::logfilename \n" );
1594 installer::files::save_file($loggingdir . $installer::globals::logfilename, \@installer::globals::logfileinfo);
1596 #######################################################
1597 # Finally really create the installation packages,
1598 # Only for Windows and only on a windows platform.
1599 #######################################################
1601 if ( $installer::globals::iswin || $installer::globals::packageformat eq 'msi' )
1603 installer::logger::print_message( "... packaging installation set ... \n" );
1604 installer::windows::msiglobal::execute_packaging($packjobref, $loggingdir, $allvariableshashref);
1605 if ( $installer::globals::include_cab_in_msi ) { installer::windows::msiglobal::include_cabs_into_msi($installdir); }
1607 ####################################
1608 # Writing log file
1609 # after cab files are packed
1610 ####################################
1612 installer::logger::print_message( "\n... creating log file $installer::globals::logfilename \n" );
1613 installer::files::save_file($loggingdir . $installer::globals::logfilename, \@installer::globals::logfileinfo);
1616 #######################################################
1617 # Analyzing the log file
1618 #######################################################
1620 my $is_success = 0;
1621 my $finalinstalldir = "";
1622 installer::worker::clean_output_tree(); # removing directories created in the output tree
1623 ($is_success, $finalinstalldir) = installer::worker::analyze_and_save_logfile($loggingdir, $installdir, $installlogdir, $allsettingsarrayref, $languagestringref, $current_install_number);
1625 #######################################################
1626 # Creating Windows msp patches
1627 #######################################################
1629 if (( $is_success ) && ( $installer::globals::updatedatabase ) && ( $allvariableshashref->{'CREATE_MSP_INSTALLSET'} ))
1631 # Required:
1632 # Temp path for administrative installations: $installer::globals::temppath
1633 # Path of new installation set: $finalinstalldir
1634 # Path of old installation set: $installer::globals::updatedatabasepath
1635 my $mspdir = installer::windows::msp::create_msp_patch($finalinstalldir, $includepatharrayref, $allvariableshashref, $languagestringref, $languagesarrayref, $filesinproductlanguageresolvedarrayref);
1636 ($is_success, $finalinstalldir) = installer::worker::analyze_and_save_logfile($loggingdir, $mspdir, $installlogdir, $allsettingsarrayref, $languagestringref, $current_install_number);
1637 installer::worker::clean_output_tree(); # removing directories created in the output tree
1640 #######################################################
1641 # Creating download installation set
1642 #######################################################
1644 my $create_download = 0;
1645 my $downloadname = installer::ziplist::getinfofromziplist($allsettingsarrayref, "downloadname");
1646 if ( $installer::globals::languagepack ) { $downloadname = installer::ziplist::getinfofromziplist($allsettingsarrayref, "langpackdownloadname"); }
1647 if ( $installer::globals::helppack ) { $downloadname = installer::ziplist::getinfofromziplist($allsettingsarrayref, "helppackdownloadname"); }
1649 if ( $$downloadname ne "" ) { $create_download = 1; }
1650 if ( $installer::globals::iswindowsbuild )
1652 $create_download = 0;
1653 if ( $allvariableshashref->{'OOODOWNLOADNAME'} ) { $$downloadname = installer::download::set_download_filename($languagestringref, $allvariableshashref); }
1654 else { $$downloadname = installer::download::resolve_variables_in_downloadname($allvariableshashref, $$downloadname, $languagestringref); }
1655 installer::systemactions::rename_one_file( $finalinstalldir . $installer::globals::separator . $installer::globals::shortmsidatabasename, $finalinstalldir . $installer::globals::separator . $$downloadname . ".msi" );
1656 if ( defined($ENV{'WINDOWS_BUILD_SIGNING'}) && ($ENV{'WINDOWS_BUILD_SIGNING'} eq 'TRUE') )
1658 my $systemcall = "signtool.exe sign ";
1659 if ( defined($ENV{'PFXFILE'}) ) { $systemcall .= "-f $ENV{'PFXFILE'} "; }
1660 if ( defined($ENV{'PFXPASSWORD'}) ) { $systemcall .= "-p $ENV{'PFXPASSWORD'} "; }
1661 if ( defined($ENV{'TIMESTAMPURL'}) ) { $systemcall .= "-t $ENV{'TIMESTAMPURL'} "; } else { $systemcall .= "-t http://timestamp.globalsign.com/scripts/timestamp.dll "; }
1662 $systemcall .= "-d \"" . installer::download::get_downloadname_productname($allvariableshashref) . " " . installer::download::get_download_version($allvariableshashref) . " " . installer::download::get_downloadname_language($languagestringref) . " " . installer::download::get_download_functionality($allvariableshashref) . "\" ";
1663 $systemcall .= $finalinstalldir . $installer::globals::separator . $$downloadname . ".msi";
1664 installer::logger::print_message( "... code signing and timestamping with signtool.exe ...\n" );
1666 my $returnvalue = system($systemcall);
1668 # do not print password to log
1669 if ( defined($ENV{'PFXPASSWORD'}) ) { $systemcall =~ s/$ENV{'PFXPASSWORD'}/********/; }
1670 my $infoline = "Systemcall: $systemcall\n";
1671 push( @installer::globals::logfileinfo, $infoline);
1673 if ($returnvalue)
1675 $infoline = "ERROR: Could not execute \"$systemcall\"!\n";
1676 push( @installer::globals::logfileinfo, $infoline);
1678 else
1680 $infoline = "Success: Executed \"$systemcall\" successfully!\n";
1681 push( @installer::globals::logfileinfo, $infoline);
1685 if (( $is_success ) && ( $create_download ) && ( $ENV{'ENABLE_DOWNLOADSETS'} ))
1687 my $downloaddir = installer::download::create_download_sets($finalinstalldir, $includepatharrayref, $allvariableshashref, $$downloadname, $languagestringref, $languagesarrayref);
1688 installer::worker::analyze_and_save_logfile($loggingdir, $downloaddir, $installlogdir, $allsettingsarrayref, $languagestringref, $current_install_number);
1691 } # end of "if ( $installer::globals::iswindowsbuild )"
1693 # saving file_info file for later analysis
1694 my $speciallogfilename = $loggingdir . "fileinfo_" . $installer::globals::product . "\.log";
1695 open my $log_fh, '>', $speciallogfilename
1696 or die "Could not open $speciallogfilename for writing: $!";
1697 print $log_fh Dumper($filesinproductlanguageresolvedarrayref);
1699 } # end of iteration for one language group
1702 sub cleanup_on_error {
1703 my $message = shift;
1705 # If an installation set is currently created, the directory name
1706 # is saved in $installer::globals::saveinstalldir. If this
1707 # directory name contains "_inprogress", it has to be renamed to
1708 # "_witherror".
1709 if ( $installer::globals::saveinstalldir =~ /_inprogress/ ) {
1710 installer::systemactions::rename_string_in_directory($installer::globals::saveinstalldir, "_inprogress", "_witherror");
1713 # Removing directories created in the output tree.
1714 installer::worker::clean_output_tree();
1716 $installer::globals::logfilename = $installer::globals::exitlog . $installer::globals::logfilename;
1718 my @log = (@installer::globals::logfileinfo, @installer::globals::globallogfileinfo);
1720 push(@log, "\n" . '*' x 65 . "\n");
1721 push(@log, $message);
1722 push(@log, '*' x 65 . "\n");
1724 installer::files::save_file($installer::globals::logfilename, \@log);
1726 print("ERROR, saved logfile $installer::globals::logfilename is:\n");
1727 open(my $log, "<", $installer::globals::logfilename);
1728 print ": $_" while (<$log>);
1729 print "\n";
1730 close($log);