| Filename | /cygdrive/c/lo/libo-master/instsetoo_native/util/C:/lo/libo-master/solenv/bin/modules/installer/helppack.pm |
| Statements | Executed 23 statements in 5.62ms |
| Calls | P | F | Exclusive Time |
Inclusive Time |
Subroutine |
|---|---|---|---|---|---|
| 1 | 1 | 1 | 373µs | 384µs | installer::helppack::BEGIN@30 |
| 1 | 1 | 1 | 19µs | 40µs | installer::helppack::BEGIN@31 |
| 1 | 1 | 1 | 18µs | 68µs | installer::helppack::BEGIN@36 |
| 1 | 1 | 1 | 18µs | 21µs | installer::helppack::BEGIN@33 |
| 1 | 1 | 1 | 16µs | 18µs | installer::helppack::BEGIN@38 |
| 1 | 1 | 1 | 16µs | 17µs | installer::helppack::BEGIN@41 |
| 1 | 1 | 1 | 15µs | 18µs | installer::helppack::BEGIN@37 |
| 1 | 1 | 1 | 15µs | 17µs | installer::helppack::BEGIN@40 |
| 1 | 1 | 1 | 15µs | 17µs | installer::helppack::BEGIN@39 |
| 1 | 1 | 1 | 14µs | 16µs | installer::helppack::BEGIN@34 |
| 1 | 1 | 1 | 13µs | 16µs | installer::helppack::BEGIN@35 |
| 0 | 0 | 0 | 0s | 0s | installer::helppack::build_installer_for_helppack |
| 0 | 0 | 0 | 0s | 0s | installer::helppack::create_tar_gz_file |
| 0 | 0 | 0 | 0s | 0s | installer::helppack::determine_packagename |
| 0 | 0 | 0 | 0s | 0s | installer::helppack::determine_scriptfile_name |
| 0 | 0 | 0 | 0s | 0s | installer::helppack::get_packagename_from_packagelist |
| 0 | 0 | 0 | 0s | 0s | installer::helppack::include_package_into_script |
| 0 | 0 | 0 | 0s | 0s | installer::helppack::put_fullproductname_into_script |
| 0 | 0 | 0 | 0s | 0s | installer::helppack::put_license_file_into_script |
| 0 | 0 | 0 | 0s | 0s | installer::helppack::put_linenumber_into_script |
| 0 | 0 | 0 | 0s | 0s | installer::helppack::put_packagename_into_script |
| 0 | 0 | 0 | 0s | 0s | installer::helppack::put_productname_into_script |
| 0 | 0 | 0 | 0s | 0s | installer::helppack::put_searchpackage_into_script |
| 0 | 0 | 0 | 0s | 0s | installer::helppack::remove_package |
| 0 | 0 | 0 | 0s | 0s | installer::helppack::replace_languagestring_variable |
| 0 | 0 | 0 | 0s | 0s | installer::helppack::save_script_file |
| 0 | 0 | 0 | 0s | 0s | installer::helppack::select_help_items |
| Line | State ments |
Time on line |
Calls | Time in subs |
Code |
|---|---|---|---|---|---|
| 1 | #************************************************************************* | ||||
| 2 | # | ||||
| 3 | # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. | ||||
| 4 | # | ||||
| 5 | # Copyright 2000, 2010 Oracle and/or its affiliates. | ||||
| 6 | # | ||||
| 7 | # OpenOffice.org - a multi-platform office productivity suite | ||||
| 8 | # | ||||
| 9 | # This file is part of OpenOffice.org. | ||||
| 10 | # | ||||
| 11 | # OpenOffice.org is free software: you can redistribute it and/or modify | ||||
| 12 | # it under the terms of the GNU Lesser General Public License version 3 | ||||
| 13 | # only, as published by the Free Software Foundation. | ||||
| 14 | # | ||||
| 15 | # OpenOffice.org is distributed in the hope that it will be useful, | ||||
| 16 | # but WITHOUT ANY WARRANTY; without even the implied warranty of | ||||
| 17 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||||
| 18 | # GNU Lesser General Public License version 3 for more details | ||||
| 19 | # (a copy is included in the LICENSE file that accompanied this code). | ||||
| 20 | # | ||||
| 21 | # You should have received a copy of the GNU Lesser General Public License | ||||
| 22 | # version 3 along with OpenOffice.org. If not, see | ||||
| 23 | # <http://www.openoffice.org/license.html> | ||||
| 24 | # for a copy of the LGPLv3 License. | ||||
| 25 | # | ||||
| 26 | #************************************************************************* | ||||
| 27 | |||||
| 28 | package installer::helppack; | ||||
| 29 | |||||
| 30 | 2 | 66µs | 2 | 396µs | # spent 384µs (373+11) within installer::helppack::BEGIN@30 which was called:
# once (373µs+11µs) by installer::BEGIN@45 at line 30 # spent 384µs making 1 call to installer::helppack::BEGIN@30
# spent 11µs making 1 call to strict::import |
| 31 | 2 | 62µs | 2 | 61µs | # spent 40µs (19+21) within installer::helppack::BEGIN@31 which was called:
# once (19µs+21µs) by installer::BEGIN@45 at line 31 # spent 40µs making 1 call to installer::helppack::BEGIN@31
# spent 21µs making 1 call to warnings::import |
| 32 | |||||
| 33 | 2 | 57µs | 2 | 24µs | # spent 21µs (18+3) within installer::helppack::BEGIN@33 which was called:
# once (18µs+3µs) by installer::BEGIN@45 at line 33 # spent 21µs making 1 call to installer::helppack::BEGIN@33
# spent 3µs making 1 call to UNIVERSAL::import |
| 34 | 2 | 53µs | 2 | 18µs | # spent 16µs (14+2) within installer::helppack::BEGIN@34 which was called:
# once (14µs+2µs) by installer::BEGIN@45 at line 34 # spent 16µs making 1 call to installer::helppack::BEGIN@34
# spent 2µs making 1 call to UNIVERSAL::import |
| 35 | 2 | 51µs | 2 | 18µs | # spent 16µs (13+3) within installer::helppack::BEGIN@35 which was called:
# once (13µs+3µs) by installer::BEGIN@45 at line 35 # spent 16µs making 1 call to installer::helppack::BEGIN@35
# spent 3µs making 1 call to UNIVERSAL::import |
| 36 | 2 | 58µs | 2 | 118µs | # spent 68µs (18+50) within installer::helppack::BEGIN@36 which was called:
# once (18µs+50µs) by installer::BEGIN@45 at line 36 # spent 68µs making 1 call to installer::helppack::BEGIN@36
# spent 50µs making 1 call to Exporter::import |
| 37 | 2 | 59µs | 2 | 20µs | # spent 18µs (15+3) within installer::helppack::BEGIN@37 which was called:
# once (15µs+3µs) by installer::BEGIN@45 at line 37 # spent 18µs making 1 call to installer::helppack::BEGIN@37
# spent 3µs making 1 call to UNIVERSAL::import |
| 38 | 2 | 54µs | 2 | 19µs | # spent 18µs (16+1) within installer::helppack::BEGIN@38 which was called:
# once (16µs+1µs) by installer::BEGIN@45 at line 38 # spent 18µs making 1 call to installer::helppack::BEGIN@38
# spent 2µs making 1 call to UNIVERSAL::import |
| 39 | 2 | 53µs | 2 | 20µs | # spent 17µs (15+3) within installer::helppack::BEGIN@39 which was called:
# once (15µs+3µs) by installer::BEGIN@45 at line 39 # spent 17µs making 1 call to installer::helppack::BEGIN@39
# spent 3µs making 1 call to UNIVERSAL::import |
| 40 | 2 | 52µs | 2 | 20µs | # spent 17µs (15+2) within installer::helppack::BEGIN@40 which was called:
# once (15µs+2µs) by installer::BEGIN@45 at line 40 # spent 17µs making 1 call to installer::helppack::BEGIN@40
# spent 2µs making 1 call to UNIVERSAL::import |
| 41 | 2 | 5.05ms | 2 | 19µs | # spent 17µs (16+1) within installer::helppack::BEGIN@41 which was called:
# once (16µs+1µs) by installer::BEGIN@45 at line 41 # spent 17µs making 1 call to installer::helppack::BEGIN@41
# spent 2µs making 1 call to UNIVERSAL::import |
| 42 | |||||
| 43 | sub select_help_items | ||||
| 44 | { | ||||
| 45 | my ( $itemsref, $languagesarrayref, $itemname ) = @_; | ||||
| 46 | |||||
| 47 | installer::logger::include_header_into_logfile("Selecting items for help pack. Item: $itemname"); | ||||
| 48 | |||||
| 49 | my @itemsarray = (); | ||||
| 50 | |||||
| 51 | for ( my $i = 0; $i <= $#{$itemsref}; $i++ ) | ||||
| 52 | { | ||||
| 53 | my $oneitem = ${$itemsref}[$i]; | ||||
| 54 | |||||
| 55 | my $styles = ""; | ||||
| 56 | if ( $oneitem->{'Styles'} ) { $styles = $oneitem->{'Styles'}; } | ||||
| 57 | |||||
| 58 | if (( $styles =~ /\bHELPPACK\b/ ) || ( $styles =~ /\bFORCEHELPPACK\b/ )) | ||||
| 59 | { | ||||
| 60 | # Files with style "HELPPACK" and "FORCEHELPPACK" also have to be included into the help pack. | ||||
| 61 | # Files with style "HELPPACK" are only included into help packs. | ||||
| 62 | # Files with style "FORCEHELPPACK" are included into help packs and non help packs. They are | ||||
| 63 | # forced, because otherwise they not not be included into helppacks. | ||||
| 64 | |||||
| 65 | my $ismultilingual = $oneitem->{'ismultilingual'}; | ||||
| 66 | |||||
| 67 | if ($ismultilingual) | ||||
| 68 | { | ||||
| 69 | my $specificlanguage = ""; | ||||
| 70 | if ( $oneitem->{'specificlanguage'} ) { $specificlanguage = $oneitem->{'specificlanguage'}; } | ||||
| 71 | |||||
| 72 | for ( my $j = 0; $j <= $#{$languagesarrayref}; $j++ ) # iterating over all languages | ||||
| 73 | { | ||||
| 74 | my $onelanguage = ${$languagesarrayref}[$j]; | ||||
| 75 | my $locallang = $onelanguage; | ||||
| 76 | $locallang =~ s/-/_/; | ||||
| 77 | |||||
| 78 | if ( $specificlanguage eq $onelanguage ) | ||||
| 79 | { | ||||
| 80 | push(@itemsarray, $oneitem); | ||||
| 81 | } | ||||
| 82 | } | ||||
| 83 | } | ||||
| 84 | else | ||||
| 85 | { | ||||
| 86 | push(@itemsarray, $oneitem); | ||||
| 87 | } | ||||
| 88 | } | ||||
| 89 | } | ||||
| 90 | |||||
| 91 | return \@itemsarray; | ||||
| 92 | } | ||||
| 93 | |||||
| 94 | sub replace_languagestring_variable | ||||
| 95 | { | ||||
| 96 | my ($onepackageref, $languagestringref) = @_; | ||||
| 97 | |||||
| 98 | my $key; | ||||
| 99 | |||||
| 100 | foreach $key (keys %{$onepackageref}) | ||||
| 101 | { | ||||
| 102 | my $value = $onepackageref->{$key}; | ||||
| 103 | $value =~ s/\%LANGUAGESTRING/$$languagestringref/g; | ||||
| 104 | $onepackageref->{$key} = $value; | ||||
| 105 | } | ||||
| 106 | } | ||||
| 107 | |||||
| 108 | ######################################################### | ||||
| 109 | # Including the license text into the script template | ||||
| 110 | ######################################################### | ||||
| 111 | |||||
| 112 | sub put_license_file_into_script | ||||
| 113 | { | ||||
| 114 | my ($scriptfile, $licensefile) = @_; | ||||
| 115 | |||||
| 116 | my $infoline = "Adding licensefile into help pack script\n"; | ||||
| 117 | push( @installer::globals::logfileinfo, $infoline); | ||||
| 118 | |||||
| 119 | my $includestring = ""; | ||||
| 120 | |||||
| 121 | for ( my $i = 0; $i <= $#{$licensefile}; $i++ ) | ||||
| 122 | { | ||||
| 123 | $includestring = $includestring . ${$licensefile}[$i]; | ||||
| 124 | } | ||||
| 125 | |||||
| 126 | for ( my $i = 0; $i <= $#{$scriptfile}; $i++ ) | ||||
| 127 | { | ||||
| 128 | ${$scriptfile}[$i] =~ s/LICENSEFILEPLACEHOLDER/$includestring/; | ||||
| 129 | } | ||||
| 130 | } | ||||
| 131 | |||||
| 132 | ######################################################### | ||||
| 133 | # Creating a tar.gz file from a Solaris package | ||||
| 134 | ######################################################### | ||||
| 135 | |||||
| 136 | sub create_tar_gz_file | ||||
| 137 | { | ||||
| 138 | my ($installdir, $packagename, $packagestring) = @_; | ||||
| 139 | |||||
| 140 | $packagename =~ s/\.rpm\s*$//; | ||||
| 141 | my $targzname = $packagename . ".tar.gz"; | ||||
| 142 | my $systemcall = "cd $installdir; tar -cf - $packagestring | gzip > $targzname"; | ||||
| 143 | installer::logger::print_message( "... $systemcall ...\n" ); | ||||
| 144 | |||||
| 145 | my $returnvalue = system($systemcall); | ||||
| 146 | |||||
| 147 | my $infoline = "Systemcall: $systemcall\n"; | ||||
| 148 | push( @installer::globals::logfileinfo, $infoline); | ||||
| 149 | |||||
| 150 | if ($returnvalue) | ||||
| 151 | { | ||||
| 152 | $infoline = "ERROR: Could not execute \"$systemcall\"!\n"; | ||||
| 153 | push( @installer::globals::logfileinfo, $infoline); | ||||
| 154 | } | ||||
| 155 | else | ||||
| 156 | { | ||||
| 157 | $infoline = "Success: Executed \"$systemcall\" successfully!\n"; | ||||
| 158 | push( @installer::globals::logfileinfo, $infoline); | ||||
| 159 | } | ||||
| 160 | |||||
| 161 | return $targzname; | ||||
| 162 | } | ||||
| 163 | |||||
| 164 | ######################################################### | ||||
| 165 | # Determining the name of the package file | ||||
| 166 | ######################################################### | ||||
| 167 | |||||
| 168 | sub get_packagename_from_packagelist | ||||
| 169 | { | ||||
| 170 | my ( $alldirs, $allvariables, $languagestringref ) = @_; | ||||
| 171 | |||||
| 172 | # my $packagename = ""; | ||||
| 173 | |||||
| 174 | # for ( my $i = 0; $i <= $#{$alldirs}; $i++ ) | ||||
| 175 | # { | ||||
| 176 | # if ( ${$alldirs}[$i] =~ /-fonts/ ) { next; } | ||||
| 177 | # if ( ${$alldirs}[$i] =~ /-help/ ) { next; } | ||||
| 178 | # if ( ${$alldirs}[$i] =~ /-res/ ) { next; } | ||||
| 179 | # | ||||
| 180 | # $packagename = ${$alldirs}[$i]; | ||||
| 181 | # last; | ||||
| 182 | # } | ||||
| 183 | |||||
| 184 | # if ( $packagename eq "" ) { installer::exiter::exit_program("ERROR: Could not find base package in directory $installdir!", "get_packagename_from_packagelist"); } | ||||
| 185 | |||||
| 186 | my $localproductname = $allvariables->{'PRODUCTNAME'}; | ||||
| 187 | $localproductname = lc($localproductname); | ||||
| 188 | $localproductname =~ s/ //g; | ||||
| 189 | $localproductname =~ s/-/_/g; | ||||
| 190 | |||||
| 191 | my $packagename = $localproductname . "_" . $$languagestringref; | ||||
| 192 | |||||
| 193 | return $packagename; | ||||
| 194 | } | ||||
| 195 | |||||
| 196 | ######################################################### | ||||
| 197 | # Determining the name of the package file or the rpm | ||||
| 198 | # in the installation directory. For help packs | ||||
| 199 | # there is only one file in this directory | ||||
| 200 | ######################################################### | ||||
| 201 | |||||
| 202 | sub determine_packagename | ||||
| 203 | { | ||||
| 204 | my ( $installdir, $allvariables, $languagestringref ) = @_; | ||||
| 205 | |||||
| 206 | my $packagename = ""; | ||||
| 207 | my $allnames = ""; | ||||
| 208 | |||||
| 209 | if ( $installer::globals::isrpmbuild ) | ||||
| 210 | { | ||||
| 211 | # determining the rpm file in directory $installdir | ||||
| 212 | |||||
| 213 | my $fileextension = "rpm"; | ||||
| 214 | my $rpmfiles = installer::systemactions::find_file_with_file_extension($fileextension, $installdir); | ||||
| 215 | if ( ! ( $#{$rpmfiles} > -1 )) { installer::exiter::exit_program("ERROR: Could not find package in directory $installdir!", "determine_packagename"); } | ||||
| 216 | my $rpmsav = [@{$rpmfiles}]; | ||||
| 217 | for ( my $i = 0; $i <= $#{$rpmfiles}; $i++ ) { installer::pathanalyzer::make_absolute_filename_to_relative_filename(\${$rpmfiles}[$i]); } | ||||
| 218 | |||||
| 219 | $packagename = get_packagename_from_packagelist($rpmfiles, $allvariables, $languagestringref); | ||||
| 220 | |||||
| 221 | my $packagestring = installer::converter::convert_array_to_space_separated_string($rpmfiles); | ||||
| 222 | $packagename = create_tar_gz_file($installdir, $packagename, $packagestring); # only one file | ||||
| 223 | for ( my $i = 0; $i <= $#{$rpmsav}; $i++ ) | ||||
| 224 | { | ||||
| 225 | my $onefile = $installdir . $installer::globals::separator . ${$rpmsav}[$i]; | ||||
| 226 | unlink($onefile); | ||||
| 227 | } | ||||
| 228 | |||||
| 229 | $allnames = $rpmfiles; | ||||
| 230 | } | ||||
| 231 | |||||
| 232 | if ( $installer::globals::issolarisbuild ) | ||||
| 233 | { | ||||
| 234 | # determining the Solaris package file in directory $installdir | ||||
| 235 | my $alldirs = installer::systemactions::get_all_directories($installdir); | ||||
| 236 | |||||
| 237 | if ( ! ( $#{$alldirs} > -1 )) { installer::exiter::exit_program("ERROR: Could not find package in directory $installdir!", "determine_packagename"); } | ||||
| 238 | my $alldirssav = [@{$alldirs}]; | ||||
| 239 | for ( my $i = 0; $i <= $#{$alldirs}; $i++ ) { installer::pathanalyzer::make_absolute_filename_to_relative_filename(\${$alldirs}[$i]); } | ||||
| 240 | |||||
| 241 | $packagename = get_packagename_from_packagelist($alldirs, $allvariables, $languagestringref); | ||||
| 242 | my $packagestring = installer::converter::convert_array_to_space_separated_string($alldirs); | ||||
| 243 | $packagename = create_tar_gz_file($installdir, $packagename, $packagestring); # only a file (not a directory) can be included into the shell script | ||||
| 244 | for ( my $i = 0; $i <= $#{$alldirssav}; $i++ ) { installer::systemactions::remove_complete_directory(${$alldirssav}[$i], 1); } | ||||
| 245 | $allnames = $alldirs; | ||||
| 246 | } | ||||
| 247 | |||||
| 248 | my $infoline = "Found package in installation directory $installdir : $packagename\n"; | ||||
| 249 | push( @installer::globals::logfileinfo, $infoline); | ||||
| 250 | |||||
| 251 | return ( $packagename, $allnames); | ||||
| 252 | } | ||||
| 253 | |||||
| 254 | ######################################################### | ||||
| 255 | # Including the name of the package file or the rpm | ||||
| 256 | # into the script template | ||||
| 257 | ######################################################### | ||||
| 258 | |||||
| 259 | sub put_packagename_into_script | ||||
| 260 | { | ||||
| 261 | my ($scriptfile, $packagename, $allnames) = @_; | ||||
| 262 | |||||
| 263 | my $localpackagename = $packagename; | ||||
| 264 | $localpackagename =~ s/\.tar\.gz//; # making "OOOopenoffice-it-ea.tar.gz" to "OOOopenoffice-it-ea" | ||||
| 265 | my $infoline = "Adding packagename $localpackagename into help pack script\n"; | ||||
| 266 | push( @installer::globals::logfileinfo, $infoline); | ||||
| 267 | |||||
| 268 | my $installline = ""; | ||||
| 269 | |||||
| 270 | if ( $installer::globals::issolarisbuild ) { $installline = " /usr/sbin/pkgadd -d \$outdir -a \$adminfile"; } | ||||
| 271 | |||||
| 272 | if ( $installer::globals::isrpmbuild ) { $installline = " rpm --prefix \$PRODUCTINSTALLLOCATION --replacepkgs -i"; } | ||||
| 273 | |||||
| 274 | for ( my $i = 0; $i <= $#{$allnames}; $i++ ) | ||||
| 275 | { | ||||
| 276 | if ( $installer::globals::issolarisbuild ) { $installline = $installline . " ${$allnames}[$i]"; } | ||||
| 277 | |||||
| 278 | if ( $installer::globals::isrpmbuild ) { $installline = $installline . " \$outdir/${$allnames}[$i]"; } | ||||
| 279 | } | ||||
| 280 | |||||
| 281 | for ( my $j = 0; $j <= $#{$scriptfile}; $j++ ) | ||||
| 282 | { | ||||
| 283 | ${$scriptfile}[$j] =~ s/INSTALLLINES/$installline/; | ||||
| 284 | } | ||||
| 285 | } | ||||
| 286 | |||||
| 287 | ################################################################## | ||||
| 288 | # Including the lowercase product name into the script template | ||||
| 289 | ################################################################## | ||||
| 290 | |||||
| 291 | sub put_productname_into_script | ||||
| 292 | { | ||||
| 293 | my ($scriptfile, $variableshashref) = @_; | ||||
| 294 | |||||
| 295 | my $productname = $variableshashref->{'PRODUCTNAME'}; | ||||
| 296 | $productname = lc($productname); | ||||
| 297 | $productname =~ s/\.//g; # openoffice.org -> openofficeorg | ||||
| 298 | |||||
| 299 | my $infoline = "Adding productname $productname into help pack script\n"; | ||||
| 300 | push( @installer::globals::logfileinfo, $infoline); | ||||
| 301 | |||||
| 302 | for ( my $i = 0; $i <= $#{$scriptfile}; $i++ ) | ||||
| 303 | { | ||||
| 304 | ${$scriptfile}[$i] =~ s/PRODUCTNAMEPLACEHOLDER/$productname/; | ||||
| 305 | } | ||||
| 306 | } | ||||
| 307 | |||||
| 308 | ################################################################## | ||||
| 309 | # Including the full product name into the script template | ||||
| 310 | # (name and version) | ||||
| 311 | ################################################################## | ||||
| 312 | |||||
| 313 | sub put_fullproductname_into_script | ||||
| 314 | { | ||||
| 315 | my ($scriptfile, $variableshashref) = @_; | ||||
| 316 | |||||
| 317 | my $productname = $variableshashref->{'PRODUCTNAME'}; | ||||
| 318 | my $productversion = ""; | ||||
| 319 | if ( $variableshashref->{'PRODUCTVERSION'} ) { $productversion = $variableshashref->{'PRODUCTVERSION'}; }; | ||||
| 320 | my $fullproductname = $productname . " " . $productversion; | ||||
| 321 | |||||
| 322 | my $infoline = "Adding full productname \"$fullproductname\" into help pack script\n"; | ||||
| 323 | push( @installer::globals::logfileinfo, $infoline); | ||||
| 324 | |||||
| 325 | for ( my $i = 0; $i <= $#{$scriptfile}; $i++ ) | ||||
| 326 | { | ||||
| 327 | ${$scriptfile}[$i] =~ s/FULLPRODUCTNAMELONGPLACEHOLDER/$fullproductname/; | ||||
| 328 | } | ||||
| 329 | } | ||||
| 330 | |||||
| 331 | ################################################################## | ||||
| 332 | # Including the name of the search package (-core01) | ||||
| 333 | # into the script template | ||||
| 334 | ################################################################## | ||||
| 335 | |||||
| 336 | sub put_searchpackage_into_script | ||||
| 337 | { | ||||
| 338 | my ($scriptfile, $variableshashref) = @_; | ||||
| 339 | |||||
| 340 | my $basispackageprefix = $variableshashref->{'BASISPACKAGEPREFIX'}; | ||||
| 341 | my $productversion = $variableshashref->{'PRODUCTVERSION'}; | ||||
| 342 | |||||
| 343 | if ( $installer::globals::issolarisbuild ) { $productversion =~ s/\.//g; } # "3.0" -> "30" | ||||
| 344 | |||||
| 345 | my $infoline = "Adding basis package prefix $basispackageprefix into help pack script\n"; | ||||
| 346 | push( @installer::globals::logfileinfo, $infoline); | ||||
| 347 | |||||
| 348 | $infoline = "Adding basis package version $productversion into help pack script\n"; | ||||
| 349 | push( @installer::globals::logfileinfo, $infoline); | ||||
| 350 | |||||
| 351 | for ( my $i = 0; $i <= $#{$scriptfile}; $i++ ) | ||||
| 352 | { | ||||
| 353 | ${$scriptfile}[$i] =~ s/BASISPACKAGEPREFIXPLACEHOLDER/$basispackageprefix/; | ||||
| 354 | ${$scriptfile}[$i] =~ s/PRODUCTVERSIONPLACEHOLDER/$productversion/; | ||||
| 355 | } | ||||
| 356 | |||||
| 357 | } | ||||
| 358 | |||||
| 359 | ######################################################### | ||||
| 360 | # Including the linenumber into the script template | ||||
| 361 | ######################################################### | ||||
| 362 | |||||
| 363 | sub put_linenumber_into_script | ||||
| 364 | { | ||||
| 365 | my ( $scriptfile, $licensefile, $allnames ) = @_; | ||||
| 366 | |||||
| 367 | my $linenumber = $#{$scriptfile} + $#{$licensefile} + 3; # also adding the content of the license file! | ||||
| 368 | |||||
| 369 | my $infoline = "Adding linenumber $linenumber into help pack script\n"; | ||||
| 370 | push( @installer::globals::logfileinfo, $infoline); | ||||
| 371 | |||||
| 372 | for ( my $i = 0; $i <= $#{$scriptfile}; $i++ ) | ||||
| 373 | { | ||||
| 374 | ${$scriptfile}[$i] =~ s/LINENUMBERPLACEHOLDER/$linenumber/; | ||||
| 375 | } | ||||
| 376 | } | ||||
| 377 | |||||
| 378 | ######################################################### | ||||
| 379 | # Determining the name of the new scriptfile | ||||
| 380 | ######################################################### | ||||
| 381 | |||||
| 382 | sub determine_scriptfile_name | ||||
| 383 | { | ||||
| 384 | my ( $packagename ) = @_; | ||||
| 385 | |||||
| 386 | my $scriptfilename = $packagename; | ||||
| 387 | |||||
| 388 | # if ( $installer::globals::isrpmbuild ) { $scriptfilename =~ s/\.rpm\s*$/\.sh/; } | ||||
| 389 | # if ( $installer::globals::issolarisbuild ) { $scriptfilename =~ s/\.tar\.gz\s*$/\.sh/; } | ||||
| 390 | |||||
| 391 | $scriptfilename =~ s/\.tar\.gz\s*$/\.sh/; | ||||
| 392 | |||||
| 393 | my $infoline = "Setting help pack script file name to $scriptfilename\n"; | ||||
| 394 | push( @installer::globals::logfileinfo, $infoline); | ||||
| 395 | |||||
| 396 | return $scriptfilename; | ||||
| 397 | } | ||||
| 398 | |||||
| 399 | ######################################################### | ||||
| 400 | # Saving the script file in the installation directory | ||||
| 401 | ######################################################### | ||||
| 402 | |||||
| 403 | sub save_script_file | ||||
| 404 | { | ||||
| 405 | my ($installdir, $newscriptfilename, $scriptfile) = @_; | ||||
| 406 | |||||
| 407 | $newscriptfilename = $installdir . $installer::globals::separator . $newscriptfilename; | ||||
| 408 | installer::files::save_file($newscriptfilename, $scriptfile); | ||||
| 409 | |||||
| 410 | my $infoline = "Saving script file $newscriptfilename\n"; | ||||
| 411 | push( @installer::globals::logfileinfo, $infoline); | ||||
| 412 | |||||
| 413 | return $newscriptfilename; | ||||
| 414 | } | ||||
| 415 | |||||
| 416 | ######################################################### | ||||
| 417 | # Including the binary package into the script | ||||
| 418 | ######################################################### | ||||
| 419 | |||||
| 420 | sub include_package_into_script | ||||
| 421 | { | ||||
| 422 | my ( $scriptfilename, $installdir, $packagename ) = @_; | ||||
| 423 | |||||
| 424 | my $longpackagename = $installdir . $installer::globals::separator . $packagename; | ||||
| 425 | my $systemcall = "cat $longpackagename >>$scriptfilename"; | ||||
| 426 | |||||
| 427 | my $returnvalue = system($systemcall); | ||||
| 428 | |||||
| 429 | my $infoline = "Systemcall: $systemcall\n"; | ||||
| 430 | push( @installer::globals::logfileinfo, $infoline); | ||||
| 431 | |||||
| 432 | if ($returnvalue) | ||||
| 433 | { | ||||
| 434 | $infoline = "ERROR: Could not execute \"$systemcall\"!\n"; | ||||
| 435 | push( @installer::globals::logfileinfo, $infoline); | ||||
| 436 | } | ||||
| 437 | else | ||||
| 438 | { | ||||
| 439 | $infoline = "Success: Executed \"$systemcall\" successfully!\n"; | ||||
| 440 | push( @installer::globals::logfileinfo, $infoline); | ||||
| 441 | } | ||||
| 442 | |||||
| 443 | my $localcall = "chmod 775 $scriptfilename \>\/dev\/null 2\>\&1"; | ||||
| 444 | system($localcall); | ||||
| 445 | |||||
| 446 | } | ||||
| 447 | |||||
| 448 | ######################################################### | ||||
| 449 | # Removing the binary package | ||||
| 450 | ######################################################### | ||||
| 451 | |||||
| 452 | sub remove_package | ||||
| 453 | { | ||||
| 454 | my ( $installdir, $packagename ) = @_; | ||||
| 455 | |||||
| 456 | my $remove_package = 1; | ||||
| 457 | |||||
| 458 | if ( $ENV{'DONT_REMOVE_PACKAGE'} ) { $remove_package = 0; } | ||||
| 459 | |||||
| 460 | if ( $remove_package ) | ||||
| 461 | { | ||||
| 462 | my $longpackagename = $installdir . $installer::globals::separator . $packagename; | ||||
| 463 | unlink $longpackagename; | ||||
| 464 | |||||
| 465 | my $infoline = "Removing package: $longpackagename \n"; | ||||
| 466 | push( @installer::globals::logfileinfo, $infoline); | ||||
| 467 | } | ||||
| 468 | } | ||||
| 469 | |||||
| 470 | #################################################### | ||||
| 471 | # Unix help packs, that are not part of | ||||
| 472 | # multilingual installation sets, need a | ||||
| 473 | # shell script installer | ||||
| 474 | #################################################### | ||||
| 475 | |||||
| 476 | sub build_installer_for_helppack | ||||
| 477 | { | ||||
| 478 | my ($installdir, $allvariableshashref, $includepatharrayref, $languagesarrayref, $languagestringref) = @_; | ||||
| 479 | |||||
| 480 | installer::logger::print_message( "... creating shell script installer ...\n" ); | ||||
| 481 | |||||
| 482 | installer::logger::include_header_into_logfile("Creating shell script installer:"); | ||||
| 483 | |||||
| 484 | # find and read setup script template | ||||
| 485 | |||||
| 486 | my $scriptfilename = "langpackscript.sh"; | ||||
| 487 | my $scriptref = installer::scriptitems::get_sourcepath_from_filename_and_includepath(\$scriptfilename, $includepatharrayref, 0); | ||||
| 488 | if ($$scriptref eq "") { installer::exiter::exit_program("ERROR: Could not find script file $scriptfilename!", "build_installer_for_helppack"); } | ||||
| 489 | my $scriptfile = installer::files::read_file($$scriptref); | ||||
| 490 | |||||
| 491 | my $infoline = "Found script file $scriptfilename: $$scriptref \n"; | ||||
| 492 | push( @installer::globals::logfileinfo, $infoline); | ||||
| 493 | |||||
| 494 | # find and read english license file | ||||
| 495 | my $licenselanguage = "en-US"; # always english ! | ||||
| 496 | my $licensefilename = "LICENSE"; # _" . $licenselanguage; | ||||
| 497 | my $licenseincludepatharrayref = installer::worker::get_language_specific_include_paths($includepatharrayref, $licenselanguage); | ||||
| 498 | |||||
| 499 | my $licenseref = installer::scriptitems::get_sourcepath_from_filename_and_includepath(\$licensefilename, $licenseincludepatharrayref, 0); | ||||
| 500 | if ($$licenseref eq "") { installer::exiter::exit_program("ERROR: Could not find License file $licensefilename!", "build_installer_for_helppack"); } | ||||
| 501 | my $licensefile = installer::files::read_file($$licenseref); | ||||
| 502 | |||||
| 503 | $infoline = "Found licensefile $licensefilename: $$licenseref \n"; | ||||
| 504 | push( @installer::globals::logfileinfo, $infoline); | ||||
| 505 | |||||
| 506 | # including variables into license file | ||||
| 507 | installer::scpzipfiles::replace_all_ziplistvariables_in_file($licensefile, $allvariableshashref); | ||||
| 508 | |||||
| 509 | # add license text into script template | ||||
| 510 | put_license_file_into_script($scriptfile, $licensefile); | ||||
| 511 | |||||
| 512 | # add rpm or package file name into script template | ||||
| 513 | my ( $packagename, $allnames) = determine_packagename($installdir, $allvariableshashref, $languagestringref); | ||||
| 514 | put_packagename_into_script($scriptfile, $packagename, $allnames); | ||||
| 515 | |||||
| 516 | # add product name into script template | ||||
| 517 | put_productname_into_script($scriptfile, $allvariableshashref); | ||||
| 518 | |||||
| 519 | # add product name into script template | ||||
| 520 | put_fullproductname_into_script($scriptfile, $allvariableshashref); | ||||
| 521 | |||||
| 522 | # add product name into script template | ||||
| 523 | put_searchpackage_into_script($scriptfile, $allvariableshashref); | ||||
| 524 | |||||
| 525 | # replace linenumber in script template | ||||
| 526 | put_linenumber_into_script($scriptfile, $licensefile, $allnames); | ||||
| 527 | |||||
| 528 | # saving the script file | ||||
| 529 | my $newscriptfilename = determine_scriptfile_name($packagename); | ||||
| 530 | $newscriptfilename = save_script_file($installdir, $newscriptfilename, $scriptfile); | ||||
| 531 | |||||
| 532 | # include rpm or package into script | ||||
| 533 | include_package_into_script($newscriptfilename, $installdir, $packagename); | ||||
| 534 | |||||
| 535 | # remove rpm or package | ||||
| 536 | remove_package($installdir, $packagename); | ||||
| 537 | } | ||||
| 538 | |||||
| 539 | 1 | 11µs | 1; |