1#************************************************************** 2# 3# Licensed to the Apache Software Foundation (ASF) under one 4# or more contributor license agreements. See the NOTICE file 5# distributed with this work for additional information 6# regarding copyright ownership. The ASF licenses this file 7# to you under the Apache License, Version 2.0 (the 8# "License"); you may not use this file except in compliance 9# with the License. You may obtain a copy of the License at 10# 11# http://www.apache.org/licenses/LICENSE-2.0 12# 13# Unless required by applicable law or agreed to in writing, 14# software distributed under the License is distributed on an 15# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 16# KIND, either express or implied. See the License for the 17# specific language governing permissions and limitations 18# under the License. 19# 20#************************************************************** 21 22 23 24package installer::download; 25 26use File::Spec; 27use installer::exiter; 28use installer::files; 29use installer::globals; 30use installer::logger; 31use installer::pathanalyzer; 32use installer::remover; 33use installer::systemactions; 34 35use strict; 36 37BEGIN { # This is needed so that Cygwin's perl evaluates ACLs 38 # (needed for correctly evaluating the -x test.) 39 if( $^O =~ /cygwin/i ) { 40 require filetest; import filetest "access"; 41 } 42} 43 44################################################################## 45# Including the lowercase product name into the script template 46################################################################## 47 48sub put_productname_into_script 49{ 50 my ($scriptfile, $variableshashref) = @_; 51 52 my $productname = $variableshashref->{'PRODUCTNAME'}; 53 $productname = lc($productname); 54 $productname =~ s/\.//g; # openoffice.org -> openofficeorg 55 $productname =~ s/\s*//g; 56 57 $installer::logger::Lang->printf("Adding productname %s into download shell script\n", $productname); 58 59 for ( my $i = 0; $i <= $#{$scriptfile}; $i++ ) 60 { 61 ${$scriptfile}[$i] =~ s/PRODUCTNAMEPLACEHOLDER/$productname/; 62 } 63} 64 65######################################################### 66# Including the linenumber into the script template 67######################################################### 68 69sub put_linenumber_into_script 70{ 71 my ( $scriptfile ) = @_; 72 73 my $linenumber = $#{$scriptfile} + 2; 74 75 $installer::logger::Lang->printf("Adding linenumber %d into download shell script\n", $linenumber); 76 77 for ( my $i = 0; $i <= $#{$scriptfile}; $i++ ) 78 { 79 ${$scriptfile}[$i] =~ s/LINENUMBERPLACEHOLDER/$linenumber/; 80 } 81} 82 83######################################################### 84# Determining the name of the new scriptfile 85######################################################### 86 87sub determine_scriptfile_name 88{ 89 my ( $filename ) = @_; 90 91 $installer::globals::downloadfileextension = ".sh"; 92 $filename = $filename . $installer::globals::downloadfileextension; 93 $installer::globals::downloadfilename = $filename; 94 95 $installer::logger::Lang->printf("Setting download shell script file name to %s\n", $filename); 96 97 return $filename; 98} 99 100######################################################### 101# Saving the script file in the installation directory 102######################################################### 103 104sub save_script_file 105{ 106 my ($directory, $newscriptfilename, $scriptfile) = @_; 107 108 $newscriptfilename = $directory . $installer::globals::separator . $newscriptfilename; 109 installer::files::save_file($newscriptfilename, $scriptfile); 110 111 $installer::logger::Lang->printf("Saving script file %s\n", $newscriptfilename); 112 113 if ( ! $installer::globals::iswindowsbuild ) 114 { 115 my $localcall = "chmod 775 $newscriptfilename \>\/dev\/null 2\>\&1"; 116 system($localcall); 117 } 118 119 return $newscriptfilename; 120} 121 122######################################################### 123# Including checksum and size into script file 124######################################################### 125 126sub put_checksum_and_size_into_script 127{ 128 my ($scriptfile, $sumout) = @_; 129 130 my $checksum = ""; 131 my $size = ""; 132 133 if ( $sumout =~ /^\s*(\d+)\s+(\d+)\s*$/ ) 134 { 135 $checksum = $1; 136 $size = $2; 137 } 138 else 139 { 140 installer::exiter::exit_program("ERROR: Incorrect return value from /usr/bin/sum: $sumout", "put_checksum_and_size_into_script"); 141 } 142 143 $installer::logger::Lang->printf( 144 "Adding checksum %s and size %s into download shell script\n", $checksum, $size); 145 146 for ( my $i = 0; $i <= $#{$scriptfile}; $i++ ) 147 { 148 ${$scriptfile}[$i] =~ s/CHECKSUMPLACEHOLDER/$checksum/; 149 ${$scriptfile}[$i] =~ s/DISCSPACEPLACEHOLDER/$size/; 150 } 151 152} 153 154######################################################### 155# Calling md5sum 156######################################################### 157 158sub call_md5sum 159{ 160 my ($filename) = @_; 161 162 my $md5sumfile = "/usr/bin/md5sum"; 163 164 if ( ! -f $md5sumfile ) { installer::exiter::exit_program("ERROR: No file /usr/bin/md5sum", "call_md5sum"); } 165 166 my $systemcall = "$md5sumfile $filename |"; 167 168 my $md5sumoutput = ""; 169 170 open (SUM, "$systemcall"); 171 $md5sumoutput = <SUM>; 172 close (SUM); 173 174 my $returnvalue = $?; # $? contains the return value of the systemcall 175 176 $installer::logger::Lang->printf("Systemcall: %s\n", $systemcall); 177 178 if ($returnvalue) 179 { 180 $installer::logger::Lang->printf("ERROR: Could not execute \"%s\"!\n", $systemcall); 181 } 182 else 183 { 184 $installer::logger::Lang->print("Success: Executed \"%s\" successfully!\n", $systemcall); 185 } 186 187 return $md5sumoutput; 188} 189 190######################################################### 191# Calling md5sum 192######################################################### 193 194sub get_md5sum 195{ 196 my ($md5sumoutput) = @_; 197 198 my $md5sum; 199 200 if ( $md5sumoutput =~ /^\s*(\w+?)\s+/ ) 201 { 202 $md5sum = $1; 203 } 204 else 205 { 206 installer::exiter::exit_program("ERROR: Incorrect return value from /usr/bin/md5sum: $md5sumoutput", "get_md5sum"); 207 } 208 209 $installer::logger::Lang->printf("Setting md5sum: %s\n", $md5sum); 210 211 return $md5sum; 212} 213 214######################################################### 215# Determining checksum and size of tar file 216######################################################### 217 218sub call_sum 219{ 220 my ($filename, $getuidlibrary) = @_; 221 222 my $systemcall = "/usr/bin/sum $filename |"; 223 224 my $sumoutput = ""; 225 226 open (SUM, "$systemcall"); 227 $sumoutput = <SUM>; 228 close (SUM); 229 230 my $returnvalue = $?; # $? contains the return value of the systemcall 231 232 $installer::logger::Lang->printf("Systemcall: %s\n", $systemcall); 233 234 if ($returnvalue) 235 { 236 $installer::logger::Lang->printf("ERROR: Could not execute \"%s\"!\n", $systemcall); 237 } 238 else 239 { 240 $installer::logger::Lang->printf("Success: Executed \"%s\" successfully!\n", $systemcall); 241 } 242 243 $sumoutput =~ s/\s+$filename\s$//; 244 return $sumoutput; 245} 246 247######################################################### 248# Searching for the getuid.so in the solver 249######################################################### 250 251sub get_path_for_library 252{ 253 my ($includepatharrayref) = @_; 254 255 my $getuidlibraryname = "getuid.so"; 256 257 my $getuidlibraryref = ""; 258 259 if ( $installer::globals::include_pathes_read ) 260 { 261 $getuidlibraryref = installer::scriptitems::get_sourcepath_from_filename_and_includepath(\$getuidlibraryname, $includepatharrayref, 0); 262 } 263 else 264 { 265 $getuidlibraryref = installer::scriptitems::get_sourcepath_from_filename_and_includepath_classic(\$getuidlibraryname, $includepatharrayref, 0); 266 } 267 268 if ($$getuidlibraryref eq "") { installer::exiter::exit_program("ERROR: Could not find $getuidlibraryname!", "get_path_for_library"); } 269 270 return $$getuidlibraryref; 271} 272 273######################################################### 274# Include the tar file into the script 275######################################################### 276 277sub include_tar_into_script 278{ 279 my ($scriptfile, $temporary_tarfile) = @_; 280 281 my $systemcall = "cat $temporary_tarfile >> $scriptfile && rm $temporary_tarfile"; 282 my $returnvalue = system($systemcall); 283 284 $installer::logger::Lang->printf("Systemcall: %s\n", $systemcall); 285 286 if ($returnvalue) 287 { 288 $installer::logger::Lang->printf("ERROR: Could not execute \"%s\"!\n", $systemcall); 289 } 290 else 291 { 292 $installer::logger::Lang->printf("Success: Executed \"%s\" successfully!\n", $systemcall); 293 } 294 return $returnvalue; 295} 296 297######################################################### 298# Create a tar file from the binary package 299######################################################### 300 301sub tar_package 302{ 303 my ( $installdir, $tarfilename, $getuidlibrary) = @_; 304 305 my $ldpreloadstring = $ENV{'FAKEROOT'}; 306 307 my $systemcall = "cd $installdir; $ldpreloadstring tar -cf - * > $tarfilename"; 308 309 my $returnvalue = system($systemcall); 310 311 $installer::logger::Lang->printf("Systemcall: %s\n", $systemcall); 312 313 if ($returnvalue) 314 { 315 $installer::logger::Lang->printf("ERROR: Could not execute \"%s\"!\n", $systemcall); 316 } 317 else 318 { 319 $installer::logger::Lang->printf("Success: Executed \"\" successfully!\n", $systemcall); 320 } 321 322 my $localcall = "chmod 775 $tarfilename \>\/dev\/null 2\>\&1"; 323 $returnvalue = system($localcall); 324 325 return ( -s $tarfilename ); 326} 327 328######################################################### 329# Creating a tar.gz file 330######################################################### 331 332sub create_tar_gz_file_from_package 333{ 334 my ($installdir, $getuidlibrary) = @_; 335 336 my $alldirs = installer::systemactions::get_all_directories($installdir); 337 my $onedir = ${$alldirs}[0]; 338 $installdir = $onedir; 339 340 my $allfiles = installer::systemactions::get_all_files_from_one_directory($installdir); 341 342 for ( my $i = 0; $i <= $#{$allfiles}; $i++ ) 343 { 344 my $onefile = ${$allfiles}[$i]; 345 my $systemcall = "cd $installdir; rm $onefile"; 346 my $returnvalue = system($systemcall); 347 348 $installer::logger::Lang->printf("Systemcall: %s\n", $systemcall); 349 350 if ($returnvalue) 351 { 352 $installer::logger::Lang->printf("ERROR: Could not execute \"%s\"!\n", $systemcall); 353 } 354 else 355 { 356 $installer::logger::Lang->printf("Success: Executed \"%s\" successfully!\n", $systemcall); 357 } 358 } 359 360 $alldirs = installer::systemactions::get_all_directories($installdir); 361 my $packagename = ${$alldirs}[0]; # only taking the first Solaris package 362 if ( $packagename eq "" ) { installer::exiter::exit_program("ERROR: Could not find package in directory $installdir!", "determine_packagename"); } 363 364 installer::pathanalyzer::make_absolute_filename_to_relative_filename(\$packagename); 365 366 $installer::globals::downloadfileextension = ".tar.gz"; 367 my $targzname = $packagename . $installer::globals::downloadfileextension; 368 $installer::globals::downloadfilename = $targzname; 369 370 my $ldpreloadstring = $ENV{'FAKEROOT'}; 371 372 my $systemcall = "cd $installdir; $ldpreloadstring tar -cf - $packagename | gzip > $targzname"; 373 $installer::logger::Info->printf("... %s ...\n", $systemcall); 374 375 my $returnvalue = system($systemcall); 376 377 $installer::logger::Lang->printf("Systemcall: %s\n", $systemcall); 378 379 if ($returnvalue) 380 { 381 $installer::logger::Lang->printf("ERROR: Could not execute \"%s\"!\n", $systemcall); 382 } 383 else 384 { 385 $installer::logger::Lang->printf("Success: Executed \"%s\" successfully!\n", $systemcall); 386 } 387} 388 389######################################################### 390# Setting type of installation 391######################################################### 392 393sub get_installation_type 394{ 395 my $type = ""; 396 397 if ( $installer::globals::languagepack ) { $type = "langpack"; } 398 else { $type = "install"; } 399 400 return $type; 401} 402 403######################################################### 404# Setting installation languages 405######################################################### 406 407sub get_downloadname_language 408{ 409 my ($languagestringref) = @_; 410 411 my $languages = $$languagestringref; 412 413 if ( $installer::globals::added_english ) 414 { 415 $languages =~ s/en-US_//; 416 $languages =~ s/_en-US//; 417 } 418 419 # en-US is default language and can be removed therefore 420 # for one-language installation sets 421 422 # if ( $languages =~ /^\s*en-US\s*$/ ) 423 # { 424 # $languages = ""; 425 # } 426 427 if ( length ($languages) > $installer::globals::max_lang_length ) 428 { 429 $languages = 'multi'; 430 } 431 432 return $languages; 433} 434 435######################################################### 436# Setting download name 437######################################################### 438 439sub get_downloadname_productname 440{ 441 my ($allvariables) = @_; 442 443 my $start; 444 445 if ( $allvariables->{'AOODOWNLOADNAMEPREFIX'} ) 446 { 447 $start = $allvariables->{'AOODOWNLOADNAMEPREFIX'}; 448 } 449 else 450 { 451 $start = "Apache_OpenOffice"; 452 if ( $allvariables->{'PRODUCTNAME'} eq "OpenOffice" ) 453 { 454 if ( $allvariables->{'POSTVERSIONEXTENSION'} eq "SDK" ) 455 { 456 $start .= "-SDK"; 457 } 458 } 459 460 if ( $allvariables->{'PRODUCTNAME'} eq "OpenOffice Developer Build" ) 461 { 462 if ( $allvariables->{'POSTVERSIONEXTENSION'} eq "SDK" ) 463 { 464 $start .= "_Dev-SDK"; 465 } 466 else 467 { 468 $start .= "_Dev"; 469 } 470 } 471 472 if ( $allvariables->{'PRODUCTNAME'} eq "URE" ) 473 { 474 $start .= "-URE"; 475 } 476 } 477 478 return $start; 479} 480 481######################################################### 482# Setting download version 483######################################################### 484 485sub get_download_version 486{ 487 my ($allvariables) = @_; 488 489 my $version = ""; 490 491 my $devproduct = 0; 492 if (( $allvariables->{'DEVELOPMENTPRODUCT'} ) && ( $allvariables->{'DEVELOPMENTPRODUCT'} == 1 )) { $devproduct = 1; } 493 494 my $cwsproduct = 0; 495 # the environment variable CWS_WORK_STAMP is set only in CWS 496 if ( $ENV{'CWS_WORK_STAMP'} ) { $cwsproduct = 1; } 497 498 if (( $cwsproduct ) || ( $devproduct )) # use "DEV300m75" 499 { 500 my $source = uc($installer::globals::build); # DEV300 501 my $localminor = ""; 502 if ( $installer::globals::minor ne "" ) { $localminor = $installer::globals::minor; } 503 else { $localminor = $installer::globals::lastminor; } 504 $version = $source . $localminor; 505 } 506 else # use 3.2.0rc1 507 { 508 $version = $allvariables->{'PRODUCTVERSION'}; 509 if (( $allvariables->{'ABOUTBOXPRODUCTVERSION'} ) && ( $allvariables->{'ABOUTBOXPRODUCTVERSION'} ne "" )) { $version = $allvariables->{'ABOUTBOXPRODUCTVERSION'}; } 510 if (( $allvariables->{'SHORT_PRODUCTEXTENSION'} ) && ( $allvariables->{'SHORT_PRODUCTEXTENSION'} ne "" )) { $version = $version . $allvariables->{'SHORT_PRODUCTEXTENSION'}; } 511 } 512 513 return $version; 514} 515 516############################################################### 517# Set date string, format: yymmdd 518############################################################### 519 520sub set_date_string 521{ 522 my ($allvariables) = @_; 523 524 my $datestring = ""; 525 526 my $devproduct = 0; 527 if (( $allvariables->{'DEVELOPMENTPRODUCT'} ) && ( $allvariables->{'DEVELOPMENTPRODUCT'} == 1 )) { $devproduct = 1; } 528 529 my $cwsproduct = 0; 530 # the environment variable CWS_WORK_STAMP is set only in CWS 531 if ( $ENV{'CWS_WORK_STAMP'} ) { $cwsproduct = 1; } 532 533 my $releasebuild = 1; 534 if (( $allvariables->{'SHORT_PRODUCTEXTENSION'} ) && ( $allvariables->{'SHORT_PRODUCTEXTENSION'} ne "" )) { $releasebuild = 0; } 535 536 if (( ! $devproduct ) && ( ! $cwsproduct ) && ( ! $releasebuild )) 537 { 538 my @timearray = localtime(time); 539 540 my $day = $timearray[3]; 541 my $month = $timearray[4] + 1; 542 my $year = $timearray[5] + 1900; 543 544 if ( $month < 10 ) { $month = "0" . $month; } 545 if ( $day < 10 ) { $day = "0" . $day; } 546 547 $datestring = $year . $month . $day; 548 } 549 550 return $datestring; 551} 552 553################################################################# 554# Setting the platform name for download 555################################################################# 556 557sub get_download_platformname 558{ 559 my $platformname = ""; 560 561 if ( $installer::globals::islinuxbuild ) 562 { 563 $platformname = "Linux"; 564 } 565 elsif ( $installer::globals::issolarisbuild ) 566 { 567 $platformname = "Solaris"; 568 } 569 elsif ( $installer::globals::iswindowsbuild ) 570 { 571 $platformname = "Win"; 572 } 573 elsif ( $installer::globals::isfreebsdbuild ) 574 { 575 $platformname = "FreeBSD"; 576 } 577 elsif ( $installer::globals::ismacbuild ) 578 { 579 $platformname = "MacOS"; 580 } 581 else 582 { 583 # $platformname = $installer::globals::packageformat; 584 $platformname = $installer::globals::compiler; 585 } 586 587 return $platformname; 588} 589 590######################################################### 591# Setting the architecture for the download name 592######################################################### 593 594sub get_download_architecture 595{ 596 my $arch = ""; 597 598 if(( $installer::globals::compiler =~ /^unxlngi/ ) 599 || ( $installer::globals::compiler =~ /^unxmac.i/ ) 600 || ( $installer::globals::issolarisx86build ) 601 || ( $installer::globals::compiler =~ /^wnt(msc|gcc)i/ )) 602 { 603 $arch = "x86"; 604 } 605 elsif ( $installer::globals::compiler =~ /^wnt(msc|gcc)x/ ) 606 { 607 # iswindowsbuild is true for BOTH Windows architectures, so testing it 608 # here named every Windows download x86 -- an x64 build produced 609 # Apache_OpenOffice_4.5.0_Win_x86_install_en-US.exe, a filename 610 # identical to the x86 one and differing only in its contents. 611 $arch = "x64"; 612 } 613 elsif(( $installer::globals::compiler =~ /^unxlngx/ ) 614 || ( $installer::globals::compiler =~ /^unxmaccx/ )) 615 { 616 $arch = "x86-64"; 617 } 618 elsif ( $installer::globals::compiler =~ /^unxmaccr/ ) 619 { 620 $arch = "aarch64"; 621 } 622 elsif ( $installer::globals::issolarissparcbuild ) 623 { 624 $arch = "Sparc"; 625 } 626 elsif(( $installer::globals::compiler =~ /^unxmacxp/ ) 627 || ( $installer::globals::compiler =~ /^unxlngppc/ )) 628 { 629 $arch = "PPC"; 630 } 631 632 return $arch; 633} 634 635######################################################### 636# Setting the installation type for the download name 637######################################################### 638 639sub get_install_type 640{ 641 my ($allvariables) = @_; 642 643 my $type = ""; 644 645 if ( $installer::globals::languagepack ) 646 { 647 $type = "langpack"; 648 649 if ( $installer::globals::islinuxrpmbuild ) 650 { 651 $type = $type . "-rpm"; 652 } 653 654 if ( $installer::globals::islinuxdebbuild ) 655 { 656 $type = $type . "-deb"; 657 } 658 659 if ( $installer::globals::packageformat eq "archive" ) 660 { 661 $type = $type . "-arc"; 662 } 663 } 664 else 665 { 666 $type = "install"; 667 668 if ( $installer::globals::islinuxrpmbuild ) 669 { 670 $type = $type . "-rpm"; 671 } 672 673 if ( $installer::globals::islinuxdebbuild ) 674 { 675 $type = $type . "-deb"; 676 } 677 678 if ( $installer::globals::packageformat eq "archive" ) 679 { 680 $type = $type . "-arc"; 681 } 682 683 } 684 685 return $type; 686} 687 688######################################################### 689# Setting installation addons 690######################################################### 691 692sub get_downloadname_addon 693{ 694 my $addon = ""; 695 696 if ( $installer::globals::islinuxdebbuild ) { $addon = $addon . "_deb"; } 697 698 return $addon; 699} 700 701######################################################### 702# Looking for versionstring in version.info 703# This has to be the only content of this file. 704######################################################### 705 706sub get_versionstring 707{ 708 my ( $versionfile ) = @_; 709 710 my $versionstring = ""; 711 712 for ( my $i = 0; $i <= $#{$versionfile}; $i++ ) 713 { 714 my $oneline = ${$versionfile}[$i]; 715 716 if ( $oneline =~ /^\s*\#/ ) { next; } # comment line 717 if ( $oneline =~ /^\s*\"\s*(.*?)\s*\"\s*$/ ) 718 { 719 $versionstring = $1; 720 last; 721 } 722 } 723 724 return $versionstring; 725} 726 727######################################################### 728# Returning the current product version 729# This has to be defined in file "version.info" 730# in directory $installer::globals::ooouploaddir 731######################################################### 732 733sub get_current_version 734{ 735 my $versionstring = ""; 736 my $filename = "version.info"; 737 # $filename = $installer::globals::ooouploaddir . $installer::globals::separator . $filename; 738 739 if ( -f $filename ) 740 { 741 $installer::logger::Lang->printf("File %s exists. Trying to find current version.\n", $filename); 742 my $versionfile = installer::files::read_file($filename); 743 $versionstring = get_versionstring($versionfile); 744 $installer::logger::Lang->printf("Setting version string: %s\n", $versionstring); 745 } 746 else 747 { 748 $installer::logger::Lang->printf("File %s does not exist. No version setting in download file name.\n", $filename); 749 } 750 751 $installer::globals::oooversionstring = $versionstring; 752 753 return $versionstring; 754} 755 756############################################################################################### 757# Setting the download file name 758# Syntax: 759# (PRODUCTNAME)_(VERSION)_(TIMESTAMP)_(OS)_(ARCH)_(INSTALLTYPE)_(LANGUAGE).(FILEEXTENSION) 760# Rules: 761# Timestamp only for Beta and Release Candidate 762############################################################################################### 763 764sub set_download_filename 765{ 766 my ($languagestringref, $allvariables) = @_; 767 768 my $start = get_downloadname_productname($allvariables); 769 my $versionstring = get_download_version($allvariables); 770 my $date = set_date_string($allvariables); 771 my $platform = get_download_platformname(); 772 my $architecture = get_download_architecture(); 773 my $type = get_install_type($allvariables); 774 my $language = get_downloadname_language($languagestringref); 775 776 # Setting the extension happens automatically 777 778 my $filename = $start . "_" . $versionstring . "_" . $date . "_" . $platform . "_" . $architecture . "_" . $type . "_" . $language; 779 780 $filename =~ s/\_\_/\_/g; # necessary, if $versionstring or $platform or $language are empty 781 $filename =~ s/\_\s*$//; # necessary, if $language and $addon are empty 782 783 $installer::globals::ooodownloadfilename = $filename; 784 785 return $filename; 786} 787 788######################################################### 789# Creating a tar.gz file 790######################################################### 791 792sub create_tar_gz_file_from_directory 793{ 794 my ($installdir, $getuidlibrary, $downloaddir, $downloadfilename) = @_; 795 796 my $packdir = $installdir; 797 installer::pathanalyzer::make_absolute_filename_to_relative_filename(\$packdir); 798 my $changedir = $installdir; 799 installer::pathanalyzer::get_path_from_fullqualifiedname(\$changedir); 800 801 my $ldpreloadstring = $ENV{'FAKEROOT'}; 802 803 $installer::globals::downloadfileextension = ".tar.gz"; 804 $installer::globals::downloadfilename = $downloadfilename . $installer::globals::downloadfileextension; 805 my $targzname = $downloaddir . $installer::globals::separator . $installer::globals::downloadfilename; 806 807 my $systemcall = "cd $changedir; $ldpreloadstring tar -cf - $packdir | gzip > $targzname"; 808 809 my $returnvalue = system($systemcall); 810 811 $installer::logger::Lang->printf("Systemcall: %s\n", $systemcall); 812 813 if ($returnvalue) 814 { 815 $installer::logger::Lang->printf("ERROR: Could not execute \"%s\"!\n", $systemcall); 816 } 817 else 818 { 819 $installer::logger::Lang->printf("Success: Executed \"%s\" successfully!\n", $systemcall); 820 } 821 822 return $targzname; 823} 824 825######################################################### 826# Setting the variables in the download name 827######################################################### 828 829sub resolve_variables_in_downloadname 830{ 831 my ($allvariables, $downloadname, $languagestringref) = @_; 832 833 # Typical name: soa-{productversion}-{extension}-bin-{os}-{languages} 834 835 my $productversion = $allvariables->{'PRODUCTVERSION'}; 836 $productversion = "" unless defined $productversion; 837 $downloadname =~ s/\{productversion\}/$productversion/; 838 839 my $packageversion = $allvariables->{'PACKAGEVERSION'}; 840 $packageversion = "" unless defined $packageversion; 841 $downloadname =~ s/\{packageversion\}/$packageversion/; 842 843 my $extension = $allvariables->{'SHORT_PRODUCTEXTENSION'}; 844 $extension = "" unless defined $extension; 845 $extension = lc($extension); 846 $downloadname =~ s/\{extension\}/$extension/; 847 848 my $os = ""; 849 if ( $installer::globals::iswindowsbuild ) { $os = "windows"; } 850 elsif ( $installer::globals::issolarissparcbuild ) { $os = "solsparc"; } 851 elsif ( $installer::globals::issolarisx86build ) { $os = "solia"; } 852 elsif ( $installer::globals::islinuxbuild ) { $os = "linux"; } 853 elsif ( $installer::globals::compiler =~ /unxmac.i/ ) { $os = "macosi"; } 854 elsif ( $installer::globals::compiler =~ /unxmac.x/ ) { $os = "macosx"; } 855 elsif ( $installer::globals::compiler =~ /unxmacxp/ ) { $os = "macosp"; } 856 else { $os = ""; } 857 $downloadname =~ s/\{os\}/$os/; 858 859 my $languages = $$languagestringref; 860 $downloadname =~ s/\{languages\}/$languages/; 861 862 $downloadname =~ s/\-\-\-/\-/g; 863 $downloadname =~ s/\-\-/\-/g; 864 $downloadname =~ s/\-\s*$//; 865 866 return $downloadname; 867} 868 869################################################################## 870# Windows: Replacing one placeholder with the specified value 871################################################################## 872 873sub replace_one_variable 874{ 875 my ($templatefile, $placeholder, $value) = @_; 876 877 $installer::logger::Lang->printf("Replacing %s by %s in nsi file\n", $placeholder, $value); 878 879 for ( my $i = 0; $i <= $#{$templatefile}; $i++ ) 880 { 881 ${$templatefile}[$i] =~ s/$placeholder/$value/g; 882 } 883 884} 885 886######################################################################################## 887# Converting a string to a unicode string 888######################################################################################## 889 890sub convert_to_unicode 891{ 892 my ($string) = @_; 893 894 my $unicodestring = ""; 895 896 my $stringlength = length($string); 897 898 for ( my $i = 0; $i < $stringlength; $i++ ) 899 { 900 $unicodestring = $unicodestring . substr($string, $i, 1); 901 $unicodestring = $unicodestring . chr(0); 902 } 903 904 return $unicodestring; 905} 906 907################################################################## 908# Windows: Including the product name into nsi template 909################################################################## 910 911sub put_windows_productname_into_template 912{ 913 my ($templatefile, $variableshashref) = @_; 914 915 my $productname = $variableshashref->{'PRODUCTNAME'}; 916 $productname =~ s/\.//g; # OpenOffice.org -> OpenOfficeorg 917 918 replace_one_variable($templatefile, "PRODUCTNAMEPLACEHOLDER", $productname); 919} 920 921################################################################## 922# Windows: Including the path to the banner.bmp into nsi template 923################################################################## 924 925sub put_banner_bmp_into_template 926{ 927 my ($templatefile, $includepatharrayref, $allvariables) = @_; 928 929 # my $filename = "downloadbanner.bmp"; 930 if ( ! $allvariables->{'DOWNLOADBANNER'} ) { installer::exiter::exit_program("ERROR: DOWNLOADBANNER not defined in product definition!", "put_banner_bmp_into_template"); } 931 my $filename = $allvariables->{'DOWNLOADBANNER'}; 932 933 my $completefilenameref = ""; 934 935 if ( $installer::globals::include_pathes_read ) 936 { 937 $completefilenameref = installer::scriptitems::get_sourcepath_from_filename_and_includepath(\$filename, $includepatharrayref, 0); 938 } 939 else 940 { 941 $completefilenameref = installer::scriptitems::get_sourcepath_from_filename_and_includepath_classic(\$filename, $includepatharrayref, 0); 942 } 943 944 if ($$completefilenameref eq "") { installer::exiter::exit_program("ERROR: Could not find download file $filename!", "put_banner_bmp_into_template"); } 945 946 if ( $^O =~ /cygwin/i ) { $$completefilenameref =~ s/\//\\/g; } 947 948 replace_one_variable($templatefile, "BANNERBMPPLACEHOLDER", $$completefilenameref); 949} 950 951################################################################## 952# Windows: Including the path to the welcome.bmp into nsi template 953################################################################## 954 955sub put_welcome_bmp_into_template 956{ 957 my ($templatefile, $includepatharrayref, $allvariables) = @_; 958 959 # my $filename = "downloadbitmap.bmp"; 960 if ( ! $allvariables->{'DOWNLOADBITMAP'} ) { installer::exiter::exit_program("ERROR: DOWNLOADBITMAP not defined in product definition!", "put_welcome_bmp_into_template"); } 961 my $filename = $allvariables->{'DOWNLOADBITMAP'}; 962 963 my $completefilenameref = ""; 964 965 if ( $installer::globals::include_pathes_read ) 966 { 967 $completefilenameref = installer::scriptitems::get_sourcepath_from_filename_and_includepath(\$filename, $includepatharrayref, 0); 968 } 969 else 970 { 971 $completefilenameref = installer::scriptitems::get_sourcepath_from_filename_and_includepath_classic(\$filename, $includepatharrayref, 0); 972 } 973 974 if ($$completefilenameref eq "") { installer::exiter::exit_program("ERROR: Could not find download file $filename!", "put_welcome_bmp_into_template"); } 975 976 if ( $^O =~ /cygwin/i ) { $$completefilenameref =~ s/\//\\/g; } 977 978 replace_one_variable($templatefile, "WELCOMEBMPPLACEHOLDER", $$completefilenameref); 979} 980 981################################################################## 982# Windows: Including the path to the setup.ico into nsi template 983################################################################## 984 985sub put_setup_ico_into_template 986{ 987 my ($templatefile, $includepatharrayref, $allvariables) = @_; 988 989 # my $filename = "downloadsetup.ico"; 990 if ( ! $allvariables->{'DOWNLOADSETUPICO'} ) { installer::exiter::exit_program("ERROR: DOWNLOADSETUPICO not defined in product definition!", "put_setup_ico_into_template"); } 991 my $filename = $allvariables->{'DOWNLOADSETUPICO'}; 992 993 my $completefilenameref = ""; 994 995 if ( $installer::globals::include_pathes_read ) 996 { 997 $completefilenameref = installer::scriptitems::get_sourcepath_from_filename_and_includepath(\$filename, $includepatharrayref, 0); 998 } 999 else 1000 { 1001 $completefilenameref = installer::scriptitems::get_sourcepath_from_filename_and_includepath_classic(\$filename, $includepatharrayref, 0); 1002 } 1003 1004 if ($$completefilenameref eq "") { installer::exiter::exit_program("ERROR: Could not find download file $filename!", "put_setup_ico_into_template"); } 1005 1006 if ( $^O =~ /cygwin/i ) { $$completefilenameref =~ s/\//\\/g; } 1007 1008 replace_one_variable($templatefile, "SETUPICOPLACEHOLDER", $$completefilenameref); 1009} 1010 1011################################################################## 1012# Windows: Including the publisher into nsi template 1013################################################################## 1014 1015sub put_publisher_into_template ($$) 1016{ 1017 my ($templatefile, $variables) = @_; 1018 1019 my $publisher = $variables->{'OOOVENDOR'}; 1020 $publisher = "" unless defined $publisher; 1021 1022 replace_one_variable($templatefile, "PUBLISHERPLACEHOLDER", $publisher); 1023} 1024 1025################################################################## 1026# Windows: Including the web site into nsi template 1027################################################################## 1028 1029sub put_website_into_template ($$) 1030{ 1031 my ($templatefile, $variables) = @_; 1032 1033 my $website = $variables->{'STARTCENTER_INFO_URL'}; 1034 $website = "" unless defined $website; 1035 1036 replace_one_variable($templatefile, "WEBSITEPLACEHOLDER", $website); 1037} 1038 1039################################################################## 1040# Windows: Including the Java file name into nsi template 1041################################################################## 1042 1043sub put_javafilename_into_template 1044{ 1045 my ($templatefile, $variableshashref) = @_; 1046 1047 my $javaversion = ""; 1048 1049 if ( $variableshashref->{'WINDOWSJAVAFILENAME'} ) { $javaversion = $variableshashref->{'WINDOWSJAVAFILENAME'}; } 1050 1051 replace_one_variable($templatefile, "WINDOWSJAVAFILENAMEPLACEHOLDER", $javaversion); 1052} 1053 1054################################################################## 1055# Windows: Including the product version into nsi template 1056################################################################## 1057 1058sub put_windows_productversion_into_template 1059{ 1060 my ($templatefile, $variableshashref) = @_; 1061 1062 my $productversion = $variableshashref->{'PRODUCTVERSION'}; 1063 1064 replace_one_variable($templatefile, "PRODUCTVERSIONPLACEHOLDER", $productversion); 1065} 1066 1067################################################################## 1068# Windows: Including the product path into nsi template 1069################################################################## 1070 1071sub put_windows_productpath_into_template 1072{ 1073 my ($templatefile, $variableshashref, $languagestringref, $localnsisdir) = @_; 1074 1075 my $productpath = $variableshashref->{'PROPERTYTABLEPRODUCTNAME'}; 1076 1077 my $locallangs = $$languagestringref; 1078 $locallangs =~ s/_/ /g; 1079 if (length($locallangs) > $installer::globals::max_lang_length) { $locallangs = "multi lingual"; } 1080 1081 if ( ! $installer::globals::languagepack ) { $productpath = $productpath . " (" . $locallangs . ")"; } 1082 1083 replace_one_variable($templatefile, "PRODUCTPATHPLACEHOLDER", $productpath); 1084} 1085 1086################################################################## 1087# Windows: Including download file name into nsi template 1088################################################################## 1089 1090sub put_outputfilename_into_template 1091{ 1092 my ($templatefile, $downloadname) = @_; 1093 1094 $installer::globals::downloadfileextension = ".exe"; 1095 $downloadname = $downloadname . $installer::globals::downloadfileextension; 1096 $installer::globals::downloadfilename = $downloadname; 1097 1098 replace_one_variable($templatefile, "DOWNLOADNAMEPLACEHOLDER", $downloadname); 1099} 1100 1101################################################################## 1102# Windows: Generating the file list in nsi file format 1103################################################################## 1104 1105sub get_file_list 1106{ 1107 my ( $basedir ) = @_; 1108 1109 my @filelist = (); 1110 1111 my $alldirs = installer::systemactions::get_all_directories($basedir); 1112 unshift(@{$alldirs}, $basedir); # $basedir is the first directory in $alldirs 1113 1114 for ( my $i = 0; $i <= $#{$alldirs}; $i++ ) 1115 { 1116 my $onedir = ${$alldirs}[$i]; 1117 1118 # Syntax: 1119 # SetOutPath "$INSTDIR" 1120 1121 my $relativedir = $onedir; 1122 $relativedir =~ s/\Q$basedir\E//; 1123 1124 my $oneline = " " . "SetOutPath" . " " . "\"\$INSTDIR" . $relativedir . "\"" . "\n"; 1125 1126 if ( $^O =~ /cygwin/i ) { 1127 $oneline =~ s/\//\\/g; 1128 } 1129 push(@filelist, $oneline); 1130 1131 # Collecting all files in the specific directory 1132 1133 my $files = installer::systemactions::get_all_files_from_one_directory($onedir); 1134 1135 for ( my $j = 0; $j <= $#{$files}; $j++ ) 1136 { 1137 my $onefile = ${$files}[$j]; 1138 1139 my $fileline = " " . "File" . " " . "\"" . $onefile . "\"" . "\n"; 1140 1141 if ( $^O =~ /cygwin/i ) { 1142 $fileline =~ s/\//\\/g; 1143 } 1144 push(@filelist, $fileline); 1145 } 1146 } 1147 1148 return \@filelist; 1149} 1150 1151################################################################## 1152# Windows: Including list of all files into nsi template 1153################################################################## 1154 1155sub put_filelist_into_template 1156{ 1157 my ($templatefile, $installationdir) = @_; 1158 1159 my $filelist = get_file_list($installationdir); 1160 1161 my $filestring = ""; 1162 1163 for ( my $i = 0; $i <= $#{$filelist}; $i++ ) 1164 { 1165 $filestring = $filestring . ${$filelist}[$i]; 1166 } 1167 1168 $filestring =~ s/\s*$//; 1169 1170 replace_one_variable($templatefile, "ALLFILESPLACEHOLDER", $filestring); 1171} 1172 1173################################################################## 1174# Windows: NSIS uses specific language names 1175################################################################## 1176 1177sub nsis_language_converter 1178{ 1179 my ($language) = @_; 1180 1181 my $nsislanguage = ""; 1182 1183 # Assign language used by NSIS. 1184 # The files "$nsislanguage.nsh" and "$nsislanguage.nlf" 1185 # are needed in the NSIS environment. 1186 # Directory: <NSIS-Dir>/Contrib/Language files 1187 if ( $language eq "en-US" ) { $nsislanguage = "English"; } 1188 elsif ( $language eq "af" ) { $nsislanguage = "Afrikaans"; } 1189 elsif ( $language eq "sq" ) { $nsislanguage = "Albanian"; } 1190 elsif ( $language eq "ar" ) { $nsislanguage = "Arabic"; } 1191 elsif ( $language eq "hy" ) { $nsislanguage = "Armenian"; } 1192 elsif ( $language eq "ast" ) { $nsislanguage = "Asturian"; } 1193 elsif ( $language eq "eu" ) { $nsislanguage = "Basque"; } 1194 elsif ( $language eq "bg" ) { $nsislanguage = "Bulgarian"; } 1195 elsif ( $language eq "ca" ) { $nsislanguage = "Catalan"; } 1196 elsif ( $language eq "hr" ) { $nsislanguage = "Croatian"; } 1197 elsif ( $language eq "cs" ) { $nsislanguage = "Czech"; } 1198 elsif ( $language eq "da" ) { $nsislanguage = "Danish"; } 1199 elsif ( $language eq "nl" ) { $nsislanguage = "Dutch"; } 1200 elsif ( $language eq "en-GB" ) { $nsislanguage = "English"; } 1201 elsif ( $language eq "eo" ) { $nsislanguage = "Esperanto"; } 1202 elsif ( $language eq "et" ) { $nsislanguage = "Estonian"; } 1203 elsif ( $language eq "fa" ) { $nsislanguage = "Farsi"; } 1204 elsif ( $language eq "fi" ) { $nsislanguage = "Finnish"; } 1205 elsif ( $language eq "fr" ) { $nsislanguage = "French"; } 1206 elsif ( $language eq "gl" ) { $nsislanguage = "Galician"; } 1207 elsif ( $language eq "de" ) { $nsislanguage = "German"; } 1208 elsif ( $language eq "el" ) { $nsislanguage = "Greek"; } 1209 elsif ( $language eq "he" ) { $nsislanguage = "Hebrew"; } 1210 elsif ( $language eq "hi" ) { $nsislanguage = "Hindi"; } 1211 elsif ( $language eq "hu" ) { $nsislanguage = "Hungarian"; } 1212 elsif ( $language eq "is" ) { $nsislanguage = "Icelandic"; } 1213 elsif ( $language eq "id" ) { $nsislanguage = "Indonesian"; } 1214 elsif ( $language eq "it" ) { $nsislanguage = "Italian"; } 1215 elsif ( $language eq "ja" ) { $nsislanguage = "Japanese"; } 1216 elsif ( $language eq "ko" ) { $nsislanguage = "Korean"; } 1217 elsif ( $language eq "lv" ) { $nsislanguage = "Latvian"; } 1218 elsif ( $language eq "lt" ) { $nsislanguage = "Lithuanian"; } 1219 elsif ( $language eq "de-LU" ) { $nsislanguage = "Luxembourgish"; } 1220 elsif ( $language eq "mk" ) { $nsislanguage = "Macedonian"; } 1221 elsif ( $language eq "mn" ) { $nsislanguage = "Mongolian"; } 1222 elsif ( $language eq "nb" ) { $nsislanguage = "Norwegian"; } 1223 elsif ( $language eq "no" ) { $nsislanguage = "Norwegian"; } 1224 elsif ( $language eq "no-NO" ) { $nsislanguage = "Norwegian"; } 1225 elsif ( $language eq "nn" ) { $nsislanguage = "NorwegianNynorsk"; } 1226 elsif ( $language eq "pl" ) { $nsislanguage = "Polish"; } 1227 elsif ( $language eq "pt" ) { $nsislanguage = "Portuguese"; } 1228 elsif ( $language eq "pt-BR" ) { $nsislanguage = "PortugueseBR"; } 1229 elsif ( $language eq "ro" ) { $nsislanguage = "Romanian"; } 1230 elsif ( $language eq "ru" ) { $nsislanguage = "Russian"; } 1231 elsif ( $language eq "gd" ) { $nsislanguage = "ScotsGaelic"; } 1232 elsif ( $language eq "sr" ) { $nsislanguage = "Serbian"; } 1233 elsif ( $language eq "sr-SP" ) { $nsislanguage = "Serbian"; } 1234 elsif ( $language eq "sh" ) { $nsislanguage = "SerbianLatin"; } 1235 elsif ( $language eq "zh-CN" ) { $nsislanguage = "SimpChinese"; } 1236 elsif ( $language eq "sk" ) { $nsislanguage = "Slovak"; } 1237 elsif ( $language eq "sl" ) { $nsislanguage = "Slovenian"; } 1238 elsif ( $language eq "es" ) { $nsislanguage = "Spanish"; } 1239 elsif ( $language eq "sv" ) { $nsislanguage = "Swedish"; } 1240 elsif ( $language eq "th" ) { $nsislanguage = "Thai"; } 1241 elsif ( $language eq "zh-TW" ) { $nsislanguage = "TradChinese"; } 1242 elsif ( $language eq "tr" ) { $nsislanguage = "Turkish"; } 1243 elsif ( $language eq "uk" ) { $nsislanguage = "Ukrainian"; } 1244 elsif ( $language eq "vi" ) { $nsislanguage = "Vietnamese"; } 1245 elsif ( $language eq "cy" ) { $nsislanguage = "Welsh"; } 1246 else 1247 { 1248 $installer::logger::Lang->printf("NSIS language_converter : Could not find nsis language for %s!\n", $language); 1249 $nsislanguage = "English"; 1250 } 1251 1252 return $nsislanguage; 1253} 1254 1255################################################################## 1256# Windows: Including list of all languages into nsi template 1257################################################################## 1258 1259sub put_language_list_into_template 1260{ 1261 my ($templatefile, $languagesarrayref) = @_; 1262 1263 my $alllangstring = ""; 1264 my %nsislangs; 1265 1266 for ( my $i = 0; $i <= $#{$languagesarrayref}; $i++ ) 1267 { 1268 my $onelanguage = ${$languagesarrayref}[$i]; 1269 my $nsislanguage = nsis_language_converter($onelanguage); 1270 $nsislangs{$nsislanguage}++; 1271 } 1272 1273 foreach my $nsislanguage ( keys(%nsislangs) ) 1274 { 1275 # Syntax: !insertmacro MUI_LANGUAGE "English" 1276 my $langstring = "\!insertmacro MUI_LANGUAGE_PACK " . $nsislanguage . "\n"; 1277 if ( $nsislanguage eq "English" ) 1278 { 1279 $alllangstring = $langstring . $alllangstring; 1280 } 1281 else 1282 { 1283 $alllangstring = $alllangstring . $langstring; 1284 } 1285 } 1286 1287 $alllangstring =~ s/\s*$//; 1288 1289 replace_one_variable($templatefile, "ALLLANGUAGESPLACEHOLDER", $alllangstring); 1290} 1291 1292################################################################## 1293# Windows: Collecting all identifier from mlf file 1294################################################################## 1295 1296sub get_identifier 1297{ 1298 my ( $mlffile ) = @_; 1299 1300 my @identifier = (); 1301 1302 for ( my $i = 0; $i <= $#{$mlffile}; $i++ ) 1303 { 1304 my $oneline = ${$mlffile}[$i]; 1305 1306 if ( $oneline =~ /^\s*\[(.+)\]\s*$/ ) 1307 { 1308 my $identifier = $1; 1309 push(@identifier, $identifier); 1310 } 1311 } 1312 1313 return \@identifier; 1314} 1315 1316############################################################## 1317# Returning the complete block in all languages 1318# for a specified string 1319############################################################## 1320 1321sub get_language_block_from_language_file 1322{ 1323 my ($searchstring, $languagefile) = @_; 1324 1325 my @language_block = (); 1326 1327 for ( my $i = 0; $i <= $#{$languagefile}; $i++ ) 1328 { 1329 if ( ${$languagefile}[$i] =~ /^\s*\[\s*$searchstring\s*\]\s*$/ ) 1330 { 1331 my $counter = $i; 1332 1333 push(@language_block, ${$languagefile}[$counter]); 1334 $counter++; 1335 1336 while (( $counter <= $#{$languagefile} ) && (!( ${$languagefile}[$counter] =~ /^\s*\[/ ))) 1337 { 1338 push(@language_block, ${$languagefile}[$counter]); 1339 $counter++; 1340 } 1341 1342 last; 1343 } 1344 } 1345 1346 return \@language_block; 1347} 1348 1349############################################################## 1350# Returning a specific language string from the block 1351# of all translations 1352############################################################## 1353 1354sub get_language_string_from_language_block 1355{ 1356 my ($language_block, $language) = @_; 1357 1358 my $newstring = ""; 1359 1360 for ( my $i = 0; $i <= $#{$language_block}; $i++ ) 1361 { 1362 if ( ${$language_block}[$i] =~ /^\s*$language\s*\=\s*\"(.*)\"\s*$/ ) 1363 { 1364 $newstring = $1; 1365 last; 1366 } 1367 } 1368 1369 if ( $newstring eq "" ) 1370 { 1371 $language = "en-US"; # defaulting to English 1372 1373 for ( my $i = 0; $i <= $#{$language_block}; $i++ ) 1374 { 1375 if ( ${$language_block}[$i] =~ /^\s*$language\s*\=\s*\"(.*)\"\s*$/ ) 1376 { 1377 $newstring = $1; 1378 last; 1379 } 1380 } 1381 } 1382 1383 return $newstring; 1384} 1385 1386################################################################## 1387# Windows: Replacing strings in NSIS nsh file 1388# nsh file syntax: 1389# !define MUI_TEXT_DIRECTORY_TITLE "Choose Install Location" 1390################################################################## 1391 1392sub replace_identifier_in_nshfile 1393{ 1394 my ( $nshfile, $identifier, $newstring, $nshfilename, $onelanguage ) = @_; 1395 1396 $newstring =~ s/\\r/\$\\r/g; # \r -> $\r in modern nsis versions 1397 $newstring =~ s/\\n/\$\\n/g; # \n -> $\n in modern nsis versions 1398 1399 for ( my $i = 0; $i <= $#{$nshfile}; $i++ ) 1400 { 1401 if ( ${$nshfile}[$i] =~ /\s+\Q$identifier\E\s+\"(.+)\"\s*$/ ) 1402 { 1403 my $oldstring = $1; 1404 ${$nshfile}[$i] =~ s/\Q$oldstring\E/$newstring/; 1405 $installer::logger::Lang->printf("NSIS replacement in %s (%s): \-\> %s\n", 1406 $nshfilename, 1407 $onelanguage, 1408 $oldstring, 1409 $newstring); 1410 } 1411 } 1412} 1413 1414################################################################## 1415# Windows: Replacing strings in NSIS nlf file 1416# nlf file syntax (2 lines): 1417# # ^DirSubText 1418# Destination Folder 1419################################################################## 1420 1421sub replace_identifier_in_nlffile 1422{ 1423 my ( $nlffile, $identifier, $newstring, $nlffilename, $onelanguage ) = @_; 1424 1425 for ( my $i = 0; $i <= $#{$nlffile}; $i++ ) 1426 { 1427 if ( ${$nlffile}[$i] =~ /^\s*\#\s+\^\s*\Q$identifier\E\s*$/ ) 1428 { 1429 my $next = $i+1; 1430 my $oldstring = ${$nlffile}[$next]; 1431 ${$nlffile}[$next] = $newstring . "\n"; 1432 $oldstring =~ s/\s*$//; 1433 $installer::logger::Lang->printf("NSIS replacement in %s (%s): %s \-\> %s\n", 1434 $nlffilename, 1435 $onelanguage, 1436 $oldstring, 1437 $newstring); 1438 } 1439 } 1440} 1441 1442################################################################## 1443# Windows: Translating the NSIS nsh and nlf file 1444################################################################## 1445 1446sub translate_nsh_nlf_file 1447{ 1448 my ($nshfile, $nlffile, $mlffile, $onelanguage, $nshfilename, $nlffilename, $nsislanguage) = @_; 1449 1450 # Analyzing the mlf file, collecting all Identifier 1451 my $allidentifier = get_identifier($mlffile); 1452 1453 $onelanguage = "en-US" if ( $nsislanguage eq "English" && $onelanguage ne "en-US"); 1454 for ( my $i = 0; $i <= $#{$allidentifier}; $i++ ) 1455 { 1456 my $identifier = ${$allidentifier}[$i]; 1457 my $language_block = get_language_block_from_language_file($identifier, $mlffile); 1458 my $newstring = get_language_string_from_language_block($language_block, $onelanguage); 1459 1460 # removing mask 1461 $newstring =~ s/\\\'/\'/g; 1462 1463 replace_identifier_in_nshfile($nshfile, $identifier, $newstring, $nshfilename, $onelanguage); 1464 replace_identifier_in_nlffile($nlffile, $identifier, $newstring, $nlffilename, $onelanguage); 1465 } 1466} 1467 1468################################################################## 1469# Converting utf 16 file to utf 8 1470################################################################## 1471 1472sub convert_utf16_to_utf8 1473{ 1474 my ( $filename ) = @_; 1475 1476 my @localfile = (); 1477 1478 my $savfilename = $filename . "_before.utf16"; 1479 installer::systemactions::copy_one_file($filename, $savfilename); 1480 1481# open( IN, "<:utf16", $filename ) || installer::exiter::exit_program("ERROR: Cannot open file $filename for reading", "convert_utf16_to_utf8"); 1482# open( IN, "<:para:crlf:uni", $filename ) || installer::exiter::exit_program("ERROR: Cannot open file $filename for reading", "convert_utf16_to_utf8"); 1483 open( IN, "<:encoding(UTF16-LE)", $filename ) || installer::exiter::exit_program("ERROR: Cannot open file $filename for reading", "convert_utf16_to_utf8"); 1484 while ( my $line = <IN> ) 1485 { 1486 push @localfile, $line; 1487 } 1488 close( IN ); 1489 1490 if ( open( OUT, ">:utf8", $filename ) ) 1491 { 1492 print OUT @localfile; 1493 close(OUT); 1494 } 1495 1496 $savfilename = $filename . "_before.utf8"; 1497 installer::systemactions::copy_one_file($filename, $savfilename); 1498} 1499 1500################################################################## 1501# Converting utf 8 file to utf 16 1502################################################################## 1503 1504sub convert_utf8_to_utf16 1505{ 1506 my ( $filename ) = @_; 1507 1508 my @localfile = (); 1509 1510 my $savfilename = $filename . "_after.utf8"; 1511 installer::systemactions::copy_one_file($filename, $savfilename); 1512 1513 open( IN, "<:utf8", $filename ) || installer::exiter::exit_program("ERROR: Cannot open file $filename for reading", "convert_utf8_to_utf16"); 1514 while (my $line = <IN>) 1515 { 1516 push @localfile, $line; 1517 } 1518 close( IN ); 1519 1520 if ( open( OUT, ">:raw:encoding(UTF16-LE):crlf:utf8", $filename ) ) 1521 { 1522 print OUT @localfile; 1523 close(OUT); 1524 } 1525 1526 $savfilename = $filename . "_after.utf16"; 1527 installer::systemactions::copy_one_file($filename, $savfilename); 1528} 1529 1530################################################################## 1531# Converting text string to utf 16 1532################################################################## 1533 1534sub convert_textstring_to_utf16 1535{ 1536 my ( $textstring, $localnsisdir, $shortfilename ) = @_; 1537 1538 my $filename = $localnsisdir . $installer::globals::separator . $shortfilename; 1539 my @filecontent = (); 1540 push(@filecontent, $textstring); 1541 installer::files::save_file($filename, \@filecontent); 1542 convert_utf8_to_utf16($filename); 1543 my $newfile = installer::files::read_file($filename); 1544 my $utf16string = ""; 1545 if ( ${$newfile}[0] ne "" ) { $utf16string = ${$newfile}[0]; } 1546 1547 return $utf16string; 1548} 1549 1550################################################################## 1551# Windows: Copying NSIS language files to local nsis directory 1552################################################################## 1553 1554sub copy_and_translate_nsis_language_files 1555{ 1556 my ($nsispath, $localnsisdir, $languagesarrayref, $allvariables) = @_; 1557 1558 my $nlffilepath = $nsispath . $installer::globals::separator . "Contrib" . $installer::globals::separator . "Language\ files" . $installer::globals::separator; 1559 my $nshfilepath = $nsispath . $installer::globals::separator . "Contrib" . $installer::globals::separator . "Modern\ UI" . $installer::globals::separator . "Language files" . $installer::globals::separator; 1560 1561 for ( my $i = 0; $i <= $#{$languagesarrayref}; $i++ ) 1562 { 1563 my $onelanguage = ${$languagesarrayref}[$i]; 1564 my $nsislanguage = nsis_language_converter($onelanguage); 1565 1566 # Copying the nlf file 1567 my $sourcepath = $nlffilepath . $nsislanguage . "\.nlf"; 1568 if ( ! -f $sourcepath ) { installer::exiter::exit_program("ERROR: Could not find nsis file: $sourcepath!", "copy_and_translate_nsis_language_files"); } 1569 my $nlffilename = $localnsisdir . $installer::globals::separator . $nsislanguage . "_pack.nlf"; 1570 if ( $^O =~ /cygwin/i ) { $nlffilename =~ s/\//\\/g; } 1571 installer::systemactions::copy_one_file($sourcepath, $nlffilename); 1572 1573 # Copying the nsh file 1574 # In newer nsis versions, the nsh file is located next to the nlf file 1575 $sourcepath = $nshfilepath . $nsislanguage . "\.nsh"; 1576 if ( ! -f $sourcepath ) 1577 { 1578 # trying to find the nsh file next to the nlf file 1579 $sourcepath = $nlffilepath . $nsislanguage . "\.nsh"; 1580 if ( ! -f $sourcepath ) 1581 { 1582 installer::exiter::exit_program("ERROR: Could not find nsis file: $sourcepath!", "copy_and_translate_nsis_language_files"); 1583 } 1584 } 1585 my $nshfilename = $localnsisdir . $installer::globals::separator . $nsislanguage . "_pack.nsh"; 1586 if ( $^O =~ /cygwin/i ) { $nshfilename =~ s/\//\\/g; } 1587 installer::systemactions::copy_one_file($sourcepath, $nshfilename); 1588 1589 # Changing the macro name in nsh file: MUI_LANGUAGEFILE_BEGIN -> MUI_LANGUAGEFILE_PACK_BEGIN 1590 #convert_utf16_to_utf8($nshfilename); 1591 #convert_utf16_to_utf8($nlffilename); 1592 my $nshfile = installer::files::read_file($nshfilename); 1593 replace_one_variable($nshfile, "MUI_LANGUAGEFILE_BEGIN", "MUI_LANGUAGEFILE_PACK_BEGIN"); 1594 1595 # find the ulf file for translation 1596 my $mlffile = get_translation_file($allvariables); 1597 1598 # Translate the files 1599 my $nlffile = installer::files::read_file($nlffilename); 1600 translate_nsh_nlf_file($nshfile, $nlffile, $mlffile, $onelanguage, $nshfilename, $nlffilename, $nsislanguage); 1601 1602 installer::files::save_file($nshfilename, $nshfile); 1603 installer::files::save_file($nlffilename, $nlffile); 1604 1605 #convert_utf8_to_utf16($nshfilename); 1606 #convert_utf8_to_utf16($nlffilename); 1607 } 1608 1609} 1610 1611################################################################## 1612# Windows: Including the nsis path into the nsi template 1613################################################################## 1614 1615sub put_nsis_path_into_template 1616{ 1617 my ($templatefile, $nsisdir) = @_; 1618 1619 replace_one_variable($templatefile, "NSISPATHPLACEHOLDER", $nsisdir); 1620} 1621 1622################################################################## 1623# Windows: Including the output path into the nsi template 1624################################################################## 1625 1626sub put_output_path_into_template 1627{ 1628 my ($templatefile, $downloaddir) = @_; 1629 1630 if ( $^O =~ /cygwin/i ) { $downloaddir =~ s/\//\\/g; } 1631 1632 replace_one_variable($templatefile, "OUTPUTDIRPLACEHOLDER", $downloaddir); 1633} 1634 1635################################################################## 1636# Windows: Finding the path to the nsis SDK 1637################################################################## 1638 1639sub get_path_to_nsis_sdk 1640{ 1641 my $nsispath = ""; 1642 1643 if ( $ENV{'NSIS_PATH'} ) 1644 { 1645 $nsispath = $ENV{'NSIS_PATH'}; 1646 } 1647 if ( $nsispath eq "" ) 1648 { 1649 $installer::logger::Info->print("... no Environment variable \"NSIS_PATH\"!\n"); 1650 } 1651 elsif ( ! -d $nsispath ) 1652 { 1653 installer::exiter::exit_program("ERROR: NSIS path $nsispath does not exist!", "get_path_to_nsis_sdk"); 1654 } 1655 1656 return $nsispath; 1657} 1658 1659################################################################## 1660# Windows: Executing NSIS to create the installation set 1661################################################################## 1662 1663sub call_nsis 1664{ 1665 my ( $nsispath, $nsifile ) = @_; 1666 1667 my $makensisexe = $nsispath . $installer::globals::separator . "makensis.exe"; 1668 1669 $installer::logger::Info->printf("... starting %s ... \n", $makensisexe); 1670 1671 if( $^O =~ /cygwin/i ) { $nsifile =~ s/\\/\//g; } 1672 1673 my $systemcall = "$makensisexe $nsifile |"; 1674 1675 $installer::logger::Lang->printf("Systemcall: %s\n", $systemcall); 1676 1677 my @nsisoutput = (); 1678 1679 open (NSI, "$systemcall"); 1680 while (<NSI>) {push(@nsisoutput, $_); } 1681 close (NSI); 1682 1683 my $returnvalue = $?; # $? contains the return value of the systemcall 1684 1685 if ($returnvalue) 1686 { 1687 $installer::logger::Lang->printf("ERROR: %s !\n", $systemcall); 1688 } 1689 else 1690 { 1691 $installer::logger::Lang->printf("Success: %s\n", $systemcall); 1692 } 1693 1694 foreach my $line (@nsisoutput) 1695 { 1696 $installer::logger::Lang->print($line); 1697 } 1698} 1699 1700################################################################################# 1701# Replacing one variable in one files 1702################################################################################# 1703 1704sub replace_one_variable_in_translationfile 1705{ 1706 my ($translationfile, $variable, $searchstring) = @_; 1707 1708 for ( my $i = 0; $i <= $#{$translationfile}; $i++ ) 1709 { 1710 ${$translationfile}[$i] =~ s/\%$searchstring/$variable/g; 1711 } 1712} 1713 1714################################################################################# 1715# Replacing the variables in the translation file 1716################################################################################# 1717 1718sub replace_variables 1719{ 1720 my ($translationfile, $variableshashref) = @_; 1721 1722 foreach my $key (keys %{$variableshashref}) 1723 { 1724 my $value = $variableshashref->{$key}; 1725 1726 # special handling for PRODUCTVERSION, if $allvariables->{'POSTVERSIONEXTENSION'} 1727 if (( $key eq "PRODUCTVERSION" ) && ( $variableshashref->{'POSTVERSIONEXTENSION'} )) { $value = $value . " " . $variableshashref->{'POSTVERSIONEXTENSION'}; } 1728 1729 replace_one_variable_in_translationfile($translationfile, $value, $key); 1730 } 1731} 1732 1733######################################################### 1734# Getting the translation file for the nsis installer 1735######################################################### 1736 1737sub get_translation_file 1738{ 1739 my ($allvariableshashref) = @_; 1740 my $translationfilename = $installer::globals::idtlanguagepath . $installer::globals::separator . $installer::globals::nsisfilename . ".uulf"; 1741 if ( ! -f $translationfilename ) { installer::exiter::exit_program("ERROR: Could not find language file $translationfilename!", "get_translation_file"); } 1742 my $translationfile = installer::files::read_file($translationfilename); 1743 replace_variables($translationfile, $allvariableshashref); 1744 1745 $installer::logger::Lang->printf("Reading translation file: %s\n", $translationfilename); 1746 1747 return $translationfile; 1748} 1749 1750#################################################### 1751# Removing English, if it was added before 1752#################################################### 1753 1754sub remove_english_for_nsis_installer 1755{ 1756 my ($languagestringref, $languagesarrayref) = @_; 1757 1758 # $$languagestringref =~ s/en-US_//; 1759 # shift(@{$languagesarrayref}); 1760 1761 @{$languagesarrayref} = ("en-US"); # only English for NSIS installer! 1762} 1763 1764#################################################### 1765# Creating link tree for upload 1766#################################################### 1767 1768sub create_link_tree 1769{ 1770 my ($sourcedownloadfile, $destfilename, $versionstring) = @_; 1771 1772 if ( ! $installer::globals::ooouploaddir ) { installer::exiter::exit_program("ERROR: Directory for AOO upload not defined!", "create_link_tree"); } 1773 my $versiondir = $installer::globals::ooouploaddir . $installer::globals::separator . $versionstring; 1774 $installer::logger::Lang->printf("Directory for the link: %s\n", $versiondir); 1775 1776 if ( ! -d $versiondir ) { installer::systemactions::create_directory_structure($versiondir); } 1777 1778 # inside directory $versiondir all links have to be created 1779 my $linkdestination = $versiondir . $installer::globals::separator . $destfilename; 1780 1781 # If there is an older version of this file (link), it has to be removed 1782 if ( -f $linkdestination ) { unlink($linkdestination); } 1783 1784 $installer::logger::Lang->printf("Creating hard link from %s to %s\n", $sourcedownloadfile, $linkdestination); 1785 installer::systemactions::hardlink_one_file($sourcedownloadfile, $linkdestination); 1786} 1787 1788####################################################### 1789# Setting supported platform for OpenOffice builds 1790####################################################### 1791 1792sub is_supported_platform 1793{ 1794 my $is_supported = 0; 1795 1796 if (( $installer::globals::islinuxrpmbuild ) || 1797 ( $installer::globals::issolarissparcbuild ) || 1798 ( $installer::globals::issolarisx86build ) || 1799 ( $installer::globals::iswindowsbuild )) 1800 { 1801 $is_supported = 1; 1802 } 1803 1804 return $is_supported; 1805} 1806 1807#################################################### 1808# Creating download installation sets 1809#################################################### 1810 1811sub create_download_sets 1812{ 1813 my ($installationdir, $includepatharrayref, $allvariableshashref, $downloadname, $languagestringref, $languagesarrayref) = @_; 1814 1815 $installer::logger::Info->print("\n"); 1816 $installer::logger::Info->print("******************************************\n"); 1817 $installer::logger::Info->print("... creating download installation set ...\n", 1); 1818 $installer::logger::Info->print("******************************************\n"); 1819 1820 installer::logger::include_header_into_logfile("Creating download installation sets:"); 1821 1822 # special handling for installation sets, to which english was added automatically 1823 if ( $installer::globals::added_english ) { remove_english_for_nsis_installer($languagestringref, $languagesarrayref); } 1824 1825 my $firstdir = $installationdir; 1826 installer::pathanalyzer::get_path_from_fullqualifiedname(\$firstdir); 1827 1828 my $lastdir = $installationdir; 1829 installer::pathanalyzer::make_absolute_filename_to_relative_filename(\$lastdir); 1830 1831 if ( $lastdir =~ /\./ ) { $lastdir =~ s/\./_download_inprogress\./ } 1832 else { $lastdir = $lastdir . "_download_inprogress"; } 1833 1834 # removing existing directory "_native_packed_inprogress" and "_native_packed_witherror" and "_native_packed" 1835 1836 my $downloaddir = $firstdir . $lastdir; 1837 1838 if ( -d $downloaddir ) { installer::systemactions::remove_complete_directory($downloaddir); } 1839 1840 my $olddir = $downloaddir; 1841 $olddir =~ s/_inprogress/_witherror/; 1842 if ( -d $olddir ) { installer::systemactions::remove_complete_directory($olddir); } 1843 1844 $olddir = $downloaddir; 1845 $olddir =~ s/_inprogress//; 1846 if ( -d $olddir ) { installer::systemactions::remove_complete_directory($olddir); } 1847 1848 # creating the new directory 1849 1850 installer::systemactions::create_directory($downloaddir); 1851 1852 $installer::globals::saveinstalldir = $downloaddir; 1853 1854 # evaluating the name of the download file 1855 1856 if ( $allvariableshashref->{'AOODOWNLOADNAME'} ) 1857 { 1858 $downloadname = set_download_filename($languagestringref, $allvariableshashref); 1859 } 1860 else 1861 { 1862 $downloadname = resolve_variables_in_downloadname($allvariableshashref, $downloadname, $languagestringref); 1863 } 1864 1865 if ( ! $installer::globals::iswindowsbuild ) # Unix specific part 1866 { 1867 1868 # getting the path of the getuid.so (only required for Solaris and Linux) 1869 my $getuidlibrary = ""; 1870 if (( $installer::globals::issolarisbuild ) || ( $installer::globals::islinuxbuild )) { $getuidlibrary = get_path_for_library($includepatharrayref); } 1871 1872 if ( $allvariableshashref->{'AOODOWNLOADNAME'} ) 1873 { 1874 my $downloadfile = create_tar_gz_file_from_directory($installationdir, $getuidlibrary, $downloaddir, $downloadname); 1875 } 1876 else 1877 { 1878 # find and read setup script template 1879 my $scriptfilename = "downloadscript.sh"; 1880 1881 my $scriptref = ""; 1882 1883 if ( $installer::globals::include_pathes_read ) 1884 { 1885 $scriptref = installer::scriptitems::get_sourcepath_from_filename_and_includepath(\$scriptfilename, $includepatharrayref, 0); 1886 } 1887 else 1888 { 1889 $scriptref = installer::scriptitems::get_sourcepath_from_filename_and_includepath_classic(\$scriptfilename, $includepatharrayref, 0); 1890 } 1891 1892 if ($$scriptref eq "") { installer::exiter::exit_program("ERROR: Could not find script file $scriptfilename!", "create_download_sets"); } 1893 my $scriptfile = installer::files::read_file($$scriptref); 1894 1895 $installer::logger::Lang->printf("Found script file %s: %s \n", $scriptfilename, $$scriptref); 1896 1897 # add product name into script template 1898 put_productname_into_script($scriptfile, $allvariableshashref); 1899 1900 # replace linenumber in script template 1901 put_linenumber_into_script($scriptfile); 1902 1903 # create tar file 1904 my $temporary_tarfile_name = $downloaddir . $installer::globals::separator . 'installset.tar'; 1905 my $size = tar_package($installationdir, $temporary_tarfile_name, $getuidlibrary); 1906 installer::exiter::exit_program("ERROR: Could not create tar file $temporary_tarfile_name!", "create_download_sets") unless $size; 1907 1908 # calling sum to determine checksum and size of the tar file 1909 my $sumout = call_sum($temporary_tarfile_name); 1910 1911 # writing checksum and size into scriptfile 1912 put_checksum_and_size_into_script($scriptfile, $sumout); 1913 1914 # saving the script file 1915 my $newscriptfilename = determine_scriptfile_name($downloadname); 1916 $newscriptfilename = save_script_file($downloaddir, $newscriptfilename, $scriptfile); 1917 1918 $installer::logger::Info->printf("... including installation set into %s ... \n", $newscriptfilename); 1919 # Append tar file to script 1920 include_tar_into_script($newscriptfilename, $temporary_tarfile_name); 1921 } 1922 } 1923 else # Windows specific part 1924 { 1925 my $localnsisdir = installer::systemactions::create_directories("nsis", $languagestringref); 1926 # push(@installer::globals::removedirs, $localnsisdir); 1927 1928 # find nsis in the system 1929 my $nsispath = get_path_to_nsis_sdk(); 1930 1931 if ( $nsispath eq "" ) { 1932 # If nsis is not found just skip the rest of this function 1933 # and do not create the NSIS file. 1934 $installer::logger::Lang->print("\n"); 1935 $installer::logger::Lang->printf("No NSIS SDK found. Skipping the generation of NSIS file.\n"); 1936 $installer::logger::Info->print("... no NSIS SDK found. Skipping the generation of NSIS file ... \n"); 1937 return $downloaddir; 1938 } 1939 1940 # copy language files into nsis directory and translate them 1941 copy_and_translate_nsis_language_files($nsispath, $localnsisdir, $languagesarrayref, $allvariableshashref); 1942 1943 # find and read the nsi file template 1944 my $templatefilename = "downloadtemplate.nsi"; 1945 1946 my $templateref = ""; 1947 1948 if ( $installer::globals::include_pathes_read ) 1949 { 1950 $templateref = installer::scriptitems::get_sourcepath_from_filename_and_includepath(\$templatefilename, $includepatharrayref, 0); 1951 } 1952 else 1953 { 1954 $templateref = installer::scriptitems::get_sourcepath_from_filename_and_includepath_classic(\$templatefilename, $includepatharrayref, 0); 1955 } 1956 1957 if ($$templateref eq "") { installer::exiter::exit_program("ERROR: Could not find nsi template file $templatefilename!", "create_download_sets"); } 1958 my $templatefile = installer::files::read_file($$templateref); 1959 1960 # add product name into script template 1961 put_windows_productname_into_template($templatefile, $allvariableshashref); 1962 put_banner_bmp_into_template($templatefile, $includepatharrayref, $allvariableshashref); 1963 put_welcome_bmp_into_template($templatefile, $includepatharrayref, $allvariableshashref); 1964 put_setup_ico_into_template($templatefile, $includepatharrayref, $allvariableshashref); 1965 put_publisher_into_template($templatefile, $allvariableshashref); 1966 put_website_into_template($templatefile, $allvariableshashref); 1967 put_javafilename_into_template($templatefile, $allvariableshashref); 1968 put_windows_productversion_into_template($templatefile, $allvariableshashref); 1969 put_windows_productpath_into_template($templatefile, $allvariableshashref, $languagestringref, $localnsisdir); 1970 put_outputfilename_into_template($templatefile, $downloadname); 1971 put_filelist_into_template($templatefile, $installationdir); 1972 put_language_list_into_template($templatefile, $languagesarrayref); 1973 put_nsis_path_into_template($templatefile, $localnsisdir); 1974 put_output_path_into_template($templatefile, $downloaddir); 1975 1976 my $nsifilename = save_script_file($localnsisdir, $templatefilename, $templatefile); 1977 1978 $installer::logger::Info->printf("... created NSIS file %s ... \n", $nsifilename); 1979 1980 # starting the NSIS SDK to create the download file 1981 call_nsis($nsispath, $nsifilename); 1982 } 1983 1984 return $downloaddir; 1985} 1986 1987#################################################### 1988# Creating AOO upload tree 1989#################################################### 1990 1991sub create_download_link_tree 1992{ 1993 my ($downloaddir, $languagestringref, $allvariableshashref) = @_; 1994 1995 $installer::logger::Info->print("\n"); 1996 $installer::logger::Info->print("******************************************\n"); 1997 $installer::logger::Info->print("... creating download hard link ...\n"); 1998 $installer::logger::Info->print("******************************************\n"); 1999 2000 installer::logger::include_header_into_logfile("Creating download hard link:"); 2001 $installer::logger::Lang->print("\n"); 2002 $installer::logger::Lang->add_timestamp("Performance Info: Creating hard link, start"); 2003 2004 if ( is_supported_platform() ) 2005 { 2006 my $versionstring = ""; 2007 # Already defined $installer::globals::oooversionstring and $installer::globals::ooodownloadfilename ? 2008 2009 if ( ! $installer::globals::oooversionstring ) { $versionstring = get_current_version(); } 2010 else { $versionstring = $installer::globals::oooversionstring; } 2011 2012 # Is $versionstring empty? If yes, there is nothing to do now. 2013 2014 $installer::logger::Lang->printf("Version string is set to: %s\n", $versionstring); 2015 2016 if ( $versionstring ) 2017 { 2018 # Now the downloadfilename has to be set (if not already done) 2019 my $destdownloadfilename = ""; 2020 if ( ! $installer::globals::ooodownloadfilename ) { $destdownloadfilename = set_download_filename($languagestringref, $versionstring, $allvariableshashref); } 2021 else { $destdownloadfilename = $installer::globals::ooodownloadfilename; } 2022 2023 if ( $destdownloadfilename ) 2024 { 2025 $destdownloadfilename = $destdownloadfilename . $installer::globals::downloadfileextension; 2026 2027 $installer::logger::Lang->printf("Setting destination download file name: %s\n", $destdownloadfilename); 2028 2029 my $sourcedownloadfile = $downloaddir . $installer::globals::separator . $installer::globals::downloadfilename; 2030 2031 $installer::logger::Lang->printf("Setting source download file name: %s\n", $sourcedownloadfile); 2032 2033 create_link_tree($sourcedownloadfile, $destdownloadfilename, $versionstring); 2034 # my $md5sumoutput = call_md5sum($downloadfile); 2035 # my $md5sum = get_md5sum($md5sumoutput); 2036 2037 } 2038 } 2039 else 2040 { 2041 $installer::logger::Lang->printf("Version string is empty. Nothing to do!\n"); 2042 } 2043 } 2044 else 2045 { 2046 $installer::logger::Lang->printf("Platform not used for hard linking. Nothing to do!\n"); 2047 } 2048 2049 $installer::logger::Lang->add_timestamp("Performance Info: Creating hard link, stop"); 2050} 2051 20521; 2053