1# 2# This file is part of the LibreOffice project. 3# 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/. 7# 8# This file incorporates work covered by the following license notice: 9# 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 . 17# 18 19package installer; 20 21use base 'Exporter'; 22 23use Cwd; 24use Data::Dumper; 25use File::Copy; 26use List::Util qw(shuffle); 27use installer::control; 28use installer::converter; 29use installer::copyproject; 30use installer::download; 31use installer::environment; 32use installer::epmfile; 33use installer::files; 34use installer::filelists; 35use installer::globals; 36use installer::helppack; 37use installer::languagepack; 38use installer::languages; 39use installer::logger; 40use installer::packagelist; 41use installer::parameter; 42use installer::pathanalyzer; 43use installer::profiles; 44use installer::scpzipfiles; 45use installer::scriptitems; 46use installer::setupscript; 47use installer::simplepackage; 48use installer::strip qw(strip_libraries); 49use installer::systemactions; 50use installer::windows::assembly; 51use installer::windows::binary; 52use installer::windows::component; 53use installer::windows::createfolder; 54use installer::windows::directory; 55use installer::windows::feature; 56use installer::windows::featurecomponent; 57use installer::windows::file; 58use installer::windows::font; 59use installer::windows::icon; 60use installer::windows::idtglobal; 61use installer::windows::inifile; 62use installer::windows::media; 63use installer::windows::mergemodule; 64use installer::windows::msiglobal; 65use installer::windows::msishortcutproperty; 66use installer::windows::msp; 67use installer::windows::property; 68use installer::windows::removefile; 69use installer::windows::registry; 70use installer::windows::shortcut; 71use installer::windows::strip; 72use installer::windows::update; 73use installer::windows::upgrade; 74use installer::worker; 75use installer::ziplist qw(read_ziplist); 76 77our @EXPORT_OK = qw(main); 78 79sub main { 80 installer::logger::starttime(); 81 82 my $exit_code = 0; 83 84 eval { 85 run(); 86 }; 87 if ($@) { 88 my $message = "ERROR: $@"; 89 90 warn "ERROR: Failure in installer.pm\n"; 91 warn "$message\n"; 92 $exit_code = -1; 93 94 cleanup_on_error($message); 95 } 96 97 installer::logger::stoptime(); 98 99 return $exit_code; 100} 101 102sub run { 103 installer::logger::print_message( "... checking environment variables ...\n" ); 104 my $environmentvariableshashref = installer::control::check_system_environment(); 105 106 installer::environment::set_global_environment_variables($environmentvariableshashref); 107 108 ################################# 109 # Check and output of parameter 110 ################################# 111 112 installer::parameter::saveparameter(); 113 installer::parameter::getparameter(); 114 115 installer::parameter::control_fundamental_parameter(); 116 installer::parameter::setglobalvariables(); 117 installer::parameter::control_required_parameter(); 118 119 if (!($installer::globals::languages_defined_in_productlist)) { installer::languages::analyze_languagelist(); } 120 installer::parameter::outputparameter(); 121 122 $installer::globals::build = uc($installer::globals::build); # using "SRC680" instead of "src680" 123 124 ###################################### 125 # Creating the log directory 126 ###################################### 127 128 my $empty = ""; 129 my $loggingdir = installer::systemactions::create_directories("logging", \$empty); 130 $loggingdir = $loggingdir . $installer::globals::separator; 131 $installer::globals::exitlog = $loggingdir; 132 133 my $installdir = ""; 134 my $currentdir = cwd(); 135 my $shipinstalldir = ""; 136 my $current_install_number = ""; 137 138 ###################################### 139 # Checking the system requirements 140 ###################################### 141 142 installer::logger::print_message( "... checking required files ...\n" ); 143 installer::control::check_system_path(); 144 145 my $pathvariableshashref = installer::environment::create_pathvariables($environmentvariableshashref); 146 147 ############################################### 148 # Checking saved setting for Windows patches 149 ############################################### 150 151 if (( $installer::globals::iswindowsbuild ) && ( $installer::globals::prepare_winpatch )) { installer::windows::msiglobal::read_saved_mappings(); } 152 153 ################################################### 154 # Analyzing the settings and variables in zip.lst 155 ################################################### 156 157 my ($allsettingsarrayref, $allvariableshashref) = read_ziplist($installer::globals::ziplistname); 158 159 ######################################################## 160 # Check if this is simple packaging mechanism 161 ######################################################## 162 163 installer::simplepackage::check_simple_packager_project($allvariableshashref); 164 165 #################################################################### 166 # setting global variables 167 #################################################################### 168 169 installer::control::set_addsystemintegration($allvariableshashref); 170 171 ######################################################## 172 # Re-define logging dir, after all variables are set 173 ######################################################## 174 175 my $oldloggingdir = $loggingdir; 176 # FIXME: It would be better to use installer::systemactions::remove_complete_directory 177 # Though, we would need to remove only the lang-specific subdirectory for langpacks and helppacks 178 rmdir $oldloggingdir; 179 $loggingdir = installer::systemactions::create_directories("logging", \$empty); 180 $loggingdir = $loggingdir . $installer::globals::separator; 181 $installer::globals::exitlog = $loggingdir; 182 183 # checking, whether this is an opensource product 184 185 if (!($installer::globals::is_copy_only_project)) { installer::ziplist::set_manufacturer($allvariableshashref); } 186 187 ############################################## 188 # Checking version of makecab.exe 189 ############################################## 190 191 if ( $installer::globals::iswindowsbuild && (!defined($ENV{'CROSS_COMPILING'}) || $ENV{'CROSS_COMPILING'} ne 'TRUE' || $installer::globals::packageformat eq 'msi')) { installer::control::check_makecab_version(); } 192 193 ########################################################## 194 # Getting the include path from the settings in zip list 195 ########################################################## 196 197 my $includepathref = installer::ziplist::getinfofromziplist($allsettingsarrayref, "include"); 198 if ( $$includepathref eq "" ) 199 { 200 die 'Definition for "include" not found in ' . $installer::globals::ziplistname; 201 } 202 203 my $includepatharrayref = installer::converter::convert_stringlist_into_array($includepathref, ","); 204 205 installer::ziplist::replace_all_variables_in_paths($includepatharrayref, $pathvariableshashref); 206 207 installer::ziplist::replace_minor_in_paths($includepatharrayref); 208 209 installer::ziplist::replace_packagetype_in_paths($includepatharrayref); 210 211 installer::ziplist::resolve_relative_paths($includepatharrayref); 212 213 installer::ziplist::remove_ending_separator($includepatharrayref); 214 215 ############################################## 216 # Collecting all files from all include 217 # paths in global hashes. 218 ############################################## 219 220 installer::worker::collect_all_files_from_includepaths($includepatharrayref); 221 222 ############################################## 223 # Analyzing languages in zip.lst if required 224 # Probably no longer used. 225 ############################################## 226 227 if ($installer::globals::languages_defined_in_productlist) { installer::languages::get_info_about_languages($allsettingsarrayref); } 228 229 ##################################### 230 # Windows requires the LCID list 231 ##################################### 232 233 if ( $installer::globals::iswindowsbuild ) { installer::control::read_lcidlist($includepatharrayref); } 234 235 ##################################################################### 236 # Including additional inc files for variable settings, if defined 237 ##################################################################### 238 239 if ( $allvariableshashref->{'ADD_INCLUDE_FILES'} ) { installer::worker::add_variables_from_inc_to_hashref($allvariableshashref, $includepatharrayref); } 240 241 ##################################### 242 # Analyzing the setup script 243 ##################################### 244 245 if ($installer::globals::setupscript_defined_in_productlist) { installer::setupscript::set_setupscript_name($allsettingsarrayref, $includepatharrayref); } 246 247 installer::logger::globallog("setup script file: $installer::globals::setupscriptname"); 248 249 installer::logger::print_message( "... analyzing script: $installer::globals::setupscriptname ... \n" ); 250 251 my $setupscriptref = installer::files::read_file($installer::globals::setupscriptname); # Reading the setup script file 252 253 # Resolving variables defined in the zip list file into setup script 254 # All the variables are defined in $allvariablesarrayref 255 256 installer::scpzipfiles::replace_all_ziplistvariables_in_file($setupscriptref, $allvariableshashref); 257 258 # Resolving %variables defined in the installation object 259 260 my $allscriptvariablesref = installer::setupscript::get_all_scriptvariables_from_installation_object($setupscriptref); 261 262 installer::setupscript::add_lowercase_productname_setupscriptvariable($allscriptvariablesref); 263 264 installer::setupscript::resolve_lowercase_productname_setupscriptvariable($allscriptvariablesref); 265 266 $setupscriptref = installer::setupscript::replace_all_setupscriptvariables_in_script($setupscriptref, $allscriptvariablesref); 267 268 # Adding all variables defined in the installation object into the hash of all variables. 269 # This is needed if variables are defined in the installation object, but not in the zip list file. 270 # If there is a definition in the zip list file and in the installation object, the installation object is more important 271 272 installer::setupscript::add_installationobject_to_variables($allvariableshashref, $allscriptvariablesref); 273 274 # Replacing preset properties, not using the default mechanisms (for example for UNIXPRODUCTNAME) 275 installer::setupscript::replace_preset_properties($allvariableshashref); 276 277 installer::scpzipfiles::replace_all_ziplistvariables_in_file($setupscriptref, $allvariableshashref); 278 279 280 installer::logger::log_hashref($allvariableshashref); 281 282 installer::logger::print_message( "... analyzing directories ... \n" ); 283 284 # Collect all directories in the script to get the destination dirs 285 286 my $dirsinproductarrayref = installer::setupscript::get_all_items_from_script($setupscriptref, "Directory"); 287 288 if ( $allvariableshashref->{'SHIFT_BASIS_INTO_BRAND_LAYER'} ) { $dirsinproductarrayref = installer::scriptitems::shift_basis_directory_parents($dirsinproductarrayref); } 289 if ( $allvariableshashref->{'OFFICEDIRECTORYNAME'} ) { installer::scriptitems::set_officedirectory_name($dirsinproductarrayref, $allvariableshashref->{'OFFICEDIRECTORYNAME'}); } 290 291 292 installer::scriptitems::resolve_all_directory_names($dirsinproductarrayref); 293 294 installer::logger::print_message( "... analyzing files ... \n" ); 295 296 my $filesinproductarrayref = installer::setupscript::get_all_items_from_script($setupscriptref, "File"); 297 298 if (( ! $installer::globals::iswindowsbuild ) && 299 ( ! $installer::globals::isrpmbuild ) && 300 ( ! $installer::globals::isdebbuild ) && 301 ( ! $installer::globals::issolarispkgbuild ) && 302 ( $installer::globals::packageformat ne "installed" ) && 303 ( $installer::globals::packageformat ne "dmg" ) && 304 ( $installer::globals::packageformat ne "archive" )) 305 { installer::control::check_oxtfiles($filesinproductarrayref); } 306 307 if (! $installer::globals::languagepack) 308 { 309 $filesinproductarrayref = installer::scriptitems::remove_Languagepacklibraries_from_Installset($filesinproductarrayref); 310 } 311 312 if (! $installer::globals::helppack) 313 { 314 $filesinproductarrayref = installer::scriptitems::remove_Helppacklibraries_from_Installset($filesinproductarrayref); 315 } 316 317 installer::logger::print_message( "... analyzing scpactions ... \n" ); 318 319 my $scpactionsinproductarrayref = installer::setupscript::get_all_items_from_script($setupscriptref, "ScpAction"); 320 321 if ( $installer::globals::languagepack ) { installer::scriptitems::use_langpack_copy_scpaction($scpactionsinproductarrayref); } 322 elsif ( $installer::globals::helppack ) { installer::scriptitems::use_langpack_copy_scpaction($scpactionsinproductarrayref); } 323 # TODO: why is this not done in scp2 based on the value of $(ENABLE_RELEASE_BUILD)? 324 elsif ( $allvariableshashref->{'PRODUCTNAME'} eq "LibreOfficeDev" ) { installer::scriptitems::use_devversion_copy_scpaction($scpactionsinproductarrayref); } 325 326 installer::scriptitems::change_keys_of_scpactions($scpactionsinproductarrayref); 327 328 installer::logger::print_message( "... analyzing shortcuts ... \n" ); 329 330 my $linksinproductarrayref = installer::setupscript::get_all_items_from_script($setupscriptref, "Shortcut"); 331 332 installer::logger::print_message( "... analyzing unix links ... \n" ); 333 334 my $unixlinksinproductarrayref = installer::setupscript::get_all_items_from_script($setupscriptref, "Unixlink"); 335 336 installer::logger::print_message( "... analyzing profile ... \n" ); 337 338 my $profilesinproductarrayref = installer::setupscript::get_all_items_from_script($setupscriptref, "Profile"); 339 340 installer::logger::print_message( "... analyzing profileitems ... \n" ); 341 342 my $profileitemsinproductarrayref = installer::setupscript::get_all_items_from_script($setupscriptref, "ProfileItem"); 343 344 my $folderinproductarrayref; 345 my $folderitemsinproductarrayref; 346 my $folderitempropertiesinproductarrayref; 347 my $registryitemsinproductarrayref; 348 my $windowscustomactionsarrayref; 349 my $mergemodulesarrayref; 350 351 if ( $installer::globals::iswindowsbuild ) # Windows specific items: Folder, FolderItem, RegistryItem, WindowsCustomAction 352 { 353 installer::logger::print_message( "... analyzing folders ... \n" ); 354 355 $folderinproductarrayref = installer::setupscript::get_all_items_from_script($setupscriptref, "Folder"); 356 357 installer::logger::print_message( "... analyzing folderitems ... \n" ); 358 359 $folderitemsinproductarrayref = installer::setupscript::get_all_items_from_script($setupscriptref, "FolderItem"); 360 361 installer::setupscript::add_predefined_folder($folderitemsinproductarrayref, $folderinproductarrayref); 362 363 installer::logger::print_message( "... analyzing folderitemproperties ... \n" ); 364 365 $folderitempropertiesinproductarrayref = installer::setupscript::get_all_items_from_script($setupscriptref, "FolderItemProperty"); 366 367 installer::setupscript::prepare_non_advertised_files($folderitemsinproductarrayref, $filesinproductarrayref); 368 369 installer::logger::print_message( "... analyzing registryitems ... \n" ); 370 371 $registryitemsinproductarrayref = installer::setupscript::get_all_items_from_script($setupscriptref, "RegistryItem"); 372 373 $registryitemsinproductarrayref = installer::scriptitems::remove_uninstall_regitems_from_script($registryitemsinproductarrayref); 374 375 installer::logger::print_message( "... analyzing Windows custom actions ... \n" ); 376 377 $windowscustomactionsarrayref = installer::setupscript::get_all_items_from_script($setupscriptref, "WindowsCustomAction"); 378 379 installer::logger::print_message( "... analyzing Windows merge modules ... \n" ); 380 381 $mergemodulesarrayref = installer::setupscript::get_all_items_from_script($setupscriptref, "MergeModule"); 382 } 383 384 my $modulesinproductarrayref; 385 386 if (!($installer::globals::is_copy_only_project)) 387 { 388 installer::logger::print_message( "... analyzing modules ... \n" ); 389 390 $modulesinproductarrayref = installer::setupscript::get_all_items_from_script($setupscriptref, "Module"); 391 392 installer::scriptitems::resolve_assigned_modules($modulesinproductarrayref); 393 394 $modulesinproductarrayref = installer::scriptitems::remove_template_modules($modulesinproductarrayref); 395 396 installer::scriptitems::set_children_flag($modulesinproductarrayref); 397 398 installer::scriptitems::collect_all_languagemodules($modulesinproductarrayref); 399 400 # Assigning the modules to the items 401 402 installer::scriptitems::assigning_modules_to_items($modulesinproductarrayref, $filesinproductarrayref, "Files"); 403 404 installer::scriptitems::assigning_modules_to_items($modulesinproductarrayref, $unixlinksinproductarrayref, "Unixlinks"); 405 406 installer::scriptitems::assigning_modules_to_items($modulesinproductarrayref, $dirsinproductarrayref, "Dirs"); 407 } 408 409 ################################################# 410 # Part 1b: The language dependent part 411 # (still platform independent) 412 ################################################# 413 414 # Now starts the language dependent part, if more than one product is defined on the command line 415 # Example -l en-US,de#es,fr,it defines two multilingual products 416 417 ############################################################################### 418 # Beginning of language dependent part 419 # The for iterates over all products, separated by an # in the language list 420 ############################################################################### 421 422 for ( my $n = 0; $n <= $#installer::globals::languageproducts; $n++ ) 423 { 424 my $languagesarrayref = installer::languages::get_all_languages_for_one_product($installer::globals::languageproducts[$n], $allvariableshashref); 425 my @setuplanguagesarray = @{ $languagesarrayref }; 426 427 my $languagestringref = installer::languages::get_language_string($languagesarrayref); 428 installer::logger::print_message( "------------------------------------\n" ); 429 installer::logger::print_message( "... languages $$languagestringref ... \n" ); 430 431 if ( $installer::globals::languagepack ) 432 { 433 $installer::globals::addsystemintegration = 0; 434 $installer::globals::addlicensefile = 0; 435 $installer::globals::makedownload = 1; 436 } 437 438 if ( $installer::globals::helppack ) 439 { 440 $installer::globals::addsystemintegration = 0; 441 $installer::globals::addlicensefile = 0; 442 $installer::globals::makedownload = 1; 443 @setuplanguagesarray = grep { $_ ne "en-US" } @setuplanguagesarray; 444 unshift(@setuplanguagesarray, "en-US"); 445 } 446 447 ############################################################ 448 # Beginning of language specific logging mechanism 449 # Until now only global logging into default: logfile.txt 450 ############################################################ 451 452 @installer::globals::logfileinfo = (); # new logfile array and new logfile name 453 installer::logger::copy_globalinfo_into_logfile(); 454 455 my $loglanguagestring = $$languagestringref; 456 my $loglanguagestring_orig = $loglanguagestring; 457 if (length($loglanguagestring) > $installer::globals::max_lang_length) 458 { 459 my $number_of_languages = installer::systemactions::get_number_of_langs($loglanguagestring); 460 #replace this in the same it was done in installer/windows/directory.pm 461 #chomp(my $shorter = `echo $loglanguagestring | $ENV{'MD5SUM'} | sed -e "s/ .*//g"`); 462 #my $id = substr($shorter, 0, 8); # taking only the first 8 digits 463 my $id = installer::windows::msiglobal::calculate_id($loglanguagestring, 8); # taking only the first 8 digits 464 $loglanguagestring = "lang_" . $number_of_languages . "_id_" . $id; 465 } 466 467 $installer::globals::logfilename = "log_" . $installer::globals::build; 468 $installer::globals::logfilename .= "_" . $loglanguagestring; 469 $installer::globals::logfilename .= ".log"; 470 $loggingdir = $loggingdir . $loglanguagestring . $installer::globals::separator; 471 installer::systemactions::create_directory($loggingdir); 472 473 if ($loglanguagestring ne $loglanguagestring_orig) { 474 (my $dir = $loggingdir) =~ s!/$!!; 475 open(my $F1, "> $dir.dir"); 476 open(my $F2, "> " . $loggingdir . $installer::globals::logfilename . '.file'); 477 my @s = map { "$_\n" } split('_', $loglanguagestring_orig); 478 print $F1 @s; 479 print $F2 @s; 480 } 481 482 $installer::globals::exitlog = $loggingdir; 483 484 ################################################################### 485 # Reading an existing msi database, to prepare update and patch 486 ################################################################### 487 488 my $refdatabase = ""; 489 my $uniquefilename = ""; 490 my $revuniquefilename = ""; 491 my $revshortfilename = ""; 492 my $allupdatesequences = ""; 493 my $allupdatecomponents = ""; 494 my $allupdatefileorder = ""; 495 my $allupdatecomponentorder = ""; 496 my $shortdirname = ""; 497 my $componentid = ""; 498 my $componentidkeypath = ""; 499 my $alloldproperties = ""; 500 my $allupdatelastsequences = ""; 501 my $allupdatediskids = ""; 502 503 if ( $installer::globals::packageformat eq 'msi' ) 504 { 505 if ( $allvariableshashref->{'UPDATE_DATABASE'} ) 506 { 507 installer::logger::print_message( "... analyzing update database ...\n" ); 508 $refdatabase = installer::windows::update::readdatabase($allvariableshashref, $languagestringref, $includepatharrayref); 509 510 if ( $installer::globals::updatedatabase ) 511 { 512 ($uniquefilename, $revuniquefilename, $revshortfilename, $allupdatesequences, $allupdatecomponents, $allupdatefileorder, $allupdatecomponentorder, $shortdirname, $componentid, $componentidkeypath, $alloldproperties, $allupdatelastsequences, $allupdatediskids) = installer::windows::update::create_database_hashes($refdatabase); 513 } 514 } 515 516 # Always analyze the merge module. 517 # We need to investigate the directory table in merge module to emit 518 # custom action for directory names that start with standard prefix 519 if ( $mergemodulesarrayref > -1 ) { 520 installer::windows::update::readmergedatabase($mergemodulesarrayref, $languagestringref, $includepatharrayref); 521 } 522 } 523 524 ############################################## 525 # Setting global code variables for Windows 526 ############################################## 527 528 if (!($installer::globals::is_copy_only_project)) 529 { 530 if ((( $installer::globals::iswindowsbuild ) && ( $installer::globals::packageformat ne "archive" ) && ( $installer::globals::packageformat ne "installed" ) ) || $installer::globals::packageformat eq 'msi' ) 531 { 532 installer::windows::msiglobal::set_global_code_variables($languagesarrayref, $languagestringref, $allvariableshashref, $alloldproperties); 533 } 534 } 535 536 ################################################ 537 # Resolving include paths (language dependent) 538 ################################################ 539 540 $includepatharrayref_lang = installer::ziplist::replace_languages_in_paths($includepatharrayref, \@setuplanguagesarray); 541 542 if ( $installer::globals::refresh_includepaths ) { installer::worker::collect_all_files_from_includepaths($includepatharrayref_lang); } 543 544 installer::ziplist::list_all_files_from_include_path($includepatharrayref_lang); 545 546 ############################################## 547 # Analyzing spellchecker languages 548 ############################################## 549 550 if ( $allvariableshashref->{'SPELLCHECKERFILE'} ) { installer::worker::set_spellcheckerlanguages($languagesarrayref, $allvariableshashref); } 551 552 ##################################### 553 # Language dependent directory part 554 ##################################### 555 556 my $dirsinproductlanguageresolvedarrayref = installer::scriptitems::resolving_all_languages_in_productlists($dirsinproductarrayref, $languagesarrayref); 557 558 # A new directory array is needed ($dirsinproductlanguageresolvedarrayref instead of $dirsinproductarrayref) 559 # because $dirsinproductarrayref is needed in get_Destination_Directory_For_Item_From_Directorylist 560 561 installer::scriptitems::changing_name_of_language_dependent_keys($dirsinproductlanguageresolvedarrayref); 562 563 installer::scriptitems::checking_directories_with_corrupt_hostname($dirsinproductlanguageresolvedarrayref, $languagesarrayref); 564 565 installer::scriptitems::set_global_directory_hostnames($dirsinproductlanguageresolvedarrayref, $allvariableshashref); 566 567 ##################################### 568 # files part, language dependent 569 ##################################### 570 571 installer::logger::print_message( "... analyzing files ...\n" ); 572 573 my $filesinproductlanguageresolvedarrayref = installer::scriptitems::resolving_all_languages_in_productlists($filesinproductarrayref, $languagesarrayref); 574 575 if ( ! $installer::globals::set_office_start_language ) 576 { 577 $filesinproductlanguageresolvedarrayref = installer::scriptitems::remove_office_start_language_files($filesinproductlanguageresolvedarrayref); 578 } 579 580 installer::scriptitems::changing_name_of_language_dependent_keys($filesinproductlanguageresolvedarrayref); 581 582 if ( $installer::globals::iswin and $^O =~ /MSWin/i ) { installer::converter::convert_slash_to_backslash($filesinproductlanguageresolvedarrayref); } 583 584 $filesinproductlanguageresolvedarrayref = installer::scriptitems::remove_non_existent_languages_in_productlists($filesinproductlanguageresolvedarrayref, $languagestringref, "Name", "file"); 585 586 installer::scriptitems::get_Destination_Directory_For_Item_From_Directorylist($filesinproductlanguageresolvedarrayref, $dirsinproductarrayref); 587 588 installer::scriptitems::get_Source_Directory_For_Files_From_Includepathlist($filesinproductlanguageresolvedarrayref, $includepatharrayref_lang, $dirsinproductlanguageresolvedarrayref, "Files", $allvariableshashref); 589 590 $filesinproductlanguageresolvedarrayref = installer::scriptitems::remove_Files_Without_Sourcedirectory($filesinproductlanguageresolvedarrayref); 591 592 if ($installer::globals::languagepack) 593 { 594 $filesinproductlanguageresolvedarrayref = installer::scriptitems::remove_Files_For_Languagepacks($filesinproductlanguageresolvedarrayref); 595 } 596 597 if ( ! $allvariableshashref->{'NO_README_IN_ROOTDIR'} ) 598 { 599 $filesinproductlanguageresolvedarrayref = installer::scriptitems::add_License_Files_into_Installdir($filesinproductlanguageresolvedarrayref, $dirsinproductlanguageresolvedarrayref, $languagesarrayref); 600 } 601 602 installer::scriptitems::make_filename_language_specific($filesinproductlanguageresolvedarrayref); 603 604 ###################################################################################### 605 # Processing files with flag FILELIST and putting listed files into the file list 606 ###################################################################################### 607 608 installer::logger::print_message( "... analyzing files with flag FILELIST ...\n" ); 609 610 ($filesinproductlanguageresolvedarrayref, $unixlinksinproductarrayref) = installer::filelists::resolve_filelist_flag($filesinproductlanguageresolvedarrayref, $unixlinksinproductarrayref, $ENV{'INSTDIR'}); 611 612 # packed files sometimes contain a "$" in their name: HighlightText$1.class. For epm the "$" has to be quoted by "$$" 613 614 if (!( $installer::globals::iswindowsbuild || $installer::globals::simple ) ) 615 { 616 installer::scriptitems::quoting_illegal_filenames($filesinproductlanguageresolvedarrayref); 617 } 618 619 ##################################### 620 # Files with flag SCPZIP_REPLACE 621 ##################################### 622 623 installer::logger::print_message( "... analyzing files with flag SCPZIP_REPLACE ...\n" ); 624 625 # Editing files with flag SCPZIP_REPLACE. 626 627 installer::scpzipfiles::resolving_scpzip_replace_flag($filesinproductlanguageresolvedarrayref, $allvariableshashref, "File", $languagestringref); 628 629 ######################################################### 630 # language dependent unix links part 631 ######################################################### 632 633 installer::logger::print_message( "... analyzing unix links ...\n" ); 634 635 my $unixlinksinproductlanguageresolvedarrayref = installer::scriptitems::resolving_all_languages_in_productlists($unixlinksinproductarrayref, $languagesarrayref); 636 637 installer::scriptitems::changing_name_of_language_dependent_keys($unixlinksinproductlanguageresolvedarrayref); 638 639 installer::scriptitems::get_Destination_Directory_For_Item_From_Directorylist($unixlinksinproductlanguageresolvedarrayref, $dirsinproductarrayref); 640 641 ############################################ 642 # Collecting directories for epm list file 643 ############################################ 644 645 installer::logger::print_message( "... analyzing all directories for this product ...\n" ); 646 647 # There are two ways for a directory to be included into the epm directory list: 648 # 1. Looking for all destination paths in the files array 649 # 2. Looking for directories with CREATE flag in the directory array 650 # Advantage: Many paths are hidden in zip files, they are not defined in the setup script. 651 # It will be possible, that in the setup script only those directories have to be defined, 652 # that have a CREATE flag. All other directories are created, if they contain at least one file. 653 654 my ($directoriesforepmarrayref, $alldirectoryhash) = installer::scriptitems::collect_directories_from_filesarray($filesinproductlanguageresolvedarrayref, $unixlinksinproductlanguageresolvedarrayref); 655 ($directoriesforepmarrayref, $alldirectoryhash) = installer::scriptitems::collect_directories_with_create_flag_from_directoryarray($dirsinproductlanguageresolvedarrayref, $alldirectoryhash); 656 657 ######################################################### 658 # language dependent scpactions part 659 ######################################################### 660 661 my $scpactionsinproductlanguageresolvedarrayref = installer::scriptitems::resolving_all_languages_in_productlists($scpactionsinproductarrayref, $languagesarrayref); 662 663 installer::scriptitems::changing_name_of_language_dependent_keys($scpactionsinproductlanguageresolvedarrayref); 664 665 installer::scriptitems::get_Source_Directory_For_Files_From_Includepathlist($scpactionsinproductlanguageresolvedarrayref, $includepatharrayref_lang, $dirsinproductlanguageresolvedarrayref, "ScpActions", $allvariableshashref); 666 667 # Editing scpactions with flag SCPZIP_REPLACE. 668 669 installer::scpzipfiles::resolving_scpzip_replace_flag($scpactionsinproductlanguageresolvedarrayref, $allvariableshashref, "ScpAction", $languagestringref); 670 671 ######################################################### 672 # language dependent links part 673 ######################################################### 674 675 installer::logger::print_message( "... analyzing links ...\n" ); 676 677 my $linksinproductlanguageresolvedarrayref = installer::scriptitems::resolving_all_languages_in_productlists($linksinproductarrayref, $languagesarrayref); 678 679 installer::scriptitems::changing_name_of_language_dependent_keys($linksinproductlanguageresolvedarrayref); 680 681 installer::scriptitems::get_destination_file_path_for_links($linksinproductlanguageresolvedarrayref, $filesinproductlanguageresolvedarrayref); 682 683 installer::scriptitems::get_Destination_Directory_For_Item_From_Directorylist($linksinproductlanguageresolvedarrayref, $dirsinproductarrayref); 684 685 # Now taking all links that have no FileID but a ShortcutID, linking to another link 686 687 installer::scriptitems::get_destination_link_path_for_links($linksinproductlanguageresolvedarrayref); 688 689 $linksinproductlanguageresolvedarrayref = installer::scriptitems::remove_workstation_only_items($linksinproductlanguageresolvedarrayref); 690 691 installer::scriptitems::resolve_links_with_flag_relative($linksinproductlanguageresolvedarrayref); 692 693 ######################################################### 694 # language dependent part for profiles and profileitems 695 ######################################################### 696 697 my $profilesinproductlanguageresolvedarrayref; 698 my $profileitemsinproductlanguageresolvedarrayref; 699 700 if ((!($installer::globals::is_copy_only_project)) && (!($installer::globals::languagepack)) && (!($installer::globals::helppack))) 701 { 702 installer::logger::print_message( "... creating profiles ...\n" ); 703 704 $profilesinproductlanguageresolvedarrayref = installer::scriptitems::resolving_all_languages_in_productlists($profilesinproductarrayref, $languagesarrayref); 705 706 $profileitemsinproductlanguageresolvedarrayref = installer::scriptitems::resolving_all_languages_in_productlists($profileitemsinproductarrayref, $languagesarrayref); 707 708 installer::scriptitems::changing_name_of_language_dependent_keys($profilesinproductlanguageresolvedarrayref); 709 710 installer::scriptitems::changing_name_of_language_dependent_keys($profileitemsinproductlanguageresolvedarrayref); 711 712 installer::scriptitems::replace_setup_variables($profileitemsinproductlanguageresolvedarrayref, $languagestringref, $allvariableshashref); 713 714 # Note that patch_user_dir is not related to the killed 715 # ancient (not MSP) "patch" thing, I think. 716 if ( $installer::globals::patch_user_dir ) 717 { 718 installer::scriptitems::replace_userdir_variable($profileitemsinproductlanguageresolvedarrayref); 719 } 720 721 installer::scriptitems::get_Destination_Directory_For_Item_From_Directorylist($profilesinproductlanguageresolvedarrayref, $dirsinproductarrayref); 722 723 # Now the Profiles can be created 724 725 installer::profiles::create_profiles($profilesinproductlanguageresolvedarrayref, $profileitemsinproductlanguageresolvedarrayref, $filesinproductlanguageresolvedarrayref, $languagestringref, $allvariableshashref); 726 } 727 728 my $registryitemsinproductlanguageresolvedarrayref; # cannot be defined in the following "if ( $installer::globals::iswindowsbuild )" 729 my $folderinproductlanguageresolvedarrayref; # cannot be defined in the following "if ( $installer::globals::iswindowsbuild )" 730 my $folderitemsinproductlanguageresolvedarrayref; # cannot be defined in the following "if ( $installer::globals::iswindowsbuild )" 731 732 if ( $installer::globals::iswindowsbuild ) # Windows specific items: Folder, FolderItem, RegistryItem 733 { 734 ######################################################### 735 # language dependent part for folder 736 ######################################################### 737 738 installer::logger::print_message( "... analyzing folder ...\n" ); 739 740 $folderinproductlanguageresolvedarrayref = installer::scriptitems::resolving_all_languages_in_productlists($folderinproductarrayref, $languagesarrayref); 741 742 installer::scriptitems::changing_name_of_language_dependent_keys($folderinproductlanguageresolvedarrayref); 743 744 ######################################################### 745 # language dependent part for folderitems 746 ######################################################### 747 748 installer::logger::print_message( "... analyzing folderitems ...\n" ); 749 750 $folderitemsinproductlanguageresolvedarrayref = installer::scriptitems::resolving_all_languages_in_productlists($folderitemsinproductarrayref, $languagesarrayref); 751 752 installer::scriptitems::changing_name_of_language_dependent_keys($folderitemsinproductlanguageresolvedarrayref); 753 754 ######################################################### 755 # language dependent part for registryitems 756 ######################################################### 757 758 installer::logger::print_message( "... analyzing registryitems ...\n" ); 759 760 $registryitemsinproductlanguageresolvedarrayref = installer::scriptitems::resolving_all_languages_in_productlists($registryitemsinproductarrayref, $languagesarrayref); 761 762 installer::scriptitems::changing_name_of_language_dependent_keys($registryitemsinproductlanguageresolvedarrayref); 763 } 764 765 ######################################################### 766 # language dependent part for modules 767 ######################################################### 768 769 my $modulesinproductlanguageresolvedarrayref; 770 771 if (!($installer::globals::is_copy_only_project)) 772 { 773 installer::logger::print_message( "... analyzing modules ...\n" ); 774 775 $modulesinproductlanguageresolvedarrayref = installer::scriptitems::resolving_all_languages_in_productlists($modulesinproductarrayref, $languagesarrayref); 776 777 $modulesinproductlanguageresolvedarrayref = installer::scriptitems::remove_not_required_language_modules($modulesinproductlanguageresolvedarrayref, $languagesarrayref); 778 779 if ( $installer::globals::analyze_spellcheckerlanguage ) 780 { 781 $modulesinproductlanguageresolvedarrayref = installer::scriptitems::remove_not_required_spellcheckerlanguage_modules($modulesinproductlanguageresolvedarrayref); 782 783 $filesinproductlanguageresolvedarrayref = installer::scriptitems::remove_not_required_spellcheckerlanguage_files($filesinproductlanguageresolvedarrayref); 784 $directoriesforepmarrayref = installer::scriptitems::remove_not_required_spellcheckerlanguage_files($directoriesforepmarrayref); 785 } 786 787 installer::scriptitems::changing_name_of_language_dependent_keys($modulesinproductlanguageresolvedarrayref); 788 789 installer::scriptitems::select_required_language_strings($modulesinproductlanguageresolvedarrayref); # using english strings 790 791 } 792 793 # Copy-only projects can now start to copy all items File and ScpAction 794 if ( $installer::globals::is_copy_only_project ) { installer::copyproject::copy_project($filesinproductlanguageresolvedarrayref, $scpactionsinproductlanguageresolvedarrayref, $loggingdir, $languagestringref, $shipinstalldir, $allsettingsarrayref); } 795 796 # Language pack projects can now start to select the required information 797 if ( $installer::globals::languagepack ) 798 { 799 $filesinproductlanguageresolvedarrayref = installer::languagepack::select_language_items($filesinproductlanguageresolvedarrayref, $languagesarrayref, "File"); 800 $scpactionsinproductlanguageresolvedarrayref = installer::languagepack::select_language_items($scpactionsinproductlanguageresolvedarrayref, $languagesarrayref, "ScpAction"); 801 $linksinproductlanguageresolvedarrayref = installer::languagepack::select_language_items($linksinproductlanguageresolvedarrayref, $languagesarrayref, "Shortcut"); 802 $unixlinksinproductlanguageresolvedarrayref = installer::languagepack::select_language_items($unixlinksinproductlanguageresolvedarrayref, $languagesarrayref, "Unixlink"); 803 @{$folderitemsinproductlanguageresolvedarrayref} = (); # no folderitems in languagepacks 804 805 # Collecting the directories again, to include only the language specific directories 806 ($directoriesforepmarrayref, $alldirectoryhash) = installer::scriptitems::collect_directories_from_filesarray($filesinproductlanguageresolvedarrayref, $unixlinksinproductlanguageresolvedarrayref); 807 ($directoriesforepmarrayref, $alldirectoryhash) = installer::scriptitems::collect_directories_with_create_flag_from_directoryarray($dirsinproductlanguageresolvedarrayref, $alldirectoryhash); 808 @$directoriesforepmarrayref = sort { $a->{"HostName"} cmp $b->{"HostName"} } @$directoriesforepmarrayref; 809 810 if ( $installer::globals::iswindowsbuild ) 811 { 812 $registryitemsinproductlanguageresolvedarrayref = installer::worker::select_langpack_items($registryitemsinproductlanguageresolvedarrayref, "RegistryItem"); 813 } 814 815 } 816 817 # Help pack projects can now start to select the required information 818 if ( $installer::globals::helppack ) 819 { 820 $filesinproductlanguageresolvedarrayref = installer::helppack::select_help_items($filesinproductlanguageresolvedarrayref, $languagesarrayref, "File"); 821 $scpactionsinproductlanguageresolvedarrayref = installer::helppack::select_help_items($scpactionsinproductlanguageresolvedarrayref, $languagesarrayref, "ScpAction"); 822 $linksinproductlanguageresolvedarrayref = installer::helppack::select_help_items($linksinproductlanguageresolvedarrayref, $languagesarrayref, "Shortcut"); 823 $unixlinksinproductlanguageresolvedarrayref = installer::helppack::select_help_items($unixlinksinproductlanguageresolvedarrayref, $languagesarrayref, "Unixlink"); 824 @{$folderitemsinproductlanguageresolvedarrayref} = (); # no folderitems in helppacks 825 826 # Collecting the directories again, to include only the language specific directories 827 ($directoriesforepmarrayref, $alldirectoryhash) = installer::scriptitems::collect_directories_from_filesarray($filesinproductlanguageresolvedarrayref, $unixlinksinproductlanguageresolvedarrayref); 828 ($directoriesforepmarrayref, $alldirectoryhash) = installer::scriptitems::collect_directories_with_create_flag_from_directoryarray($dirsinproductlanguageresolvedarrayref, $alldirectoryhash); 829 @$directoriesforepmarrayref = sort { $a->{"HostName"} cmp $b->{"HostName"} } @$directoriesforepmarrayref; 830 831 if ( $installer::globals::iswindowsbuild ) 832 { 833 $registryitemsinproductlanguageresolvedarrayref = installer::worker::select_helppack_items($registryitemsinproductlanguageresolvedarrayref, "RegistryItem"); 834 } 835 836 } 837 838 ######################################################### 839 # Collecting all scp actions 840 ######################################################### 841 842 installer::worker::collect_scpactions($scpactionsinproductlanguageresolvedarrayref); 843 844 ########################################################### 845 # Simple package projects can now start to create the 846 # installation structure by creating Directories, Files 847 # Links and ScpActions. This is the last platform 848 # independent part. 849 ########################################################### 850 851 if ( $installer::globals::is_simple_packager_project ) 852 { 853 installer::simplepackage::create_simple_package($filesinproductlanguageresolvedarrayref, $directoriesforepmarrayref, $scpactionsinproductlanguageresolvedarrayref, $linksinproductlanguageresolvedarrayref, $unixlinksinproductlanguageresolvedarrayref, $loggingdir, $languagestringref, $shipinstalldir, $allsettingsarrayref, $allvariableshashref, $includepatharrayref); 854 next; # ! leaving the current loop, because no further packaging required. 855 } 856 857 ########################################################### 858 # Analyzing the package structure 859 ########################################################### 860 861 installer::logger::print_message( "... analyzing package list ...\n" ); 862 863 my $packages = installer::packagelist::collectpackages($modulesinproductlanguageresolvedarrayref, $languagesarrayref); 864 installer::packagelist::check_packagelist($packages); 865 866 $packages = installer::packagelist::analyze_list($packages, $modulesinproductlanguageresolvedarrayref); 867 installer::packagelist::remove_multiple_modules_packages($packages); 868 869 # printing packages content: 870 installer::packagelist::log_packages_content($packages); 871 installer::packagelist::create_module_destination_hash($packages, $allvariableshashref); 872 873 ################################################# 874 # Part 2: The platform dependent part 875 ################################################# 876 877 ################################################# 878 # Part 2a: All non-Windows platforms 879 ################################################# 880 881 ######################################################### 882 # ... creating epm list file ... 883 # Only for non-Windows platforms 884 ######################################################### 885 886 if (!( $installer::globals::iswindowsbuild )) 887 { 888 #################################################### 889 # Writing log file before packages are packed 890 #################################################### 891 892 installer::logger::print_message( "... creating log file " . $loggingdir . $installer::globals::logfilename . "\n" ); 893 installer::files::save_file($loggingdir . $installer::globals::logfilename, \@installer::globals::logfileinfo); 894 895 #################################################### 896 # Creating directories 897 #################################################### 898 899 installer::download::set_download_filename($languagestringref, $allvariableshashref); 900 901 $installdir = installer::worker::create_installation_directory($shipinstalldir, $languagestringref, \$current_install_number); 902 903 my $listfiledir = installer::systemactions::create_directories("listfile", $languagestringref); 904 my $installlogdir = installer::systemactions::create_directory_next_to_directory($installdir, "log"); 905 906 #################################################### 907 # Reading for Solaris all package descriptions 908 # from file defined in property PACKAGEMAP 909 #################################################### 910 911 if ( $installer::globals::issolarisbuild ) { installer::epmfile::read_packagemap($allvariableshashref, $includepatharrayref, $languagesarrayref); } 912 913 ########################################### 914 # Checking epm state 915 ########################################### 916 917 my $epmexecutable = ""; 918 if ( $installer::globals::call_epm ) 919 { 920 $epmexecutable = installer::epmfile::find_epm_on_system($includepatharrayref); 921 installer::epmfile::set_patch_state($epmexecutable); # setting $installer::globals::is_special_epm 922 } 923 924 # shuffle array to reduce parallel packaging process in pool 925 @{$packages} = shuffle @{$packages} 926 unless $installer::globals::simple; 927 928 # iterating over all packages 929 for my $onepackage ( @{$packages} ) 930 { 931 # checking, if this is a language pack or a project pack. 932 # Creating language packs only, if $installer::globals::languagepack is set. Parameter: -languagepack 933 934 if ( $installer::globals::languagepack ) { installer::languagepack::replace_languagestring_variable($onepackage, $languagestringref); } 935 936 # checking, if this is a help pack 937 # Creating help packs only, if $installer::globals::helppack is set. Parameter: -helppack 938 939 if ( $installer::globals::helppack ) { installer::helppack::replace_languagestring_variable($onepackage, $languagestringref); } 940 941 my $onepackagename = $onepackage->{'module'}; # name of the top module (required) 942 943 my $shellscriptsfilename = ""; 944 if ( $onepackage->{'script'} ) { $shellscriptsfilename = $onepackage->{'script'}; } 945 946 ########################### 947 # package name 948 ########################### 949 950 my $packagename = ""; 951 952 if ( $installer::globals::issolarisbuild ) # only for Solaris 953 { 954 if ( $onepackage->{'solarispackagename'} ) { $packagename = $onepackage->{'solarispackagename'}; } 955 } 956 else # not Solaris 957 { 958 if ( $onepackage->{'packagename'} ) { $packagename = $onepackage->{'packagename'}; } 959 } 960 961 if (!($packagename eq "")) 962 { 963 installer::packagelist::resolve_packagevariables(\$packagename, $allvariableshashref, 0); 964 } 965 966 # Debian allows no underline in package name 967 if ( $installer::globals::debian ) { $packagename =~ s/_/-/g; } 968 969 #################################################### 970 # Header for this package into log file 971 #################################################### 972 973 installer::logger::include_header_into_logfile("Creating package: $packagename"); 974 975 ########################################### 976 # Root path, can be defined as parameter 977 ########################################### 978 979 my $packagerootpath = ""; 980 981 if ($installer::globals::rootpath eq "") 982 { 983 $packagerootpath = $onepackage->{'destpath'}; 984 installer::packagelist::resolve_packagevariables(\$packagerootpath, $allvariableshashref, 1); 985 # we put branding and common stuff into the same prefix on unixes => $packagerootpath must be the whole prefix, including the product name 986 if ($installer::globals::isunix) { $packagerootpath .= "/$allvariableshashref->{'UNIXBASISROOTNAME'}"; } 987 if ( $^O =~ /darwin/i ) { $packagerootpath =~ s/\/opt\//\/Applications\//; } 988 } 989 else 990 { 991 $packagerootpath = $installer::globals::rootpath; 992 } 993 994 ################################# 995 # collecting items for package 996 ################################# 997 998 my $filesinpackage = installer::packagelist::find_files_for_package($filesinproductlanguageresolvedarrayref, $onepackage); 999 my $unixlinksinpackage = installer::packagelist::find_files_for_package($unixlinksinproductlanguageresolvedarrayref, $onepackage); 1000 my $linksinpackage = installer::packagelist::find_links_for_package($linksinproductlanguageresolvedarrayref, $onepackage); 1001 my $dirsinpackage = installer::packagelist::find_dirs_for_package($directoriesforepmarrayref, $onepackage); 1002 1003 ############################################# 1004 # copying the collectors for each package 1005 ############################################# 1006 1007 $filesinpackage = installer::converter::copy_collector($filesinpackage); 1008 $linksinpackage = installer::converter::copy_collector($linksinpackage); 1009 $unixlinksinpackage = installer::converter::copy_collector($unixlinksinpackage); 1010 $dirsinpackage = installer::converter::copy_collector($dirsinpackage); 1011 1012 ########################################### 1013 # setting the root path for the packages 1014 ########################################### 1015 1016 installer::scriptitems::add_rootpath_to_directories($dirsinpackage, $packagerootpath); 1017 installer::scriptitems::add_rootpath_to_files($filesinpackage, $packagerootpath); 1018 installer::scriptitems::add_rootpath_to_links($linksinpackage, $packagerootpath); 1019 installer::scriptitems::add_rootpath_to_files($unixlinksinpackage, $packagerootpath); 1020 1021 ############################################### 1022 # nothing to do, if $filesinpackage is empty 1023 ############################################### 1024 1025 if ( ! ( $#{$filesinpackage} > -1 )) 1026 { 1027 $infoline = "\n\nNo file in package: $packagename \-\> Skipping\n\n"; 1028 push(@installer::globals::logfileinfo, $infoline); 1029 next; # next package, end of loop ! 1030 } 1031 1032 ########################################### 1033 # Stripping libraries 1034 ########################################### 1035 1036 # Building for non Windows platforms in cws requires, that all files are stripped before packaging: 1037 # 1. copy all files that need to be stripped locally 1038 # 2. strip all these files 1039 1040 if ( $installer::globals::strip ) 1041 { 1042 strip_libraries($filesinpackage, $languagestringref); 1043 } 1044 1045 if ( $installer::globals::simple ) { 1046 installer::worker::install_simple($onepackagename, $$languagestringref, $dirsinpackage, $filesinpackage, $linksinpackage, $unixlinksinpackage); 1047 } 1048 else { 1049 # epm list file format: 1050 # type mode owner group destination source options 1051 # Example for a file: f 755 root sys /usr/bin/foo foo 1052 # Example for a directory: d 755 root sys /var/spool/foo - 1053 # Example for a link: l 000 root sys /usr/bin/linkname filename 1054 # The source field specifies the file to link to 1055 1056 my $epmfilename = "epm_" . $onepackagename . ".lst"; 1057 1058 installer::logger::print_message( "... creating epm list file $epmfilename ... \n" ); 1059 1060 my $completeepmfilename = $listfiledir . $installer::globals::separator . $epmfilename; 1061 1062 my @epmfile = (); 1063 1064 my $epmheaderref = installer::epmfile::create_epm_header($allvariableshashref, $filesinproductlanguageresolvedarrayref, $languagesarrayref, $onepackage); 1065 installer::epmfile::adding_header_to_epm_file(\@epmfile, $epmheaderref); 1066 1067 # adding directories, files and links into epm file 1068 1069 installer::epmfile::put_directories_into_epmfile($dirsinpackage, \@epmfile, $allvariableshashref, $packagerootpath); 1070 installer::epmfile::put_files_into_epmfile($filesinpackage, \@epmfile ); 1071 installer::epmfile::put_links_into_epmfile($linksinpackage, \@epmfile ); 1072 installer::epmfile::put_unixlinks_into_epmfile($unixlinksinpackage, \@epmfile ); 1073 1074 if ((!( $shellscriptsfilename eq "" )) && (!($installer::globals::iswindowsbuild))) { installer::epmfile::adding_shellscripts_to_epm_file(\@epmfile, $shellscriptsfilename, $packagerootpath, $allvariableshashref, $filesinpackage); } 1075 1076 installer::files::save_file($completeepmfilename ,\@epmfile); 1077 1078 # ... splitting the rootpath into a relocatable part and a static part, if possible 1079 1080 my $staticpath = ""; 1081 my $relocatablepath = ""; 1082 # relocatable path can be defined in package list 1083 if ( $onepackage->{'relocatablepath'} ) { $relocatablepath = $onepackage->{'relocatablepath'}; } 1084 # setting fix part and variable part of destination path 1085 installer::epmfile::analyze_rootpath($packagerootpath, \$staticpath, \$relocatablepath, $allvariableshashref); 1086 1087 # ... replacing the variable PRODUCTDIRECTORYNAME in the shellscriptfile by $staticpath 1088 1089 installer::epmfile::resolve_path_in_epm_list_before_packaging(\@epmfile, $completeepmfilename, "PRODUCTDIRECTORYNAME", $staticpath); 1090 installer::epmfile::resolve_path_in_epm_list_before_packaging(\@epmfile, $completeepmfilename, "SOLSUREPACKAGEPREFIX", $allvariableshashref->{'SOLSUREPACKAGEPREFIX'}); 1091 installer::epmfile::resolve_path_in_epm_list_before_packaging(\@epmfile, $completeepmfilename, "UREPACKAGEPREFIX", $allvariableshashref->{'UREPACKAGEPREFIX'}); 1092 installer::files::save_file($completeepmfilename ,\@epmfile); 1093 1094 { 1095 # changing into the "install" directory to create installation sets 1096 1097 $currentdir = cwd(); # $currentdir is global in this file 1098 1099 chdir($installdir); # changing into install directory ($installdir is global in this file) 1100 1101 ########################################### 1102 # Starting epm 1103 ########################################### 1104 1105 # With a patched epm, it is now possible to set the relocatable directory, change 1106 # the directory in which the packages are created, setting "requires" and "provides" 1107 # (Linux) or creating the "depend" file (Solaris) and finally to begin 1108 # the packaging process with standard tooling and standard parameter 1109 # Linux: Adding into the spec file: Prefix: /opt 1110 # Solaris: Adding into the pkginfo file: BASEDIR=/opt 1111 # Attention: Changing of the path can influence the shell scripts 1112 1113 if (( $installer::globals::is_special_epm ) && ( ($installer::globals::isrpmbuild) || ($installer::globals::issolarispkgbuild) )) # special handling only for Linux RPMs and Solaris Packages 1114 { 1115 if ( $installer::globals::call_epm ) # only do something, if epm is really executed 1116 { 1117 # ... now epm can be started, to create the installation sets 1118 1119 installer::logger::print_message( "... starting patched epm ... \n" ); 1120 1121 installer::epmfile::call_epm($epmexecutable, $completeepmfilename, $packagename, $includepatharrayref); 1122 1123 my $newepmdir = installer::epmfile::prepare_packages($loggingdir, $packagename, $staticpath, $relocatablepath, $onepackage, $allvariableshashref, $filesinpackage, $languagestringref); # adding the line for Prefix / Basedir, include rpmdir 1124 1125 installer::epmfile::create_packages_without_epm($newepmdir, $packagename, $includepatharrayref, $allvariableshashref, $languagestringref); # start to package 1126 1127 # finally removing all temporary files 1128 1129 installer::epmfile::remove_temporary_epm_files($newepmdir, $loggingdir, $packagename); 1130 1131 # Installation: 1132 # Install: pkgadd -a myAdminfile -d ./SUNWso8m34.pkg 1133 # Install: rpm -i --prefix=/opt/special --nodeps so8m35.rpm 1134 1135 installer::epmfile::create_new_directory_structure($newepmdir); 1136 $installer::globals::postprocess_specialepm = 1; 1137 1138 # solaris patch not needed anymore 1139 } 1140 } 1141 1142 else # this is the standard epm (not relocatable) or ( nonlinux and nonsolaris ) 1143 { 1144 installer::epmfile::resolve_path_in_epm_list_before_packaging(\@epmfile, $completeepmfilename, "\$\$PRODUCTINSTALLLOCATION", $relocatablepath); 1145 installer::files::save_file($completeepmfilename ,\@epmfile); # Warning for pool, content of epm file is changed. 1146 1147 if ( $installer::globals::call_epm ) 1148 { 1149 # ... now epm can be started, to create the installation sets 1150 1151 if ( $installer::globals::is_special_epm ) 1152 { 1153 installer::logger::print_message( "... starting patched epm ... \n" ); 1154 } 1155 else 1156 { 1157 installer::logger::print_message( "... starting unpatched epm ... \n" ); 1158 } 1159 1160 if ( $installer::globals::call_epm ) { installer::epmfile::call_epm($epmexecutable, $completeepmfilename, $packagename, $includepatharrayref); } 1161 1162 if (($installer::globals::isrpmbuild) || ($installer::globals::issolarispkgbuild) || ($installer::globals::debian)) 1163 { 1164 $installer::globals::postprocess_standardepm = 1; 1165 } 1166 } 1167 } 1168 1169 chdir($currentdir); # changing back into start directory 1170 1171 } 1172 1173 } # end of "if ( ! $installer::globals::simple ) 1174 1175 } # end of "for ( @{$packages} )" 1176 1177 ############################################################## 1178 # Post epm functionality, after the last package is packed 1179 ############################################################## 1180 1181 if ( $installer::globals::postprocess_specialepm ) 1182 { 1183 installer::logger::include_header_into_logfile("Post EPM processes (Patched EPM):"); 1184 1185 chdir($installdir); 1186 1187 # Copying the cde, kde and gnome packages into the installation set 1188 if ( $installer::globals::addsystemintegration ) { installer::epmfile::put_systemintegration_into_installset($installer::globals::epmoutpath, $includepatharrayref, $allvariableshashref, $modulesinproductarrayref); } 1189 1190 # Adding license and readme into installation set 1191 if ($installer::globals::addlicensefile) { installer::worker::put_scpactions_into_installset("."); } 1192 1193 # Adding license file into setup 1194 if ( $allvariableshashref->{'PUT_LICENSE_INTO_SETUP'} ) { installer::worker::put_license_into_setup(".", $includepatharrayref); } 1195 1196 # Creating installation set for Unix language packs, that are not part of multi lingual installation sets 1197 if ( ( $installer::globals::languagepack ) && ( ! $installer::globals::debian ) && ( ! $installer::globals::makedownload ) ) { installer::languagepack::build_installer_for_languagepack($installer::globals::epmoutpath, $allvariableshashref, $includepatharrayref, $languagesarrayref, $languagestringref); } 1198 1199 # Creating installation set for Unix help packs, that are not part of multi lingual installation sets 1200 if ( ( $installer::globals::helppack ) && ( ! $installer::globals::debian ) && ( ! $installer::globals::makedownload ) ) { installer::helppack::build_installer_for_helppack($installer::globals::epmoutpath, $allvariableshashref, $includepatharrayref, $languagesarrayref, $languagestringref); } 1201 1202 chdir($currentdir); # changing back into start directory 1203 } 1204 1205 if ( $installer::globals::postprocess_standardepm ) 1206 { 1207 installer::logger::include_header_into_logfile("Post EPM processes (Standard EPM):"); 1208 1209 chdir($installdir); 1210 1211 # determine the destination directory 1212 my $newepmdir = installer::epmfile::determine_installdir_ooo(); 1213 1214 # Copying the cde, kde and gnome packages into the installation set 1215 if ( $installer::globals::addsystemintegration ) { installer::epmfile::put_systemintegration_into_installset($newepmdir, $includepatharrayref, $allvariableshashref, $modulesinproductarrayref); } 1216 1217 # Adding license and readme into installation set 1218 if ($installer::globals::addlicensefile) { installer::worker::put_scpactions_into_installset("."); } 1219 1220 # Adding license file into setup 1221 if ( $allvariableshashref->{'PUT_LICENSE_INTO_SETUP'} ) { installer::worker::put_license_into_setup(".", $includepatharrayref); } 1222 1223 # Creating installation set for Unix language packs, that are not part of multi lingual installation sets 1224 if ( ( $installer::globals::languagepack ) && ( ! $installer::globals::debian ) && ( ! $installer::globals::makedownload ) ) { installer::languagepack::build_installer_for_languagepack($newepmdir, $allvariableshashref, $includepatharrayref, $languagesarrayref, $languagestringref); } 1225 1226 # Creating installation set for Unix help packs, that are not part of multi lingual installation sets 1227 if ( ( $installer::globals::helppack ) && ( ! $installer::globals::debian ) && ( ! $installer::globals::makedownload ) ) { installer::helppack::build_installer_for_helpepack($newepmdir, $allvariableshashref, $includepatharrayref, $languagesarrayref, $languagestringref); } 1228 1229 chdir($currentdir); # changing back into start directory 1230 } 1231 1232 if (( $installer::globals::issolarispkgbuild ) && ( $allvariableshashref->{'COLLECT_PKGMAP'} )) { installer::worker::collectpackagemaps($installdir, $languagestringref, $allvariableshashref); } 1233 1234 ####################################################### 1235 # Analyzing the log file 1236 ####################################################### 1237 1238 my $is_success = 0; 1239 my $finalinstalldir = ""; 1240 1241 installer::worker::clean_output_tree(); # removing directories created in the output tree 1242 ($is_success, $finalinstalldir) = installer::worker::analyze_and_save_logfile($loggingdir, $installdir, $installlogdir, $allsettingsarrayref, $languagestringref, $current_install_number); 1243 my $downloadname = installer::ziplist::getinfofromziplist($allsettingsarrayref, "downloadname"); 1244 1245 ####################################################### 1246 # Creating download installation set 1247 ####################################################### 1248 1249 if ( $installer::globals::makedownload ) 1250 { 1251 my $create_download = 0; 1252 if ( $$downloadname ne "" ) { $create_download = 1; } 1253 if ( $installer::globals::iswindowsbuild ) { $create_download = 0; } 1254 if (( $is_success ) && ( $create_download ) && ( $ENV{'ENABLE_DOWNLOADSETS'} )) 1255 { 1256 my $downloaddir = installer::download::create_download_sets($finalinstalldir, $includepatharrayref, $allvariableshashref, $$downloadname, $languagestringref, $languagesarrayref); 1257 installer::worker::analyze_and_save_logfile($loggingdir, $downloaddir, $installlogdir, $allsettingsarrayref, $languagestringref, $current_install_number); 1258 } 1259 } 1260 } # end of "if (!( $installer::globals::iswindowsbuild ))" 1261 1262 ################################################# 1263 # Part 2b: The Windows platform 1264 ################################################# 1265 1266 ##################################################################### 1267 # ... creating idt files ... 1268 # Only for Windows builds 1269 ##################################################################### 1270 1271 if ( $installer::globals::iswindowsbuild ) 1272 { 1273 ########################################### 1274 # Stripping libraries 1275 ########################################### 1276 1277 # Building for gcc build in cws requires, that all files are stripped before packaging: 1278 # 1. copy all files that need to be stripped locally 1279 # 2. strip all these files 1280 1281 if ( $installer::globals::com eq 'GCC') 1282 { 1283 installer::windows::strip::strip_binaries($filesinproductlanguageresolvedarrayref, $languagestringref); 1284 } 1285 1286 $installdir = installer::worker::create_installation_directory($shipinstalldir, $languagestringref, \$current_install_number); 1287 1288 my $idtdirbase = installer::systemactions::create_directories("idt_files", $languagestringref); 1289 $installer::globals::infodirectory = installer::systemactions::create_directories("info_files", $languagestringref); 1290 my $installlogdir = installer::systemactions::create_directory_next_to_directory($installdir, "log"); 1291 1292 ################################################################################# 1293 # Preparing cabinet files from package definitions 1294 ################################################################################# 1295 1296 installer::packagelist::prepare_cabinet_files($packages, $allvariableshashref); 1297 # printing packages content: 1298 installer::packagelist::log_cabinet_assignments(); 1299 1300 ################################################################################# 1301 # Begin of functions that are used for the creation of idt files (Windows only) 1302 ################################################################################# 1303 1304 installer::logger::print_message( "... creating idt files ...\n" ); 1305 1306 installer::logger::include_header_into_logfile("Creating idt files:"); 1307 1308 my $newidtdir = $idtdirbase . $installer::globals::separator . "00"; # new files into language independent directory "00" 1309 installer::systemactions::create_directory($newidtdir); 1310 1311 my @allfilecomponents = (); 1312 my @allregistrycomponents = (); 1313 1314 # Collecting all files with flag "BINARYTABLE" 1315 my $binarytablefiles = installer::worker::collect_all_items_with_special_flag($filesinproductlanguageresolvedarrayref ,"BINARYTABLE"); 1316 1317 # Removing all files with flag "BINARYTABLE_ONLY" 1318 @installer::globals::binarytableonlyfiles = (); 1319 $filesinproductlanguageresolvedarrayref = installer::worker::remove_all_items_with_special_flag($filesinproductlanguageresolvedarrayref ,"BINARYTABLE_ONLY"); 1320 1321 # Collecting all profileitems with flag "INIFILETABLE" for table "IniFile" 1322 my $inifiletableentries = installer::worker::collect_all_items_with_special_flag($profileitemsinproductlanguageresolvedarrayref ,"INIFILETABLE"); 1323 1324 # Creating the important dynamic idt files 1325 installer::windows::msiglobal::set_msiproductversion($allvariableshashref); 1326 installer::windows::msiglobal::put_msiproductversion_into_bootstrapfile($filesinproductlanguageresolvedarrayref); 1327 1328 # Add cabinet assignments to files 1329 installer::windows::file::assign_cab_to_files($filesinproductlanguageresolvedarrayref); 1330 installer::windows::file::assign_sequencenumbers_to_files($filesinproductlanguageresolvedarrayref); 1331 1332 # Collection all available directory trees 1333 installer::windows::directory::collectdirectorytrees($directoriesforepmarrayref); 1334 1335 # Attention: The table "Director.idt" contains language specific strings -> parameter: \@setuplanguagesarray ! 1336 installer::windows::directory::create_directory_table($directoriesforepmarrayref, \@setuplanguagesarray, $newidtdir, $allvariableshashref, $shortdirname, $loggingdir); 1337 1338 $filesinproductlanguageresolvedarrayref = installer::windows::file::create_files_table($filesinproductlanguageresolvedarrayref, $directoriesforepmarrayref, \@allfilecomponents, $newidtdir, $allvariableshashref, $uniquefilename, $allupdatesequences, $allupdatecomponents, $allupdatefileorder); 1339 if ( $installer::globals::updatedatabase ) { installer::windows::file::check_file_sequences($allupdatefileorder, $allupdatecomponentorder); } 1340 1341 # Attention: The table "Registry.idt" contains language specific strings -> parameter: \@setuplanguagesarray ! 1342 installer::windows::registry::create_registry_table($registryitemsinproductlanguageresolvedarrayref, \@allregistrycomponents, $newidtdir, \@setuplanguagesarray, $allvariableshashref); 1343 1344 installer::windows::component::create_component_table($filesinproductlanguageresolvedarrayref, $registryitemsinproductlanguageresolvedarrayref, $directoriesforepmarrayref, \@allfilecomponents, \@allregistrycomponents, $newidtdir, $componentid, $componentidkeypath, $allvariableshashref); 1345 1346 # Attention: The table "Feature.idt" contains language specific strings -> parameter: \@setuplanguagesarray ! 1347 installer::windows::feature::add_uniquekey($modulesinproductlanguageresolvedarrayref); 1348 $modulesinproductlanguageresolvedarrayref = installer::windows::feature::sort_feature($modulesinproductlanguageresolvedarrayref); 1349 installer::windows::feature::create_feature_table($modulesinproductlanguageresolvedarrayref, $newidtdir, \@setuplanguagesarray, $allvariableshashref); 1350 1351 installer::windows::featurecomponent::create_featurecomponent_table($filesinproductlanguageresolvedarrayref, $registryitemsinproductlanguageresolvedarrayref, $newidtdir); 1352 1353 installer::windows::media::create_media_table($filesinproductlanguageresolvedarrayref, $newidtdir, $allvariableshashref, $allupdatelastsequences, $allupdatediskids); 1354 1355 installer::windows::font::create_font_table($filesinproductlanguageresolvedarrayref, $newidtdir); 1356 1357 # Attention: The table "Shortcut.idt" contains language specific strings -> parameter: \@setuplanguagesarray ! 1358 # Attention: Shortcuts (Folderitems) have icon files, that have to be copied into the Icon directory (last parameter) 1359 my @iconfilecollector = (); 1360 1361 installer::windows::shortcut::create_shortcut_table($filesinproductlanguageresolvedarrayref, $linksinproductlanguageresolvedarrayref, $folderinproductlanguageresolvedarrayref, $folderitemsinproductlanguageresolvedarrayref, $directoriesforepmarrayref, $newidtdir, \@setuplanguagesarray, $includepatharrayref, \@iconfilecollector); 1362 1363 installer::windows::inifile::create_inifile_table($inifiletableentries, $filesinproductlanguageresolvedarrayref, $newidtdir); 1364 1365 installer::windows::icon::create_icon_table(\@iconfilecollector, $newidtdir); # creating the icon table with all iconfiles used as shortcuts (FolderItems) 1366 1367 installer::windows::createfolder::create_createfolder_table($directoriesforepmarrayref, $filesinproductlanguageresolvedarrayref, $newidtdir, $allvariableshashref); 1368 1369 installer::windows::upgrade::create_upgrade_table($newidtdir, $allvariableshashref); 1370 1371 installer::windows::msishortcutproperty::create_msishortcutproperty_table($folderitempropertiesinproductarrayref, $folderitemsinproductarrayref, $newidtdir); 1372 1373 if (( ! $installer::globals::languagepack ) && ( ! $installer::globals::helppack )) # the following tables not for language packs or help packs 1374 { 1375 installer::windows::removefile::create_removefile_table($folderitemsinproductlanguageresolvedarrayref, $newidtdir); 1376 1377 # Adding Assemblies into the tables MsiAssembly and MsiAssemblyName dynamically 1378 installer::windows::assembly::create_msiassembly_table($filesinproductlanguageresolvedarrayref, $newidtdir); 1379 installer::windows::assembly::create_msiassemblyname_table($filesinproductlanguageresolvedarrayref, $newidtdir); 1380 installer::windows::assembly::add_assembly_condition_into_component_table($filesinproductlanguageresolvedarrayref, $newidtdir); 1381 } 1382 1383 $infoline = "\n"; 1384 push(@installer::globals::logfileinfo, $infoline); 1385 1386 # Localizing the language dependent idt files 1387 # For every language there will be a localized msi database 1388 # For multilingual installation sets, the differences of this 1389 # databases have to be stored in transforms. 1390 1391 for ( my $m = 0; $m <= $#{\@setuplanguagesarray}; $m++ ) 1392 { 1393 my $onelanguage = ${\@setuplanguagesarray}[$m]; 1394 1395 my $is_rtl = 0; 1396 my @rtllanguages = ("ar", "fa", "he", "ug", "ky-CN"); 1397 if ( grep {$_ eq $onelanguage} @rtllanguages ) { $is_rtl = 1; } 1398 1399 my $languageidtdir = $idtdirbase . $installer::globals::separator . $onelanguage; 1400 if ( -d $languageidtdir ) { installer::systemactions::remove_complete_directory($languageidtdir, 1); } 1401 installer::systemactions::create_directory($languageidtdir); 1402 1403 # Copy the template idt files and the new created idt files into this language directory 1404 1405 installer::logger::print_message( "... copying idt files ...\n" ); 1406 1407 installer::logger::include_header_into_logfile("Copying idt files to $languageidtdir:"); 1408 1409 installer::windows::idtglobal::prepare_language_idt_directory($languageidtdir, $newidtdir, $onelanguage, $filesinproductlanguageresolvedarrayref, \@iconfilecollector, $binarytablefiles, $allvariableshashref); 1410 1411 # Now all files are copied into a language specific directory 1412 # The template idt files can be translated 1413 1414 installer::logger::print_message( "... localizing idt files (language: $onelanguage) ...\n" ); 1415 1416 installer::logger::include_header_into_logfile("Localizing idt files (Language: $onelanguage):"); 1417 1418 my @translationfiles = (); # all idt files, that need a translation 1419 push(@translationfiles, "ActionTe.idt"); 1420 push(@translationfiles, "Control.idt"); 1421 push(@translationfiles, "CustomAc.idt"); 1422 push(@translationfiles, "Error.idt"); 1423 push(@translationfiles, "LaunchCo.idt"); 1424 push(@translationfiles, "RadioBut.idt"); 1425 push(@translationfiles, "Property.idt"); 1426 push(@translationfiles, "UIText.idt"); 1427 1428 my $oneidtfilename; 1429 my $oneidtfile; 1430 1431 foreach $oneidtfilename (@translationfiles) 1432 { 1433 my $languagefilename = installer::windows::idtglobal::get_languagefilename($oneidtfilename, $installer::globals::idtlanguagepath); 1434 my $languagefile = installer::files::read_file($languagefilename); 1435 1436 $oneidtfilename = $languageidtdir . $installer::globals::separator . $oneidtfilename; 1437 $oneidtfile = installer::files::read_file($oneidtfilename); 1438 1439 # Now the substitution can start 1440 installer::windows::idtglobal::translate_idtfile($oneidtfile, $languagefile, $onelanguage); 1441 1442 installer::files::save_file($oneidtfilename, $oneidtfile); 1443 1444 $infoline = "Translated idt file: $oneidtfilename into language $onelanguage\n"; 1445 push(@installer::globals::logfileinfo, $infoline); 1446 $infoline = "Used languagefile: $languagefilename\n"; 1447 push(@installer::globals::logfileinfo, $infoline); 1448 } 1449 1450 # setting bidi attributes, if required 1451 if ( $is_rtl ) { installer::windows::idtglobal::setbidiattributes($languageidtdir, $onelanguage); } 1452 1453 # setting the condition, that at least one module is selected 1454 installer::windows::idtglobal::set_multilanguageonly_condition($languageidtdir); 1455 1456 # include the license text into the table Control.idt 1457 1458 if ( ! $allvariableshashref->{'HIDELICENSEDIALOG'} ) 1459 { 1460 my $licensefilesource = installer::windows::idtglobal::get_rtflicensefilesource($onelanguage, $includepatharrayref_lang); 1461 my $licensefile = installer::files::read_file($licensefilesource); 1462 installer::scpzipfiles::replace_all_ziplistvariables_in_rtffile($licensefile, $allvariableshashref); 1463 my $controltablename = $languageidtdir . $installer::globals::separator . "Control.idt"; 1464 my $controltable = installer::files::read_file($controltablename); 1465 installer::windows::idtglobal::add_licensefile_to_database($licensefile, $controltable); 1466 installer::files::save_file($controltablename, $controltable); 1467 1468 $infoline = "Added licensefile $licensefilesource into database $controltablename\n"; 1469 push(@installer::globals::logfileinfo, $infoline); 1470 } 1471 1472 # include a component into environment table if required 1473 1474 installer::windows::component::set_component_in_environment_table($languageidtdir, $filesinproductlanguageresolvedarrayref); 1475 1476 # include the ProductCode and the UpgradeCode from codes-file into the Property.idt 1477 1478 installer::windows::property::set_codes_in_property_table($languageidtdir); 1479 1480 # the language specific properties can now be set in the Property.idt 1481 1482 installer::windows::property::update_property_table($languageidtdir, $onelanguage, $allvariableshashref, $languagestringref); 1483 1484 # replacing variables in RegLocat.idt 1485 1486 installer::windows::msiglobal::update_reglocat_table($languageidtdir, $allvariableshashref); 1487 1488 # replacing variables in RemoveRe.idt (RemoveRegistry.idt) 1489 1490 installer::windows::msiglobal::update_removere_table($languageidtdir); 1491 1492 # adding language specific properties for multilingual installation sets 1493 1494 installer::windows::property::set_languages_in_property_table($languageidtdir, \@setuplanguagesarray); 1495 1496 # adding settings into CheckBox.idt 1497 installer::windows::property::update_checkbox_table($languageidtdir, $allvariableshashref); 1498 1499 # adding the files from the binary directory into the binary table 1500 installer::windows::binary::update_binary_table($languageidtdir, $filesinproductlanguageresolvedarrayref, $binarytablefiles); 1501 1502 # Adding Windows Installer CustomActions 1503 1504 installer::windows::idtglobal::addcustomactions($languageidtdir, $windowscustomactionsarrayref, $filesinproductlanguageresolvedarrayref); 1505 1506 installer::logger::print_message( "... Analyze if custom action table must be patched with merge module directory names ...\n" ); 1507 1508 my @customactions = (); 1509 for my $e (keys %installer::globals::merge_directory_hash) { 1510 my $var; 1511 installer::logger::print_message( "... analyzing directory from merge module: $e\n"); 1512 if (installer::windows::directory::has_standard_directory_prefix($e, \$var)) { 1513 installer::logger::print_message( "... emitting custom action to set the var $e to directory: $var\n"); 1514 push(@customactions, installer::windows::idtglobal::emit_custom_action_for_standard_directory($e, $var)); 1515 } 1516 } 1517 1518 if (@customactions) { 1519 installer::logger::print_message( "... Patching custom action table with merge module directory names ...\n" ); 1520 #print Dumper(@customactions); 1521 installer::windows::idtglobal::addcustomactions($languageidtdir, \@customactions, $filesinproductlanguageresolvedarrayref); 1522 } 1523 1524 # Then the language specific msi database can be created 1525 1526 if ( $installer::globals::iswin || $installer::globals::packageformat eq 'msi' ) 1527 { 1528 my $msidatabasename = installer::windows::msiglobal::get_msidatabasename($allvariableshashref, $onelanguage); 1529 my $msifilename = $languageidtdir . $installer::globals::separator . $msidatabasename; 1530 1531 installer::logger::print_message( "... creating msi database (language $onelanguage) ... \n" ); 1532 1533 installer::windows::msiglobal::set_uuid_into_component_table($languageidtdir, $allvariableshashref); # setting new GUID for the components using the tool uuidgen.exe 1534 installer::windows::msiglobal::prepare_64bit_database($languageidtdir, $allvariableshashref); # making last 64 bit changes 1535 installer::windows::msiglobal::create_msi_database($languageidtdir ,$msifilename); 1536 1537 # validating the database # ToDo 1538 1539 installer::windows::msiglobal::write_summary_into_msi_database($msifilename, $onelanguage, $languagefile, $allvariableshashref); 1540 1541 # copy msi database into installation directory 1542 1543 my $msidestfilename = $installdir . $installer::globals::separator . $msidatabasename; 1544 installer::systemactions::copy_one_file($msifilename, $msidestfilename); 1545 } 1546 } 1547 1548 # Creating transforms, if the installation set has more than one language 1549 # renaming the msi database 1550 1551 my $defaultlanguage = installer::languages::get_default_language(\@setuplanguagesarray); 1552 1553 if ( $installer::globals::iswin || $installer::globals::packageformat eq 'msi' ) 1554 { 1555 if ( $#{\@setuplanguagesarray} > 0 ) 1556 { 1557 installer::windows::msiglobal::create_transforms(\@setuplanguagesarray, $defaultlanguage, $installdir, $allvariableshashref); 1558 } 1559 # if there are Merge Modules, they have to be integrated now 1560 my $mergedbname = installer::windows::msiglobal::get_msidatabasename($allvariableshashref, $defaultlanguage); 1561 my $mergeidtdir = $idtdirbase . $installer::globals::separator . "mergemodules"; 1562 if ( -d $mergeidtdir ) { installer::systemactions::remove_complete_directory($mergeidtdir, 1); } 1563 installer::systemactions::create_directory($mergeidtdir); 1564 installer::systemactions::copy_one_file($installdir . $installer::globals::separator . $mergedbname, $mergeidtdir . $installer::globals::separator . $mergedbname); 1565 $filesinproductlanguageresolvedarrayref = installer::windows::mergemodule::merge_mergemodules_into_msi_database($mergemodulesarrayref, $filesinproductlanguageresolvedarrayref, $mergeidtdir . $installer::globals::separator . $mergedbname, $languagestringref, $allvariableshashref, $includepatharrayref, $allupdatesequences, $allupdatelastsequences, $allupdatediskids); 1566 installer::systemactions::copy_one_file($mergeidtdir . $installer::globals::separator . $mergedbname, $installdir . $installer::globals::separator . $mergedbname); 1567 1568 installer::windows::msiglobal::rename_msi_database_in_installset($defaultlanguage, $installdir, $allvariableshashref); 1569 } 1570 1571 # Analyzing the ScpActions and copying the files into the installation set 1572 1573 installer::logger::print_message( "... copying files into installation set ...\n" ); 1574 1575 installer::worker::put_scpactions_into_installset($installdir); 1576 1577 # ... copying MergeModules into installation set 1578 1579 if ( ! $installer::globals::fix_number_of_cab_files ) { installer::windows::msiglobal::copy_merge_modules_into_installset($installdir); } 1580 1581 installer::logger::print_message( "... creating ddf files ...\n" ); 1582 1583 # Creating all needed ddf files and generating a list 1584 # for the package process containing all system calls 1585 1586 my $ddfdir = installer::systemactions::create_directories("ddf", $languagestringref); 1587 1588 my $packjobref = installer::windows::msiglobal::generate_cab_file_list($filesinproductlanguageresolvedarrayref, $installdir, $ddfdir, $allvariableshashref); 1589 1590 # Update and patch reasons the pack order needs to be saved 1591 installer::windows::msiglobal::save_packorder(); 1592 1593 $infoline = "\n"; 1594 push(@installer::globals::logfileinfo, $infoline); 1595 1596 #################################### 1597 # Writing log file 1598 # before cab files are packed 1599 #################################### 1600 1601 installer::logger::print_message( "... creating log file $installer::globals::logfilename \n" ); 1602 1603 installer::files::save_file($loggingdir . $installer::globals::logfilename, \@installer::globals::logfileinfo); 1604 1605 ####################################################### 1606 # Finally really create the installation packages, 1607 # Only for Windows and only on a windows platform. 1608 ####################################################### 1609 1610 if ( $installer::globals::iswin || $installer::globals::packageformat eq 'msi' ) 1611 { 1612 installer::logger::print_message( "... packaging installation set ... \n" ); 1613 installer::windows::msiglobal::execute_packaging($packjobref, $loggingdir, $allvariableshashref); 1614 if ( $installer::globals::include_cab_in_msi ) { installer::windows::msiglobal::include_cabs_into_msi($installdir); } 1615 1616 #################################### 1617 # Writing log file 1618 # after cab files are packed 1619 #################################### 1620 1621 installer::logger::print_message( "\n... creating log file $installer::globals::logfilename \n" ); 1622 installer::files::save_file($loggingdir . $installer::globals::logfilename, \@installer::globals::logfileinfo); 1623 } 1624 1625 ####################################################### 1626 # Analyzing the log file 1627 ####################################################### 1628 1629 my $is_success = 0; 1630 my $finalinstalldir = ""; 1631 installer::worker::clean_output_tree(); # removing directories created in the output tree 1632 ($is_success, $finalinstalldir) = installer::worker::analyze_and_save_logfile($loggingdir, $installdir, $installlogdir, $allsettingsarrayref, $languagestringref, $current_install_number); 1633 1634 ####################################################### 1635 # Creating Windows msp patches 1636 ####################################################### 1637 1638 if (( $is_success ) && ( $installer::globals::updatedatabase ) && ( $allvariableshashref->{'CREATE_MSP_INSTALLSET'} )) 1639 { 1640 # Required: 1641 # Temp path for administrative installations: $installer::globals::temppath 1642 # Path of new installation set: $finalinstalldir 1643 # Path of old installation set: $installer::globals::updatedatabasepath 1644 my $mspdir = installer::windows::msp::create_msp_patch($finalinstalldir, $includepatharrayref, $allvariableshashref, $languagestringref, $languagesarrayref, $filesinproductlanguageresolvedarrayref); 1645 ($is_success, $finalinstalldir) = installer::worker::analyze_and_save_logfile($loggingdir, $mspdir, $installlogdir, $allsettingsarrayref, $languagestringref, $current_install_number); 1646 installer::worker::clean_output_tree(); # removing directories created in the output tree 1647 } 1648 1649 ####################################################### 1650 # Creating download installation set 1651 ####################################################### 1652 1653 my $create_download = 0; 1654 my $downloadname = installer::ziplist::getinfofromziplist($allsettingsarrayref, "downloadname"); 1655 if ( $installer::globals::languagepack ) { $downloadname = installer::ziplist::getinfofromziplist($allsettingsarrayref, "langpackdownloadname"); } 1656 if ( $installer::globals::helppack ) { $downloadname = installer::ziplist::getinfofromziplist($allsettingsarrayref, "helppackdownloadname"); } 1657 1658 if ( $$downloadname ne "" ) { $create_download = 1; } 1659 if ( $installer::globals::iswindowsbuild ) 1660 { 1661 $create_download = 0; 1662 $$downloadname = installer::download::set_download_filename($languagestringref, $allvariableshashref); 1663 installer::systemactions::rename_one_file( $finalinstalldir . $installer::globals::separator . $installer::globals::shortmsidatabasename, $finalinstalldir . $installer::globals::separator . $$downloadname . ".msi" ); 1664 } 1665 if (( $is_success ) && ( $create_download ) && ( $ENV{'ENABLE_DOWNLOADSETS'} )) 1666 { 1667 my $downloaddir = installer::download::create_download_sets($finalinstalldir, $includepatharrayref, $allvariableshashref, $$downloadname, $languagestringref, $languagesarrayref); 1668 installer::worker::analyze_and_save_logfile($loggingdir, $downloaddir, $installlogdir, $allsettingsarrayref, $languagestringref, $current_install_number); 1669 } 1670 1671 } # end of "if ( $installer::globals::iswindowsbuild )" 1672 1673 # saving file_info file for later analysis 1674 my $speciallogfilename = $loggingdir . "fileinfo_" . $installer::globals::product . "\.log"; 1675 open my $log_fh, '>', $speciallogfilename 1676 or die "Could not open $speciallogfilename for writing: $!"; 1677 print $log_fh Dumper($filesinproductlanguageresolvedarrayref); 1678 1679 } # end of iteration for one language group 1680} 1681 1682sub cleanup_on_error { 1683 my $message = shift; 1684 1685 # If an installation set is currently created, the directory name 1686 # is saved in $installer::globals::saveinstalldir. If this 1687 # directory name contains "_inprogress", it has to be renamed to 1688 # "_witherror". 1689 if ( $installer::globals::saveinstalldir =~ /_inprogress/ ) { 1690 installer::systemactions::rename_string_in_directory($installer::globals::saveinstalldir, "_inprogress", "_witherror"); 1691 } 1692 1693 # Removing directories created in the output tree. 1694 installer::worker::clean_output_tree(); 1695 1696 $installer::globals::logfilename = $installer::globals::exitlog . $installer::globals::logfilename; 1697 1698 my @log = (@installer::globals::logfileinfo, @installer::globals::globallogfileinfo); 1699 1700 push(@log, "\n" . '*' x 65 . "\n"); 1701 push(@log, $message); 1702 push(@log, '*' x 65 . "\n"); 1703 1704 installer::files::save_file($installer::globals::logfilename, \@log); 1705 1706 print("ERROR, saved logfile $installer::globals::logfilename is:\n"); 1707 open(my $log, "<", $installer::globals::logfilename); 1708 print ": $_" while (<$log>); 1709 print "\n"; 1710 close($log); 1711} 1712 17131; 1714