Update ooo320-m1
[ooovba.git] / solenv / bin / modules / installer / simplepackage.pm
blob893046d6cbb79692d1da872d229ce9f9344f02f0
1 #*************************************************************************
3 # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 #
5 # Copyright 2008 by Sun Microsystems, Inc.
7 # OpenOffice.org - a multi-platform office productivity suite
9 # $RCSfile: simplepackage.pm,v $
11 # $Revision: 1.19.48.1 $
13 # This file is part of OpenOffice.org.
15 # OpenOffice.org is free software: you can redistribute it and/or modify
16 # it under the terms of the GNU Lesser General Public License version 3
17 # only, as published by the Free Software Foundation.
19 # OpenOffice.org is distributed in the hope that it will be useful,
20 # but WITHOUT ANY WARRANTY; without even the implied warranty of
21 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
22 # GNU Lesser General Public License version 3 for more details
23 # (a copy is included in the LICENSE file that accompanied this code).
25 # You should have received a copy of the GNU Lesser General Public License
26 # version 3 along with OpenOffice.org. If not, see
27 # <http://www.openoffice.org/license.html>
28 # for a copy of the LGPLv3 License.
30 #*************************************************************************
32 package installer::simplepackage;
34 # use Archive::Zip qw( :ERROR_CODES :CONSTANTS );
35 use Cwd;
36 use File::Copy;
37 use installer::download;
38 use installer::exiter;
39 use installer::globals;
40 use installer::logger;
41 use installer::strip;
42 use installer::systemactions;
43 use installer::worker;
45 ####################################################
46 # Checking if the simple packager is required.
47 # This can be achieved by setting the global
48 # variable SIMPLE_PACKAGE in *.lst file or by
49 # setting the environment variable SIMPLE_PACKAGE.
50 ####################################################
52 sub check_simple_packager_project
54 my ( $allvariables ) = @_;
56 if (( $installer::globals::packageformat eq "installed" ) ||
57 ( $installer::globals::packageformat eq "archive" ))
59 $installer::globals::is_simple_packager_project = 1;
60 $installer::globals::patch_user_dir = 1;
62 elsif( $installer::globals::packageformat eq "dmg" )
64 $installer::globals::is_simple_packager_project = 1;
68 ####################################################
69 # Registering extensions
70 ####################################################
72 sub register_extensions
74 my ($officedir, $languagestringref) = @_;
76 my $programdir = $officedir . $installer::globals::separator;
77 # if ( $installer::globals::sundirhostname ne "" ) { $programdir = $programdir . $installer::globals::sundirhostname . $installer::globals::separator; }
78 if ( $installer::globals::officedirhostname ne "" ) { $programdir = $programdir . $installer::globals::officedirhostname . $installer::globals::separator; }
79 $programdir = $programdir . "program";
81 my $from = cwd();
82 chdir($programdir);
84 my $infoline = "";
86 # my $unopkgfile = $officedir . $installer::globals::separator . "program" .
87 # $installer::globals::separator . $installer::globals::unopkgfile;
89 my $unopkgfile = $installer::globals::unopkgfile;
91 my $unopkgexists = 1;
92 if (( $installer::globals::languagepack ) && ( ! -f $unopkgfile ))
94 $unopkgexists = 0;
95 $infoline = "Language packs do not contain unopkg!\n";
96 push( @installer::globals::logfileinfo, $infoline);
99 # my $extensiondir = $officedir . $installer::globals::separator . "share" .
100 # $installer::globals::separator . "extension" .
101 # $installer::globals::separator . "install";
103 my $extensiondir = ".." . $installer::globals::separator . "share" . $installer::globals::separator . "extension" . $installer::globals::separator . "install";
105 my $allextensions = installer::systemactions::find_file_with_file_extension("oxt", $extensiondir);
107 if (( $#{$allextensions} > -1 ) && ( $unopkgexists ))
109 my $currentdir = cwd();
110 print "... current dir: $currentdir ...\n";
111 $infoline = "Current dir: $currentdir\n";
112 push( @installer::globals::logfileinfo, $infoline);
114 for ( my $i = 0; $i <= $#{$allextensions}; $i++ )
116 my $oneextension = $extensiondir . $installer::globals::separator . ${$allextensions}[$i];
118 # my $systemcall = $unopkgfile . " add --shared " . "\"" . $oneextension . "\"";
120 if ( ! -f $unopkgfile ) { installer::exiter::exit_program("ERROR: $unopkgfile not found!", "register_extensions"); }
121 if ( ! -f $oneextension ) { installer::exiter::exit_program("ERROR: $oneextension not found!", "register_extensions"); }
123 my $localtemppath = installer::systemactions::create_directories("uno", $languagestringref);
125 if ( $installer::globals::iswindowsbuild )
127 if ( $^O =~ /cygwin/i )
129 $localtemppath = $installer::globals::cyg_temppath;
131 else
133 $windowsslash = "\/";
135 $localtemppath =~ s/\\/\//g;
136 $localtemppath = "/".$localtemppath;
138 my $systemcall = "JFW_PLUGIN_DO_NOT_CHECK_ACCESSIBILITY=1 " . $unopkgfile . " add --shared --verbose " . $oneextension . " -env:UserInstallation=file://" . $localtemppath . " 2\>\&1 |";
140 print "... $systemcall ...\n";
142 $infoline = "Systemcall: $systemcall\n";
143 push( @installer::globals::logfileinfo, $infoline);
145 my @unopkgoutput = ();
147 open (UNOPKG, $systemcall);
148 while (<UNOPKG>)
150 my $lastline = $_;
151 push(@unopkgoutput, $lastline);
153 close (UNOPKG);
155 for ( my $j = 0; $j <= $#unopkgoutput; $j++ ) { push( @installer::globals::logfileinfo, "$unopkgoutput[$j]"); }
157 my $returnvalue = $?; # $? contains the return value of the systemcall
159 if ($returnvalue)
161 $infoline = "ERROR: Could not execute \"$systemcall\"!\nExitcode: '$returnvalue'\n";
162 push( @installer::globals::logfileinfo, $infoline);
163 installer::exiter::exit_program("ERROR: $systemcall failed!", "register_extensions");
165 else
167 $infoline = "Success: Executed \"$systemcall\" successfully!\n";
168 push( @installer::globals::logfileinfo, $infoline);
172 else
174 if ( ! ( $#{$allextensions} > -1 ))
176 $infoline = "No extensions located in directory $extensiondir.\n";
177 push( @installer::globals::logfileinfo, $infoline);
181 chdir($from);
184 ########################################################################
185 # Getting the translation file for the Mac Language Pack installer
186 ########################################################################
188 sub get_mac_translation_file
190 my $translationfilename = $installer::globals::maclangpackfilename;
191 # my $translationfilename = $installer::globals::idtlanguagepath . $installer::globals::separator . $installer::globals::maclangpackfilename;
192 # if ( $installer::globals::unicodensis ) { $translationfilename = $translationfilename . ".uulf"; }
193 # else { $translationfilename = $translationfilename . ".mlf"; }
194 if ( ! -f $translationfilename ) { installer::exiter::exit_program("ERROR: Could not find language file $translationfilename!", "get_mac_translation_file"); }
195 my $translationfile = installer::files::read_file($translationfilename);
197 my $infoline = "Reading translation file: $translationfilename\n";
198 push( @installer::globals::logfileinfo, $infoline);
200 return $translationfile;
203 ##################################################################
204 # Collecting all identifier from ulf file
205 ##################################################################
207 sub get_identifier
209 my ( $translationfile ) = @_;
211 my @identifier = ();
213 for ( my $i = 0; $i <= $#{$translationfile}; $i++ )
215 my $oneline = ${$translationfile}[$i];
217 if ( $oneline =~ /^\s*\[(.+)\]\s*$/ )
219 my $identifier = $1;
220 push(@identifier, $identifier);
224 return \@identifier;
227 ##############################################################
228 # Returning the complete block in all languages
229 # for a specified string
230 ##############################################################
232 sub get_language_block_from_language_file
234 my ($searchstring, $languagefile) = @_;
236 my @language_block = ();
238 for ( my $i = 0; $i <= $#{$languagefile}; $i++ )
240 if ( ${$languagefile}[$i] =~ /^\s*\[\s*$searchstring\s*\]\s*$/ )
242 my $counter = $i;
244 push(@language_block, ${$languagefile}[$counter]);
245 $counter++;
247 while (( $counter <= $#{$languagefile} ) && (!( ${$languagefile}[$counter] =~ /^\s*\[/ )))
249 push(@language_block, ${$languagefile}[$counter]);
250 $counter++;
253 last;
257 return \@language_block;
260 ##############################################################
261 # Returning a specific language string from the block
262 # of all translations
263 ##############################################################
265 sub get_language_string_from_language_block
267 my ($language_block, $language) = @_;
269 my $newstring = "";
271 for ( my $i = 0; $i <= $#{$language_block}; $i++ )
273 if ( ${$language_block}[$i] =~ /^\s*$language\s*\=\s*\"(.*)\"\s*$/ )
275 $newstring = $1;
276 last;
280 if ( $newstring eq "" )
282 $language = "en-US"; # defaulting to english
284 for ( my $i = 0; $i <= $#{$language_block}; $i++ )
286 if ( ${$language_block}[$i] =~ /^\s*$language\s*\=\s*\"(.*)\"\s*$/ )
288 $newstring = $1;
289 last;
294 return $newstring;
297 ########################################################################
298 # Localizing the script for the Mac Language Pack installer
299 ########################################################################
301 sub localize_scriptfile
303 my ($scriptfile, $translationfile, $languagestringref) = @_;
305 # my $translationfile = get_mac_translation_file();
307 my $onelanguage = $$languagestringref;
308 if ( $onelanguage =~ /^\s*(.*?)_/ ) { $onelanguage = $1; }
310 # Analyzing the ulf file, collecting all Identifier
311 my $allidentifier = get_identifier($translationfile);
313 for ( my $i = 0; $i <= $#{$allidentifier}; $i++ )
315 my $identifier = ${$allidentifier}[$i];
316 my $language_block = get_language_block_from_language_file($identifier, $translationfile);
317 my $newstring = get_language_string_from_language_block($language_block, $onelanguage);
319 # removing mask
320 $newstring =~ s/\\\'/\'/g;
322 replace_one_variable_in_shellscript($scriptfile, $newstring, $identifier);
326 #################################################################################
327 # Replacing one variable in Mac shell script
328 #################################################################################
330 sub replace_one_variable_in_shellscript
332 my ($scriptfile, $variable, $searchstring) = @_;
334 for ( my $i = 0; $i <= $#{$scriptfile}; $i++ )
336 ${$scriptfile}[$i] =~ s/\[$searchstring\]/$variable/g;
340 #############################################
341 # Replacing variables in Mac shell script
342 #############################################
344 sub replace_variables_in_scriptfile
346 my ($scriptfile, $volume_name, $allvariables) = @_;
348 replace_one_variable_in_shellscript($scriptfile, $volume_name, "FULLPRODUCTNAME" );
349 replace_one_variable_in_shellscript($scriptfile, $allvariables->{'PRODUCTNAME'}, "PRODUCTNAME" );
350 replace_one_variable_in_shellscript($scriptfile, $allvariables->{'PRODUCTVERSION'}, "PRODUCTVERSION" );
352 my $scriptname = lc($allvariables->{'PRODUCTNAME'}) . "\.script";
353 if ( $allvariables->{'PRODUCTNAME'} eq "OpenOffice.org" ) { $scriptname = "org.openoffice.script"; }
355 replace_one_variable_in_shellscript($scriptfile, $scriptname, "SEARCHSCRIPTNAME" );
358 #############################################
359 # Creating the "simple" package.
360 # "zip" for Windows
361 # "dmg" on Mac OS X
362 # "tar.gz" for all other platforms
363 #############################################
365 sub create_package
367 my ( $installdir, $packagename, $allvariables, $includepatharrayref, $languagestringref ) = @_;
369 # moving dir into temporary directory
370 my $pid = $$; # process id
371 my $tempdir = $installdir . "_temp" . "." . $pid;
372 my $systemcall = "";
373 my $from = "";
374 my $makesystemcall = 1;
375 my $return_to_start = 0;
376 installer::systemactions::rename_directory($installdir, $tempdir);
378 # creating new directory with original name
379 installer::systemactions::create_directory($installdir);
381 my $archive = $installdir . $installer::globals::separator . $packagename . $installer::globals::archiveformat;
383 if ( $archive =~ /zip$/ )
385 $from = cwd();
386 $return_to_start = 1;
387 chdir($tempdir);
388 $systemcall = "$installer::globals::zippath -qr $archive .";
390 # Using Archive::Zip fails because of very long path names below "share/uno_packages/cache"
391 # my $packzip = Archive::Zip->new();
392 # $packzip->addTree("."); # after changing into $tempdir
393 # $packzip->writeToFileNamed($archive);
394 # $makesystemcall = 0;
396 elsif ( $archive =~ /dmg$/ )
398 installer::worker::put_scpactions_into_installset("$tempdir/$packagename");
399 my $folder = (( -l "$tempdir/$packagename/Applications" ) or ( -l "$tempdir/$packagename/opt" )) ? $packagename : "\.";
401 if ( $allvariables->{'PACK_INSTALLED'} ) {
402 $folder = $packagename;
405 my $volume_name = $allvariables->{'PRODUCTNAME'} . ' ' . $allvariables->{'PRODUCTVERSION'};
406 $volume_name = $volume_name . ' ' . $allvariables->{'PRODUCTEXTENSION'} if $allvariables->{'PRODUCTEXTENSION'};
407 if ( $allvariables->{'DMG_VOLUMEEXTENSION'} ) {
408 $volume_name = $volume_name . ' ' . $allvariables->{'DMG_VOLUMEEXTENSION'};
411 my $sla = 'sla.r';
412 my $ref = installer::scriptitems::get_sourcepath_from_filename_and_includepath( \$sla, $includepatharrayref, 0);
414 my $localtempdir = $tempdir;
416 if (( $installer::globals::languagepack ) || ( $installer::globals::patch ))
418 $localtempdir = "$tempdir/$packagename";
419 if ( $installer::globals::languagepack ) { $volume_name = "$volume_name Language Pack"; }
420 if ( $installer::globals::patch ) { $volume_name = "$volume_name Patch"; }
422 # Create tar ball named tarball.tar.bz2
423 my $appfolder = $localtempdir . "/" . $volume_name . "\.app";
424 my $contentsfolder = $appfolder . "/Contents";
425 my $tarballname = "tarball.tar.bz2";
427 my $localfrom = cwd();
428 chdir $appfolder;
430 $systemcall = "tar -cjf $tarballname Contents/";
432 print "... $systemcall ...\n";
433 my $localreturnvalue = system($systemcall);
434 $infoline = "Systemcall: $systemcall\n";
435 push( @installer::globals::logfileinfo, $infoline);
437 if ($localreturnvalue)
439 $infoline = "ERROR: Could not execute \"$systemcall\"!\n";
440 push( @installer::globals::logfileinfo, $infoline);
442 else
444 $infoline = "Success: Executed \"$systemcall\" successfully!\n";
445 push( @installer::globals::logfileinfo, $infoline);
448 my $sourcefile = $appfolder . "/" . $tarballname;
449 my $destfile = $contentsfolder . "/" . $tarballname;
451 installer::systemactions::remove_complete_directory($contentsfolder);
452 installer::systemactions::create_directory($contentsfolder);
454 installer::systemactions::copy_one_file($sourcefile, $destfile);
455 unlink($sourcefile);
457 # Copy two files into installation set next to the tar ball
458 # 1. "osx_install.applescript"
459 # 2 "OpenOffice.org Languagepack"
461 my $scriptrealfilename = "osx_install.applescript";
462 my $scriptfilename = "";
463 if ( $installer::globals::languagepack ) { $scriptfilename = "osx_install_languagepack.applescript"; }
464 if ( $installer::globals::patch ) { $scriptfilename = "osx_install_patch.applescript"; }
465 my $scripthelpersolverfilename = "mac_install.script";
466 my $scripthelperrealfilename = $volume_name;
467 my $translationfilename = $installer::globals::macinstallfilename;
469 # Finding both files in solver
471 my $scriptref = installer::scriptitems::get_sourcepath_from_filename_and_includepath( \$scriptfilename, $includepatharrayref, 0);
472 if ($$scriptref eq "") { installer::exiter::exit_program("ERROR: Could not find Apple script $scriptfilename!", "create_package"); }
473 my $scripthelperref = installer::scriptitems::get_sourcepath_from_filename_and_includepath( \$scripthelpersolverfilename, $includepatharrayref, 0);
474 if ($$scripthelperref eq "") { installer::exiter::exit_program("ERROR: Could not find Apple script $scripthelpersolverfilename!", "create_package"); }
475 my $translationfileref = installer::scriptitems::get_sourcepath_from_filename_and_includepath( \$translationfilename, $includepatharrayref, 0);
476 if ($$translationfileref eq "") { installer::exiter::exit_program("ERROR: Could not find Apple script translation file $translationfilename!", "create_package"); }
478 $scriptfilename = $contentsfolder . "/" . $scriptrealfilename;
479 $scripthelperrealfilename = $contentsfolder . "/" . $scripthelperrealfilename;
481 installer::systemactions::copy_one_file($$scriptref, $scriptfilename);
482 installer::systemactions::copy_one_file($$scripthelperref, $scripthelperrealfilename);
484 # Replacing variables in script $scriptfilename
485 # Localizing script $scriptfilename
486 my $scriptfilecontent = installer::files::read_file($scriptfilename);
487 my $translationfilecontent = installer::files::read_file($$translationfileref);
488 localize_scriptfile($scriptfilecontent, $translationfilecontent, $languagestringref);
489 replace_variables_in_scriptfile($scriptfilecontent, $volume_name, $allvariables);
490 installer::files::save_file($scriptfilename, $scriptfilecontent);
492 $systemcall = "chmod 775 " . "\"" . $scriptfilename . "\"";
493 system($systemcall);
494 $systemcall = "chmod 775 " . "\"" . $scripthelperrealfilename . "\"";
495 system($systemcall);
497 # Copy also Info.plist and icon file
498 # Finding both files in solver
499 my $iconfile = "ooo3_installer.icns";
500 my $iconfileref = installer::scriptitems::get_sourcepath_from_filename_and_includepath( \$iconfile, $includepatharrayref, 0);
501 if ($$iconfileref eq "") { installer::exiter::exit_program("ERROR: Could not find Apple script icon file $iconfile!", "create_package"); }
502 my $subdir = $contentsfolder . "/" . "Resources";
503 if ( ! -d $subdir ) { installer::systemactions::create_directory($subdir); }
504 $destfile = $subdir . "/" . $iconfile;
505 installer::systemactions::copy_one_file($$iconfileref, $destfile);
507 my $infoplistfile = "Info.plist.langpack";
508 my $installname = "Info.plist";
509 my $infoplistfileref = installer::scriptitems::get_sourcepath_from_filename_and_includepath( \$infoplistfile, $includepatharrayref, 0);
510 if ($$infoplistfileref eq "") { installer::exiter::exit_program("ERROR: Could not find Apple script Info.plist: $infoplistfile!", "create_package"); }
511 $destfile = $contentsfolder . "/" . $installname;
512 installer::systemactions::copy_one_file($$infoplistfileref, $destfile);
514 # Replacing variables in Info.plist
515 $scriptfilecontent = installer::files::read_file($destfile);
516 replace_one_variable_in_shellscript($scriptfilecontent, $volume_name, "FULLPRODUCTNAME" );
517 installer::files::save_file($destfile, $scriptfilecontent);
519 chdir $localfrom;
522 $systemcall = "cd $localtempdir && hdiutil makehybrid -hfs -hfs-openfolder $folder $folder -hfs-volume-name \"$volume_name\" -ov -o $installdir/tmp && hdiutil convert -ov -format UDZO $installdir/tmp.dmg -o $archive && ";
523 if ($$ref ne "") {
524 $systemcall .= "hdiutil unflatten $archive && Rez -a $$ref -o $archive && hdiutil flatten $archive &&";
526 $systemcall .= "rm -f $installdir/tmp.dmg";
528 else
530 # getting the path of the getuid.so (only required for Solaris and Linux)
531 my $getuidlibrary = "";
532 my $ldpreloadstring = "";
533 if (( $installer::globals::issolarisbuild ) || ( $installer::globals::islinuxbuild ))
535 $getuidlibrary = installer::download::get_path_for_library($includepatharrayref);
536 if ( $getuidlibrary ne "" ) { $ldpreloadstring = "LD_PRELOAD=" . $getuidlibrary; }
539 $systemcall = "cd $tempdir; $ldpreloadstring tar -cf - . | gzip > $archive";
542 if ( $makesystemcall )
544 print "... $systemcall ...\n";
545 my $returnvalue = system($systemcall);
546 my $infoline = "Systemcall: $systemcall\n";
547 push( @installer::globals::logfileinfo, $infoline);
549 if ($returnvalue)
551 $infoline = "ERROR: Could not execute \"$systemcall\"!\n";
552 push( @installer::globals::logfileinfo, $infoline);
554 else
556 $infoline = "Success: Executed \"$systemcall\" successfully!\n";
557 push( @installer::globals::logfileinfo, $infoline);
561 if ( $return_to_start ) { chdir($from); }
563 print "... removing $tempdir ...\n";
564 installer::systemactions::remove_complete_directory($tempdir);
567 ####################################################
568 # Main method for creating the simple package
569 # installation sets
570 ####################################################
572 sub create_simple_package
574 my ( $filesref, $dirsref, $scpactionsref, $linksref, $unixlinksref, $loggingdir, $languagestringref, $shipinstalldir, $allsettingsarrayref, $allvariables, $includepatharrayref ) = @_;
576 # Creating directories
578 my $current_install_number = "";
579 my $infoline = "";
581 installer::logger::print_message( "... creating installation directory ...\n" );
582 installer::logger::include_header_into_logfile("Creating installation directory");
584 $installer::globals::csp_installdir = installer::worker::create_installation_directory($shipinstalldir, $languagestringref, \$current_install_number);
585 $installer::globals::csp_installlogdir = installer::systemactions::create_directory_next_to_directory($installer::globals::csp_installdir, "log");
587 my $installdir = $installer::globals::csp_installdir;
588 my $installlogdir = $installer::globals::csp_installlogdir;
590 # Setting package name (similar to the download name)
591 my $packagename = "";
593 if ( $installer::globals::packageformat eq "archive" ||
594 $installer::globals::packageformat eq "dmg" )
596 $installer::globals::csp_languagestring = $$languagestringref;
598 my $locallanguage = $installer::globals::csp_languagestring;
600 if ( $allvariables->{'OOODOWNLOADNAME'} )
602 $packagename = installer::download::set_download_filename(\$locallanguage, $allvariables);
604 else
606 $downloadname = installer::ziplist::getinfofromziplist($allsettingsarrayref, "downloadname");
607 if ( $installer::globals::languagepack ) { $downloadname = installer::ziplist::getinfofromziplist($allsettingsarrayref, "langpackdownloadname"); }
608 if ( $installer::globals::patch ) { $downloadname = installer::ziplist::getinfofromziplist($allsettingsarrayref, "patchdownloadname"); }
609 $packagename = installer::download::resolve_variables_in_downloadname($allvariables, $$downloadname, \$locallanguage);
613 # Creating subfolder in installdir, which shall become the root of package or zip file
614 my $subfolderdir = "";
615 if ( $packagename ne "" ) { $subfolderdir = $installdir . $installer::globals::separator . $packagename; }
616 else { $subfolderdir = $installdir; }
618 if ( ! -d $subfolderdir ) { installer::systemactions::create_directory($subfolderdir); }
620 # Create directories, copy files and ScpActions
622 installer::logger::print_message( "... creating directories ...\n" );
623 installer::logger::include_header_into_logfile("Creating directories:");
625 for ( my $i = 0; $i <= $#{$dirsref}; $i++ )
627 my $onedir = ${$dirsref}[$i];
629 if ( $onedir->{'HostName'} )
631 my $destdir = $subfolderdir . $installer::globals::separator . $onedir->{'HostName'};
632 if ( ! -d $destdir )
634 if ( $^O =~ /cygwin/i ) # Cygwin performance check
636 $infoline = "Try to create directory $destdir\n";
637 push(@installer::globals::logfileinfo, $infoline);
638 # Directories in $dirsref are sorted and all parents were added -> "mkdir" works without parent creation!
639 if ( ! ( -d $destdir )) { mkdir($destdir, 0775); }
641 else
643 installer::systemactions::create_directory_structure($destdir);
649 # stripping files ?!
650 if (( $installer::globals::strip ) && ( ! $installer::globals::iswindowsbuild )) { installer::strip::strip_libraries($filesref, $languagestringref); }
652 # copy Files
653 installer::logger::print_message( "... copying files ...\n" );
654 installer::logger::include_header_into_logfile("Copying files:");
656 for ( my $i = 0; $i <= $#{$filesref}; $i++ )
658 my $onefile = ${$filesref}[$i];
660 if (( $onefile->{'Styles'} ) && ( $onefile->{'Styles'} =~ /\bBINARYTABLE_ONLY\b/ )) { next; }
661 if (( $installer::globals::patch ) && ( $onefile->{'Styles'} ) && ( ! ( $onefile->{'Styles'} =~ /\bPATCH\b/ ))) { next; }
663 my $source = $onefile->{'sourcepath'};
664 my $destination = $onefile->{'destination'};
665 $destination = $subfolderdir . $installer::globals::separator . $destination;
667 # Replacing $$ by $ is necessary to install files with $ in its name (back-masquerading)
668 # Otherwise, the following shell command does not work and the file list is not correct
669 $source =~ s/\$\$/\$/;
670 $destination =~ s/\$\$/\$/;
672 if ( $^O =~ /cygwin/i ) # Cygwin performance, do not use copy_one_file. "chmod -R" at the end
674 my $copyreturn = copy($source, $destination);
676 if ($copyreturn)
678 $infoline = "Copy: $source to $destination\n";
679 $returnvalue = 1;
681 else
683 $infoline = "ERROR: Could not copy $source to $destination\n";
684 $returnvalue = 0;
687 push(@installer::globals::logfileinfo, $infoline);
689 else
691 installer::systemactions::copy_one_file($source, $destination);
693 if ( ! $installer::globals::iswindowsbuild )
695 # see issue 102274
696 my $unixrights = "";
697 if ( $onefile->{'UnixRights'} )
699 $unixrights = $onefile->{'UnixRights'};
701 my $localcall = "$installer::globals::wrapcmd chmod $unixrights \'$destination\' \>\/dev\/null 2\>\&1";
702 system($localcall);
708 # creating Links
710 installer::logger::print_message( "... creating links ...\n" );
711 installer::logger::include_header_into_logfile("Creating links:");
713 for ( my $i = 0; $i <= $#{$linksref}; $i++ )
715 my $onelink = ${$linksref}[$i];
717 if (( $installer::globals::patch ) && ( $onelink->{'Styles'} ) && ( ! ( $onelink->{'Styles'} =~ /\bPATCH\b/ ))) { next; }
719 my $destination = $onelink->{'destination'};
720 $destination = $subfolderdir . $installer::globals::separator . $destination;
721 my $destinationfile = $onelink->{'destinationfile'};
723 my $localcall = "ln -sf \'$destinationfile\' \'$destination\' \>\/dev\/null 2\>\&1";
724 system($localcall);
726 $infoline = "Creating link: \"ln -sf $destinationfile $destination\"\n";
727 push(@installer::globals::logfileinfo, $infoline);
730 for ( my $i = 0; $i <= $#{$unixlinksref}; $i++ )
732 my $onelink = ${$unixlinksref}[$i];
734 if (( $installer::globals::patch ) && ( $onelink->{'Styles'} ) && ( ! ( $onelink->{'Styles'} =~ /\bPATCH\b/ ))) { next; }
736 my $target = $onelink->{'Target'};
737 my $destination = $subfolderdir . $installer::globals::separator . $onelink->{'destination'};
739 my $localcall = "ln -sf \'$target\' \'$destination\' \>\/dev\/null 2\>\&1";
740 system($localcall);
742 $infoline = "Creating Unix link: \"ln -sf $target $destination\"\n";
743 push(@installer::globals::logfileinfo, $infoline);
746 # Setting privileges for cygwin globally
748 if ( $^O =~ /cygwin/i )
750 installer::logger::print_message( "... changing privileges in $subfolderdir ...\n" );
751 installer::logger::include_header_into_logfile("Changing privileges in $subfolderdir:");
753 my $localcall = "chmod -R 755 " . "\"" . $subfolderdir . "\"";
754 system($localcall);
757 # Registering the extensions
759 installer::logger::print_message( "... registering extensions ...\n" );
760 installer::logger::include_header_into_logfile("Registering extensions:");
761 register_extensions($subfolderdir, $languagestringref);
763 # Adding scpactions for mac installations sets, that use not dmg format. Without scpactions the
764 # office does not start.
766 if (( $installer::globals::packageformat eq "installed" ) && ( $installer::globals::compiler =~ /^unxmacx/ ))
768 installer::worker::put_scpactions_into_installset("$installdir/$packagename");
771 # Creating archive file
772 if (( $installer::globals::packageformat eq "archive" ) || ( $installer::globals::packageformat eq "dmg" ))
774 # creating a package
775 # -> zip for Windows
776 # -> tar.gz for all other platforms
777 installer::logger::print_message( "... creating $installer::globals::packageformat file ...\n" );
778 installer::logger::include_header_into_logfile("Creating $installer::globals::packageformat file:");
779 create_package($installdir, $packagename, $allvariables, $includepatharrayref, $languagestringref);
782 # Analyzing the log file
784 installer::worker::clean_output_tree(); # removing directories created in the output tree
785 installer::worker::analyze_and_save_logfile($loggingdir, $installdir, $installlogdir, $allsettingsarrayref, $languagestringref, $current_install_number);