1*cdf0e10cSrcweir#************************************************************************* 2*cdf0e10cSrcweir# 3*cdf0e10cSrcweir# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4*cdf0e10cSrcweir# 5*cdf0e10cSrcweir# Copyright 2000, 2010 Oracle and/or its affiliates. 6*cdf0e10cSrcweir# 7*cdf0e10cSrcweir# OpenOffice.org - a multi-platform office productivity suite 8*cdf0e10cSrcweir# 9*cdf0e10cSrcweir# This file is part of OpenOffice.org. 10*cdf0e10cSrcweir# 11*cdf0e10cSrcweir# OpenOffice.org is free software: you can redistribute it and/or modify 12*cdf0e10cSrcweir# it under the terms of the GNU Lesser General Public License version 3 13*cdf0e10cSrcweir# only, as published by the Free Software Foundation. 14*cdf0e10cSrcweir# 15*cdf0e10cSrcweir# OpenOffice.org is distributed in the hope that it will be useful, 16*cdf0e10cSrcweir# but WITHOUT ANY WARRANTY; without even the implied warranty of 17*cdf0e10cSrcweir# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 18*cdf0e10cSrcweir# GNU Lesser General Public License version 3 for more details 19*cdf0e10cSrcweir# (a copy is included in the LICENSE file that accompanied this code). 20*cdf0e10cSrcweir# 21*cdf0e10cSrcweir# You should have received a copy of the GNU Lesser General Public License 22*cdf0e10cSrcweir# version 3 along with OpenOffice.org. If not, see 23*cdf0e10cSrcweir# <http://www.openoffice.org/license.html> 24*cdf0e10cSrcweir# for a copy of the LGPLv3 License. 25*cdf0e10cSrcweir# 26*cdf0e10cSrcweir#************************************************************************* 27*cdf0e10cSrcweir 28*cdf0e10cSrcweirpackage installer::scriptitems; 29*cdf0e10cSrcweir 30*cdf0e10cSrcweiruse installer::converter; 31*cdf0e10cSrcweiruse installer::existence; 32*cdf0e10cSrcweiruse installer::exiter; 33*cdf0e10cSrcweiruse installer::globals; 34*cdf0e10cSrcweiruse installer::languages; 35*cdf0e10cSrcweiruse installer::logger; 36*cdf0e10cSrcweiruse installer::pathanalyzer; 37*cdf0e10cSrcweiruse installer::remover; 38*cdf0e10cSrcweiruse installer::systemactions; 39*cdf0e10cSrcweir 40*cdf0e10cSrcweir################################################################ 41*cdf0e10cSrcweir# Resolving the GID for the directories defined in setup script 42*cdf0e10cSrcweir################################################################ 43*cdf0e10cSrcweir 44*cdf0e10cSrcweirsub resolve_all_directory_names 45*cdf0e10cSrcweir{ 46*cdf0e10cSrcweir my ($directoryarrayref) = @_; 47*cdf0e10cSrcweir 48*cdf0e10cSrcweir if ( $installer::globals::debug ) { installer::logger::debuginfo("installer::scriptitems::resolve_all_directory_names : $#{$directoryarrayref}"); } 49*cdf0e10cSrcweir 50*cdf0e10cSrcweir # After this procedure the hash shall contain the complete language 51*cdf0e10cSrcweir # dependent path, not only the language dependent HostName. 52*cdf0e10cSrcweir 53*cdf0e10cSrcweir my ($key, $value, $parentvalue, $parentgid, $parentdirectoryhashref); 54*cdf0e10cSrcweir 55*cdf0e10cSrcweir for ( my $i = 0; $i <= $#{$directoryarrayref}; $i++ ) 56*cdf0e10cSrcweir { 57*cdf0e10cSrcweir my $directoryhashref = ${$directoryarrayref}[$i]; 58*cdf0e10cSrcweir my $gid = $directoryhashref-> {'gid'}; 59*cdf0e10cSrcweir my $parentid = $directoryhashref-> {'ParentID'}; 60*cdf0e10cSrcweir 61*cdf0e10cSrcweir if ( $parentid ne "PREDEFINED_PROGDIR" ) 62*cdf0e10cSrcweir { 63*cdf0e10cSrcweir # find the array of the parentid, which has to be defined before in setup script 64*cdf0e10cSrcweir # and is therefore listed before in this array 65*cdf0e10cSrcweir 66*cdf0e10cSrcweir for ( my $j = 0; $j <= $i; $j++ ) 67*cdf0e10cSrcweir { 68*cdf0e10cSrcweir $parentdirectoryhashref = ${$directoryarrayref}[$j]; 69*cdf0e10cSrcweir $parentgid = $parentdirectoryhashref->{'gid'}; 70*cdf0e10cSrcweir 71*cdf0e10cSrcweir if ( $parentid eq $parentgid) 72*cdf0e10cSrcweir { 73*cdf0e10cSrcweir last; 74*cdf0e10cSrcweir } 75*cdf0e10cSrcweir } 76*cdf0e10cSrcweir 77*cdf0e10cSrcweir # and now we can put the path together 78*cdf0e10cSrcweir # But take care of the languages! 79*cdf0e10cSrcweir 80*cdf0e10cSrcweir my $dirismultilingual = $directoryhashref->{'ismultilingual'}; 81*cdf0e10cSrcweir my $parentismultilingual = $parentdirectoryhashref->{'ismultilingual'}; 82*cdf0e10cSrcweir 83*cdf0e10cSrcweir # First: Both directories are language independent or both directories are language dependent 84*cdf0e10cSrcweir 85*cdf0e10cSrcweir if ((( ! $dirismultilingual ) && ( ! $parentismultilingual )) || 86*cdf0e10cSrcweir (( $dirismultilingual ) && ( $parentismultilingual ))) 87*cdf0e10cSrcweir { 88*cdf0e10cSrcweir foreach $key (keys %{$directoryhashref}) 89*cdf0e10cSrcweir { 90*cdf0e10cSrcweir # the key ("HostName (en-US)") must be usable for both hashes 91*cdf0e10cSrcweir 92*cdf0e10cSrcweir if ( $key =~ /\bHostName\b/ ) 93*cdf0e10cSrcweir { 94*cdf0e10cSrcweir $parentvalue = ""; 95*cdf0e10cSrcweir $value = $directoryhashref->{$key}; 96*cdf0e10cSrcweir if ( $parentdirectoryhashref->{$key} ) { $parentvalue = $parentdirectoryhashref->{$key}; } 97*cdf0e10cSrcweir 98*cdf0e10cSrcweir # It is possible, that in scp project, a directory is defined in more languages than 99*cdf0e10cSrcweir # the directory parent (happened after automatic generation of macros.inc). 100*cdf0e10cSrcweir # Therefore this is checked now and written with a warning into the logfile. 101*cdf0e10cSrcweir # This is no error, because (in most cases) the concerned language is not build. 102*cdf0e10cSrcweir 103*cdf0e10cSrcweir if ($parentvalue eq "") 104*cdf0e10cSrcweir { 105*cdf0e10cSrcweir $directoryhashref->{$key} = "FAILURE"; 106*cdf0e10cSrcweir my $infoline = "WARNING: No hostname for $parentid with \"$key\". Needed by child directory $gid !\n"; 107*cdf0e10cSrcweir push( @installer::globals::globallogfileinfo, $infoline); 108*cdf0e10cSrcweir } 109*cdf0e10cSrcweir else 110*cdf0e10cSrcweir { 111*cdf0e10cSrcweir $directoryhashref->{$key} = $parentvalue . $installer::globals::separator . $value; 112*cdf0e10cSrcweir } 113*cdf0e10cSrcweir } 114*cdf0e10cSrcweir } 115*cdf0e10cSrcweir } 116*cdf0e10cSrcweir 117*cdf0e10cSrcweir # Second: The directory is language dependent, the parent not 118*cdf0e10cSrcweir 119*cdf0e10cSrcweir if (( $dirismultilingual ) && ( ! $parentismultilingual )) 120*cdf0e10cSrcweir { 121*cdf0e10cSrcweir $parentvalue = $parentdirectoryhashref->{'HostName'}; # there is only one 122*cdf0e10cSrcweir 123*cdf0e10cSrcweir foreach $key (keys %{$directoryhashref}) # the current directory 124*cdf0e10cSrcweir { 125*cdf0e10cSrcweir if ( $key =~ /\bHostName\b/ ) 126*cdf0e10cSrcweir { 127*cdf0e10cSrcweir $value = $directoryhashref->{$key}; 128*cdf0e10cSrcweir $directoryhashref->{$key} = $parentvalue . $installer::globals::separator . $value; 129*cdf0e10cSrcweir } 130*cdf0e10cSrcweir } 131*cdf0e10cSrcweir } 132*cdf0e10cSrcweir 133*cdf0e10cSrcweir # Third: The directory is not language dependent, the parent is language dependent 134*cdf0e10cSrcweir 135*cdf0e10cSrcweir if (( ! $dirismultilingual ) && ( $parentismultilingual )) 136*cdf0e10cSrcweir { 137*cdf0e10cSrcweir $value = $directoryhashref->{'HostName'}; # there is only one 138*cdf0e10cSrcweir delete($directoryhashref->{'HostName'}); 139*cdf0e10cSrcweir 140*cdf0e10cSrcweir foreach $key (keys %{$parentdirectoryhashref}) # the parent directory 141*cdf0e10cSrcweir { 142*cdf0e10cSrcweir if ( $key =~ /\bHostName\b/ ) 143*cdf0e10cSrcweir { 144*cdf0e10cSrcweir $parentvalue = $parentdirectoryhashref->{$key}; # there is only one 145*cdf0e10cSrcweir $directoryhashref->{$key} = $parentvalue . $installer::globals::separator . $value; 146*cdf0e10cSrcweir } 147*cdf0e10cSrcweir } 148*cdf0e10cSrcweir 149*cdf0e10cSrcweir $directoryhashref->{'ismultilingual'} = 1; # now this directory is also language dependent 150*cdf0e10cSrcweir } 151*cdf0e10cSrcweir } 152*cdf0e10cSrcweir } 153*cdf0e10cSrcweir} 154*cdf0e10cSrcweir 155*cdf0e10cSrcweir############################################################################# 156*cdf0e10cSrcweir# Files with flag DELETE_ONLY do not need to be packed into installation set 157*cdf0e10cSrcweir############################################################################# 158*cdf0e10cSrcweir 159*cdf0e10cSrcweirsub remove_delete_only_files_from_productlists 160*cdf0e10cSrcweir{ 161*cdf0e10cSrcweir my ($productarrayref) = @_; 162*cdf0e10cSrcweir 163*cdf0e10cSrcweir if ( $installer::globals::debug ) { installer::logger::debuginfo("installer::scriptitems::remove_delete_only_files_from_productlists : $#{$productarrayref}"); } 164*cdf0e10cSrcweir 165*cdf0e10cSrcweir my @newitems = (); 166*cdf0e10cSrcweir 167*cdf0e10cSrcweir for ( my $i = 0; $i <= $#{$productarrayref}; $i++ ) 168*cdf0e10cSrcweir { 169*cdf0e10cSrcweir my $oneitem = ${$productarrayref}[$i]; 170*cdf0e10cSrcweir my $styles = ""; 171*cdf0e10cSrcweir 172*cdf0e10cSrcweir if ( $oneitem->{'Styles'} ) { $styles = $oneitem->{'Styles'}; } 173*cdf0e10cSrcweir 174*cdf0e10cSrcweir if (!($styles =~ /\bDELETE_ONLY\b/)) 175*cdf0e10cSrcweir { 176*cdf0e10cSrcweir push(@newitems, $oneitem); 177*cdf0e10cSrcweir } 178*cdf0e10cSrcweir } 179*cdf0e10cSrcweir 180*cdf0e10cSrcweir return \@newitems; 181*cdf0e10cSrcweir} 182*cdf0e10cSrcweir 183*cdf0e10cSrcweir############################################################################# 184*cdf0e10cSrcweir# Files with flag NOT_IN_SUITE do not need to be packed into 185*cdf0e10cSrcweir# Suite installation sets 186*cdf0e10cSrcweir############################################################################# 187*cdf0e10cSrcweir 188*cdf0e10cSrcweirsub remove_notinsuite_files_from_productlists 189*cdf0e10cSrcweir{ 190*cdf0e10cSrcweir my ($productarrayref) = @_; 191*cdf0e10cSrcweir 192*cdf0e10cSrcweir if ( $installer::globals::debug ) { installer::logger::debuginfo("installer::scriptitems::remove_notinsuite_files_from_productlists : $#{$productarrayref}"); } 193*cdf0e10cSrcweir 194*cdf0e10cSrcweir my @newitems = (); 195*cdf0e10cSrcweir 196*cdf0e10cSrcweir for ( my $i = 0; $i <= $#{$productarrayref}; $i++ ) 197*cdf0e10cSrcweir { 198*cdf0e10cSrcweir my $oneitem = ${$productarrayref}[$i]; 199*cdf0e10cSrcweir my $styles = ""; 200*cdf0e10cSrcweir 201*cdf0e10cSrcweir if ( $oneitem->{'Styles'} ) { $styles = $oneitem->{'Styles'}; } 202*cdf0e10cSrcweir 203*cdf0e10cSrcweir if (!($styles =~ /\bNOT_IN_SUITE\b/)) 204*cdf0e10cSrcweir { 205*cdf0e10cSrcweir push(@newitems, $oneitem); 206*cdf0e10cSrcweir } 207*cdf0e10cSrcweir else 208*cdf0e10cSrcweir { 209*cdf0e10cSrcweir my $infoline = "INFO: Flag NOT_IN_SUITE \-\> Removing $oneitem->{'gid'} from file list.\n"; 210*cdf0e10cSrcweir push( @installer::globals::globallogfileinfo, $infoline); 211*cdf0e10cSrcweir } 212*cdf0e10cSrcweir } 213*cdf0e10cSrcweir 214*cdf0e10cSrcweir return \@newitems; 215*cdf0e10cSrcweir} 216*cdf0e10cSrcweir 217*cdf0e10cSrcweir############################################################################# 218*cdf0e10cSrcweir# Files with flag NOT_IN_SUITE do not need to be packed into 219*cdf0e10cSrcweir# Suite installation sets 220*cdf0e10cSrcweir############################################################################# 221*cdf0e10cSrcweir 222*cdf0e10cSrcweirsub remove_office_start_language_files 223*cdf0e10cSrcweir{ 224*cdf0e10cSrcweir my ($productarrayref) = @_; 225*cdf0e10cSrcweir 226*cdf0e10cSrcweir if ( $installer::globals::debug ) { installer::logger::debuginfo("installer::scriptitems::remove_notinsuite_files_from_productlists : $#{$productarrayref}"); } 227*cdf0e10cSrcweir 228*cdf0e10cSrcweir my @newitems = (); 229*cdf0e10cSrcweir 230*cdf0e10cSrcweir for ( my $i = 0; $i <= $#{$productarrayref}; $i++ ) 231*cdf0e10cSrcweir { 232*cdf0e10cSrcweir my $oneitem = ${$productarrayref}[$i]; 233*cdf0e10cSrcweir my $styles = ""; 234*cdf0e10cSrcweir 235*cdf0e10cSrcweir if ( $oneitem->{'Styles'} ) { $styles = $oneitem->{'Styles'}; } 236*cdf0e10cSrcweir 237*cdf0e10cSrcweir if (!($styles =~ /\bSET_OFFICE_LANGUAGE\b/)) 238*cdf0e10cSrcweir { 239*cdf0e10cSrcweir push(@newitems, $oneitem); 240*cdf0e10cSrcweir } 241*cdf0e10cSrcweir else 242*cdf0e10cSrcweir { 243*cdf0e10cSrcweir my $infoline = "INFO: Flag SET_OFFICE_LANGUAGE \-\> Removing $oneitem->{'gid'} from file list.\n"; 244*cdf0e10cSrcweir push( @installer::globals::logfileinfo, $infoline); 245*cdf0e10cSrcweir } 246*cdf0e10cSrcweir } 247*cdf0e10cSrcweir 248*cdf0e10cSrcweir return \@newitems; 249*cdf0e10cSrcweir} 250*cdf0e10cSrcweir 251*cdf0e10cSrcweir############################################################################# 252*cdf0e10cSrcweir# Registryitems for Uninstall have to be removed 253*cdf0e10cSrcweir############################################################################# 254*cdf0e10cSrcweir 255*cdf0e10cSrcweirsub remove_uninstall_regitems_from_script 256*cdf0e10cSrcweir{ 257*cdf0e10cSrcweir my ($registryarrayref) = @_; 258*cdf0e10cSrcweir 259*cdf0e10cSrcweir if ( $installer::globals::debug ) { installer::logger::debuginfo("installer::scriptitems::remove_uninstall_regitems_from_script : $#{$registryarrayref}"); } 260*cdf0e10cSrcweir 261*cdf0e10cSrcweir my @newitems = (); 262*cdf0e10cSrcweir 263*cdf0e10cSrcweir for ( my $i = 0; $i <= $#{$registryarrayref}; $i++ ) 264*cdf0e10cSrcweir { 265*cdf0e10cSrcweir my $oneitem = ${$registryarrayref}[$i]; 266*cdf0e10cSrcweir my $subkey = ""; 267*cdf0e10cSrcweir 268*cdf0e10cSrcweir if ( $oneitem->{'Subkey'} ) { $subkey = $oneitem->{'Subkey'}; } 269*cdf0e10cSrcweir 270*cdf0e10cSrcweir if ( $subkey =~ /Software\\Microsoft\\Windows\\CurrentVersion\\Uninstall/ ) { next; } 271*cdf0e10cSrcweir 272*cdf0e10cSrcweir push(@newitems, $oneitem); 273*cdf0e10cSrcweir } 274*cdf0e10cSrcweir 275*cdf0e10cSrcweir return \@newitems; 276*cdf0e10cSrcweir} 277*cdf0e10cSrcweir 278*cdf0e10cSrcweir############################################################################## 279*cdf0e10cSrcweir# Searching the language module for a specified language 280*cdf0e10cSrcweir############################################################################## 281*cdf0e10cSrcweir 282*cdf0e10cSrcweirsub get_languagespecific_module 283*cdf0e10cSrcweir{ 284*cdf0e10cSrcweir my ( $lang, $modulestring ) = @_; 285*cdf0e10cSrcweir 286*cdf0e10cSrcweir my $langmodulestring = ""; 287*cdf0e10cSrcweir 288*cdf0e10cSrcweir my $module; 289*cdf0e10cSrcweir foreach $module ( keys %installer::globals::alllangmodules ) 290*cdf0e10cSrcweir { 291*cdf0e10cSrcweir if (( $installer::globals::alllangmodules{$module} eq $lang ) && ( $modulestring =~ /\b$module\b/ )) 292*cdf0e10cSrcweir { 293*cdf0e10cSrcweir $langmodulestring = "$langmodulestring,$module"; 294*cdf0e10cSrcweir } 295*cdf0e10cSrcweir } 296*cdf0e10cSrcweir 297*cdf0e10cSrcweir $langmodulestring =~ s/^\s*,//; 298*cdf0e10cSrcweir 299*cdf0e10cSrcweir if ( $langmodulestring eq "" ) { installer::exiter::exit_program("ERROR: No language pack module found for language $lang in string \"$modulestring\"!", "get_languagespecific_module"); } 300*cdf0e10cSrcweir 301*cdf0e10cSrcweir return $langmodulestring; 302*cdf0e10cSrcweir} 303*cdf0e10cSrcweir 304*cdf0e10cSrcweir############################################################################## 305*cdf0e10cSrcweir# Removing all items in product lists which do not have the correct languages 306*cdf0e10cSrcweir############################################################################## 307*cdf0e10cSrcweir 308*cdf0e10cSrcweirsub resolving_all_languages_in_productlists 309*cdf0e10cSrcweir{ 310*cdf0e10cSrcweir my ($productarrayref, $languagesarrayref) = @_; 311*cdf0e10cSrcweir 312*cdf0e10cSrcweir if ( $installer::globals::debug ) { installer::logger::debuginfo("installer::scriptitems::resolving_all_languages_in_productlists : $#{$productarrayref} : $#{$languagesarrayref}"); } 313*cdf0e10cSrcweir 314*cdf0e10cSrcweir my @itemsinalllanguages = (); 315*cdf0e10cSrcweir 316*cdf0e10cSrcweir my ($key, $value); 317*cdf0e10cSrcweir 318*cdf0e10cSrcweir for ( my $i = 0; $i <= $#{$productarrayref}; $i++ ) 319*cdf0e10cSrcweir { 320*cdf0e10cSrcweir my $oneitem = ${$productarrayref}[$i]; 321*cdf0e10cSrcweir 322*cdf0e10cSrcweir my $ismultilingual = $oneitem->{'ismultilingual'}; 323*cdf0e10cSrcweir 324*cdf0e10cSrcweir if (!($ismultilingual)) # nothing to do with single language items 325*cdf0e10cSrcweir { 326*cdf0e10cSrcweir $oneitem->{'specificlanguage'} = ""; 327*cdf0e10cSrcweir push(@itemsinalllanguages, $oneitem); 328*cdf0e10cSrcweir } 329*cdf0e10cSrcweir else #all language dependent files 330*cdf0e10cSrcweir { 331*cdf0e10cSrcweir for ( my $j = 0; $j <= $#{$languagesarrayref}; $j++ ) # iterating over all languages 332*cdf0e10cSrcweir { 333*cdf0e10cSrcweir my $onelanguage = ${$languagesarrayref}[$j]; 334*cdf0e10cSrcweir 335*cdf0e10cSrcweir my %oneitemhash = (); 336*cdf0e10cSrcweir 337*cdf0e10cSrcweir foreach $key (keys %{$oneitem}) 338*cdf0e10cSrcweir { 339*cdf0e10cSrcweir if ( $key =~ /\(\S+\)/ ) # this are the language dependent keys 340*cdf0e10cSrcweir { 341*cdf0e10cSrcweir if ( $key =~ /\(\Q$onelanguage\E\)/ ) 342*cdf0e10cSrcweir { 343*cdf0e10cSrcweir $value = $oneitem->{$key}; 344*cdf0e10cSrcweir $oneitemhash{$key} = $value; 345*cdf0e10cSrcweir } 346*cdf0e10cSrcweir } 347*cdf0e10cSrcweir else 348*cdf0e10cSrcweir { 349*cdf0e10cSrcweir $value = $oneitem->{$key}; 350*cdf0e10cSrcweir $oneitemhash{$key} = $value; 351*cdf0e10cSrcweir } 352*cdf0e10cSrcweir } 353*cdf0e10cSrcweir 354*cdf0e10cSrcweir $oneitemhash{'specificlanguage'} = $onelanguage; 355*cdf0e10cSrcweir 356*cdf0e10cSrcweir if ( $oneitemhash{'haslanguagemodule'} ) 357*cdf0e10cSrcweir { 358*cdf0e10cSrcweir my $langmodulestring = get_languagespecific_module($onelanguage, $oneitemhash{'modules'}); 359*cdf0e10cSrcweir $oneitemhash{'modules'} = $langmodulestring; 360*cdf0e10cSrcweir } 361*cdf0e10cSrcweir 362*cdf0e10cSrcweir push(@itemsinalllanguages, \%oneitemhash); 363*cdf0e10cSrcweir } 364*cdf0e10cSrcweir } 365*cdf0e10cSrcweir } 366*cdf0e10cSrcweir 367*cdf0e10cSrcweir return \@itemsinalllanguages; 368*cdf0e10cSrcweir} 369*cdf0e10cSrcweir 370*cdf0e10cSrcweir################################################################################ 371*cdf0e10cSrcweir# Removing all modules, that have the flag LANGUAGEMODULE, but do not 372*cdf0e10cSrcweir# have the correct language 373*cdf0e10cSrcweir################################################################################ 374*cdf0e10cSrcweir 375*cdf0e10cSrcweirsub remove_not_required_language_modules 376*cdf0e10cSrcweir{ 377*cdf0e10cSrcweir my ($modulesarrayref, $languagesarrayref) = @_; 378*cdf0e10cSrcweir 379*cdf0e10cSrcweir my @allmodules = (); 380*cdf0e10cSrcweir 381*cdf0e10cSrcweir for ( my $i = 0; $i <= $#{$modulesarrayref}; $i++ ) 382*cdf0e10cSrcweir { 383*cdf0e10cSrcweir my $module = ${$modulesarrayref}[$i]; 384*cdf0e10cSrcweir my $styles = ""; 385*cdf0e10cSrcweir if ( $module->{'Styles'} ) { $styles = $module->{'Styles'}; } 386*cdf0e10cSrcweir 387*cdf0e10cSrcweir if ( $styles =~ /\bLANGUAGEMODULE\b/ ) 388*cdf0e10cSrcweir { 389*cdf0e10cSrcweir if ( ! exists($module->{'Language'}) ) { installer::exiter::exit_program("ERROR: \"$module->{'gid'}\" has flag LANGUAGEMODULE, but does not know its language!", "remove_not_required_language_modules"); } 390*cdf0e10cSrcweir my $modulelanguage = $module->{'Language'}; 391*cdf0e10cSrcweir # checking, if language is required 392*cdf0e10cSrcweir my $doinclude = 0; 393*cdf0e10cSrcweir for ( my $j = 0; $j <= $#{$languagesarrayref}; $j++ ) 394*cdf0e10cSrcweir { 395*cdf0e10cSrcweir my $onelanguage = ${$languagesarrayref}[$j]; 396*cdf0e10cSrcweir if ( $onelanguage eq $modulelanguage ) 397*cdf0e10cSrcweir { 398*cdf0e10cSrcweir $doinclude = 1; 399*cdf0e10cSrcweir last; 400*cdf0e10cSrcweir } 401*cdf0e10cSrcweir } 402*cdf0e10cSrcweir 403*cdf0e10cSrcweir if ( $doinclude ) { push(@allmodules, $module); } 404*cdf0e10cSrcweir } 405*cdf0e10cSrcweir else 406*cdf0e10cSrcweir { 407*cdf0e10cSrcweir push(@allmodules, $module); 408*cdf0e10cSrcweir } 409*cdf0e10cSrcweir } 410*cdf0e10cSrcweir 411*cdf0e10cSrcweir return \@allmodules; 412*cdf0e10cSrcweir} 413*cdf0e10cSrcweir 414*cdf0e10cSrcweir################################################################################ 415*cdf0e10cSrcweir# Removing all modules, that have a spellchecker language that is not 416*cdf0e10cSrcweir# required for this product (spellchecker selection). 417*cdf0e10cSrcweir# All required spellchecker languages are stored in 418*cdf0e10cSrcweir# %installer::globals::spellcheckerlanguagehash 419*cdf0e10cSrcweir################################################################################ 420*cdf0e10cSrcweir 421*cdf0e10cSrcweirsub remove_not_required_spellcheckerlanguage_modules 422*cdf0e10cSrcweir{ 423*cdf0e10cSrcweir my ($modulesarrayref) = @_; 424*cdf0e10cSrcweir 425*cdf0e10cSrcweir my $infoline = ""; 426*cdf0e10cSrcweir my @allmodules = (); 427*cdf0e10cSrcweir 428*cdf0e10cSrcweir for ( my $i = 0; $i <= $#{$modulesarrayref}; $i++ ) 429*cdf0e10cSrcweir { 430*cdf0e10cSrcweir my $module = ${$modulesarrayref}[$i]; 431*cdf0e10cSrcweir if ( $module->{'Spellcheckerlanguage'} ) # selecting modules with Spellcheckerlanguage 432*cdf0e10cSrcweir { 433*cdf0e10cSrcweir if ( exists($installer::globals::spellcheckerlanguagehash{$module->{'Spellcheckerlanguage'}}) ) 434*cdf0e10cSrcweir { 435*cdf0e10cSrcweir push(@allmodules, $module); 436*cdf0e10cSrcweir } 437*cdf0e10cSrcweir else 438*cdf0e10cSrcweir { 439*cdf0e10cSrcweir $infoline = "Spellchecker selection: Removing module $module->{'gid'}\n"; 440*cdf0e10cSrcweir push( @installer::globals::logfileinfo, $infoline); 441*cdf0e10cSrcweir 442*cdf0e10cSrcweir # Collecting all files at modules that are removed 443*cdf0e10cSrcweir 444*cdf0e10cSrcweir if ( $module->{'Files'} ) 445*cdf0e10cSrcweir { 446*cdf0e10cSrcweir if ( $module->{'Files'} =~ /^\s*\((.*?)\)\s*$/ ) 447*cdf0e10cSrcweir { 448*cdf0e10cSrcweir my $filelist = $1; 449*cdf0e10cSrcweir 450*cdf0e10cSrcweir my $filelisthash = installer::converter::convert_stringlist_into_hash(\$filelist, ","); 451*cdf0e10cSrcweir foreach my $onefile ( keys %{$filelisthash} ) { $installer::globals::spellcheckerfilehash{$onefile} = 1; } 452*cdf0e10cSrcweir } 453*cdf0e10cSrcweir } 454*cdf0e10cSrcweir } 455*cdf0e10cSrcweir } 456*cdf0e10cSrcweir else 457*cdf0e10cSrcweir { 458*cdf0e10cSrcweir push(@allmodules, $module); 459*cdf0e10cSrcweir } 460*cdf0e10cSrcweir } 461*cdf0e10cSrcweir 462*cdf0e10cSrcweir return \@allmodules; 463*cdf0e10cSrcweir} 464*cdf0e10cSrcweir 465*cdf0e10cSrcweir################################################################################ 466*cdf0e10cSrcweir# Removing all modules, that belong to a module that was removed 467*cdf0e10cSrcweir# in "remove_not_required_spellcheckerlanguage_modules" because of the 468*cdf0e10cSrcweir# spellchecker language. The files belonging to the modules are collected 469*cdf0e10cSrcweir# in %installer::globals::spellcheckerfilehash. 470*cdf0e10cSrcweir################################################################################ 471*cdf0e10cSrcweir 472*cdf0e10cSrcweirsub remove_not_required_spellcheckerlanguage_files 473*cdf0e10cSrcweir{ 474*cdf0e10cSrcweir my ($filesarrayref) = @_; 475*cdf0e10cSrcweir 476*cdf0e10cSrcweir my @filesarray = (); 477*cdf0e10cSrcweir my $infoline = ""; 478*cdf0e10cSrcweir 479*cdf0e10cSrcweir for ( my $i = 0; $i <= $#{$filesarrayref}; $i++ ) 480*cdf0e10cSrcweir { 481*cdf0e10cSrcweir my $onefile = ${$filesarrayref}[$i]; 482*cdf0e10cSrcweir if ( exists($installer::globals::spellcheckerfilehash{$onefile->{'gid'}}) ) 483*cdf0e10cSrcweir { 484*cdf0e10cSrcweir $infoline = "Spellchecker selection: Removing file $onefile->{'gid'}\n"; 485*cdf0e10cSrcweir push( @installer::globals::logfileinfo, $infoline); 486*cdf0e10cSrcweir next; 487*cdf0e10cSrcweir } 488*cdf0e10cSrcweir push(@filesarray, $onefile); 489*cdf0e10cSrcweir } 490*cdf0e10cSrcweir 491*cdf0e10cSrcweir return \@filesarray; 492*cdf0e10cSrcweir} 493*cdf0e10cSrcweir 494*cdf0e10cSrcweir################################################################################ 495*cdf0e10cSrcweir# Looking for directories without correct HostName 496*cdf0e10cSrcweir################################################################################ 497*cdf0e10cSrcweir 498*cdf0e10cSrcweirsub checking_directories_with_corrupt_hostname 499*cdf0e10cSrcweir{ 500*cdf0e10cSrcweir my ($dirsref, $languagesarrayref) = @_; 501*cdf0e10cSrcweir 502*cdf0e10cSrcweir for ( my $i = 0; $i <= $#{$dirsref}; $i++ ) 503*cdf0e10cSrcweir { 504*cdf0e10cSrcweir my $onedir = ${$dirsref}[$i]; 505*cdf0e10cSrcweir 506*cdf0e10cSrcweir my $hostname = ""; 507*cdf0e10cSrcweir 508*cdf0e10cSrcweir if ( $onedir->{'HostName'} ) { $hostname = $onedir->{'HostName'}; } 509*cdf0e10cSrcweir 510*cdf0e10cSrcweir if ( $hostname eq "" ) 511*cdf0e10cSrcweir { 512*cdf0e10cSrcweir my $langstring = ""; 513*cdf0e10cSrcweir for ( my $j = 0; $j <= $#{$languagesarrayref}; $j++ ) { $langstring .= ${$languagesarrayref}[$j] . " "; } 514*cdf0e10cSrcweir installer::exiter::exit_program("ERROR: HostName not defined for $onedir->{'gid'} for specified language. Probably you wanted to create an installation set, in a language not defined in scp2 project. You selected the following language(s): $langstring", "checking_directories_with_corrupt_hostname"); 515*cdf0e10cSrcweir } 516*cdf0e10cSrcweir 517*cdf0e10cSrcweir if ( $hostname eq "FAILURE" ) 518*cdf0e10cSrcweir { 519*cdf0e10cSrcweir installer::exiter::exit_program("ERROR: Could not create HostName for $onedir->{'gid'} (missing language at parent). See logfile warning for more info!", "checking_directories_with_corrupt_hostname"); 520*cdf0e10cSrcweir } 521*cdf0e10cSrcweir } 522*cdf0e10cSrcweir} 523*cdf0e10cSrcweir 524*cdf0e10cSrcweir################################################################################ 525*cdf0e10cSrcweir# Setting global properties 526*cdf0e10cSrcweir################################################################################ 527*cdf0e10cSrcweir 528*cdf0e10cSrcweirsub set_global_directory_hostnames 529*cdf0e10cSrcweir{ 530*cdf0e10cSrcweir my ($dirsref, $allvariables) = @_; 531*cdf0e10cSrcweir 532*cdf0e10cSrcweir for ( my $i = 0; $i <= $#{$dirsref}; $i++ ) 533*cdf0e10cSrcweir { 534*cdf0e10cSrcweir my $onedir = ${$dirsref}[$i]; 535*cdf0e10cSrcweir my $styles = ""; 536*cdf0e10cSrcweir if ( $onedir->{'Styles'} ) { $styles = $onedir->{'Styles'}; } 537*cdf0e10cSrcweir 538*cdf0e10cSrcweir if ( $styles =~ /\bOFFICEDIRECTORY\b/ ) 539*cdf0e10cSrcweir { 540*cdf0e10cSrcweir $installer::globals::officedirhostname = $onedir->{'HostName'}; 541*cdf0e10cSrcweir $installer::globals::officedirgid = $onedir->{'gid'}; 542*cdf0e10cSrcweir $allvariables->{'OFFICEDIRECTORYHOSTNAME'} = $installer::globals::officedirhostname; 543*cdf0e10cSrcweir } 544*cdf0e10cSrcweir if ( $styles =~ /\bSUNDIRECTORY\b/ ) 545*cdf0e10cSrcweir { 546*cdf0e10cSrcweir $installer::globals::sundirhostname = $onedir->{'HostName'}; 547*cdf0e10cSrcweir $installer::globals::sundirgid = $onedir->{'gid'}; 548*cdf0e10cSrcweir $allvariables->{'SUNDIRECTORYHOSTNAME'} = $installer::globals::sundirhostname; 549*cdf0e10cSrcweir } 550*cdf0e10cSrcweir } 551*cdf0e10cSrcweir} 552*cdf0e10cSrcweir 553*cdf0e10cSrcweir######################################################## 554*cdf0e10cSrcweir# Recursively defined procedure to order 555*cdf0e10cSrcweir# modules and directories 556*cdf0e10cSrcweir######################################################## 557*cdf0e10cSrcweir 558*cdf0e10cSrcweirsub get_children 559*cdf0e10cSrcweir{ 560*cdf0e10cSrcweir my ($allitems, $startparent, $newitemorder) = @_; 561*cdf0e10cSrcweir 562*cdf0e10cSrcweir for ( my $i = 0; $i <= $#{$allitems}; $i++ ) 563*cdf0e10cSrcweir { 564*cdf0e10cSrcweir my $gid = ${$allitems}[$i]->{'gid'}; 565*cdf0e10cSrcweir my $parent = ""; 566*cdf0e10cSrcweir if ( ${$allitems}[$i]->{'ParentID'} ) { $parent = ${$allitems}[$i]->{'ParentID'}; } 567*cdf0e10cSrcweir 568*cdf0e10cSrcweir if ( $parent eq $startparent ) 569*cdf0e10cSrcweir { 570*cdf0e10cSrcweir push(@{$newitemorder}, ${$allitems}[$i]); 571*cdf0e10cSrcweir my $parent = $gid; 572*cdf0e10cSrcweir get_children($allitems, $parent, $newitemorder); # recursive! 573*cdf0e10cSrcweir } 574*cdf0e10cSrcweir } 575*cdf0e10cSrcweir} 576*cdf0e10cSrcweir 577*cdf0e10cSrcweir################################################################################ 578*cdf0e10cSrcweir# Using different HostName for language packs 579*cdf0e10cSrcweir################################################################################ 580*cdf0e10cSrcweir 581*cdf0e10cSrcweirsub use_langpack_hostname 582*cdf0e10cSrcweir{ 583*cdf0e10cSrcweir my ($dirsref) = @_; 584*cdf0e10cSrcweir 585*cdf0e10cSrcweir for ( my $i = 0; $i <= $#{$dirsref}; $i++ ) 586*cdf0e10cSrcweir { 587*cdf0e10cSrcweir my $onedir = ${$dirsref}[$i]; 588*cdf0e10cSrcweir if (( $onedir->{'LangPackHostName'} ) && ( $onedir->{'LangPackHostName'} ne "" )) { $onedir->{'HostName'} = $onedir->{'LangPackHostName'}; } 589*cdf0e10cSrcweir } 590*cdf0e10cSrcweir} 591*cdf0e10cSrcweir 592*cdf0e10cSrcweir################################################################################ 593*cdf0e10cSrcweir# Using different HostName for language packs 594*cdf0e10cSrcweir################################################################################ 595*cdf0e10cSrcweir 596*cdf0e10cSrcweirsub use_patch_hostname 597*cdf0e10cSrcweir{ 598*cdf0e10cSrcweir my ($dirsref) = @_; 599*cdf0e10cSrcweir 600*cdf0e10cSrcweir for ( my $i = 0; $i <= $#{$dirsref}; $i++ ) 601*cdf0e10cSrcweir { 602*cdf0e10cSrcweir my $onedir = ${$dirsref}[$i]; 603*cdf0e10cSrcweir if (( $onedir->{'PatchHostName'} ) && ( $onedir->{'PatchHostName'} ne "" )) { $onedir->{'HostName'} = $onedir->{'PatchHostName'}; } 604*cdf0e10cSrcweir } 605*cdf0e10cSrcweir} 606*cdf0e10cSrcweir 607*cdf0e10cSrcweir################################################################################ 608*cdf0e10cSrcweir# Using different HostName for language packs 609*cdf0e10cSrcweir################################################################################ 610*cdf0e10cSrcweir 611*cdf0e10cSrcweirsub use_langpack_copy_scpaction 612*cdf0e10cSrcweir{ 613*cdf0e10cSrcweir my ($scpactionsref) = @_; 614*cdf0e10cSrcweir 615*cdf0e10cSrcweir for ( my $i = 0; $i <= $#{$scpactionsref}; $i++ ) 616*cdf0e10cSrcweir { 617*cdf0e10cSrcweir my $onescpaction = ${$scpactionsref}[$i]; 618*cdf0e10cSrcweir if (( $onescpaction->{'LangPackCopy'} ) && ( $onescpaction->{'LangPackCopy'} ne "" )) { $onescpaction->{'Copy'} = $onescpaction->{'LangPackCopy'}; } 619*cdf0e10cSrcweir } 620*cdf0e10cSrcweir} 621*cdf0e10cSrcweir 622*cdf0e10cSrcweir################################################################################ 623*cdf0e10cSrcweir# Using different HostName for language packs 624*cdf0e10cSrcweir################################################################################ 625*cdf0e10cSrcweir 626*cdf0e10cSrcweirsub use_patch_copy_scpaction 627*cdf0e10cSrcweir{ 628*cdf0e10cSrcweir my ($scpactionsref) = @_; 629*cdf0e10cSrcweir 630*cdf0e10cSrcweir for ( my $i = 0; $i <= $#{$scpactionsref}; $i++ ) 631*cdf0e10cSrcweir { 632*cdf0e10cSrcweir my $onescpaction = ${$scpactionsref}[$i]; 633*cdf0e10cSrcweir if (( $onescpaction->{'PatchCopy'} ) && ( $onescpaction->{'PatchCopy'} ne "" )) { $onescpaction->{'Copy'} = $onescpaction->{'PatchCopy'}; } 634*cdf0e10cSrcweir } 635*cdf0e10cSrcweir} 636*cdf0e10cSrcweir 637*cdf0e10cSrcweir################################################################################ 638*cdf0e10cSrcweir# Shifting parent directories of URE and Basis layer, so that 639*cdf0e10cSrcweir# these directories are located below the Brand layer. 640*cdf0e10cSrcweir# Style: SHIFT_BASIS_INTO_BRAND_LAYER 641*cdf0e10cSrcweir################################################################################ 642*cdf0e10cSrcweir 643*cdf0e10cSrcweirsub shift_basis_directory_parents 644*cdf0e10cSrcweir{ 645*cdf0e10cSrcweir my ($dirsref) = @_; 646*cdf0e10cSrcweir 647*cdf0e10cSrcweir my @alldirs = (); 648*cdf0e10cSrcweir my @savedirs = (); 649*cdf0e10cSrcweir my @shifteddirs = (); 650*cdf0e10cSrcweir 651*cdf0e10cSrcweir my $officedirgid = ""; 652*cdf0e10cSrcweir 653*cdf0e10cSrcweir for ( my $i = 0; $i <= $#{$dirsref}; $i++ ) 654*cdf0e10cSrcweir { 655*cdf0e10cSrcweir my $onedir = ${$dirsref}[$i]; 656*cdf0e10cSrcweir my $styles = ""; 657*cdf0e10cSrcweir if ( $onedir->{'Styles'} ) { $styles = $onedir->{'Styles'}; } 658*cdf0e10cSrcweir 659*cdf0e10cSrcweir if ( $styles =~ /\bOFFICEDIRECTORY\b/ ) { $officedirgid = $onedir->{'gid'}; } 660*cdf0e10cSrcweir } 661*cdf0e10cSrcweir 662*cdf0e10cSrcweir if ( $officedirgid ne "" ) 663*cdf0e10cSrcweir { 664*cdf0e10cSrcweir for ( my $i = 0; $i <= $#{$dirsref}; $i++ ) 665*cdf0e10cSrcweir { 666*cdf0e10cSrcweir my $onedir = ${$dirsref}[$i]; 667*cdf0e10cSrcweir my $styles = ""; 668*cdf0e10cSrcweir if ( $onedir->{'Styles'} ) { $styles = $onedir->{'Styles'}; } 669*cdf0e10cSrcweir 670*cdf0e10cSrcweir if (( $styles =~ /\bBASISDIRECTORY\b/ ) || ( $styles =~ /\bUREDIRECTORY\b/ )) 671*cdf0e10cSrcweir { 672*cdf0e10cSrcweir $onedir->{'ParentID'} = $officedirgid; 673*cdf0e10cSrcweir } 674*cdf0e10cSrcweir } 675*cdf0e10cSrcweir 676*cdf0e10cSrcweir # Sorting directories 677*cdf0e10cSrcweir my $startgid = "PREDEFINED_PROGDIR"; 678*cdf0e10cSrcweir get_children($dirsref, $startgid, \@alldirs); 679*cdf0e10cSrcweir } 680*cdf0e10cSrcweir 681*cdf0e10cSrcweir return \@alldirs; 682*cdf0e10cSrcweir} 683*cdf0e10cSrcweir 684*cdf0e10cSrcweir################################################################################ 685*cdf0e10cSrcweir# Setting the name of the directory with style OFFICEDIRECTORY. 686*cdf0e10cSrcweir# The name can be defined in property OFFICEDIRECTORYNAME. 687*cdf0e10cSrcweir################################################################################ 688*cdf0e10cSrcweir 689*cdf0e10cSrcweirsub set_officedirectory_name 690*cdf0e10cSrcweir{ 691*cdf0e10cSrcweir my ($dirsref, $officedirname) = @_; 692*cdf0e10cSrcweir 693*cdf0e10cSrcweir for ( my $i = 0; $i <= $#{$dirsref}; $i++ ) 694*cdf0e10cSrcweir { 695*cdf0e10cSrcweir my $onedir = ${$dirsref}[$i]; 696*cdf0e10cSrcweir my $styles = ""; 697*cdf0e10cSrcweir if ( $onedir->{'Styles'} ) { $styles = $onedir->{'Styles'}; } 698*cdf0e10cSrcweir if ( $styles =~ /\bOFFICEDIRECTORY\b/ ) 699*cdf0e10cSrcweir { 700*cdf0e10cSrcweir $onedir->{'HostName'} = $officedirname; 701*cdf0e10cSrcweir last; 702*cdf0e10cSrcweir } 703*cdf0e10cSrcweir } 704*cdf0e10cSrcweir} 705*cdf0e10cSrcweir 706*cdf0e10cSrcweir################################################################################ 707*cdf0e10cSrcweir# Simplifying the name for language dependent items from "Name (xy)" to "Name" 708*cdf0e10cSrcweir################################################################################ 709*cdf0e10cSrcweir 710*cdf0e10cSrcweirsub changing_name_of_language_dependent_keys 711*cdf0e10cSrcweir{ 712*cdf0e10cSrcweir my ($itemsarrayref) = @_; 713*cdf0e10cSrcweir 714*cdf0e10cSrcweir if ( $installer::globals::debug ) { installer::logger::debuginfo("installer::scriptitems::changing_name_of_language_dependent_keys : $#{$itemsarrayref}"); } 715*cdf0e10cSrcweir 716*cdf0e10cSrcweir # Changing key for multilingual items from "Name ( )" to "Name" or "HostName ( )" to "HostName" 717*cdf0e10cSrcweir 718*cdf0e10cSrcweir for ( my $i = 0; $i <= $#{$itemsarrayref}; $i++ ) 719*cdf0e10cSrcweir { 720*cdf0e10cSrcweir my $oneitem = ${$itemsarrayref}[$i]; 721*cdf0e10cSrcweir my $onelanguage = $oneitem->{'specificlanguage'}; 722*cdf0e10cSrcweir 723*cdf0e10cSrcweir if (!($onelanguage eq "" )) # language dependent item 724*cdf0e10cSrcweir { 725*cdf0e10cSrcweir my $itemkey; 726*cdf0e10cSrcweir 727*cdf0e10cSrcweir foreach $itemkey (keys %{$oneitem}) 728*cdf0e10cSrcweir { 729*cdf0e10cSrcweir if ( $itemkey =~ /^\s*(\S+?)\s+\(\S+\)\s*$/ ) 730*cdf0e10cSrcweir { 731*cdf0e10cSrcweir my $newitemkey = $1; 732*cdf0e10cSrcweir my $itemvalue = $oneitem->{$itemkey}; 733*cdf0e10cSrcweir $oneitem->{$newitemkey} = $itemvalue; 734*cdf0e10cSrcweir delete($oneitem->{$itemkey}); 735*cdf0e10cSrcweir } 736*cdf0e10cSrcweir } 737*cdf0e10cSrcweir } 738*cdf0e10cSrcweir } 739*cdf0e10cSrcweir} 740*cdf0e10cSrcweir 741*cdf0e10cSrcweir################################################################################ 742*cdf0e10cSrcweir# Collecting language specific names for language packs 743*cdf0e10cSrcweir################################################################################ 744*cdf0e10cSrcweir 745*cdf0e10cSrcweirsub collect_language_specific_names 746*cdf0e10cSrcweir{ 747*cdf0e10cSrcweir my ($itemsarrayref) = @_; 748*cdf0e10cSrcweir 749*cdf0e10cSrcweir for ( my $i = 0; $i <= $#{$itemsarrayref}; $i++ ) 750*cdf0e10cSrcweir { 751*cdf0e10cSrcweir my $oneitem = ${$itemsarrayref}[$i]; 752*cdf0e10cSrcweir my $styles = ""; 753*cdf0e10cSrcweir if ( $oneitem->{'Styles'} ) { $styles = $oneitem->{'Styles'}; } 754*cdf0e10cSrcweir 755*cdf0e10cSrcweir if ( $styles =~ /\bUSELANGUAGENAME\b/ ) 756*cdf0e10cSrcweir { 757*cdf0e10cSrcweir my $language = ""; 758*cdf0e10cSrcweir if ( $oneitem->{'Language'} ) { $language = $oneitem->{'Language'}; } 759*cdf0e10cSrcweir my $specificlanguage = ""; 760*cdf0e10cSrcweir if ( $oneitem->{'specificlanguage'} ) { $specificlanguage = $oneitem->{'specificlanguage'}; } 761*cdf0e10cSrcweir 762*cdf0e10cSrcweir if (( $language ne "" ) && ( $language eq $specificlanguage )) 763*cdf0e10cSrcweir { 764*cdf0e10cSrcweir if (! installer::existence::exists_in_array($oneitem->{'Name'}, \@installer::globals::languagenames )) 765*cdf0e10cSrcweir { 766*cdf0e10cSrcweir push(@installer::globals::languagenames, $oneitem->{'Name'}); 767*cdf0e10cSrcweir } 768*cdf0e10cSrcweir } 769*cdf0e10cSrcweir } 770*cdf0e10cSrcweir } 771*cdf0e10cSrcweir} 772*cdf0e10cSrcweir 773*cdf0e10cSrcweir################################################################################ 774*cdf0e10cSrcweir# Replacement of setup variables in ConfigurationItems and ProfileItems 775*cdf0e10cSrcweir# <productkey>, <buildid>, <sequence_languages>, <productcode>, <upgradecode>, <productupdate> 776*cdf0e10cSrcweir################################################################################ 777*cdf0e10cSrcweir 778*cdf0e10cSrcweirsub replace_setup_variables 779*cdf0e10cSrcweir{ 780*cdf0e10cSrcweir my ($itemsarrayref, $languagestringref, $hashref) = @_; 781*cdf0e10cSrcweir 782*cdf0e10cSrcweir if ( $installer::globals::debug ) { installer::logger::debuginfo("installer::scriptitems::replace_setup_variables : $#{$itemsarrayref} : $$languagestringref : $hashref->{'PRODUCTNAME'}"); } 783*cdf0e10cSrcweir 784*cdf0e10cSrcweir my $languagesstring = $$languagestringref; 785*cdf0e10cSrcweir $languagesstring =~ s/\_/ /g; # replacing underscore with whitespace 786*cdf0e10cSrcweir # $languagesstring is "01 49" instead of "en-US de" 787*cdf0e10cSrcweir installer::languages::fake_languagesstring(\$languagesstring); 788*cdf0e10cSrcweir 789*cdf0e10cSrcweir my $productname = $hashref->{'PRODUCTNAME'}; 790*cdf0e10cSrcweir my $productversion = $hashref->{'PRODUCTVERSION'}; 791*cdf0e10cSrcweir my $userdirproductversion = ""; 792*cdf0e10cSrcweir if ( $hashref->{'USERDIRPRODUCTVERSION'} ) { $userdirproductversion = $hashref->{'USERDIRPRODUCTVERSION'}; } 793*cdf0e10cSrcweir my $productkey = $productname . " " . $productversion; 794*cdf0e10cSrcweir 795*cdf0e10cSrcweir # string $buildid, which is used to replace the setup variable <buildid> 796*cdf0e10cSrcweir 797*cdf0e10cSrcweir my $localminor = "flat"; 798*cdf0e10cSrcweir if ( $installer::globals::minor ne "" ) { $localminor = $installer::globals::minor; } 799*cdf0e10cSrcweir else { $localminor = $installer::globals::lastminor; } 800*cdf0e10cSrcweir 801*cdf0e10cSrcweir my $localbuild = $installer::globals::build; 802*cdf0e10cSrcweir 803*cdf0e10cSrcweir if ( $localbuild =~ /^\s*(\w+?)(\d+)\s*$/ ) { $localbuild = $2; } # using "680" instead of "src680" 804*cdf0e10cSrcweir 805*cdf0e10cSrcweir my $buildidstring = $localbuild . $localminor . "(Build:" . $installer::globals::buildid . ")"; 806*cdf0e10cSrcweir 807*cdf0e10cSrcweir # the environment variable CWS_WORK_STAMP is set only in CWS 808*cdf0e10cSrcweir if ( $ENV{'CWS_WORK_STAMP'} ) { $buildidstring = $buildidstring . "\[CWS\:" . $ENV{'CWS_WORK_STAMP'} . "\]"; } 809*cdf0e10cSrcweir 810*cdf0e10cSrcweir if ( $localminor =~ /^\s*\w(\d+)\w*\s*$/ ) { $localminor = $1; } 811*cdf0e10cSrcweir 812*cdf0e10cSrcweir # $updateid 813*cdf0e10cSrcweir my $updateid = $productname . "_" . $userdirproductversion . "_" . $$languagestringref; 814*cdf0e10cSrcweir $updateid =~ s/ /_/g; 815*cdf0e10cSrcweir 816*cdf0e10cSrcweir for ( my $i = 0; $i <= $#{$itemsarrayref}; $i++ ) 817*cdf0e10cSrcweir { 818*cdf0e10cSrcweir my $oneitem = ${$itemsarrayref}[$i]; 819*cdf0e10cSrcweir my $value = $oneitem->{'Value'}; 820*cdf0e10cSrcweir 821*cdf0e10cSrcweir $value =~ s/\<buildid\>/$buildidstring/; 822*cdf0e10cSrcweir $value =~ s/\<sequence_languages\>/$languagesstring/; 823*cdf0e10cSrcweir $value =~ s/\<productkey\>/$productkey/; 824*cdf0e10cSrcweir $value =~ s/\<productcode\>/$installer::globals::productcode/; 825*cdf0e10cSrcweir $value =~ s/\<upgradecode\>/$installer::globals::upgradecode/; 826*cdf0e10cSrcweir $value =~ s/\<alllanguages\>/$languagesstring/; 827*cdf0e10cSrcweir $value =~ s/\<productmajor\>/$localbuild/; 828*cdf0e10cSrcweir $value =~ s/\<productminor\>/$localminor/; 829*cdf0e10cSrcweir $value =~ s/\<productbuildid\>/$installer::globals::buildid/; 830*cdf0e10cSrcweir $value =~ s/\<sourceid\>/$installer::globals::build/; 831*cdf0e10cSrcweir $value =~ s/\<updateid\>/$updateid/; 832*cdf0e10cSrcweir $value =~ s/\<pkgformat\>/$installer::globals::packageformat/; 833*cdf0e10cSrcweir 834*cdf0e10cSrcweir $oneitem->{'Value'} = $value; 835*cdf0e10cSrcweir } 836*cdf0e10cSrcweir} 837*cdf0e10cSrcweir 838*cdf0e10cSrcweir################################################################################ 839*cdf0e10cSrcweir# By defining variable LOCALUSERDIR in *.lst it is possible to change 840*cdf0e10cSrcweir# the standard destination of user directory defined in scp2 ($SYSUSERCONFIG). 841*cdf0e10cSrcweir################################################################################ 842*cdf0e10cSrcweir 843*cdf0e10cSrcweirsub replace_userdir_variable 844*cdf0e10cSrcweir{ 845*cdf0e10cSrcweir my ($itemsarrayref) = @_; 846*cdf0e10cSrcweir 847*cdf0e10cSrcweir my $userdir = ""; 848*cdf0e10cSrcweir if ( $allvariableshashref->{'LOCALUSERDIR'} ) { $userdir = $allvariableshashref->{'LOCALUSERDIR'}; } 849*cdf0e10cSrcweir else { $userdir = $installer::globals::simpledefaultuserdir; } 850*cdf0e10cSrcweir 851*cdf0e10cSrcweir if ( $userdir ne "" ) 852*cdf0e10cSrcweir { 853*cdf0e10cSrcweir for ( my $i = 0; $i <= $#{$itemsarrayref}; $i++ ) 854*cdf0e10cSrcweir { 855*cdf0e10cSrcweir my $oneitem = ${$itemsarrayref}[$i]; 856*cdf0e10cSrcweir $oneitem->{'Value'} =~ s/\$SYSUSERCONFIG/$userdir/; 857*cdf0e10cSrcweir } 858*cdf0e10cSrcweir } 859*cdf0e10cSrcweir} 860*cdf0e10cSrcweir 861*cdf0e10cSrcweir##################################################################################### 862*cdf0e10cSrcweir# Files and ConfigurationItems are not included for all languages. 863*cdf0e10cSrcweir# For instance asian fonts. These can be removed, if no "Name" is found. 864*cdf0e10cSrcweir# ConfigurationItems are not always defined in the linguistic configuration file. 865*cdf0e10cSrcweir# The "Key" cannot be found for them. 866*cdf0e10cSrcweir##################################################################################### 867*cdf0e10cSrcweir 868*cdf0e10cSrcweirsub remove_non_existent_languages_in_productlists 869*cdf0e10cSrcweir{ 870*cdf0e10cSrcweir my ($itemsarrayref, $languagestringref, $searchkey, $itemtype) = @_; 871*cdf0e10cSrcweir 872*cdf0e10cSrcweir if ( $installer::globals::debug ) { installer::logger::debuginfo("installer::scriptitems::remove_non_existent_languages_in_productlists : $#{$itemsarrayref} : $$languagestringref : $searchkey : $itemtype"); } 873*cdf0e10cSrcweir 874*cdf0e10cSrcweir # Removing of all non existent files, for instance asian fonts 875*cdf0e10cSrcweir 876*cdf0e10cSrcweir installer::logger::include_header_into_logfile("Removing for this language $$languagestringref:"); 877*cdf0e10cSrcweir 878*cdf0e10cSrcweir my @allexistentitems = (); 879*cdf0e10cSrcweir 880*cdf0e10cSrcweir my $infoline; 881*cdf0e10cSrcweir 882*cdf0e10cSrcweir for ( my $i = 0; $i <= $#{$itemsarrayref}; $i++ ) 883*cdf0e10cSrcweir { 884*cdf0e10cSrcweir my $oneitem = ${$itemsarrayref}[$i]; 885*cdf0e10cSrcweir my $oneitemname = ""; # $searchkey is "Name" for files and "Key" for ConfigurationItems 886*cdf0e10cSrcweir 887*cdf0e10cSrcweir if ( $oneitem->{$searchkey} ) { $oneitemname = $oneitem->{$searchkey} } 888*cdf0e10cSrcweir 889*cdf0e10cSrcweir my $itemtoberemoved = 0; 890*cdf0e10cSrcweir 891*cdf0e10cSrcweir if ($oneitemname eq "") # for instance asian font in english installation set 892*cdf0e10cSrcweir { 893*cdf0e10cSrcweir $itemtoberemoved = 1; 894*cdf0e10cSrcweir } 895*cdf0e10cSrcweir 896*cdf0e10cSrcweir if ($itemtoberemoved) 897*cdf0e10cSrcweir { 898*cdf0e10cSrcweir $infoline = "WARNING: Language $$languagestringref: No $itemtype packed for $oneitem->{'gid'}!\n"; 899*cdf0e10cSrcweir push( @installer::globals::logfileinfo, $infoline); 900*cdf0e10cSrcweir } 901*cdf0e10cSrcweir else 902*cdf0e10cSrcweir { 903*cdf0e10cSrcweir push(@allexistentitems, $oneitem); 904*cdf0e10cSrcweir } 905*cdf0e10cSrcweir } 906*cdf0e10cSrcweir 907*cdf0e10cSrcweir $infoline = "\n"; 908*cdf0e10cSrcweir push( @installer::globals::logfileinfo, $infoline); 909*cdf0e10cSrcweir 910*cdf0e10cSrcweir return \@allexistentitems; 911*cdf0e10cSrcweir} 912*cdf0e10cSrcweir 913*cdf0e10cSrcweir######################################################################## 914*cdf0e10cSrcweir# Input is the directory gid, output the "HostName" of the directory 915*cdf0e10cSrcweir######################################################################## 916*cdf0e10cSrcweir 917*cdf0e10cSrcweirsub get_Directoryname_From_Directorygid 918*cdf0e10cSrcweir{ 919*cdf0e10cSrcweir my ($dirsarrayref ,$searchgid, $onelanguage, $oneitemgid) = @_; 920*cdf0e10cSrcweir 921*cdf0e10cSrcweir if ( $installer::globals::debug ) { installer::logger::debuginfo("installer::scriptitems::get_Directoryname_From_Directorygid : $#{$dirsarrayref} : $searchgid : $onelanguage"); } 922*cdf0e10cSrcweir 923*cdf0e10cSrcweir my $directoryname = ""; 924*cdf0e10cSrcweir my $onedirectory; 925*cdf0e10cSrcweir my $foundgid = 0; 926*cdf0e10cSrcweir 927*cdf0e10cSrcweir for ( my $i = 0; $i <= $#{$dirsarrayref}; $i++ ) 928*cdf0e10cSrcweir { 929*cdf0e10cSrcweir $onedirectory = ${$dirsarrayref}[$i]; 930*cdf0e10cSrcweir my $directorygid = $onedirectory->{'gid'}; 931*cdf0e10cSrcweir 932*cdf0e10cSrcweir if ($directorygid eq $searchgid) 933*cdf0e10cSrcweir { 934*cdf0e10cSrcweir $foundgid = 1; 935*cdf0e10cSrcweir last; 936*cdf0e10cSrcweir } 937*cdf0e10cSrcweir } 938*cdf0e10cSrcweir 939*cdf0e10cSrcweir if (!($foundgid)) 940*cdf0e10cSrcweir { 941*cdf0e10cSrcweir installer::exiter::exit_program("ERROR: Gid $searchgid not defined in $installer::globals::setupscriptname", "get_Directoryname_From_Directorygid"); 942*cdf0e10cSrcweir } 943*cdf0e10cSrcweir 944*cdf0e10cSrcweir if ( ! ( $onedirectory->{'ismultilingual'} )) # the directory is not language dependent 945*cdf0e10cSrcweir { 946*cdf0e10cSrcweir $directoryname = $onedirectory->{'HostName'}; 947*cdf0e10cSrcweir } 948*cdf0e10cSrcweir else 949*cdf0e10cSrcweir { 950*cdf0e10cSrcweir $directoryname = $onedirectory->{"HostName ($onelanguage)"}; 951*cdf0e10cSrcweir } 952*cdf0e10cSrcweir 953*cdf0e10cSrcweir # gid_Dir_Template_Wizard_Letter is defined as language dependent directory, but the file gid_Dir_Template_Wizard_Letter 954*cdf0e10cSrcweir # is not language dependent. Therefore $onelanguage is not defined. But which language is the correct language for the 955*cdf0e10cSrcweir # directory? 956*cdf0e10cSrcweir # Perhaps better solution: In scp it must be forbidden to have a language independent file in a language dependent directory. 957*cdf0e10cSrcweir 958*cdf0e10cSrcweir if (( ! $directoryname ) && ( $onelanguage eq "" )) 959*cdf0e10cSrcweir { 960*cdf0e10cSrcweir installer::exiter::exit_program("ERROR (in scp): Directory $searchgid is language dependent, but not $oneitemgid inside this directory", "get_Directoryname_From_Directorygid"); 961*cdf0e10cSrcweir } 962*cdf0e10cSrcweir 963*cdf0e10cSrcweir return \$directoryname; 964*cdf0e10cSrcweir} 965*cdf0e10cSrcweir 966*cdf0e10cSrcweir################################################################## 967*cdf0e10cSrcweir# Getting destination direcotory for links, files and profiles 968*cdf0e10cSrcweir################################################################## 969*cdf0e10cSrcweir 970*cdf0e10cSrcweirsub get_Destination_Directory_For_Item_From_Directorylist # this is used for Files, Profiles and Links 971*cdf0e10cSrcweir{ 972*cdf0e10cSrcweir my ($itemarrayref, $dirsarrayref) = @_; 973*cdf0e10cSrcweir 974*cdf0e10cSrcweir if ( $installer::globals::debug ) { installer::logger::debuginfo("installer::scriptitems::get_Destination_Directory_For_Item_From_Directorylist : $#{$itemarrayref} : $#{$dirsarrayref}"); } 975*cdf0e10cSrcweir 976*cdf0e10cSrcweir for ( my $i = 0; $i <= $#{$itemarrayref}; $i++ ) 977*cdf0e10cSrcweir { 978*cdf0e10cSrcweir my $oneitem = ${$itemarrayref}[$i]; 979*cdf0e10cSrcweir my $oneitemgid = $oneitem->{'gid'}; 980*cdf0e10cSrcweir my $directorygid = $oneitem->{'Dir'}; # for instance gid_Dir_Program 981*cdf0e10cSrcweir my $netdirectorygid = ""; 982*cdf0e10cSrcweir my $onelanguage = $oneitem->{'specificlanguage'}; 983*cdf0e10cSrcweir my $ispredefinedprogdir = 0; 984*cdf0e10cSrcweir my $ispredefinedconfigdir = 0; 985*cdf0e10cSrcweir 986*cdf0e10cSrcweir my $oneitemname = $oneitem->{'Name'}; 987*cdf0e10cSrcweir 988*cdf0e10cSrcweir if ( $oneitem->{'NetDir'} ) { $netdirectorygid = $oneitem->{'NetDir'}; } 989*cdf0e10cSrcweir 990*cdf0e10cSrcweir installer::pathanalyzer::make_absolute_filename_to_relative_filename(\$oneitemname); # making /registry/schema/org/openoffice/VCL.xcs to VCL.xcs 991*cdf0e10cSrcweir 992*cdf0e10cSrcweir my $searchdirgid; 993*cdf0e10cSrcweir 994*cdf0e10cSrcweir if ( $netdirectorygid eq "" ) # if NetDir is defined, it is privileged 995*cdf0e10cSrcweir { 996*cdf0e10cSrcweir $searchdirgid = $directorygid 997*cdf0e10cSrcweir } 998*cdf0e10cSrcweir else 999*cdf0e10cSrcweir { 1000*cdf0e10cSrcweir $searchdirgid = $netdirectorygid 1001*cdf0e10cSrcweir } 1002*cdf0e10cSrcweir 1003*cdf0e10cSrcweir if ($searchdirgid =~ /PREDEFINED_PROGDIR/) # the root directory is not defined in setup script 1004*cdf0e10cSrcweir { 1005*cdf0e10cSrcweir $ispredefinedprogdir = 1; 1006*cdf0e10cSrcweir } 1007*cdf0e10cSrcweir 1008*cdf0e10cSrcweir if ($searchdirgid =~ /PREDEFINED_CONFIGDIR/) # the root directory is not defined in setup script 1009*cdf0e10cSrcweir { 1010*cdf0e10cSrcweir $ispredefinedconfigdir = 1; 1011*cdf0e10cSrcweir } 1012*cdf0e10cSrcweir 1013*cdf0e10cSrcweir my $destfilename; 1014*cdf0e10cSrcweir 1015*cdf0e10cSrcweir if ((!( $ispredefinedprogdir )) && (!( $ispredefinedconfigdir ))) 1016*cdf0e10cSrcweir { 1017*cdf0e10cSrcweir my $directorynameref = get_Directoryname_From_Directorygid($dirsarrayref, $searchdirgid, $onelanguage, $oneitemgid); 1018*cdf0e10cSrcweir $destfilename = $$directorynameref . $installer::globals::separator . $oneitemname; 1019*cdf0e10cSrcweir } 1020*cdf0e10cSrcweir else 1021*cdf0e10cSrcweir { 1022*cdf0e10cSrcweir $destfilename = $oneitemname; 1023*cdf0e10cSrcweir } 1024*cdf0e10cSrcweir 1025*cdf0e10cSrcweir $oneitem->{'destination'} = $destfilename; 1026*cdf0e10cSrcweir } 1027*cdf0e10cSrcweir} 1028*cdf0e10cSrcweir 1029*cdf0e10cSrcweir########################################################################## 1030*cdf0e10cSrcweir# Searching a file in a list of pathes 1031*cdf0e10cSrcweir########################################################################## 1032*cdf0e10cSrcweir 1033*cdf0e10cSrcweirsub get_sourcepath_from_filename_and_includepath_classic 1034*cdf0e10cSrcweir{ 1035*cdf0e10cSrcweir my ($searchfilenameref, $includepatharrayref, $write_logfile) = @_; 1036*cdf0e10cSrcweir 1037*cdf0e10cSrcweir if ( $installer::globals::debug ) { installer::logger::debuginfo("installer::scriptitems::get_sourcepath_from_filename_and_includepath_classic : $$searchfilenameref : $#{$includepatharrayref} : $write_logfile"); } 1038*cdf0e10cSrcweir 1039*cdf0e10cSrcweir my ($onefile, $includepath, $infoline); 1040*cdf0e10cSrcweir 1041*cdf0e10cSrcweir my $foundsourcefile = 0; 1042*cdf0e10cSrcweir 1043*cdf0e10cSrcweir for ( my $j = 0; $j <= $#{$includepatharrayref}; $j++ ) 1044*cdf0e10cSrcweir { 1045*cdf0e10cSrcweir $includepath = ${$includepatharrayref}[$j]; 1046*cdf0e10cSrcweir installer::remover::remove_leading_and_ending_whitespaces(\$includepath); 1047*cdf0e10cSrcweir 1048*cdf0e10cSrcweir $onefile = $includepath . $installer::globals::separator . $$searchfilenameref; 1049*cdf0e10cSrcweir 1050*cdf0e10cSrcweir if ( -f $onefile ) 1051*cdf0e10cSrcweir { 1052*cdf0e10cSrcweir $foundsourcefile = 1; 1053*cdf0e10cSrcweir last; 1054*cdf0e10cSrcweir } 1055*cdf0e10cSrcweir } 1056*cdf0e10cSrcweir 1057*cdf0e10cSrcweir if (!($foundsourcefile)) 1058*cdf0e10cSrcweir { 1059*cdf0e10cSrcweir $onefile = ""; # the sourcepath has to be empty 1060*cdf0e10cSrcweir if ( $write_logfile) 1061*cdf0e10cSrcweir { 1062*cdf0e10cSrcweir if ( $ENV{'DEFAULT_TO_ENGLISH_FOR_PACKING'} ) 1063*cdf0e10cSrcweir { 1064*cdf0e10cSrcweir $infoline = "WARNING: Source for $$searchfilenameref not found!\n"; # Important message in log file 1065*cdf0e10cSrcweir } 1066*cdf0e10cSrcweir else 1067*cdf0e10cSrcweir { 1068*cdf0e10cSrcweir $infoline = "ERROR: Source for $$searchfilenameref not found!\n"; # Important message in log file 1069*cdf0e10cSrcweir } 1070*cdf0e10cSrcweir 1071*cdf0e10cSrcweir push( @installer::globals::logfileinfo, $infoline); 1072*cdf0e10cSrcweir } 1073*cdf0e10cSrcweir } 1074*cdf0e10cSrcweir else 1075*cdf0e10cSrcweir { 1076*cdf0e10cSrcweir if ( $write_logfile) 1077*cdf0e10cSrcweir { 1078*cdf0e10cSrcweir $infoline = "SUCCESS: Source for $$searchfilenameref: $onefile\n"; 1079*cdf0e10cSrcweir push( @installer::globals::logfileinfo, $infoline); 1080*cdf0e10cSrcweir } 1081*cdf0e10cSrcweir } 1082*cdf0e10cSrcweir 1083*cdf0e10cSrcweir return \$onefile; 1084*cdf0e10cSrcweir} 1085*cdf0e10cSrcweir 1086*cdf0e10cSrcweir########################################################################## 1087*cdf0e10cSrcweir# Input is one file name, output the complete absolute path of this file 1088*cdf0e10cSrcweir########################################################################## 1089*cdf0e10cSrcweir 1090*cdf0e10cSrcweirsub get_sourcepath_from_filename_and_includepath 1091*cdf0e10cSrcweir{ 1092*cdf0e10cSrcweir my ($searchfilenameref, $unused, $write_logfile) = @_; 1093*cdf0e10cSrcweir 1094*cdf0e10cSrcweir if ( $installer::globals::debug ) { installer::logger::debuginfo("installer::scriptitems::get_sourcepath_from_filename_and_includepath : $$searchfilenameref : $#{$includepatharrayref} : $write_logfile"); } 1095*cdf0e10cSrcweir 1096*cdf0e10cSrcweir my ($onefile, $includepath, $infoline); 1097*cdf0e10cSrcweir 1098*cdf0e10cSrcweir my $foundsourcefile = 0; 1099*cdf0e10cSrcweir my $foundnewname = 0; 1100*cdf0e10cSrcweir 1101*cdf0e10cSrcweir for ( my $j = 0; $j <= $#installer::globals::allincludepathes; $j++ ) 1102*cdf0e10cSrcweir { 1103*cdf0e10cSrcweir my $allfiles = $installer::globals::allincludepathes[$j]; 1104*cdf0e10cSrcweir 1105*cdf0e10cSrcweir if ( exists( $allfiles->{$$searchfilenameref} )) 1106*cdf0e10cSrcweir { 1107*cdf0e10cSrcweir $onefile = $allfiles->{'includepath'} . $installer::globals::separator . $$searchfilenameref; 1108*cdf0e10cSrcweir $foundsourcefile = 1; 1109*cdf0e10cSrcweir last; 1110*cdf0e10cSrcweir } 1111*cdf0e10cSrcweir } 1112*cdf0e10cSrcweir 1113*cdf0e10cSrcweir if (!($foundsourcefile)) # testing with lowercase filename 1114*cdf0e10cSrcweir { 1115*cdf0e10cSrcweir # Attention: README01.html is copied for Windows to readme01.html, not case sensitive 1116*cdf0e10cSrcweir 1117*cdf0e10cSrcweir for ( my $j = 0; $j <= $#installer::globals::allincludepathes; $j++ ) 1118*cdf0e10cSrcweir { 1119*cdf0e10cSrcweir my $allfiles = $installer::globals::allincludepathes[$j]; 1120*cdf0e10cSrcweir 1121*cdf0e10cSrcweir my $newfilename = $$searchfilenameref; 1122*cdf0e10cSrcweir $newfilename =~ s/readme/README/; # special handling for readme files 1123*cdf0e10cSrcweir $newfilename =~ s/license/LICENSE/; # special handling for license files 1124*cdf0e10cSrcweir 1125*cdf0e10cSrcweir if ( exists( $allfiles->{$newfilename} )) 1126*cdf0e10cSrcweir { 1127*cdf0e10cSrcweir $onefile = $allfiles->{'includepath'} . $installer::globals::separator . $newfilename; 1128*cdf0e10cSrcweir $foundsourcefile = 1; 1129*cdf0e10cSrcweir $foundnewname = 1; 1130*cdf0e10cSrcweir last; 1131*cdf0e10cSrcweir } 1132*cdf0e10cSrcweir } 1133*cdf0e10cSrcweir } 1134*cdf0e10cSrcweir 1135*cdf0e10cSrcweir if (!($foundsourcefile)) 1136*cdf0e10cSrcweir { 1137*cdf0e10cSrcweir $onefile = ""; # the sourcepath has to be empty 1138*cdf0e10cSrcweir if ( $write_logfile) 1139*cdf0e10cSrcweir { 1140*cdf0e10cSrcweir if ( $ENV{'DEFAULT_TO_ENGLISH_FOR_PACKING'} ) 1141*cdf0e10cSrcweir { 1142*cdf0e10cSrcweir $infoline = "WARNING: Source for $$searchfilenameref not found!\n"; # Important message in log file 1143*cdf0e10cSrcweir } 1144*cdf0e10cSrcweir else 1145*cdf0e10cSrcweir { 1146*cdf0e10cSrcweir $infoline = "ERROR: Source for $$searchfilenameref not found!\n"; # Important message in log file 1147*cdf0e10cSrcweir } 1148*cdf0e10cSrcweir 1149*cdf0e10cSrcweir push( @installer::globals::logfileinfo, $infoline); 1150*cdf0e10cSrcweir } 1151*cdf0e10cSrcweir } 1152*cdf0e10cSrcweir else 1153*cdf0e10cSrcweir { 1154*cdf0e10cSrcweir if ( $write_logfile) 1155*cdf0e10cSrcweir { 1156*cdf0e10cSrcweir if (!($foundnewname)) 1157*cdf0e10cSrcweir { 1158*cdf0e10cSrcweir $infoline = "SUCCESS: Source for $$searchfilenameref: $onefile\n"; 1159*cdf0e10cSrcweir } 1160*cdf0e10cSrcweir else 1161*cdf0e10cSrcweir { 1162*cdf0e10cSrcweir $infoline = "SUCCESS/WARNING: Special handling for $$searchfilenameref: $onefile\n"; 1163*cdf0e10cSrcweir } 1164*cdf0e10cSrcweir push( @installer::globals::logfileinfo, $infoline); 1165*cdf0e10cSrcweir } 1166*cdf0e10cSrcweir } 1167*cdf0e10cSrcweir 1168*cdf0e10cSrcweir return \$onefile; 1169*cdf0e10cSrcweir} 1170*cdf0e10cSrcweir 1171*cdf0e10cSrcweir############################################################## 1172*cdf0e10cSrcweir# Determining, whether a specified directory is language 1173*cdf0e10cSrcweir# dependent 1174*cdf0e10cSrcweir############################################################## 1175*cdf0e10cSrcweir 1176*cdf0e10cSrcweirsub determine_directory_language_dependency 1177*cdf0e10cSrcweir{ 1178*cdf0e10cSrcweir my($directorygid, $dirsref) = @_; 1179*cdf0e10cSrcweir 1180*cdf0e10cSrcweir my $is_multilingual = 0; 1181*cdf0e10cSrcweir 1182*cdf0e10cSrcweir for ( my $i = 0; $i <= $#{$dirsref}; $i++ ) 1183*cdf0e10cSrcweir { 1184*cdf0e10cSrcweir my $onedir = ${$dirsref}[$i]; 1185*cdf0e10cSrcweir my $gid = $onedir->{'gid'}; 1186*cdf0e10cSrcweir 1187*cdf0e10cSrcweir if ( $gid eq $directorygid ) 1188*cdf0e10cSrcweir { 1189*cdf0e10cSrcweir $is_multilingual = $onedir->{'ismultilingual'}; 1190*cdf0e10cSrcweir last; 1191*cdf0e10cSrcweir } 1192*cdf0e10cSrcweir } 1193*cdf0e10cSrcweir 1194*cdf0e10cSrcweir return $is_multilingual; 1195*cdf0e10cSrcweir} 1196*cdf0e10cSrcweir 1197*cdf0e10cSrcweir############################################################## 1198*cdf0e10cSrcweir# Getting all source pathes for all files to be packed 1199*cdf0e10cSrcweir# $item can be "Files" or "ScpActions" 1200*cdf0e10cSrcweir############################################################## 1201*cdf0e10cSrcweir 1202*cdf0e10cSrcweirsub get_Source_Directory_For_Files_From_Includepathlist 1203*cdf0e10cSrcweir{ 1204*cdf0e10cSrcweir my ($filesarrayref, $includepatharrayref, $dirsref, $item) = @_; 1205*cdf0e10cSrcweir 1206*cdf0e10cSrcweir if ( $installer::globals::debug ) { installer::logger::debuginfo("installer::scriptitems::get_Source_Directory_For_Files_From_Includepathlist : $#{$filesarrayref} : $#{$includepatharrayref} : $item"); } 1207*cdf0e10cSrcweir 1208*cdf0e10cSrcweir installer::logger::include_header_into_logfile("$item:"); 1209*cdf0e10cSrcweir 1210*cdf0e10cSrcweir my $infoline = ""; 1211*cdf0e10cSrcweir 1212*cdf0e10cSrcweir for ( my $i = 0; $i <= $#{$filesarrayref}; $i++ ) 1213*cdf0e10cSrcweir { 1214*cdf0e10cSrcweir my $onefile = ${$filesarrayref}[$i]; 1215*cdf0e10cSrcweir my $onelanguage = $onefile->{'specificlanguage'}; 1216*cdf0e10cSrcweir 1217*cdf0e10cSrcweir if ( ! $onefile->{'Name'} ) { installer::exiter::exit_program("ERROR: $item without name ! GID: $onefile->{'gid'} ! Language: $onelanguage", "get_Source_Directory_For_Files_From_Includepathlist"); } 1218*cdf0e10cSrcweir 1219*cdf0e10cSrcweir my $onefilename = $onefile->{'Name'}; 1220*cdf0e10cSrcweir if ( $item eq "ScpActions" ) { $onefilename =~ s/\//$installer::globals::separator/g; } 1221*cdf0e10cSrcweir $onefilename =~ s/^\s*\Q$installer::globals::separator\E//; # filename begins with a slash, for instance /registry/schema/org/openoffice/VCL.xcs 1222*cdf0e10cSrcweir 1223*cdf0e10cSrcweir my $styles = ""; 1224*cdf0e10cSrcweir my $file_can_miss = 0; 1225*cdf0e10cSrcweir if ( $onefile->{'Styles'} ) { $styles = $onefile->{'Styles'}; } 1226*cdf0e10cSrcweir if ( $styles =~ /\bFILE_CAN_MISS\b/ ) { $file_can_miss = 1; } 1227*cdf0e10cSrcweir 1228*cdf0e10cSrcweir if (( $installer::globals::languagepack ) && ( ! $onefile->{'ismultilingual'} ) && ( ! ( $styles =~ /\bFORCELANGUAGEPACK\b/ ))) { $file_can_miss = 1; } 1229*cdf0e10cSrcweir 1230*cdf0e10cSrcweir my $sourcepathref = ""; 1231*cdf0e10cSrcweir 1232*cdf0e10cSrcweir if ( $file_can_miss ) { $sourcepathref = get_sourcepath_from_filename_and_includepath(\$onefilename, $includepatharrayref, 0); } 1233*cdf0e10cSrcweir else { $sourcepathref = get_sourcepath_from_filename_and_includepath(\$onefilename, $includepatharrayref, 1); } 1234*cdf0e10cSrcweir 1235*cdf0e10cSrcweir $onefile->{'sourcepath'} = $$sourcepathref; # This $$sourcepathref is empty, if no source was found 1236*cdf0e10cSrcweir 1237*cdf0e10cSrcweir # defaulting to english for multilingual files if DEFAULT_TO_ENGLISH_FOR_PACKING is set 1238*cdf0e10cSrcweir 1239*cdf0e10cSrcweir if ( $ENV{'DEFAULT_TO_ENGLISH_FOR_PACKING'} ) 1240*cdf0e10cSrcweir { 1241*cdf0e10cSrcweir if (( ! $onefile->{'sourcepath'} ) && ( $onefile->{'ismultilingual'} )) 1242*cdf0e10cSrcweir { 1243*cdf0e10cSrcweir my $oldname = $onefile->{'Name'}; 1244*cdf0e10cSrcweir my $oldlanguage = $onefile->{'specificlanguage'}; 1245*cdf0e10cSrcweir my $newlanguage = "en-US"; 1246*cdf0e10cSrcweir # $onefile->{'Name'} =~ s/$oldlanguage\./$newlanguage\./; # Example: tplwizfax_it.zip -> tplwizfax_en-US.zip 1247*cdf0e10cSrcweir $onefilename = $onefile->{'Name'}; 1248*cdf0e10cSrcweir $onefilename =~ s/$oldlanguage\./$newlanguage\./; # Example: tplwizfax_it.zip -> tplwizfax_en-US.zip 1249*cdf0e10cSrcweir $onefilename =~ s/^\s*\Q$installer::globals::separator\E//; # filename begins with a slash, for instance /registry/schema/org/openoffice/VCL.xcs 1250*cdf0e10cSrcweir $sourcepathref = get_sourcepath_from_filename_and_includepath(\$onefilename, $includepatharrayref, 1); 1251*cdf0e10cSrcweir $onefile->{'sourcepath'} = $$sourcepathref; # This $$sourcepathref is empty, if no source was found 1252*cdf0e10cSrcweir 1253*cdf0e10cSrcweir if ($onefile->{'sourcepath'}) # defaulting to english was successful 1254*cdf0e10cSrcweir { 1255*cdf0e10cSrcweir $infoline = "WARNING: Using $onefilename instead of $oldname\n"; 1256*cdf0e10cSrcweir push( @installer::globals::logfileinfo, $infoline); 1257*cdf0e10cSrcweir print " $infoline"; 1258*cdf0e10cSrcweir # if ( $onefile->{'destination'} ) { $onefile->{'destination'} =~ s/\Q$oldname\E/$onefile->{'Name'}/; } 1259*cdf0e10cSrcweir 1260*cdf0e10cSrcweir # If the directory, in which the new file is installed, is not language dependent, 1261*cdf0e10cSrcweir # the filename has to be changed to avoid installation conflicts 1262*cdf0e10cSrcweir # No mechanism for resource files! 1263*cdf0e10cSrcweir # -> implementing for the content of ARCHIVE files 1264*cdf0e10cSrcweir 1265*cdf0e10cSrcweir if ( $onefile->{'Styles'} =~ /\bARCHIVE\b/ ) 1266*cdf0e10cSrcweir { 1267*cdf0e10cSrcweir my $directorygid = $onefile->{'Dir'}; 1268*cdf0e10cSrcweir my $islanguagedependent = determine_directory_language_dependency($directorygid, $dirsref); 1269*cdf0e10cSrcweir 1270*cdf0e10cSrcweir if ( ! $islanguagedependent ) 1271*cdf0e10cSrcweir { 1272*cdf0e10cSrcweir $onefile->{'Styles'} =~ s/\bARCHIVE\b/ARCHIVE, RENAME_TO_LANGUAGE/; # Setting new flag RENAME_TO_LANGUAGE 1273*cdf0e10cSrcweir $infoline = "Setting flag RENAME_TO_LANGUAGE: File $onefile->{'Name'} in directory: $directorygid\n"; 1274*cdf0e10cSrcweir push( @installer::globals::logfileinfo, $infoline); 1275*cdf0e10cSrcweir } 1276*cdf0e10cSrcweir } 1277*cdf0e10cSrcweir } 1278*cdf0e10cSrcweir else 1279*cdf0e10cSrcweir { 1280*cdf0e10cSrcweir $infoline = "WARNING: Using $onefile->{'Name'} instead of $oldname was not successful\n"; 1281*cdf0e10cSrcweir push( @installer::globals::logfileinfo, $infoline); 1282*cdf0e10cSrcweir $onefile->{'Name'} = $oldname; # Switching back to old file name 1283*cdf0e10cSrcweir } 1284*cdf0e10cSrcweir } 1285*cdf0e10cSrcweir } 1286*cdf0e10cSrcweir } 1287*cdf0e10cSrcweir 1288*cdf0e10cSrcweir $infoline = "\n"; # empty line after listing of all files 1289*cdf0e10cSrcweir push( @installer::globals::logfileinfo, $infoline); 1290*cdf0e10cSrcweir} 1291*cdf0e10cSrcweir 1292*cdf0e10cSrcweir################################################################################# 1293*cdf0e10cSrcweir# Removing files, that shall not be included into languagepacks 1294*cdf0e10cSrcweir# (because of rpm conflicts) 1295*cdf0e10cSrcweir################################################################################# 1296*cdf0e10cSrcweir 1297*cdf0e10cSrcweirsub remove_Files_For_Languagepacks 1298*cdf0e10cSrcweir{ 1299*cdf0e10cSrcweir my ($itemsarrayref) = @_; 1300*cdf0e10cSrcweir 1301*cdf0e10cSrcweir if ( $installer::globals::debug ) { installer::logger::debuginfo("installer::scriptitems::remove_Files_For_Languagepacks : $#{$filesarrayref}"); } 1302*cdf0e10cSrcweir 1303*cdf0e10cSrcweir my $infoline; 1304*cdf0e10cSrcweir 1305*cdf0e10cSrcweir my @newitemsarray = (); 1306*cdf0e10cSrcweir 1307*cdf0e10cSrcweir for ( my $i = 0; $i <= $#{$itemsarrayref}; $i++ ) 1308*cdf0e10cSrcweir { 1309*cdf0e10cSrcweir my $oneitem = ${$itemsarrayref}[$i]; 1310*cdf0e10cSrcweir my $gid = $oneitem->{'gid'}; 1311*cdf0e10cSrcweir 1312*cdf0e10cSrcweir # scp Todo: Remove asap after removal of old setup 1313*cdf0e10cSrcweir 1314*cdf0e10cSrcweir if (( $gid eq "gid_File_Extra_Fontunxpsprint" ) || 1315*cdf0e10cSrcweir ( $gid eq "gid_File_Extra_Migration_Lang" )) 1316*cdf0e10cSrcweir { 1317*cdf0e10cSrcweir $infoline = "ATTENTION: Removing item $oneitem->{'gid'} from the installation set.\n"; 1318*cdf0e10cSrcweir push( @installer::globals::logfileinfo, $infoline); 1319*cdf0e10cSrcweir 1320*cdf0e10cSrcweir next; 1321*cdf0e10cSrcweir } 1322*cdf0e10cSrcweir 1323*cdf0e10cSrcweir push(@newitemsarray, $oneitem); 1324*cdf0e10cSrcweir } 1325*cdf0e10cSrcweir 1326*cdf0e10cSrcweir return \@newitemsarray; 1327*cdf0e10cSrcweir} 1328*cdf0e10cSrcweir 1329*cdf0e10cSrcweir################################################################################# 1330*cdf0e10cSrcweir# Files, whose source directory is not found, are removed now (this is an ERROR) 1331*cdf0e10cSrcweir################################################################################# 1332*cdf0e10cSrcweir 1333*cdf0e10cSrcweirsub remove_Files_Without_Sourcedirectory 1334*cdf0e10cSrcweir{ 1335*cdf0e10cSrcweir my ($filesarrayref) = @_; 1336*cdf0e10cSrcweir 1337*cdf0e10cSrcweir if ( $installer::globals::debug ) { installer::logger::debuginfo("installer::scriptitems::remove_Files_Without_Sourcedirectory : $#{$filesarrayref}"); } 1338*cdf0e10cSrcweir 1339*cdf0e10cSrcweir my $infoline; 1340*cdf0e10cSrcweir 1341*cdf0e10cSrcweir my $error_occured = 0; 1342*cdf0e10cSrcweir my @missingfiles = (); 1343*cdf0e10cSrcweir push(@missingfiles, "ERROR: The following files could not be found: \n"); 1344*cdf0e10cSrcweir 1345*cdf0e10cSrcweir my @newfilesarray = (); 1346*cdf0e10cSrcweir 1347*cdf0e10cSrcweir for ( my $i = 0; $i <= $#{$filesarrayref}; $i++ ) 1348*cdf0e10cSrcweir { 1349*cdf0e10cSrcweir my $onefile = ${$filesarrayref}[$i]; 1350*cdf0e10cSrcweir my $sourcepath = $onefile->{'sourcepath'}; 1351*cdf0e10cSrcweir 1352*cdf0e10cSrcweir if ($sourcepath eq "") 1353*cdf0e10cSrcweir { 1354*cdf0e10cSrcweir my $styles = $onefile->{'Styles'}; 1355*cdf0e10cSrcweir my $filename = $onefile->{'Name'}; 1356*cdf0e10cSrcweir 1357*cdf0e10cSrcweir if ( ! $installer::globals::languagepack ) 1358*cdf0e10cSrcweir { 1359*cdf0e10cSrcweir $infoline = "ERROR: Removing file $filename from file list.\n"; 1360*cdf0e10cSrcweir push( @installer::globals::logfileinfo, $infoline); 1361*cdf0e10cSrcweir 1362*cdf0e10cSrcweir push(@missingfiles, "ERROR: File not found: $filename\n"); 1363*cdf0e10cSrcweir $error_occured = 1; 1364*cdf0e10cSrcweir 1365*cdf0e10cSrcweir next; # removing this file from list, if sourcepath is empty 1366*cdf0e10cSrcweir } 1367*cdf0e10cSrcweir else # special case for language packs 1368*cdf0e10cSrcweir { 1369*cdf0e10cSrcweir if (( $onefile->{'ismultilingual'} ) || ( $styles =~ /\bFORCELANGUAGEPACK\b/ )) 1370*cdf0e10cSrcweir { 1371*cdf0e10cSrcweir $infoline = "ERROR: Removing file $filename from file list.\n"; 1372*cdf0e10cSrcweir push( @installer::globals::logfileinfo, $infoline); 1373*cdf0e10cSrcweir 1374*cdf0e10cSrcweir push(@missingfiles, "ERROR: File not found: $filename\n"); 1375*cdf0e10cSrcweir $error_occured = 1; 1376*cdf0e10cSrcweir 1377*cdf0e10cSrcweir next; # removing this file from list, if sourcepath is empty 1378*cdf0e10cSrcweir } 1379*cdf0e10cSrcweir else 1380*cdf0e10cSrcweir { 1381*cdf0e10cSrcweir $infoline = "INFO: Removing file $filename from file list. It is not language dependent.\n"; 1382*cdf0e10cSrcweir push( @installer::globals::logfileinfo, $infoline); 1383*cdf0e10cSrcweir $infoline = "INFO: It is not language dependent and can be ignored in language packs.\n"; 1384*cdf0e10cSrcweir push( @installer::globals::logfileinfo, $infoline); 1385*cdf0e10cSrcweir 1386*cdf0e10cSrcweir next; # removing this file from list, if sourcepath is empty 1387*cdf0e10cSrcweir } 1388*cdf0e10cSrcweir } 1389*cdf0e10cSrcweir } 1390*cdf0e10cSrcweir 1391*cdf0e10cSrcweir push(@newfilesarray, $onefile); 1392*cdf0e10cSrcweir } 1393*cdf0e10cSrcweir 1394*cdf0e10cSrcweir $infoline = "\n"; 1395*cdf0e10cSrcweir push( @installer::globals::logfileinfo, $infoline); 1396*cdf0e10cSrcweir 1397*cdf0e10cSrcweir if ( $error_occured ) 1398*cdf0e10cSrcweir { 1399*cdf0e10cSrcweir for ( my $i = 0; $i <= $#missingfiles; $i++ ) { print "$missingfiles[$i]"; } 1400*cdf0e10cSrcweir installer::exiter::exit_program("ERROR: Missing files", "remove_Files_Without_Sourcedirectory"); 1401*cdf0e10cSrcweir } 1402*cdf0e10cSrcweir 1403*cdf0e10cSrcweir return \@newfilesarray; 1404*cdf0e10cSrcweir} 1405*cdf0e10cSrcweir 1406*cdf0e10cSrcweir############################################################################ 1407*cdf0e10cSrcweir# License and Readme files in the default language have to be installed 1408*cdf0e10cSrcweir# in the directory with flag OFFICEDIRECTORY. If this is not defined 1409*cdf0e10cSrcweir# they have to be installed in the installation root. 1410*cdf0e10cSrcweir############################################################################ 1411*cdf0e10cSrcweir 1412*cdf0e10cSrcweirsub get_office_directory_gid_and_hostname 1413*cdf0e10cSrcweir{ 1414*cdf0e10cSrcweir my ($dirsarrayref) = @_; 1415*cdf0e10cSrcweir 1416*cdf0e10cSrcweir my $foundofficedir = 0; 1417*cdf0e10cSrcweir my $gid = ""; 1418*cdf0e10cSrcweir my $hostname = ""; 1419*cdf0e10cSrcweir 1420*cdf0e10cSrcweir for ( my $i = 0; $i <= $#{$dirsarrayref}; $i++ ) 1421*cdf0e10cSrcweir { 1422*cdf0e10cSrcweir my $onedir = ${$dirsarrayref}[$i]; 1423*cdf0e10cSrcweir if ( $onedir->{'Styles'} ) 1424*cdf0e10cSrcweir { 1425*cdf0e10cSrcweir my $styles = $onedir->{'Styles'}; 1426*cdf0e10cSrcweir 1427*cdf0e10cSrcweir if ( $styles =~ /\bOFFICEDIRECTORY\b/ ) 1428*cdf0e10cSrcweir { 1429*cdf0e10cSrcweir $foundofficedir = 1; 1430*cdf0e10cSrcweir $gid = $onedir->{'gid'}; 1431*cdf0e10cSrcweir $hostname = $onedir->{'HostName'}; 1432*cdf0e10cSrcweir last; 1433*cdf0e10cSrcweir } 1434*cdf0e10cSrcweir } 1435*cdf0e10cSrcweir } 1436*cdf0e10cSrcweir 1437*cdf0e10cSrcweir return ($foundofficedir, $gid, $hostname); 1438*cdf0e10cSrcweir} 1439*cdf0e10cSrcweir 1440*cdf0e10cSrcweir############################################################################ 1441*cdf0e10cSrcweir# License and Readme files in the default language have to be installed 1442*cdf0e10cSrcweir# in the installation root (next to the program dir). This is in scp 1443*cdf0e10cSrcweir# project done by a post install basic script 1444*cdf0e10cSrcweir############################################################################ 1445*cdf0e10cSrcweir 1446*cdf0e10cSrcweirsub add_License_Files_into_Installdir 1447*cdf0e10cSrcweir{ 1448*cdf0e10cSrcweir my ($filesarrayref, $dirsarrayref, $languagesarrayref) = @_; 1449*cdf0e10cSrcweir 1450*cdf0e10cSrcweir if ( $installer::globals::debug ) { installer::logger::debuginfo("installer::scriptitems::add_License_Files_into_Installdir : $#{$filesarrayref} : $#{$languagesarrayref}"); } 1451*cdf0e10cSrcweir 1452*cdf0e10cSrcweir my $infoline; 1453*cdf0e10cSrcweir 1454*cdf0e10cSrcweir my @newfilesarray = (); 1455*cdf0e10cSrcweir 1456*cdf0e10cSrcweir my $defaultlanguage = installer::languages::get_default_language($languagesarrayref); 1457*cdf0e10cSrcweir 1458*cdf0e10cSrcweir my ($foundofficedir, $officedirectorygid, $officedirectoryhostname) = get_office_directory_gid_and_hostname($dirsarrayref); 1459*cdf0e10cSrcweir 1460*cdf0e10cSrcweir # copy all files from directory share/readme, that contain the default language in their name 1461*cdf0e10cSrcweir # without default language into the installation root. This makes the settings of the correct 1462*cdf0e10cSrcweir # file names superfluous. On the other hand this requires a dependency to the directory 1463*cdf0e10cSrcweir # share/readme 1464*cdf0e10cSrcweir 1465*cdf0e10cSrcweir for ( my $i = 0; $i <= $#{$filesarrayref}; $i++ ) 1466*cdf0e10cSrcweir { 1467*cdf0e10cSrcweir my $onefile = ${$filesarrayref}[$i]; 1468*cdf0e10cSrcweir my $destination = $onefile->{'destination'}; 1469*cdf0e10cSrcweir my $styles = ""; 1470*cdf0e10cSrcweir if ( $onefile->{'Styles'} ) { $styles = $onefile->{'Styles'}; } 1471*cdf0e10cSrcweir 1472*cdf0e10cSrcweir if ( ( $destination =~ /share\Q$installer::globals::separator\Ereadme\Q$installer::globals::separator\E(\w+?)_?$defaultlanguage\.?(\w*)\s*/ ) 1473*cdf0e10cSrcweir || (( $styles =~ /\bROOTLICENSEFILE\b/ ) && ( $destination =~ /\Q$installer::globals::separator\E?(\w+?)_?$defaultlanguage\.?(\w*?)\s*$/ )) ) 1474*cdf0e10cSrcweir { 1475*cdf0e10cSrcweir my $filename = $1; 1476*cdf0e10cSrcweir my $extension = $2; 1477*cdf0e10cSrcweir 1478*cdf0e10cSrcweir my $newfilename; 1479*cdf0e10cSrcweir 1480*cdf0e10cSrcweir if ( $extension eq "" ) { $newfilename = $filename; } 1481*cdf0e10cSrcweir else { $newfilename = $filename . "\." . $extension; } 1482*cdf0e10cSrcweir 1483*cdf0e10cSrcweir my %newfile = (); 1484*cdf0e10cSrcweir my $newfile = \%newfile; 1485*cdf0e10cSrcweir 1486*cdf0e10cSrcweir installer::converter::copy_item_object($onefile, $newfile); 1487*cdf0e10cSrcweir 1488*cdf0e10cSrcweir $newfile->{'gid'} = $onefile->{'gid'} . "_Copy"; 1489*cdf0e10cSrcweir $newfile->{'Name'} = $newfilename; 1490*cdf0e10cSrcweir $newfile->{'ismultilingual'} = "0"; 1491*cdf0e10cSrcweir $newfile->{'specificlanguage'} = ""; 1492*cdf0e10cSrcweir $newfile->{'haslanguagemodule'} = "0"; 1493*cdf0e10cSrcweir 1494*cdf0e10cSrcweir if ( defined $newfile->{'InstallName'} ) 1495*cdf0e10cSrcweir { 1496*cdf0e10cSrcweir if ( $newfile->{'InstallName'} =~ /^\s*(.*?)_$defaultlanguage\.?(\w*?)\s*$/ ) 1497*cdf0e10cSrcweir { 1498*cdf0e10cSrcweir my $localfilename = $1; 1499*cdf0e10cSrcweir my $localextension = $2; 1500*cdf0e10cSrcweir 1501*cdf0e10cSrcweir if ( $localextension eq "" ) { $newfile->{'InstallName'} = $localfilename; } 1502*cdf0e10cSrcweir else { $newfile->{'InstallName'} = $localfilename . "\." . $localextension; } 1503*cdf0e10cSrcweir } 1504*cdf0e10cSrcweir } 1505*cdf0e10cSrcweir 1506*cdf0e10cSrcweir $newfile->{'removelangfromfile'} = "1"; # Important for files with an InstallName, because language also has to be removed there. 1507*cdf0e10cSrcweir 1508*cdf0e10cSrcweir if ( $foundofficedir ) 1509*cdf0e10cSrcweir { 1510*cdf0e10cSrcweir $newfile->{'Dir'} = $officedirectorygid; 1511*cdf0e10cSrcweir $newfile->{'destination'} = $officedirectoryhostname . $installer::globals::separator . $newfilename; 1512*cdf0e10cSrcweir } 1513*cdf0e10cSrcweir else 1514*cdf0e10cSrcweir { 1515*cdf0e10cSrcweir $newfile->{'Dir'} = "PREDEFINED_PROGDIR"; 1516*cdf0e10cSrcweir $newfile->{'destination'} = $newfilename; 1517*cdf0e10cSrcweir } 1518*cdf0e10cSrcweir 1519*cdf0e10cSrcweir # Also setting "modules=gid_Module_Root_Brand" (module with style: ROOT_BRAND_PACKAGE) 1520*cdf0e10cSrcweir if ( $installer::globals::rootbrandpackageset ) 1521*cdf0e10cSrcweir { 1522*cdf0e10cSrcweir $newfile->{'modules'} = $installer::globals::rootbrandpackage; 1523*cdf0e10cSrcweir } 1524*cdf0e10cSrcweir 1525*cdf0e10cSrcweir push(@newfilesarray, $newfile); 1526*cdf0e10cSrcweir 1527*cdf0e10cSrcweir $infoline = "New files: Adding file $newfilename for the installation root to the file list. Language: $defaultlanguage\n"; 1528*cdf0e10cSrcweir push( @installer::globals::logfileinfo, $infoline); 1529*cdf0e10cSrcweir 1530*cdf0e10cSrcweir if ( defined $newfile->{'InstallName'} ) 1531*cdf0e10cSrcweir { 1532*cdf0e10cSrcweir $infoline = "New files: Using installation name: $newfile->{'InstallName'}\n"; 1533*cdf0e10cSrcweir push( @installer::globals::logfileinfo, $infoline); 1534*cdf0e10cSrcweir } 1535*cdf0e10cSrcweir 1536*cdf0e10cSrcweir # Collecting license and readme file for the installation set 1537*cdf0e10cSrcweir 1538*cdf0e10cSrcweir push(@installer::globals::installsetfiles, $newfile); 1539*cdf0e10cSrcweir $infoline = "New files: Adding file $newfilename to the file collector for the installation set. Language: $defaultlanguage\n"; 1540*cdf0e10cSrcweir push( @installer::globals::logfileinfo, $infoline); 1541*cdf0e10cSrcweir } 1542*cdf0e10cSrcweir 1543*cdf0e10cSrcweir push(@newfilesarray, $onefile); 1544*cdf0e10cSrcweir } 1545*cdf0e10cSrcweir 1546*cdf0e10cSrcweir return \@newfilesarray; 1547*cdf0e10cSrcweir} 1548*cdf0e10cSrcweir 1549*cdf0e10cSrcweir############################################################################ 1550*cdf0e10cSrcweir# Removing files with flag ONLY_ASIA_LANGUAGE, only if no asian 1551*cdf0e10cSrcweir# language is part of the product. 1552*cdf0e10cSrcweir# This special files are connected to the root module and are not 1553*cdf0e10cSrcweir# included into a language pack (would lead to conflicts!). 1554*cdf0e10cSrcweir# But this files shall only be included into the product, if the 1555*cdf0e10cSrcweir# product contains at least one asian language. 1556*cdf0e10cSrcweir############################################################################ 1557*cdf0e10cSrcweir 1558*cdf0e10cSrcweirsub remove_onlyasialanguage_files_from_productlists 1559*cdf0e10cSrcweir{ 1560*cdf0e10cSrcweir my ($filesarrayref) = @_; 1561*cdf0e10cSrcweir 1562*cdf0e10cSrcweir my $infoline; 1563*cdf0e10cSrcweir 1564*cdf0e10cSrcweir my @newfilesarray = (); 1565*cdf0e10cSrcweir my $returnfilesarrayref; 1566*cdf0e10cSrcweir 1567*cdf0e10cSrcweir my $containsasianlanguage = installer::languages::detect_asian_language($installer::globals::alllanguagesinproductarrayref); 1568*cdf0e10cSrcweir 1569*cdf0e10cSrcweir my $alllangstring = installer::converter::convert_array_to_comma_separated_string($installer::globals::alllanguagesinproductarrayref); 1570*cdf0e10cSrcweir $infoline = "\nLanguages in complete product: $alllangstring\n"; 1571*cdf0e10cSrcweir push( @installer::globals::logfileinfo, $infoline); 1572*cdf0e10cSrcweir 1573*cdf0e10cSrcweir if ( ! $containsasianlanguage ) 1574*cdf0e10cSrcweir { 1575*cdf0e10cSrcweir $infoline = "Product does not contain asian language -> removing files\n"; 1576*cdf0e10cSrcweir push( @installer::globals::logfileinfo, $infoline); 1577*cdf0e10cSrcweir 1578*cdf0e10cSrcweir for ( my $i = 0; $i <= $#{$filesarrayref}; $i++ ) 1579*cdf0e10cSrcweir { 1580*cdf0e10cSrcweir my $onefile = ${$filesarrayref}[$i]; 1581*cdf0e10cSrcweir my $styles = ""; 1582*cdf0e10cSrcweir if ( $onefile->{'Styles'} ) { $styles = $onefile->{'Styles'}; } 1583*cdf0e10cSrcweir if ( $styles =~ /\bONLY_ASIA_LANGUAGE\b/ ) 1584*cdf0e10cSrcweir { 1585*cdf0e10cSrcweir $infoline = "Flag ONLY_ASIA_LANGUAGE: Removing file $onefile->{'Name'} from files collector!\n"; 1586*cdf0e10cSrcweir push( @installer::globals::logfileinfo, $infoline); 1587*cdf0e10cSrcweir next; 1588*cdf0e10cSrcweir } 1589*cdf0e10cSrcweir 1590*cdf0e10cSrcweir push(@newfilesarray, $onefile); 1591*cdf0e10cSrcweir } 1592*cdf0e10cSrcweir 1593*cdf0e10cSrcweir $returnfilesarrayref = \@newfilesarray; 1594*cdf0e10cSrcweir } 1595*cdf0e10cSrcweir else 1596*cdf0e10cSrcweir { 1597*cdf0e10cSrcweir $returnfilesarrayref = $filesarrayref; 1598*cdf0e10cSrcweir 1599*cdf0e10cSrcweir $infoline = "Product contains asian language -> Nothing to do\n"; 1600*cdf0e10cSrcweir push( @installer::globals::logfileinfo, $infoline); 1601*cdf0e10cSrcweir 1602*cdf0e10cSrcweir } 1603*cdf0e10cSrcweir 1604*cdf0e10cSrcweir return $returnfilesarrayref; 1605*cdf0e10cSrcweir} 1606*cdf0e10cSrcweir 1607*cdf0e10cSrcweir############################################################################ 1608*cdf0e10cSrcweir# Removing files with flag ONLY_WESTERN_LANGUAGE, only if no western 1609*cdf0e10cSrcweir# language is part of the product. 1610*cdf0e10cSrcweir# This special files are connected to the root module and are not 1611*cdf0e10cSrcweir# included into a language pack (would lead to conflicts!). 1612*cdf0e10cSrcweir# But this files shall only be included into the product, if the 1613*cdf0e10cSrcweir# product contains at least one western language. 1614*cdf0e10cSrcweir############################################################################ 1615*cdf0e10cSrcweir 1616*cdf0e10cSrcweirsub remove_onlywesternlanguage_files_from_productlists 1617*cdf0e10cSrcweir{ 1618*cdf0e10cSrcweir my ($filesarrayref) = @_; 1619*cdf0e10cSrcweir 1620*cdf0e10cSrcweir my $infoline; 1621*cdf0e10cSrcweir 1622*cdf0e10cSrcweir my @newfilesarray = (); 1623*cdf0e10cSrcweir my $returnfilesarrayref; 1624*cdf0e10cSrcweir 1625*cdf0e10cSrcweir my $containswesternlanguage = installer::languages::detect_western_language($installer::globals::alllanguagesinproductarrayref); 1626*cdf0e10cSrcweir 1627*cdf0e10cSrcweir my $alllangstring = installer::converter::convert_array_to_comma_separated_string($installer::globals::alllanguagesinproductarrayref); 1628*cdf0e10cSrcweir $infoline = "\nLanguages in complete product: $alllangstring\n"; 1629*cdf0e10cSrcweir push( @installer::globals::logfileinfo, $infoline); 1630*cdf0e10cSrcweir 1631*cdf0e10cSrcweir if ( ! $containswesternlanguage ) 1632*cdf0e10cSrcweir { 1633*cdf0e10cSrcweir $infoline = "Product does not contain western language -> removing files\n"; 1634*cdf0e10cSrcweir push( @installer::globals::logfileinfo, $infoline); 1635*cdf0e10cSrcweir 1636*cdf0e10cSrcweir for ( my $i = 0; $i <= $#{$filesarrayref}; $i++ ) 1637*cdf0e10cSrcweir { 1638*cdf0e10cSrcweir my $onefile = ${$filesarrayref}[$i]; 1639*cdf0e10cSrcweir my $styles = ""; 1640*cdf0e10cSrcweir if ( $onefile->{'Styles'} ) { $styles = $onefile->{'Styles'}; } 1641*cdf0e10cSrcweir if ( $styles =~ /\bONLY_WESTERN_LANGUAGE\b/ ) 1642*cdf0e10cSrcweir { 1643*cdf0e10cSrcweir $infoline = "Flag ONLY_WESTERN_LANGUAGE: Removing file $onefile->{'Name'} from files collector!\n"; 1644*cdf0e10cSrcweir push( @installer::globals::logfileinfo, $infoline); 1645*cdf0e10cSrcweir next; 1646*cdf0e10cSrcweir } 1647*cdf0e10cSrcweir 1648*cdf0e10cSrcweir push(@newfilesarray, $onefile); 1649*cdf0e10cSrcweir } 1650*cdf0e10cSrcweir 1651*cdf0e10cSrcweir $returnfilesarrayref = \@newfilesarray; 1652*cdf0e10cSrcweir } 1653*cdf0e10cSrcweir else 1654*cdf0e10cSrcweir { 1655*cdf0e10cSrcweir $returnfilesarrayref = $filesarrayref; 1656*cdf0e10cSrcweir 1657*cdf0e10cSrcweir $infoline = "Product contains western language -> Nothing to do\n"; 1658*cdf0e10cSrcweir push( @installer::globals::logfileinfo, $infoline); 1659*cdf0e10cSrcweir 1660*cdf0e10cSrcweir } 1661*cdf0e10cSrcweir 1662*cdf0e10cSrcweir return $returnfilesarrayref; 1663*cdf0e10cSrcweir} 1664*cdf0e10cSrcweir 1665*cdf0e10cSrcweir############################################################################ 1666*cdf0e10cSrcweir# Some files are included for more than one language and have the same 1667*cdf0e10cSrcweir# name and the same destination directory for all languages. This would 1668*cdf0e10cSrcweir# lead to conflicts, if the filenames are not changed. 1669*cdf0e10cSrcweir# In scp project this files must have the flag MAKE_LANG_SPECIFIC 1670*cdf0e10cSrcweir# For this files, the language is included into the filename. 1671*cdf0e10cSrcweir############################################################################ 1672*cdf0e10cSrcweir 1673*cdf0e10cSrcweirsub make_filename_language_specific 1674*cdf0e10cSrcweir{ 1675*cdf0e10cSrcweir my ($filesarrayref) = @_; 1676*cdf0e10cSrcweir 1677*cdf0e10cSrcweir my $infoline = ""; 1678*cdf0e10cSrcweir 1679*cdf0e10cSrcweir for ( my $i = 0; $i <= $#{$filesarrayref}; $i++ ) 1680*cdf0e10cSrcweir { 1681*cdf0e10cSrcweir my $onefile = ${$filesarrayref}[$i]; 1682*cdf0e10cSrcweir 1683*cdf0e10cSrcweir if ( $onefile->{'ismultilingual'} ) 1684*cdf0e10cSrcweir { 1685*cdf0e10cSrcweir my $styles = ""; 1686*cdf0e10cSrcweir if ( $onefile->{'Styles'} ) { $styles = $onefile->{'Styles'}; } 1687*cdf0e10cSrcweir if ( $styles =~ /\bMAKE_LANG_SPECIFIC\b/ ) 1688*cdf0e10cSrcweir { 1689*cdf0e10cSrcweir my $language = $onefile->{'specificlanguage'}; 1690*cdf0e10cSrcweir my $olddestination = $onefile->{'destination'}; 1691*cdf0e10cSrcweir my $oldname = $onefile->{'Name'}; 1692*cdf0e10cSrcweir 1693*cdf0e10cSrcweir # Including the language into the file name. 1694*cdf0e10cSrcweir # But be sure, to include the language before the file extension. 1695*cdf0e10cSrcweir 1696*cdf0e10cSrcweir my $fileextension = ""; 1697*cdf0e10cSrcweir 1698*cdf0e10cSrcweir if ( $onefile->{'Name'} =~ /(\.\w+?)\s*$/ ) { $fileextension = $1; } 1699*cdf0e10cSrcweir if ( $fileextension ne "" ) 1700*cdf0e10cSrcweir { 1701*cdf0e10cSrcweir $onefile->{'Name'} =~ s/\Q$fileextension\E\s*$/_$language$fileextension/; 1702*cdf0e10cSrcweir $onefile->{'destination'} =~ s/\Q$fileextension\E\s*$/_$language$fileextension/; 1703*cdf0e10cSrcweir } 1704*cdf0e10cSrcweir 1705*cdf0e10cSrcweir $infoline = "Flag MAKE_LANG_SPECIFIC:\n"; 1706*cdf0e10cSrcweir push( @installer::globals::logfileinfo, $infoline); 1707*cdf0e10cSrcweir $infoline = "Changing name from $oldname to $onefile->{'Name'} !\n"; 1708*cdf0e10cSrcweir push( @installer::globals::logfileinfo, $infoline); 1709*cdf0e10cSrcweir $infoline = "Changing destination from $olddestination to $onefile->{'destination'} !\n"; 1710*cdf0e10cSrcweir push( @installer::globals::logfileinfo, $infoline); 1711*cdf0e10cSrcweir } 1712*cdf0e10cSrcweir } 1713*cdf0e10cSrcweir } 1714*cdf0e10cSrcweir} 1715*cdf0e10cSrcweir 1716*cdf0e10cSrcweir############################################################################ 1717*cdf0e10cSrcweir# Removing all scpactions, that have no name. 1718*cdf0e10cSrcweir# See: FlatLoaderZip 1719*cdf0e10cSrcweir############################################################################ 1720*cdf0e10cSrcweir 1721*cdf0e10cSrcweirsub remove_scpactions_without_name 1722*cdf0e10cSrcweir{ 1723*cdf0e10cSrcweir my ($itemsarrayref) = @_; 1724*cdf0e10cSrcweir 1725*cdf0e10cSrcweir if ( $installer::globals::debug ) { installer::logger::debuginfo("installer::scriptitems::remove_scpactions_without_name : $#{$itemsarrayref}"); } 1726*cdf0e10cSrcweir 1727*cdf0e10cSrcweir my $infoline; 1728*cdf0e10cSrcweir 1729*cdf0e10cSrcweir my @newitemsarray = (); 1730*cdf0e10cSrcweir 1731*cdf0e10cSrcweir for ( my $i = 0; $i <= $#{$itemsarrayref}; $i++ ) 1732*cdf0e10cSrcweir { 1733*cdf0e10cSrcweir my $oneitem = ${$itemsarrayref}[$i]; 1734*cdf0e10cSrcweir my $name = ""; 1735*cdf0e10cSrcweir 1736*cdf0e10cSrcweir if ( $oneitem->{'Name'} ) { $name = $oneitem->{'Name'}; } 1737*cdf0e10cSrcweir 1738*cdf0e10cSrcweir if ( $name eq "" ) 1739*cdf0e10cSrcweir { 1740*cdf0e10cSrcweir $infoline = "ATTENTION: Removing scpaction $oneitem->{'gid'} from the installation set.\n"; 1741*cdf0e10cSrcweir push( @installer::globals::logfileinfo, $infoline); 1742*cdf0e10cSrcweir next; 1743*cdf0e10cSrcweir } 1744*cdf0e10cSrcweir 1745*cdf0e10cSrcweir push(@newitemsarray, $oneitem); 1746*cdf0e10cSrcweir } 1747*cdf0e10cSrcweir 1748*cdf0e10cSrcweir return \@newitemsarray; 1749*cdf0e10cSrcweir} 1750*cdf0e10cSrcweir 1751*cdf0e10cSrcweir############################################################################ 1752*cdf0e10cSrcweir# Because of the item "File" the source name must be "Name". Therefore 1753*cdf0e10cSrcweir# "Copy" is changed to "Name" and "Name" is changed to "DestinationName". 1754*cdf0e10cSrcweir############################################################################ 1755*cdf0e10cSrcweir 1756*cdf0e10cSrcweirsub change_keys_of_scpactions 1757*cdf0e10cSrcweir{ 1758*cdf0e10cSrcweir my ($itemsarrayref) = @_; 1759*cdf0e10cSrcweir 1760*cdf0e10cSrcweir if ( $installer::globals::debug ) { installer::logger::debuginfo("installer::scriptitems::change_keys_of_scpactions : $#{$itemsarrayref}"); } 1761*cdf0e10cSrcweir 1762*cdf0e10cSrcweir for ( my $i = 0; $i <= $#{$itemsarrayref}; $i++ ) 1763*cdf0e10cSrcweir { 1764*cdf0e10cSrcweir my $oneitem = ${$itemsarrayref}[$i]; 1765*cdf0e10cSrcweir 1766*cdf0e10cSrcweir my $key; 1767*cdf0e10cSrcweir 1768*cdf0e10cSrcweir # First Name to DestinationName, then deleting Name 1769*cdf0e10cSrcweir foreach $key (keys %{$oneitem}) 1770*cdf0e10cSrcweir { 1771*cdf0e10cSrcweir if ( $key =~ /\bName\b/ ) 1772*cdf0e10cSrcweir { 1773*cdf0e10cSrcweir my $value = $oneitem->{$key}; 1774*cdf0e10cSrcweir my $oldkey = $key; 1775*cdf0e10cSrcweir $key =~ s/Name/DestinationName/; 1776*cdf0e10cSrcweir $oneitem->{$key} = $value; 1777*cdf0e10cSrcweir delete($oneitem->{$oldkey}); 1778*cdf0e10cSrcweir } 1779*cdf0e10cSrcweir } 1780*cdf0e10cSrcweir 1781*cdf0e10cSrcweir # Second Copy to Name, then deleting Copy 1782*cdf0e10cSrcweir foreach $key (keys %{$oneitem}) 1783*cdf0e10cSrcweir { 1784*cdf0e10cSrcweir if ( $key =~ /\bCopy\b/ ) 1785*cdf0e10cSrcweir { 1786*cdf0e10cSrcweir my $value = $oneitem->{$key}; 1787*cdf0e10cSrcweir my $oldkey = $key; 1788*cdf0e10cSrcweir $key =~ s/Copy/Name/; 1789*cdf0e10cSrcweir $oneitem->{$key} = $value; 1790*cdf0e10cSrcweir delete($oneitem->{$oldkey}); 1791*cdf0e10cSrcweir } 1792*cdf0e10cSrcweir } 1793*cdf0e10cSrcweir } 1794*cdf0e10cSrcweir} 1795*cdf0e10cSrcweir 1796*cdf0e10cSrcweir############################################################################ 1797*cdf0e10cSrcweir# Removing all xpd only items from installation set (scpactions with 1798*cdf0e10cSrcweir# the style XPD_ONLY), except an xpd installation set is created 1799*cdf0e10cSrcweir############################################################################ 1800*cdf0e10cSrcweir 1801*cdf0e10cSrcweirsub remove_Xpdonly_Items 1802*cdf0e10cSrcweir{ 1803*cdf0e10cSrcweir my ($itemsarrayref) = @_; 1804*cdf0e10cSrcweir 1805*cdf0e10cSrcweir if ( $installer::globals::debug ) { installer::logger::debuginfo("installer::scriptitems::remove_Xpdonly_Items : $#{$itemsarrayref}"); } 1806*cdf0e10cSrcweir 1807*cdf0e10cSrcweir my $infoline; 1808*cdf0e10cSrcweir 1809*cdf0e10cSrcweir my @newitemsarray = (); 1810*cdf0e10cSrcweir 1811*cdf0e10cSrcweir for ( my $i = 0; $i <= $#{$itemsarrayref}; $i++ ) 1812*cdf0e10cSrcweir { 1813*cdf0e10cSrcweir my $oneitem = ${$itemsarrayref}[$i]; 1814*cdf0e10cSrcweir my $styles = ""; 1815*cdf0e10cSrcweir if ( $oneitem->{'Styles'} ) { $styles = $oneitem->{'Styles'}; } 1816*cdf0e10cSrcweir 1817*cdf0e10cSrcweir if ( $styles =~ /\bXPD_ONLY\b/ ) 1818*cdf0e10cSrcweir { 1819*cdf0e10cSrcweir $infoline = "Removing \"xpd only\" item $oneitem->{'gid'} from the installation set.\n"; 1820*cdf0e10cSrcweir push( @installer::globals::globallogfileinfo, $infoline); 1821*cdf0e10cSrcweir 1822*cdf0e10cSrcweir next; 1823*cdf0e10cSrcweir } 1824*cdf0e10cSrcweir 1825*cdf0e10cSrcweir push(@newitemsarray, $oneitem); 1826*cdf0e10cSrcweir } 1827*cdf0e10cSrcweir 1828*cdf0e10cSrcweir $infoline = "\n"; 1829*cdf0e10cSrcweir push( @installer::globals::globallogfileinfo, $infoline); 1830*cdf0e10cSrcweir 1831*cdf0e10cSrcweir return \@newitemsarray; 1832*cdf0e10cSrcweir} 1833*cdf0e10cSrcweir 1834*cdf0e10cSrcweir############################################################################ 1835*cdf0e10cSrcweir# Removing all language pack files from installation set (files with 1836*cdf0e10cSrcweir# the style LANGUAGEPACK), except this is a language pack. 1837*cdf0e10cSrcweir############################################################################ 1838*cdf0e10cSrcweir 1839*cdf0e10cSrcweirsub remove_Languagepacklibraries_from_Installset 1840*cdf0e10cSrcweir{ 1841*cdf0e10cSrcweir my ($itemsarrayref) = @_; 1842*cdf0e10cSrcweir 1843*cdf0e10cSrcweir if ( $installer::globals::debug ) { installer::logger::debuginfo("installer::scriptitems::remove_Languagepacklibraries_from_Installset : $#{$itemsarrayref}"); } 1844*cdf0e10cSrcweir 1845*cdf0e10cSrcweir my $infoline; 1846*cdf0e10cSrcweir 1847*cdf0e10cSrcweir my @newitemsarray = (); 1848*cdf0e10cSrcweir 1849*cdf0e10cSrcweir for ( my $i = 0; $i <= $#{$itemsarrayref}; $i++ ) 1850*cdf0e10cSrcweir { 1851*cdf0e10cSrcweir my $oneitem = ${$itemsarrayref}[$i]; 1852*cdf0e10cSrcweir my $styles = ""; 1853*cdf0e10cSrcweir if ( $oneitem->{'Styles'} ) { $styles = $oneitem->{'Styles'}; } 1854*cdf0e10cSrcweir 1855*cdf0e10cSrcweir if ( $styles =~ /\bLANGUAGEPACK\b/ ) 1856*cdf0e10cSrcweir { 1857*cdf0e10cSrcweir $infoline = "Removing language pack file $oneitem->{'gid'} from the installation set.\n"; 1858*cdf0e10cSrcweir push( @installer::globals::globallogfileinfo, $infoline); 1859*cdf0e10cSrcweir 1860*cdf0e10cSrcweir next; 1861*cdf0e10cSrcweir } 1862*cdf0e10cSrcweir 1863*cdf0e10cSrcweir push(@newitemsarray, $oneitem); 1864*cdf0e10cSrcweir } 1865*cdf0e10cSrcweir 1866*cdf0e10cSrcweir $infoline = "\n"; 1867*cdf0e10cSrcweir push( @installer::globals::globallogfileinfo, $infoline); 1868*cdf0e10cSrcweir 1869*cdf0e10cSrcweir return \@newitemsarray; 1870*cdf0e10cSrcweir} 1871*cdf0e10cSrcweir 1872*cdf0e10cSrcweir############################################################################ 1873*cdf0e10cSrcweir# Removing all files with flag PATCH_ONLY from installation set. 1874*cdf0e10cSrcweir# This function is not called during patch creation. 1875*cdf0e10cSrcweir############################################################################ 1876*cdf0e10cSrcweir 1877*cdf0e10cSrcweirsub remove_patchonlyfiles_from_Installset 1878*cdf0e10cSrcweir{ 1879*cdf0e10cSrcweir my ($itemsarrayref) = @_; 1880*cdf0e10cSrcweir 1881*cdf0e10cSrcweir if ( $installer::globals::debug ) { installer::logger::debuginfo("installer::scriptitems::remove_patchonlyfiles_from_Installset : $#{$itemsarrayref}"); } 1882*cdf0e10cSrcweir 1883*cdf0e10cSrcweir my $infoline; 1884*cdf0e10cSrcweir 1885*cdf0e10cSrcweir my @newitemsarray = (); 1886*cdf0e10cSrcweir 1887*cdf0e10cSrcweir for ( my $i = 0; $i <= $#{$itemsarrayref}; $i++ ) 1888*cdf0e10cSrcweir { 1889*cdf0e10cSrcweir my $oneitem = ${$itemsarrayref}[$i]; 1890*cdf0e10cSrcweir my $styles = ""; 1891*cdf0e10cSrcweir if ( $oneitem->{'Styles'} ) { $styles = $oneitem->{'Styles'}; } 1892*cdf0e10cSrcweir 1893*cdf0e10cSrcweir if ( $styles =~ /\bPATCH_ONLY\b/ ) 1894*cdf0e10cSrcweir { 1895*cdf0e10cSrcweir $infoline = "Removing file with flag PATCH_ONLY $oneitem->{'gid'} from the installation set.\n"; 1896*cdf0e10cSrcweir push( @installer::globals::globallogfileinfo, $infoline); 1897*cdf0e10cSrcweir 1898*cdf0e10cSrcweir next; 1899*cdf0e10cSrcweir } 1900*cdf0e10cSrcweir 1901*cdf0e10cSrcweir push(@newitemsarray, $oneitem); 1902*cdf0e10cSrcweir } 1903*cdf0e10cSrcweir 1904*cdf0e10cSrcweir $infoline = "\n"; 1905*cdf0e10cSrcweir push( @installer::globals::globallogfileinfo, $infoline); 1906*cdf0e10cSrcweir 1907*cdf0e10cSrcweir return \@newitemsarray; 1908*cdf0e10cSrcweir} 1909*cdf0e10cSrcweir 1910*cdf0e10cSrcweir############################################################################ 1911*cdf0e10cSrcweir# Removing all files with flag TAB_ONLY from installation set. 1912*cdf0e10cSrcweir# This function is not called during tab creation. 1913*cdf0e10cSrcweir############################################################################ 1914*cdf0e10cSrcweir 1915*cdf0e10cSrcweirsub remove_tabonlyfiles_from_Installset 1916*cdf0e10cSrcweir{ 1917*cdf0e10cSrcweir my ($itemsarrayref) = @_; 1918*cdf0e10cSrcweir 1919*cdf0e10cSrcweir if ( $installer::globals::debug ) { installer::logger::debuginfo("installer::scriptitems::remove_tabonlyfiles_from_Installset : $#{$itemsarrayref}"); } 1920*cdf0e10cSrcweir 1921*cdf0e10cSrcweir my $infoline; 1922*cdf0e10cSrcweir 1923*cdf0e10cSrcweir my @newitemsarray = (); 1924*cdf0e10cSrcweir 1925*cdf0e10cSrcweir for ( my $i = 0; $i <= $#{$itemsarrayref}; $i++ ) 1926*cdf0e10cSrcweir { 1927*cdf0e10cSrcweir my $oneitem = ${$itemsarrayref}[$i]; 1928*cdf0e10cSrcweir my $styles = ""; 1929*cdf0e10cSrcweir if ( $oneitem->{'Styles'} ) { $styles = $oneitem->{'Styles'}; } 1930*cdf0e10cSrcweir 1931*cdf0e10cSrcweir if ( $styles =~ /\bTAB_ONLY\b/ ) 1932*cdf0e10cSrcweir { 1933*cdf0e10cSrcweir $infoline = "Removing tab only file $oneitem->{'gid'} from the installation set.\n"; 1934*cdf0e10cSrcweir push( @installer::globals::globallogfileinfo, $infoline); 1935*cdf0e10cSrcweir 1936*cdf0e10cSrcweir next; 1937*cdf0e10cSrcweir } 1938*cdf0e10cSrcweir 1939*cdf0e10cSrcweir push(@newitemsarray, $oneitem); 1940*cdf0e10cSrcweir } 1941*cdf0e10cSrcweir 1942*cdf0e10cSrcweir $infoline = "\n"; 1943*cdf0e10cSrcweir push( @installer::globals::globallogfileinfo, $infoline); 1944*cdf0e10cSrcweir 1945*cdf0e10cSrcweir return \@newitemsarray; 1946*cdf0e10cSrcweir} 1947*cdf0e10cSrcweir 1948*cdf0e10cSrcweir############################################################################### 1949*cdf0e10cSrcweir# Removing all files with flag ONLY_INSTALLED_PRODUCT from installation set. 1950*cdf0e10cSrcweir# This function is not called for PKGFORMAT installed and archive. 1951*cdf0e10cSrcweir############################################################################### 1952*cdf0e10cSrcweir 1953*cdf0e10cSrcweirsub remove_installedproductonlyfiles_from_Installset 1954*cdf0e10cSrcweir{ 1955*cdf0e10cSrcweir my ($itemsarrayref) = @_; 1956*cdf0e10cSrcweir 1957*cdf0e10cSrcweir if ( $installer::globals::debug ) { installer::logger::debuginfo("installer::scriptitems::remove_installedproductonlyfiles_from_Installset : $#{$itemsarrayref}"); } 1958*cdf0e10cSrcweir 1959*cdf0e10cSrcweir my $infoline; 1960*cdf0e10cSrcweir 1961*cdf0e10cSrcweir my @newitemsarray = (); 1962*cdf0e10cSrcweir 1963*cdf0e10cSrcweir for ( my $i = 0; $i <= $#{$itemsarrayref}; $i++ ) 1964*cdf0e10cSrcweir { 1965*cdf0e10cSrcweir my $oneitem = ${$itemsarrayref}[$i]; 1966*cdf0e10cSrcweir my $styles = ""; 1967*cdf0e10cSrcweir if ( $oneitem->{'Styles'} ) { $styles = $oneitem->{'Styles'}; } 1968*cdf0e10cSrcweir 1969*cdf0e10cSrcweir if ( $styles =~ /\bONLY_INSTALLED_PRODUCT\b/ ) 1970*cdf0e10cSrcweir { 1971*cdf0e10cSrcweir $infoline = "Removing file $oneitem->{'gid'} from the installation set. This file is only required for PKGFORMAT archive or installed).\n"; 1972*cdf0e10cSrcweir push( @installer::globals::globallogfileinfo, $infoline); 1973*cdf0e10cSrcweir next; 1974*cdf0e10cSrcweir } 1975*cdf0e10cSrcweir 1976*cdf0e10cSrcweir push(@newitemsarray, $oneitem); 1977*cdf0e10cSrcweir } 1978*cdf0e10cSrcweir 1979*cdf0e10cSrcweir $infoline = "\n"; 1980*cdf0e10cSrcweir push( @installer::globals::globallogfileinfo, $infoline); 1981*cdf0e10cSrcweir 1982*cdf0e10cSrcweir return \@newitemsarray; 1983*cdf0e10cSrcweir} 1984*cdf0e10cSrcweir 1985*cdf0e10cSrcweir############################################################################ 1986*cdf0e10cSrcweir# Some files cotain a $ in their name. epm conflicts with such files. 1987*cdf0e10cSrcweir# Solution: Renaming this files, converting "$" to "$$" 1988*cdf0e10cSrcweir############################################################################ 1989*cdf0e10cSrcweir 1990*cdf0e10cSrcweirsub quoting_illegal_filenames 1991*cdf0e10cSrcweir{ 1992*cdf0e10cSrcweir my ($filesarrayref) = @_; 1993*cdf0e10cSrcweir 1994*cdf0e10cSrcweir if ( $installer::globals::debug ) { installer::logger::debuginfo("installer::scriptitems::rename_illegal_filenames : $#{$filesarrayref}"); } 1995*cdf0e10cSrcweir 1996*cdf0e10cSrcweir # This function has to be removed as soon as possible! 1997*cdf0e10cSrcweir 1998*cdf0e10cSrcweir installer::logger::include_header_into_logfile("Renaming illegal filenames:"); 1999*cdf0e10cSrcweir 2000*cdf0e10cSrcweir for ( my $i = 0; $i <= $#{$filesarrayref}; $i++ ) 2001*cdf0e10cSrcweir { 2002*cdf0e10cSrcweir my $onefile = ${$filesarrayref}[$i]; 2003*cdf0e10cSrcweir my $filename = $onefile->{'Name'}; 2004*cdf0e10cSrcweir 2005*cdf0e10cSrcweir if ( $filename =~ /\$/ ) 2006*cdf0e10cSrcweir { 2007*cdf0e10cSrcweir my $sourcepath = $onefile->{'sourcepath'}; 2008*cdf0e10cSrcweir my $destpath = $onefile->{'destination'}; 2009*cdf0e10cSrcweir 2010*cdf0e10cSrcweir # sourcepath and destination have to be quoted for epm list file 2011*cdf0e10cSrcweir 2012*cdf0e10cSrcweir # $filename =~ s/\$/\$\$/g; 2013*cdf0e10cSrcweir $destpath =~ s/\$/\$\$/g; 2014*cdf0e10cSrcweir $sourcepath =~ s/\$/\$\$/g; 2015*cdf0e10cSrcweir 2016*cdf0e10cSrcweir # my $infoline = "ATTENTION: Files: Renaming $onefile->{'Name'} to $filename\n"; 2017*cdf0e10cSrcweir # push( @installer::globals::logfileinfo, $infoline); 2018*cdf0e10cSrcweir my $infoline = "ATTENTION: Files: Quoting sourcepath $onefile->{'sourcepath'} to $sourcepath\n"; 2019*cdf0e10cSrcweir push( @installer::globals::logfileinfo, $infoline); 2020*cdf0e10cSrcweir $infoline = "ATTENTION: Files: Quoting destination path $onefile->{'destination'} to $destpath\n"; 2021*cdf0e10cSrcweir push( @installer::globals::logfileinfo, $infoline); 2022*cdf0e10cSrcweir 2023*cdf0e10cSrcweir # $onefile->{'Name'} = $filename; 2024*cdf0e10cSrcweir $onefile->{'sourcepath'} = $sourcepath; 2025*cdf0e10cSrcweir $onefile->{'destination'} = $destpath; 2026*cdf0e10cSrcweir } 2027*cdf0e10cSrcweir } 2028*cdf0e10cSrcweir} 2029*cdf0e10cSrcweir 2030*cdf0e10cSrcweir############################################################################ 2031*cdf0e10cSrcweir# Removing multiple occurences of same module. 2032*cdf0e10cSrcweir############################################################################ 2033*cdf0e10cSrcweir 2034*cdf0e10cSrcweirsub optimize_list 2035*cdf0e10cSrcweir{ 2036*cdf0e10cSrcweir my ( $longlist ) = @_; 2037*cdf0e10cSrcweir 2038*cdf0e10cSrcweir my $shortlist = ""; 2039*cdf0e10cSrcweir my $hashref = installer::converter::convert_stringlist_into_hash(\$longlist, ","); 2040*cdf0e10cSrcweir foreach my $key (sort keys %{$hashref} ) { $shortlist = "$shortlist,$key"; } 2041*cdf0e10cSrcweir $shortlist =~ s/^\s*\,//; 2042*cdf0e10cSrcweir 2043*cdf0e10cSrcweir return $shortlist; 2044*cdf0e10cSrcweir} 2045*cdf0e10cSrcweir 2046*cdf0e10cSrcweir####################################################################### 2047*cdf0e10cSrcweir# Collecting all directories needed for the epm list 2048*cdf0e10cSrcweir# 1. Looking for all destination paths in the files array 2049*cdf0e10cSrcweir# 2. Looking for directories with CREATE flag in the directory array 2050*cdf0e10cSrcweir####################################################################### 2051*cdf0e10cSrcweir 2052*cdf0e10cSrcweir################################## 2053*cdf0e10cSrcweir# Collecting directories: Part 1 2054*cdf0e10cSrcweir################################## 2055*cdf0e10cSrcweir 2056*cdf0e10cSrcweirsub collect_directories_from_filesarray 2057*cdf0e10cSrcweir{ 2058*cdf0e10cSrcweir my ($filesarrayref) = @_; 2059*cdf0e10cSrcweir 2060*cdf0e10cSrcweir if ( $installer::globals::debug ) { installer::logger::debuginfo("installer::scriptitems::collect_directories_from_filesarray : $#{$filesarrayref}"); } 2061*cdf0e10cSrcweir 2062*cdf0e10cSrcweir my @alldirectories = (); 2063*cdf0e10cSrcweir my %alldirectoryhash = (); 2064*cdf0e10cSrcweir 2065*cdf0e10cSrcweir my $predefinedprogdir_added = 0; 2066*cdf0e10cSrcweir my $alreadyincluded = 0; 2067*cdf0e10cSrcweir 2068*cdf0e10cSrcweir # Preparing this already as hash, although the only needed value at the moment is the HostName 2069*cdf0e10cSrcweir # But also adding: "specificlanguage" and "Dir" (for instance gid_Dir_Program) 2070*cdf0e10cSrcweir 2071*cdf0e10cSrcweir for ( my $i = 0; $i <= $#{$filesarrayref}; $i++ ) 2072*cdf0e10cSrcweir { 2073*cdf0e10cSrcweir my $onefile = ${$filesarrayref}[$i]; 2074*cdf0e10cSrcweir my $destinationpath = $onefile->{'destination'}; 2075*cdf0e10cSrcweir installer::pathanalyzer::get_path_from_fullqualifiedname(\$destinationpath); 2076*cdf0e10cSrcweir $destinationpath =~ s/\Q$installer::globals::separator\E\s*$//; # removing ending slashes or backslashes 2077*cdf0e10cSrcweir 2078*cdf0e10cSrcweir $alreadyincluded = 0; 2079*cdf0e10cSrcweir if ( exists($alldirectoryhash{$destinationpath}) ) { $alreadyincluded = 1; } 2080*cdf0e10cSrcweir 2081*cdf0e10cSrcweir if (!($alreadyincluded)) 2082*cdf0e10cSrcweir { 2083*cdf0e10cSrcweir my %directoryhash = (); 2084*cdf0e10cSrcweir $directoryhash{'HostName'} = $destinationpath; 2085*cdf0e10cSrcweir $directoryhash{'specificlanguage'} = $onefile->{'specificlanguage'}; 2086*cdf0e10cSrcweir $directoryhash{'Dir'} = $onefile->{'Dir'}; 2087*cdf0e10cSrcweir $directoryhash{'modules'} = $onefile->{'modules'}; # NEW, saving modules 2088*cdf0e10cSrcweir # NEVER!!! if ( ! $installer::globals::iswindowsbuild ) { $directoryhash{'Styles'} = "(CREATE)"; } # this directories must be created 2089*cdf0e10cSrcweir 2090*cdf0e10cSrcweir if ( $onefile->{'Dir'} eq "PREDEFINED_PROGDIR" ) { $predefinedprogdir_added = 1; } 2091*cdf0e10cSrcweir 2092*cdf0e10cSrcweir $alldirectoryhash{$destinationpath} = \%directoryhash; 2093*cdf0e10cSrcweir 2094*cdf0e10cSrcweir # Problem: The $destinationpath can be share/registry/schema/org/openoffice 2095*cdf0e10cSrcweir # but not all directories contain files and will be added to this list. 2096*cdf0e10cSrcweir # Therefore the path has to be analyzed. 2097*cdf0e10cSrcweir 2098*cdf0e10cSrcweir while ( $destinationpath =~ /(^.*\S)\Q$installer::globals::separator\E(\S.*?)\s*$/ ) # as long as the path contains slashes 2099*cdf0e10cSrcweir { 2100*cdf0e10cSrcweir $destinationpath = $1; 2101*cdf0e10cSrcweir 2102*cdf0e10cSrcweir $alreadyincluded = 0; 2103*cdf0e10cSrcweir if ( exists($alldirectoryhash{$destinationpath}) ) { $alreadyincluded = 1; } 2104*cdf0e10cSrcweir 2105*cdf0e10cSrcweir if (!($alreadyincluded)) 2106*cdf0e10cSrcweir { 2107*cdf0e10cSrcweir my %directoryhash = (); 2108*cdf0e10cSrcweir 2109*cdf0e10cSrcweir $directoryhash{'HostName'} = $destinationpath; 2110*cdf0e10cSrcweir $directoryhash{'specificlanguage'} = $onefile->{'specificlanguage'}; 2111*cdf0e10cSrcweir $directoryhash{'Dir'} = $onefile->{'Dir'}; 2112*cdf0e10cSrcweir $directoryhash{'modules'} = $onefile->{'modules'}; # NEW, saving modules 2113*cdf0e10cSrcweir # NEVER!!! if ( ! $installer::globals::iswindowsbuild ) { $directoryhash{'Styles'} = "(CREATE)"; } # this directories must be created 2114*cdf0e10cSrcweir 2115*cdf0e10cSrcweir $alldirectoryhash{$destinationpath} = \%directoryhash; 2116*cdf0e10cSrcweir } 2117*cdf0e10cSrcweir else 2118*cdf0e10cSrcweir { 2119*cdf0e10cSrcweir # Adding the modules to the module list! 2120*cdf0e10cSrcweir $alldirectoryhash{$destinationpath}->{'modules'} = $alldirectoryhash{$destinationpath}->{'modules'} . "," . $onefile->{'modules'}; 2121*cdf0e10cSrcweir } 2122*cdf0e10cSrcweir } 2123*cdf0e10cSrcweir } 2124*cdf0e10cSrcweir else 2125*cdf0e10cSrcweir { 2126*cdf0e10cSrcweir # Adding the modules to the module list! 2127*cdf0e10cSrcweir $alldirectoryhash{$destinationpath}->{'modules'} = $alldirectoryhash{$destinationpath}->{'modules'} . "," . $onefile->{'modules'}; 2128*cdf0e10cSrcweir 2129*cdf0e10cSrcweir # Also adding the module to all parents 2130*cdf0e10cSrcweir while ( $destinationpath =~ /(^.*\S)\Q$installer::globals::separator\E(\S.*?)\s*$/ ) # as long as the path contains slashes 2131*cdf0e10cSrcweir { 2132*cdf0e10cSrcweir $destinationpath = $1; 2133*cdf0e10cSrcweir $alldirectoryhash{$destinationpath}->{'modules'} = $alldirectoryhash{$destinationpath}->{'modules'} . "," . $onefile->{'modules'}; 2134*cdf0e10cSrcweir } 2135*cdf0e10cSrcweir } 2136*cdf0e10cSrcweir } 2137*cdf0e10cSrcweir 2138*cdf0e10cSrcweir # if there is no file in the root directory PREDEFINED_PROGDIR, it has to be included into the directory array now 2139*cdf0e10cSrcweir # HostName= specificlanguage= Dir=PREDEFINED_PROGDIR 2140*cdf0e10cSrcweir 2141*cdf0e10cSrcweir if (! $predefinedprogdir_added ) 2142*cdf0e10cSrcweir { 2143*cdf0e10cSrcweir my %directoryhash = (); 2144*cdf0e10cSrcweir $directoryhash{'HostName'} = ""; 2145*cdf0e10cSrcweir $directoryhash{'specificlanguage'} = ""; 2146*cdf0e10cSrcweir $directoryhash{'modules'} = ""; # ToDo? 2147*cdf0e10cSrcweir $directoryhash{'Dir'} = "PREDEFINED_PROGDIR"; 2148*cdf0e10cSrcweir 2149*cdf0e10cSrcweir push(@alldirectories, \%directoryhash); 2150*cdf0e10cSrcweir } 2151*cdf0e10cSrcweir 2152*cdf0e10cSrcweir # Creating directory array 2153*cdf0e10cSrcweir foreach my $destdir ( sort keys %alldirectoryhash ) 2154*cdf0e10cSrcweir { 2155*cdf0e10cSrcweir $alldirectoryhash{$destdir}->{'modules'} = optimize_list($alldirectoryhash{$destdir}->{'modules'}); 2156*cdf0e10cSrcweir push(@alldirectories, $alldirectoryhash{$destdir}); 2157*cdf0e10cSrcweir } 2158*cdf0e10cSrcweir 2159*cdf0e10cSrcweir return (\@alldirectories, \%alldirectoryhash); 2160*cdf0e10cSrcweir} 2161*cdf0e10cSrcweir 2162*cdf0e10cSrcweir################################## 2163*cdf0e10cSrcweir# Collecting directories: Part 2 2164*cdf0e10cSrcweir################################## 2165*cdf0e10cSrcweir 2166*cdf0e10cSrcweirsub collect_directories_with_create_flag_from_directoryarray 2167*cdf0e10cSrcweir{ 2168*cdf0e10cSrcweir my ($directoryarrayref, $alldirectoryhash) = @_; 2169*cdf0e10cSrcweir 2170*cdf0e10cSrcweir if ( $installer::globals::debug ) { installer::logger::debuginfo("installer::scriptitems::collect_directories_with_create_flag_from_directoryarray : $#{$directoryarrayref}"); } 2171*cdf0e10cSrcweir 2172*cdf0e10cSrcweir my $alreadyincluded = 0; 2173*cdf0e10cSrcweir my @alldirectories = (); 2174*cdf0e10cSrcweir 2175*cdf0e10cSrcweir for ( my $i = 0; $i <= $#{$directoryarrayref}; $i++ ) 2176*cdf0e10cSrcweir { 2177*cdf0e10cSrcweir my $onedir = ${$directoryarrayref}[$i]; 2178*cdf0e10cSrcweir my $styles = ""; 2179*cdf0e10cSrcweir $newdirincluded = 0; 2180*cdf0e10cSrcweir 2181*cdf0e10cSrcweir if ( $onedir->{'Styles'} ) { $styles = $onedir->{'Styles'}; } 2182*cdf0e10cSrcweir 2183*cdf0e10cSrcweir if ( $styles =~ /\bCREATE\b/ ) 2184*cdf0e10cSrcweir { 2185*cdf0e10cSrcweir my $directoryname = ""; 2186*cdf0e10cSrcweir 2187*cdf0e10cSrcweir if ( $onedir->{'HostName'} ) { $directoryname = $onedir->{'HostName'}; } 2188*cdf0e10cSrcweir else { installer::exiter::exit_program("ERROR: No directory name (HostName) set for specified language in gid $onedir->{'gid'}", "collect_directories_with_create_flag_from_directoryarray"); } 2189*cdf0e10cSrcweir 2190*cdf0e10cSrcweir $alreadyincluded = 0; 2191*cdf0e10cSrcweir if ( exists($alldirectoryhash->{$directoryname}) ) { $alreadyincluded = 1; } 2192*cdf0e10cSrcweir 2193*cdf0e10cSrcweir if (!($alreadyincluded)) 2194*cdf0e10cSrcweir { 2195*cdf0e10cSrcweir my %directoryhash = (); 2196*cdf0e10cSrcweir $directoryhash{'HostName'} = $directoryname; 2197*cdf0e10cSrcweir $directoryhash{'specificlanguage'} = $onedir->{'specificlanguage'}; 2198*cdf0e10cSrcweir # $directoryhash{'gid'} = $onedir->{'gid'}; 2199*cdf0e10cSrcweir $directoryhash{'Dir'} = $onedir->{'gid'}; 2200*cdf0e10cSrcweir $directoryhash{'Styles'} = $onedir->{'Styles'}; 2201*cdf0e10cSrcweir 2202*cdf0e10cSrcweir # saving also the modules 2203*cdf0e10cSrcweir if ( ! $onedir->{'modules'} ) { installer::exiter::exit_program("ERROR: No assigned modules found for directory $onedir->{'gid'}", "collect_directories_with_create_flag_from_directoryarray"); } 2204*cdf0e10cSrcweir $directoryhash{'modules'} = $onedir->{'modules'}; 2205*cdf0e10cSrcweir 2206*cdf0e10cSrcweir $alldirectoryhash->{$directoryname} = \%directoryhash; 2207*cdf0e10cSrcweir $newdirincluded = 1; 2208*cdf0e10cSrcweir 2209*cdf0e10cSrcweir # Problem: The $destinationpath can be share/registry/schema/org/openoffice 2210*cdf0e10cSrcweir # but not all directories contain files and will be added to this list. 2211*cdf0e10cSrcweir # Therefore the path has to be analyzed. 2212*cdf0e10cSrcweir 2213*cdf0e10cSrcweir while ( $directoryname =~ /(^.*\S)\Q$installer::globals::separator\E(\S.*?)\s*$/ ) # as long as the path contains slashes 2214*cdf0e10cSrcweir { 2215*cdf0e10cSrcweir $directoryname = $1; 2216*cdf0e10cSrcweir 2217*cdf0e10cSrcweir $alreadyincluded = 0; 2218*cdf0e10cSrcweir if ( exists($alldirectoryhash->{$directoryname}) ) { $alreadyincluded = 1; } 2219*cdf0e10cSrcweir 2220*cdf0e10cSrcweir if (!($alreadyincluded)) 2221*cdf0e10cSrcweir { 2222*cdf0e10cSrcweir my %directoryhash = (); 2223*cdf0e10cSrcweir 2224*cdf0e10cSrcweir $directoryhash{'HostName'} = $directoryname; 2225*cdf0e10cSrcweir $directoryhash{'specificlanguage'} = $onedir->{'specificlanguage'}; 2226*cdf0e10cSrcweir $directoryhash{'Dir'} = $onedir->{'gid'}; 2227*cdf0e10cSrcweir if ( ! $installer::globals::iswindowsbuild ) { $directoryhash{'Styles'} = "(CREATE)"; } # Exeception for Windows? 2228*cdf0e10cSrcweir 2229*cdf0e10cSrcweir # saving also the modules 2230*cdf0e10cSrcweir $directoryhash{'modules'} = $onedir->{'modules'}; 2231*cdf0e10cSrcweir 2232*cdf0e10cSrcweir $alldirectoryhash->{$directoryname} = \%directoryhash; 2233*cdf0e10cSrcweir $newdirincluded = 1; 2234*cdf0e10cSrcweir } 2235*cdf0e10cSrcweir else 2236*cdf0e10cSrcweir { 2237*cdf0e10cSrcweir # Adding the modules to the module list! 2238*cdf0e10cSrcweir $alldirectoryhash->{$directoryname}->{'modules'} = $alldirectoryhash->{$directoryname}->{'modules'} . "," . $onedir->{'modules'}; 2239*cdf0e10cSrcweir } 2240*cdf0e10cSrcweir } 2241*cdf0e10cSrcweir } 2242*cdf0e10cSrcweir else 2243*cdf0e10cSrcweir { 2244*cdf0e10cSrcweir # Adding the modules to the module list! 2245*cdf0e10cSrcweir $alldirectoryhash->{$directoryname}->{'modules'} = $alldirectoryhash->{$directoryname}->{'modules'} . "," . $onedir->{'modules'}; 2246*cdf0e10cSrcweir 2247*cdf0e10cSrcweir while ( $directoryname =~ /(^.*\S)\Q$installer::globals::separator\E(\S.*?)\s*$/ ) # as long as the path contains slashes 2248*cdf0e10cSrcweir { 2249*cdf0e10cSrcweir $directoryname = $1; 2250*cdf0e10cSrcweir # Adding the modules to the module list! 2251*cdf0e10cSrcweir $alldirectoryhash->{$directoryname}->{'modules'} = $alldirectoryhash->{$directoryname}->{'modules'} . "," . $onedir->{'modules'}; 2252*cdf0e10cSrcweir } 2253*cdf0e10cSrcweir } 2254*cdf0e10cSrcweir } 2255*cdf0e10cSrcweir 2256*cdf0e10cSrcweir # Saving the styles for already added directories in function collect_directories_from_filesarray 2257*cdf0e10cSrcweir 2258*cdf0e10cSrcweir if (( ! $newdirincluded ) && ( $styles ne "" )) 2259*cdf0e10cSrcweir { 2260*cdf0e10cSrcweir $styles =~ s/\bWORKSTATION\b//; 2261*cdf0e10cSrcweir $styles =~ s/\bCREATE\b//; 2262*cdf0e10cSrcweir 2263*cdf0e10cSrcweir if (( ! ( $styles =~ /^\s*\(\s*\)\s*$/ )) && ( ! ( $styles =~ /^\s*\(\s*\,\s*\)\s*$/ )) && ( ! ( $styles =~ /^\s*$/ ))) # checking, if there are styles left 2264*cdf0e10cSrcweir { 2265*cdf0e10cSrcweir my $directoryname = ""; 2266*cdf0e10cSrcweir if ( $onedir->{'HostName'} ) { $directoryname = $onedir->{'HostName'}; } 2267*cdf0e10cSrcweir else { installer::exiter::exit_program("ERROR: No directory name (HostName) set for specified language in gid $onedir->{'gid'}", "collect_directories_with_create_flag_from_directoryarray"); } 2268*cdf0e10cSrcweir 2269*cdf0e10cSrcweir if ( exists($alldirectoryhash->{$directoryname}) ) 2270*cdf0e10cSrcweir { 2271*cdf0e10cSrcweir $alldirectoryhash->{$directoryname}->{'Styles'} = $styles; 2272*cdf0e10cSrcweir } 2273*cdf0e10cSrcweir } 2274*cdf0e10cSrcweir } 2275*cdf0e10cSrcweir } 2276*cdf0e10cSrcweir 2277*cdf0e10cSrcweir # Creating directory array 2278*cdf0e10cSrcweir foreach my $destdir ( sort keys %{$alldirectoryhash} ) 2279*cdf0e10cSrcweir { 2280*cdf0e10cSrcweir $alldirectoryhash->{$destdir}->{'modules'} = optimize_list($alldirectoryhash->{$destdir}->{'modules'}); 2281*cdf0e10cSrcweir push(@alldirectories, $alldirectoryhash->{$destdir}); 2282*cdf0e10cSrcweir } 2283*cdf0e10cSrcweir 2284*cdf0e10cSrcweir return (\@alldirectories, \%alldirectoryhash); 2285*cdf0e10cSrcweir} 2286*cdf0e10cSrcweir 2287*cdf0e10cSrcweir################################################# 2288*cdf0e10cSrcweir# Determining the destination file of a link 2289*cdf0e10cSrcweir################################################# 2290*cdf0e10cSrcweir 2291*cdf0e10cSrcweirsub get_destination_file_path_for_links 2292*cdf0e10cSrcweir{ 2293*cdf0e10cSrcweir my ($linksarrayref, $filesarrayref) = @_; 2294*cdf0e10cSrcweir 2295*cdf0e10cSrcweir if ( $installer::globals::debug ) { installer::logger::debuginfo("installer::scriptitems::get_destination_file_path_for_links : $#{$linksarrayref} : $#{$filesarrayref}"); } 2296*cdf0e10cSrcweir 2297*cdf0e10cSrcweir my $infoline; 2298*cdf0e10cSrcweir 2299*cdf0e10cSrcweir for ( my $i = 0; $i <= $#{$linksarrayref}; $i++ ) 2300*cdf0e10cSrcweir { 2301*cdf0e10cSrcweir my $fileid = ""; 2302*cdf0e10cSrcweir my $onelink = ${$linksarrayref}[$i]; 2303*cdf0e10cSrcweir if ( $onelink->{'FileID'} ) { $fileid = $onelink->{'FileID'}; } 2304*cdf0e10cSrcweir 2305*cdf0e10cSrcweir if (!( $fileid eq "" )) 2306*cdf0e10cSrcweir { 2307*cdf0e10cSrcweir my $foundfile = 0; 2308*cdf0e10cSrcweir 2309*cdf0e10cSrcweir for ( my $j = 0; $j <= $#{$filesarrayref}; $j++ ) 2310*cdf0e10cSrcweir { 2311*cdf0e10cSrcweir my $onefile = ${$filesarrayref}[$j]; 2312*cdf0e10cSrcweir my $filegid = $onefile->{'gid'}; 2313*cdf0e10cSrcweir 2314*cdf0e10cSrcweir if ( $filegid eq $fileid ) 2315*cdf0e10cSrcweir { 2316*cdf0e10cSrcweir $foundfile = 1; 2317*cdf0e10cSrcweir $onelink->{'destinationfile'} = $onefile->{'destination'}; 2318*cdf0e10cSrcweir last; 2319*cdf0e10cSrcweir } 2320*cdf0e10cSrcweir } 2321*cdf0e10cSrcweir 2322*cdf0e10cSrcweir if (!($foundfile)) 2323*cdf0e10cSrcweir { 2324*cdf0e10cSrcweir $infoline = "Warning: FileID $fileid for Link $onelink->{'gid'} not found!\n"; 2325*cdf0e10cSrcweir push( @installer::globals::logfileinfo, $infoline); 2326*cdf0e10cSrcweir } 2327*cdf0e10cSrcweir } 2328*cdf0e10cSrcweir } 2329*cdf0e10cSrcweir 2330*cdf0e10cSrcweir $infoline = "\n"; 2331*cdf0e10cSrcweir push( @installer::globals::logfileinfo, $infoline); 2332*cdf0e10cSrcweir} 2333*cdf0e10cSrcweir 2334*cdf0e10cSrcweir################################################# 2335*cdf0e10cSrcweir# Determining the destination link of a link 2336*cdf0e10cSrcweir################################################# 2337*cdf0e10cSrcweir 2338*cdf0e10cSrcweirsub get_destination_link_path_for_links 2339*cdf0e10cSrcweir{ 2340*cdf0e10cSrcweir my ($linksarrayref) = @_; 2341*cdf0e10cSrcweir 2342*cdf0e10cSrcweir if ( $installer::globals::debug ) { installer::logger::debuginfo("installer::scriptitems::get_destination_link_path_for_links : $#{$linksarrayref}"); } 2343*cdf0e10cSrcweir 2344*cdf0e10cSrcweir my $infoline; 2345*cdf0e10cSrcweir 2346*cdf0e10cSrcweir for ( my $i = 0; $i <= $#{$linksarrayref}; $i++ ) 2347*cdf0e10cSrcweir { 2348*cdf0e10cSrcweir my $shortcutid = ""; 2349*cdf0e10cSrcweir my $onelink = ${$linksarrayref}[$i]; 2350*cdf0e10cSrcweir if ( $onelink->{'ShortcutID'} ) { $shortcutid = $onelink->{'ShortcutID'}; } 2351*cdf0e10cSrcweir 2352*cdf0e10cSrcweir if (!( $shortcutid eq "" )) 2353*cdf0e10cSrcweir { 2354*cdf0e10cSrcweir my $foundlink = 0; 2355*cdf0e10cSrcweir 2356*cdf0e10cSrcweir for ( my $j = 0; $j <= $#{$linksarrayref}; $j++ ) 2357*cdf0e10cSrcweir { 2358*cdf0e10cSrcweir my $destlink = ${$linksarrayref}[$j]; 2359*cdf0e10cSrcweir $shortcutgid = $destlink->{'gid'}; 2360*cdf0e10cSrcweir 2361*cdf0e10cSrcweir if ( $shortcutgid eq $shortcutid ) 2362*cdf0e10cSrcweir { 2363*cdf0e10cSrcweir $foundlink = 1; 2364*cdf0e10cSrcweir $onelink->{'destinationfile'} = $destlink->{'destination'}; # making key 'destinationfile' 2365*cdf0e10cSrcweir last; 2366*cdf0e10cSrcweir } 2367*cdf0e10cSrcweir } 2368*cdf0e10cSrcweir 2369*cdf0e10cSrcweir if (!($foundlink)) 2370*cdf0e10cSrcweir { 2371*cdf0e10cSrcweir $infoline = "Warning: ShortcutID $shortcutid for Link $onelink->{'gid'} not found!\n"; 2372*cdf0e10cSrcweir push( @installer::globals::logfileinfo, $infoline); 2373*cdf0e10cSrcweir } 2374*cdf0e10cSrcweir } 2375*cdf0e10cSrcweir } 2376*cdf0e10cSrcweir 2377*cdf0e10cSrcweir $infoline = "\n"; 2378*cdf0e10cSrcweir push( @installer::globals::logfileinfo, $infoline); 2379*cdf0e10cSrcweir} 2380*cdf0e10cSrcweir 2381*cdf0e10cSrcweir################################################################################### 2382*cdf0e10cSrcweir# Items with flag WORKSTATION are not needed (here: links and configurationitems) 2383*cdf0e10cSrcweir################################################################################### 2384*cdf0e10cSrcweir 2385*cdf0e10cSrcweirsub remove_workstation_only_items 2386*cdf0e10cSrcweir{ 2387*cdf0e10cSrcweir my ($itemarrayref) = @_; 2388*cdf0e10cSrcweir 2389*cdf0e10cSrcweir if ( $installer::globals::debug ) { installer::logger::debuginfo("installer::scriptitems::remove_workstation_only_items : $#{$itemarrayref}"); } 2390*cdf0e10cSrcweir 2391*cdf0e10cSrcweir my @newitemarray = (); 2392*cdf0e10cSrcweir 2393*cdf0e10cSrcweir for ( my $i = 0; $i <= $#{$itemarrayref}; $i++ ) 2394*cdf0e10cSrcweir { 2395*cdf0e10cSrcweir my $oneitem = ${$itemarrayref}[$i]; 2396*cdf0e10cSrcweir my $styles = $oneitem->{'Styles'}; 2397*cdf0e10cSrcweir 2398*cdf0e10cSrcweir if (( $styles =~ /\bWORKSTATION\b/ ) && 2399*cdf0e10cSrcweir (!( $styles =~ /\bNETWORK\b/ )) && 2400*cdf0e10cSrcweir (!( $styles =~ /\bSTANDALONE\b/ ))) 2401*cdf0e10cSrcweir { 2402*cdf0e10cSrcweir next; # removing this link, it is only needed for a workstation installation 2403*cdf0e10cSrcweir } 2404*cdf0e10cSrcweir 2405*cdf0e10cSrcweir push(@newitemarray, $oneitem); 2406*cdf0e10cSrcweir } 2407*cdf0e10cSrcweir 2408*cdf0e10cSrcweir return \@newitemarray; 2409*cdf0e10cSrcweir} 2410*cdf0e10cSrcweir 2411*cdf0e10cSrcweir################################################ 2412*cdf0e10cSrcweir# Resolving relative path in links 2413*cdf0e10cSrcweir################################################ 2414*cdf0e10cSrcweir 2415*cdf0e10cSrcweirsub resolve_links_with_flag_relative 2416*cdf0e10cSrcweir{ 2417*cdf0e10cSrcweir my ($linksarrayref) = @_; 2418*cdf0e10cSrcweir 2419*cdf0e10cSrcweir if ( $installer::globals::debug ) { installer::logger::debuginfo("installer::scriptitems::resolve_links_with_flag_relative : $#{$linksarrayref}"); } 2420*cdf0e10cSrcweir 2421*cdf0e10cSrcweir # Before this step is: 2422*cdf0e10cSrcweir # destination=program/libsalhelperC52.so.3, this will be the name of the link 2423*cdf0e10cSrcweir # destinationfile=program/libsalhelperC52.so.3, this will be the linked file or name 2424*cdf0e10cSrcweir # If the flag RELATIVE is set, the pathes have to be analyzed. If the flag is not set 2425*cdf0e10cSrcweir # (this will not occur in the future?) destinationfile has to be an absolute path name 2426*cdf0e10cSrcweir 2427*cdf0e10cSrcweir for ( my $i = 0; $i <= $#{$linksarrayref}; $i++ ) 2428*cdf0e10cSrcweir { 2429*cdf0e10cSrcweir my $onelink = ${$linksarrayref}[$i]; 2430*cdf0e10cSrcweir my $styles = $onelink->{'Styles'}; 2431*cdf0e10cSrcweir 2432*cdf0e10cSrcweir if ( $styles =~ /\bRELATIVE\b/ ) 2433*cdf0e10cSrcweir { 2434*cdf0e10cSrcweir # ToDo: This is only a simple not sufficient mechanism 2435*cdf0e10cSrcweir 2436*cdf0e10cSrcweir my $destination = $onelink->{'destination'}; 2437*cdf0e10cSrcweir my $destinationfile = $onelink->{'destinationfile'}; 2438*cdf0e10cSrcweir 2439*cdf0e10cSrcweir my $destinationpath = $destination; 2440*cdf0e10cSrcweir 2441*cdf0e10cSrcweir installer::pathanalyzer::get_path_from_fullqualifiedname(\$destinationpath); 2442*cdf0e10cSrcweir 2443*cdf0e10cSrcweir my $destinationfilepath = $destinationfile; 2444*cdf0e10cSrcweir 2445*cdf0e10cSrcweir # it is possible, that the destinationfile is no longer part of the files collector 2446*cdf0e10cSrcweir if ($destinationfilepath) { installer::pathanalyzer::get_path_from_fullqualifiedname(\$destinationfilepath); } 2447*cdf0e10cSrcweir else { $destinationfilepath = ""; } 2448*cdf0e10cSrcweir 2449*cdf0e10cSrcweir if ( $destinationpath eq $destinationfilepath ) 2450*cdf0e10cSrcweir { 2451*cdf0e10cSrcweir # link and file are in the same directory 2452*cdf0e10cSrcweir # Therefore the path of the file can be removed 2453*cdf0e10cSrcweir 2454*cdf0e10cSrcweir my $newdestinationfile = $destinationfile; 2455*cdf0e10cSrcweir installer::pathanalyzer::make_absolute_filename_to_relative_filename(\$newdestinationfile); 2456*cdf0e10cSrcweir 2457*cdf0e10cSrcweir $onelink->{'destinationfile'} = $newdestinationfile; 2458*cdf0e10cSrcweir } 2459*cdf0e10cSrcweir } 2460*cdf0e10cSrcweir } 2461*cdf0e10cSrcweir} 2462*cdf0e10cSrcweir 2463*cdf0e10cSrcweir######################################################################## 2464*cdf0e10cSrcweir# This function is a helper of function "assigning_modules_to_items" 2465*cdf0e10cSrcweir######################################################################## 2466*cdf0e10cSrcweir 2467*cdf0e10cSrcweirsub insert_for_item ($$$) 2468*cdf0e10cSrcweir{ 2469*cdf0e10cSrcweir my ($hash, $item, $id) = @_; 2470*cdf0e10cSrcweir 2471*cdf0e10cSrcweir # print STDERR "insert '$id' for '$item'\n"; 2472*cdf0e10cSrcweir if (!defined $hash->{$item}) 2473*cdf0e10cSrcweir { 2474*cdf0e10cSrcweir my @gids = (); 2475*cdf0e10cSrcweir $hash->{$item} = \@gids; 2476*cdf0e10cSrcweir } 2477*cdf0e10cSrcweir my $gid_list = $hash->{$item}; 2478*cdf0e10cSrcweir push @{$gid_list}, $id; 2479*cdf0e10cSrcweir $hash->{$item} = $gid_list; 2480*cdf0e10cSrcweir} 2481*cdf0e10cSrcweir 2482*cdf0e10cSrcweirsub build_modulegids_table 2483*cdf0e10cSrcweir{ 2484*cdf0e10cSrcweir my ($modulesref, $itemname) = @_; 2485*cdf0e10cSrcweir 2486*cdf0e10cSrcweir my %module_lookup_table = (); 2487*cdf0e10cSrcweir 2488*cdf0e10cSrcweir # build map of item names to list of respective module gids 2489*cdf0e10cSrcweir # containing these items 2490*cdf0e10cSrcweir for my $onemodule (@{$modulesref}) 2491*cdf0e10cSrcweir { 2492*cdf0e10cSrcweir next if ( ! defined $onemodule->{$itemname} ); 2493*cdf0e10cSrcweir # these are the items contained in this module 2494*cdf0e10cSrcweir # eg. Files = (gid_a_b_c,gid_d_e_f) 2495*cdf0e10cSrcweir my $module_gids = $onemodule->{$itemname}; 2496*cdf0e10cSrcweir 2497*cdf0e10cSrcweir # prune outer brackets 2498*cdf0e10cSrcweir $module_gids =~ s|^\s*\(||g; 2499*cdf0e10cSrcweir $module_gids =~ s|\)\s*$||g; 2500*cdf0e10cSrcweir for my $id (split (/,/, $module_gids)) 2501*cdf0e10cSrcweir { 2502*cdf0e10cSrcweir chomp $id; 2503*cdf0e10cSrcweir insert_for_item(\%module_lookup_table, lc ($id), $onemodule->{'gid'}); 2504*cdf0e10cSrcweir } 2505*cdf0e10cSrcweir } 2506*cdf0e10cSrcweir 2507*cdf0e10cSrcweir return \%module_lookup_table; 2508*cdf0e10cSrcweir} 2509*cdf0e10cSrcweir 2510*cdf0e10cSrcweir######################################################################## 2511*cdf0e10cSrcweir# Items like files do not know their modules 2512*cdf0e10cSrcweir# This function is a helper of function "assigning_modules_to_items" 2513*cdf0e10cSrcweir######################################################################## 2514*cdf0e10cSrcweir 2515*cdf0e10cSrcweirsub get_string_of_modulegids_for_itemgid 2516*cdf0e10cSrcweir{ 2517*cdf0e10cSrcweir my ($module_lookup_table, $modulesref, $itemgid, $itemname) = @_; 2518*cdf0e10cSrcweir 2519*cdf0e10cSrcweir if ( $installer::globals::debug ) { installer::logger::debuginfo("installer::scriptitems::get_string_of_modulegids_for_itemgid : $#{$modulesref} : $itemgid : $itemname"); } 2520*cdf0e10cSrcweir 2521*cdf0e10cSrcweir my $allmodules = ""; 2522*cdf0e10cSrcweir my $haslanguagemodule = 0; 2523*cdf0e10cSrcweir my %foundmodules = (); 2524*cdf0e10cSrcweir 2525*cdf0e10cSrcweir # print STDERR "lookup '" . lc($itemgid) . "'\n"; 2526*cdf0e10cSrcweir my $gid_list = $module_lookup_table->{lc($itemgid)}; 2527*cdf0e10cSrcweir 2528*cdf0e10cSrcweir for my $gid (@{$gid_list}) 2529*cdf0e10cSrcweir { 2530*cdf0e10cSrcweir $foundmodules{$gid} = 1; 2531*cdf0e10cSrcweir $allmodules = $allmodules . "," . $gid; 2532*cdf0e10cSrcweir # Is this module a language module? This info should be stored at the file. 2533*cdf0e10cSrcweir if ( exists($installer::globals::alllangmodules{$gid}) ) { $haslanguagemodule = 1; } 2534*cdf0e10cSrcweir } 2535*cdf0e10cSrcweir 2536*cdf0e10cSrcweir $allmodules =~ s/^\s*\,//; # removing leading comma 2537*cdf0e10cSrcweir 2538*cdf0e10cSrcweir # Check: All modules or no module must have flag LANGUAGEMODULE 2539*cdf0e10cSrcweir if ( $haslanguagemodule ) 2540*cdf0e10cSrcweir { 2541*cdf0e10cSrcweir my $isreallylanguagemodule = installer::worker::key_in_a_is_also_key_in_b(\%foundmodules, \%installer::globals::alllangmodules); 2542*cdf0e10cSrcweir if ( ! $isreallylanguagemodule ) { installer::exiter::exit_program("ERROR: \"$itemgid\" is assigned to modules with flag \"LANGUAGEMODULE\" and also to modules without this flag! Modules: $allmodules", "get_string_of_modulegids_for_itemgid"); } 2543*cdf0e10cSrcweir } 2544*cdf0e10cSrcweir 2545*cdf0e10cSrcweir # print STDERR "get_string_for_itemgid ($itemgid, $itemname) => $allmodules, $haslanguagemodule\n"; 2546*cdf0e10cSrcweir 2547*cdf0e10cSrcweir return ($allmodules, $haslanguagemodule); 2548*cdf0e10cSrcweir} 2549*cdf0e10cSrcweir 2550*cdf0e10cSrcweir######################################################## 2551*cdf0e10cSrcweir# Items like files do not know their modules 2552*cdf0e10cSrcweir# This function add the {'modules'} to these items 2553*cdf0e10cSrcweir######################################################## 2554*cdf0e10cSrcweir 2555*cdf0e10cSrcweirsub assigning_modules_to_items 2556*cdf0e10cSrcweir{ 2557*cdf0e10cSrcweir my ($modulesref, $itemsref, $itemname) = @_; 2558*cdf0e10cSrcweir 2559*cdf0e10cSrcweir if ( $installer::globals::debug ) { installer::logger::debuginfo("installer::scriptitems::assigning_modules_to_items : $#{$modulesref} : $#{$itemsref} : $itemname"); } 2560*cdf0e10cSrcweir 2561*cdf0e10cSrcweir my $infoline = ""; 2562*cdf0e10cSrcweir my $languageassignmenterror = 0; 2563*cdf0e10cSrcweir my @languageassignmenterrors = (); 2564*cdf0e10cSrcweir 2565*cdf0e10cSrcweir my $module_lookup_table = build_modulegids_table($modulesref, $itemname); 2566*cdf0e10cSrcweir 2567*cdf0e10cSrcweir for my $oneitem (@{$itemsref}) 2568*cdf0e10cSrcweir { 2569*cdf0e10cSrcweir my $itemgid = $oneitem->{'gid'}; 2570*cdf0e10cSrcweir 2571*cdf0e10cSrcweir my $styles = ""; 2572*cdf0e10cSrcweir if ( $oneitem->{'Styles'} ) { $styles = $oneitem->{'Styles'}; } 2573*cdf0e10cSrcweir if (( $itemname eq "Dirs" ) && ( ! ( $styles =~ /\bCREATE\b/ ))) { next; } 2574*cdf0e10cSrcweir 2575*cdf0e10cSrcweir if ( $itemgid eq "" ) 2576*cdf0e10cSrcweir { 2577*cdf0e10cSrcweir installer::exiter::exit_program("ERROR in item collection: No gid for item $oneitem->{'Name'}", "assigning_modules_to_items"); 2578*cdf0e10cSrcweir } 2579*cdf0e10cSrcweir 2580*cdf0e10cSrcweir # every item can belong to many modules 2581*cdf0e10cSrcweir 2582*cdf0e10cSrcweir my ($modulegids, $haslanguagemodule) = get_string_of_modulegids_for_itemgid($module_lookup_table, $modulesref, $itemgid, $itemname); 2583*cdf0e10cSrcweir 2584*cdf0e10cSrcweir if ($modulegids eq "") 2585*cdf0e10cSrcweir { 2586*cdf0e10cSrcweir installer::exiter::exit_program("ERROR in file collection: No module found for $itemname $itemgid", "assigning_modules_to_items"); 2587*cdf0e10cSrcweir } 2588*cdf0e10cSrcweir 2589*cdf0e10cSrcweir $oneitem->{'modules'} = $modulegids; 2590*cdf0e10cSrcweir $oneitem->{'haslanguagemodule'} = $haslanguagemodule; 2591*cdf0e10cSrcweir 2592*cdf0e10cSrcweir # Important check: "ismultilingual" and "haslanguagemodule" must have the same value ! 2593*cdf0e10cSrcweir if (( $oneitem->{'ismultilingual'} ) && ( ! $oneitem->{'haslanguagemodule'} )) 2594*cdf0e10cSrcweir { 2595*cdf0e10cSrcweir $infoline = "Error: \"$oneitem->{'gid'}\" is multi lingual, but not in language pack (Assigned module: $modulegids)!\n"; 2596*cdf0e10cSrcweir push( @installer::globals::globallogfileinfo, $infoline); 2597*cdf0e10cSrcweir push( @languageassignmenterrors, $infoline ); 2598*cdf0e10cSrcweir $languageassignmenterror = 1; 2599*cdf0e10cSrcweir } 2600*cdf0e10cSrcweir if (( $oneitem->{'haslanguagemodule'} ) && ( ! $oneitem->{'ismultilingual'} )) 2601*cdf0e10cSrcweir { 2602*cdf0e10cSrcweir $infoline = "Error: \"$oneitem->{'gid'}\" is in language pack, but not multi lingual (Assigned module: $modulegids)!\n"; 2603*cdf0e10cSrcweir push( @installer::globals::globallogfileinfo, $infoline); 2604*cdf0e10cSrcweir push( @languageassignmenterrors, $infoline ); 2605*cdf0e10cSrcweir $languageassignmenterror = 1; 2606*cdf0e10cSrcweir } 2607*cdf0e10cSrcweir } 2608*cdf0e10cSrcweir 2609*cdf0e10cSrcweir if ($languageassignmenterror) 2610*cdf0e10cSrcweir { 2611*cdf0e10cSrcweir for ( my $i = 0; $i <= $#languageassignmenterrors; $i++ ) { print "$languageassignmenterrors[$i]"; } 2612*cdf0e10cSrcweir installer::exiter::exit_program("ERROR: Incorrect assignments for language packs.", "assigning_modules_to_items"); 2613*cdf0e10cSrcweir } 2614*cdf0e10cSrcweir 2615*cdf0e10cSrcweir} 2616*cdf0e10cSrcweir 2617*cdf0e10cSrcweir################################################################################################# 2618*cdf0e10cSrcweir# Root path (for instance /opt/openofficeorg20) needs to be added to directories, files and links 2619*cdf0e10cSrcweir################################################################################################# 2620*cdf0e10cSrcweir 2621*cdf0e10cSrcweirsub add_rootpath_to_directories 2622*cdf0e10cSrcweir{ 2623*cdf0e10cSrcweir my ($dirsref, $rootpath) = @_; 2624*cdf0e10cSrcweir 2625*cdf0e10cSrcweir if ( $installer::globals::debug ) { installer::logger::debuginfo("installer::scriptitems::add_rootpath_to_directories : $#{$dirsref} : $rootpath"); } 2626*cdf0e10cSrcweir 2627*cdf0e10cSrcweir for ( my $i = 0; $i <= $#{$dirsref}; $i++ ) 2628*cdf0e10cSrcweir { 2629*cdf0e10cSrcweir my $onedir = ${$dirsref}[$i]; 2630*cdf0e10cSrcweir my $dir = ""; 2631*cdf0e10cSrcweir 2632*cdf0e10cSrcweir if ( $onedir->{'Dir'} ) { $dir = $onedir->{'Dir'}; } 2633*cdf0e10cSrcweir 2634*cdf0e10cSrcweir if (!($dir =~ /\bPREDEFINED_/ )) 2635*cdf0e10cSrcweir { 2636*cdf0e10cSrcweir my $hostname = $onedir->{'HostName'}; 2637*cdf0e10cSrcweir $hostname = $rootpath . $installer::globals::separator . $hostname; 2638*cdf0e10cSrcweir $onedir->{'HostName'} = $hostname; 2639*cdf0e10cSrcweir } 2640*cdf0e10cSrcweir 2641*cdf0e10cSrcweir # added 2642*cdf0e10cSrcweir 2643*cdf0e10cSrcweir if ( $dir =~ /\bPREDEFINED_PROGDIR\b/ ) 2644*cdf0e10cSrcweir { 2645*cdf0e10cSrcweir my $hostname = $onedir->{'HostName'}; 2646*cdf0e10cSrcweir if ( $hostname eq "" ) { $onedir->{'HostName'} = $rootpath; } 2647*cdf0e10cSrcweir else { $onedir->{'HostName'} = $rootpath . $installer::globals::separator . $hostname; } 2648*cdf0e10cSrcweir } 2649*cdf0e10cSrcweir } 2650*cdf0e10cSrcweir} 2651*cdf0e10cSrcweir 2652*cdf0e10cSrcweirsub add_rootpath_to_files 2653*cdf0e10cSrcweir{ 2654*cdf0e10cSrcweir my ($filesref, $rootpath) = @_; 2655*cdf0e10cSrcweir 2656*cdf0e10cSrcweir if ( $installer::globals::debug ) { installer::logger::debuginfo("installer::scriptitems::add_rootpath_to_files : $#{$filesref} : $rootpath"); } 2657*cdf0e10cSrcweir 2658*cdf0e10cSrcweir for ( my $i = 0; $i <= $#{$filesref}; $i++ ) 2659*cdf0e10cSrcweir { 2660*cdf0e10cSrcweir my $onefile = ${$filesref}[$i]; 2661*cdf0e10cSrcweir my $destination = $onefile->{'destination'}; 2662*cdf0e10cSrcweir $destination = $rootpath . $installer::globals::separator . $destination; 2663*cdf0e10cSrcweir $onefile->{'destination'} = $destination; 2664*cdf0e10cSrcweir } 2665*cdf0e10cSrcweir} 2666*cdf0e10cSrcweir 2667*cdf0e10cSrcweirsub add_rootpath_to_links 2668*cdf0e10cSrcweir{ 2669*cdf0e10cSrcweir my ($linksref, $rootpath) = @_; 2670*cdf0e10cSrcweir 2671*cdf0e10cSrcweir if ( $installer::globals::debug ) { installer::logger::debuginfo("installer::scriptitems::add_rootpath_to_links : $#{$linksref} : $rootpath"); } 2672*cdf0e10cSrcweir 2673*cdf0e10cSrcweir for ( my $i = 0; $i <= $#{$linksref}; $i++ ) 2674*cdf0e10cSrcweir { 2675*cdf0e10cSrcweir my $onelink = ${$linksref}[$i]; 2676*cdf0e10cSrcweir my $styles = $onelink->{'Styles'}; 2677*cdf0e10cSrcweir 2678*cdf0e10cSrcweir my $destination = $onelink->{'destination'}; 2679*cdf0e10cSrcweir $destination = $rootpath . $installer::globals::separator . $destination; 2680*cdf0e10cSrcweir $onelink->{'destination'} = $destination; 2681*cdf0e10cSrcweir 2682*cdf0e10cSrcweir if (!($styles =~ /\bRELATIVE\b/ )) # for absolute links 2683*cdf0e10cSrcweir { 2684*cdf0e10cSrcweir my $destinationfile = $onelink->{'destinationfile'}; 2685*cdf0e10cSrcweir $destinationfile = $rootpath . $installer::globals::separator . $destinationfile; 2686*cdf0e10cSrcweir $onelink->{'destinationfile'} = $destinationfile; 2687*cdf0e10cSrcweir } 2688*cdf0e10cSrcweir } 2689*cdf0e10cSrcweir} 2690*cdf0e10cSrcweir 2691*cdf0e10cSrcweir################################################################################# 2692*cdf0e10cSrcweir# Collecting all parent gids 2693*cdf0e10cSrcweir################################################################################# 2694*cdf0e10cSrcweir 2695*cdf0e10cSrcweirsub collect_all_parent_feature 2696*cdf0e10cSrcweir{ 2697*cdf0e10cSrcweir my ($modulesref) = @_; 2698*cdf0e10cSrcweir 2699*cdf0e10cSrcweir my @allparents = (); 2700*cdf0e10cSrcweir 2701*cdf0e10cSrcweir my $found_root_module = 0; 2702*cdf0e10cSrcweir 2703*cdf0e10cSrcweir for ( my $i = 0; $i <= $#{$modulesref}; $i++ ) 2704*cdf0e10cSrcweir { 2705*cdf0e10cSrcweir my $onefeature = ${$modulesref}[$i]; 2706*cdf0e10cSrcweir 2707*cdf0e10cSrcweir my $parentgid = ""; 2708*cdf0e10cSrcweir if ( $onefeature->{'ParentID'} ) 2709*cdf0e10cSrcweir { 2710*cdf0e10cSrcweir $parentgid = $onefeature->{'ParentID'}; 2711*cdf0e10cSrcweir } 2712*cdf0e10cSrcweir 2713*cdf0e10cSrcweir if ( $parentgid ne "" ) 2714*cdf0e10cSrcweir { 2715*cdf0e10cSrcweir if (! installer::existence::exists_in_array($parentgid, \@allparents)) 2716*cdf0e10cSrcweir { 2717*cdf0e10cSrcweir push(@allparents, $parentgid); 2718*cdf0e10cSrcweir } 2719*cdf0e10cSrcweir } 2720*cdf0e10cSrcweir 2721*cdf0e10cSrcweir # Setting the global root module 2722*cdf0e10cSrcweir 2723*cdf0e10cSrcweir if ( $parentgid eq "" ) 2724*cdf0e10cSrcweir { 2725*cdf0e10cSrcweir if ( $found_root_module ) { installer::exiter::exit_program("ERROR: Only one module without ParentID or with empty ParentID allowed ($installer::globals::rootmodulegid, $onefeature->{'gid'}).", "collect_all_parent_feature"); } 2726*cdf0e10cSrcweir $installer::globals::rootmodulegid = $onefeature->{'gid'}; 2727*cdf0e10cSrcweir $found_root_module = 1; 2728*cdf0e10cSrcweir $infoline = "Setting Root Module: $installer::globals::rootmodulegid\n"; 2729*cdf0e10cSrcweir push( @installer::globals::globallogfileinfo, $infoline); 2730*cdf0e10cSrcweir } 2731*cdf0e10cSrcweir 2732*cdf0e10cSrcweir if ( ! $found_root_module ) { installer::exiter::exit_program("ERROR: Could not define root module. No module without ParentID or with empty ParentID exists.", "collect_all_parent_feature"); } 2733*cdf0e10cSrcweir 2734*cdf0e10cSrcweir } 2735*cdf0e10cSrcweir 2736*cdf0e10cSrcweir return \@allparents; 2737*cdf0e10cSrcweir} 2738*cdf0e10cSrcweir 2739*cdf0e10cSrcweir################################################################################# 2740*cdf0e10cSrcweir# Checking for every feature, whether it has children 2741*cdf0e10cSrcweir################################################################################# 2742*cdf0e10cSrcweir 2743*cdf0e10cSrcweirsub set_children_flag 2744*cdf0e10cSrcweir{ 2745*cdf0e10cSrcweir my ($modulesref) = @_; 2746*cdf0e10cSrcweir 2747*cdf0e10cSrcweir my $allparents = collect_all_parent_feature($modulesref); 2748*cdf0e10cSrcweir 2749*cdf0e10cSrcweir for ( my $i = 0; $i <= $#{$modulesref}; $i++ ) 2750*cdf0e10cSrcweir { 2751*cdf0e10cSrcweir my $onefeature = ${$modulesref}[$i]; 2752*cdf0e10cSrcweir my $gid = $onefeature->{'gid'}; 2753*cdf0e10cSrcweir 2754*cdf0e10cSrcweir # is this gid a parent? 2755*cdf0e10cSrcweir 2756*cdf0e10cSrcweir if ( installer::existence::exists_in_array($gid, $allparents) ) 2757*cdf0e10cSrcweir { 2758*cdf0e10cSrcweir $onefeature->{'has_children'} = 1; 2759*cdf0e10cSrcweir } 2760*cdf0e10cSrcweir else 2761*cdf0e10cSrcweir { 2762*cdf0e10cSrcweir $onefeature->{'has_children'} = 0; 2763*cdf0e10cSrcweir } 2764*cdf0e10cSrcweir } 2765*cdf0e10cSrcweir} 2766*cdf0e10cSrcweir 2767*cdf0e10cSrcweir################################################################################# 2768*cdf0e10cSrcweir# All modules, that use a template module, do now get the assignments of 2769*cdf0e10cSrcweir# the template module. 2770*cdf0e10cSrcweir################################################################################# 2771*cdf0e10cSrcweir 2772*cdf0e10cSrcweirsub resolve_assigned_modules 2773*cdf0e10cSrcweir{ 2774*cdf0e10cSrcweir my ($modulesref) = @_; 2775*cdf0e10cSrcweir 2776*cdf0e10cSrcweir # collecting all template modules 2777*cdf0e10cSrcweir 2778*cdf0e10cSrcweir my %directaccess = (); 2779*cdf0e10cSrcweir 2780*cdf0e10cSrcweir for ( my $i = 0; $i <= $#{$modulesref}; $i++ ) 2781*cdf0e10cSrcweir { 2782*cdf0e10cSrcweir my $onefeature = ${$modulesref}[$i]; 2783*cdf0e10cSrcweir my $styles = ""; 2784*cdf0e10cSrcweir if ( $onefeature->{'Styles'} ) { $styles = $onefeature->{'Styles'}; } 2785*cdf0e10cSrcweir if ( $styles =~ /\bTEMPLATEMODULE\b/ ) { $directaccess{$onefeature->{'gid'}} = $onefeature; } 2786*cdf0e10cSrcweir 2787*cdf0e10cSrcweir # also looking for module with flag ROOT_BRAND_PACKAGE, to save is for further usage 2788*cdf0e10cSrcweir if ( $styles =~ /\bROOT_BRAND_PACKAGE\b/ ) 2789*cdf0e10cSrcweir { 2790*cdf0e10cSrcweir $installer::globals::rootbrandpackage = $onefeature->{'gid'}; 2791*cdf0e10cSrcweir $installer::globals::rootbrandpackageset = 1; 2792*cdf0e10cSrcweir } 2793*cdf0e10cSrcweir } 2794*cdf0e10cSrcweir 2795*cdf0e10cSrcweir # looking, where template modules are assigned 2796*cdf0e10cSrcweir 2797*cdf0e10cSrcweir for ( my $i = 0; $i <= $#{$modulesref}; $i++ ) 2798*cdf0e10cSrcweir { 2799*cdf0e10cSrcweir my $onefeature = ${$modulesref}[$i]; 2800*cdf0e10cSrcweir if ( $onefeature->{'Assigns'} ) 2801*cdf0e10cSrcweir { 2802*cdf0e10cSrcweir my $templategid = $onefeature->{'Assigns'}; 2803*cdf0e10cSrcweir 2804*cdf0e10cSrcweir if ( ! exists($directaccess{$templategid}) ) 2805*cdf0e10cSrcweir { 2806*cdf0e10cSrcweir installer::exiter::exit_program("ERROR: Did not find definition of assigned template module \"$templategid\"", "resolve_assigned_modules"); 2807*cdf0e10cSrcweir } 2808*cdf0e10cSrcweir 2809*cdf0e10cSrcweir # Currently no merging of Files, Dirs, ... 2810*cdf0e10cSrcweir # This has to be included here, if it is required 2811*cdf0e10cSrcweir my $item; 2812*cdf0e10cSrcweir foreach $item (@installer::globals::items_at_modules) 2813*cdf0e10cSrcweir { 2814*cdf0e10cSrcweir if ( exists($directaccess{$templategid}->{$item}) ) { $onefeature->{$item} = $directaccess{$templategid}->{$item}; } 2815*cdf0e10cSrcweir } 2816*cdf0e10cSrcweir } 2817*cdf0e10cSrcweir } 2818*cdf0e10cSrcweir} 2819*cdf0e10cSrcweir 2820*cdf0e10cSrcweir################################################################################# 2821*cdf0e10cSrcweir# Removing the template modules from the list, after all 2822*cdf0e10cSrcweir# assignments are transferred to the "real" modules. 2823*cdf0e10cSrcweir################################################################################# 2824*cdf0e10cSrcweir 2825*cdf0e10cSrcweirsub remove_template_modules 2826*cdf0e10cSrcweir{ 2827*cdf0e10cSrcweir my ($modulesref) = @_; 2828*cdf0e10cSrcweir 2829*cdf0e10cSrcweir my @modules = (); 2830*cdf0e10cSrcweir 2831*cdf0e10cSrcweir for ( my $i = 0; $i <= $#{$modulesref}; $i++ ) 2832*cdf0e10cSrcweir { 2833*cdf0e10cSrcweir my $onefeature = ${$modulesref}[$i]; 2834*cdf0e10cSrcweir my $styles = ""; 2835*cdf0e10cSrcweir if ( $onefeature->{'Styles'} ) { $styles = $onefeature->{'Styles'}; } 2836*cdf0e10cSrcweir if ( $styles =~ /\bTEMPLATEMODULE\b/ ) { next; } 2837*cdf0e10cSrcweir 2838*cdf0e10cSrcweir push(@modules, $onefeature); 2839*cdf0e10cSrcweir } 2840*cdf0e10cSrcweir 2841*cdf0e10cSrcweir return \@modules; 2842*cdf0e10cSrcweir} 2843*cdf0e10cSrcweir 2844*cdf0e10cSrcweir################################################################################# 2845*cdf0e10cSrcweir# Collecting all modules with flag LANGUAGEMODULE in a global 2846*cdf0e10cSrcweir# collector. 2847*cdf0e10cSrcweir################################################################################# 2848*cdf0e10cSrcweir 2849*cdf0e10cSrcweirsub collect_all_languagemodules 2850*cdf0e10cSrcweir{ 2851*cdf0e10cSrcweir my ($modulesref) = @_; 2852*cdf0e10cSrcweir 2853*cdf0e10cSrcweir for ( my $i = 0; $i <= $#{$modulesref}; $i++ ) 2854*cdf0e10cSrcweir { 2855*cdf0e10cSrcweir my $onefeature = ${$modulesref}[$i]; 2856*cdf0e10cSrcweir my $styles = ""; 2857*cdf0e10cSrcweir if ( $onefeature->{'Styles'} ) { $styles = $onefeature->{'Styles'}; } 2858*cdf0e10cSrcweir if ( $styles =~ /\bLANGUAGEMODULE\b/ ) 2859*cdf0e10cSrcweir { 2860*cdf0e10cSrcweir if ( ! exists($onefeature->{'Language'}) ) { installer::exiter::exit_program("ERROR: \"$onefeature->{'gid'}\" has flag LANGUAGEMODULE, but does not know its language!", "collect_all_languagemodules"); } 2861*cdf0e10cSrcweir $installer::globals::alllangmodules{$onefeature->{'gid'}} = $onefeature->{'Language'}; 2862*cdf0e10cSrcweir # Collecting also the english names, that are used for nsis unpack directory for language packs 2863*cdf0e10cSrcweir my $lang = $onefeature->{'Language'}; 2864*cdf0e10cSrcweir my $name = ""; 2865*cdf0e10cSrcweir foreach my $localkey ( keys %{$onefeature} ) 2866*cdf0e10cSrcweir { 2867*cdf0e10cSrcweir if ( $localkey =~ /^\s*Name\s*\(\s*en-US\s*\)\s*$/ ) 2868*cdf0e10cSrcweir { 2869*cdf0e10cSrcweir $installer::globals::all_english_languagestrings{$lang} = $onefeature->{$localkey}; 2870*cdf0e10cSrcweir } 2871*cdf0e10cSrcweir } 2872*cdf0e10cSrcweir } 2873*cdf0e10cSrcweir } 2874*cdf0e10cSrcweir} 2875*cdf0e10cSrcweir 2876*cdf0e10cSrcweir################################################################################# 2877*cdf0e10cSrcweir# Selecting from all collected english language strings those, that are really 2878*cdf0e10cSrcweir# required in this installation set. 2879*cdf0e10cSrcweir################################################################################# 2880*cdf0e10cSrcweir 2881*cdf0e10cSrcweirsub select_required_language_strings 2882*cdf0e10cSrcweir{ 2883*cdf0e10cSrcweir my ($modulesref) = @_; 2884*cdf0e10cSrcweir 2885*cdf0e10cSrcweir for ( my $i = 0; $i <= $#{$modulesref}; $i++ ) 2886*cdf0e10cSrcweir { 2887*cdf0e10cSrcweir my $onefeature = ${$modulesref}[$i]; 2888*cdf0e10cSrcweir my $styles = ""; 2889*cdf0e10cSrcweir if ( $onefeature->{'Styles'} ) { $styles = $onefeature->{'Styles'}; } 2890*cdf0e10cSrcweir if ( $styles =~ /\bLANGUAGEMODULE\b/ ) 2891*cdf0e10cSrcweir { 2892*cdf0e10cSrcweir if ( ! exists($onefeature->{'Language'}) ) { installer::exiter::exit_program("ERROR: \"$onefeature->{'gid'}\" has flag LANGUAGEMODULE, but does not know its language!", "select_required_language_strings"); } 2893*cdf0e10cSrcweir my $lang = $onefeature->{'Language'}; 2894*cdf0e10cSrcweir 2895*cdf0e10cSrcweir if (( exists($installer::globals::all_english_languagestrings{$lang}) ) && ( ! exists($installer::globals::all_required_english_languagestrings{$lang}) )) 2896*cdf0e10cSrcweir { 2897*cdf0e10cSrcweir $installer::globals::all_required_english_languagestrings{$lang} = $installer::globals::all_english_languagestrings{$lang}; 2898*cdf0e10cSrcweir } 2899*cdf0e10cSrcweir } 2900*cdf0e10cSrcweir } 2901*cdf0e10cSrcweir} 2902*cdf0e10cSrcweir 2903*cdf0e10cSrcweir##################################################################################### 2904*cdf0e10cSrcweir# Unixlinks are not always required. For Linux RPMs and Solaris Packages they are 2905*cdf0e10cSrcweir# created dynamically. Exception: For package formats "installed" or "archive". 2906*cdf0e10cSrcweir# In scp2 this unixlinks have the flag LAYERLINK. 2907*cdf0e10cSrcweir##################################################################################### 2908*cdf0e10cSrcweir 2909*cdf0e10cSrcweirsub filter_layerlinks_from_unixlinks 2910*cdf0e10cSrcweir{ 2911*cdf0e10cSrcweir my ( $unixlinksref ) = @_; 2912*cdf0e10cSrcweir 2913*cdf0e10cSrcweir my @alllinks = (); 2914*cdf0e10cSrcweir 2915*cdf0e10cSrcweir for ( my $i = 0; $i <= $#{$unixlinksref}; $i++ ) 2916*cdf0e10cSrcweir { 2917*cdf0e10cSrcweir my $isrequired = 1; 2918*cdf0e10cSrcweir 2919*cdf0e10cSrcweir my $onelink = ${$unixlinksref}[$i]; 2920*cdf0e10cSrcweir my $styles = ""; 2921*cdf0e10cSrcweir if ( $onelink->{'Styles'} ) { $styles = $onelink->{'Styles'}; } 2922*cdf0e10cSrcweir 2923*cdf0e10cSrcweir if ( $styles =~ /\bLAYERLINK\b/ ) 2924*cdf0e10cSrcweir { 2925*cdf0e10cSrcweir # Platforms, that do not need the layer links 2926*cdf0e10cSrcweir if (( $installer::globals::islinuxrpmbuild ) || ( $installer::globals::issolarispkgbuild )) 2927*cdf0e10cSrcweir { 2928*cdf0e10cSrcweir $isrequired = 0; 2929*cdf0e10cSrcweir } 2930*cdf0e10cSrcweir 2931*cdf0e10cSrcweir # Package formats, that need the layer link (platform independent) 2932*cdf0e10cSrcweir if (( $installer::globals::packageformat eq "installed" ) || ( $installer::globals::packageformat eq "archive" )) 2933*cdf0e10cSrcweir { 2934*cdf0e10cSrcweir $isrequired = 1; 2935*cdf0e10cSrcweir } 2936*cdf0e10cSrcweir } 2937*cdf0e10cSrcweir 2938*cdf0e10cSrcweir if ( $isrequired ) { push(@alllinks, $onelink); } 2939*cdf0e10cSrcweir } 2940*cdf0e10cSrcweir 2941*cdf0e10cSrcweir return \@alllinks; 2942*cdf0e10cSrcweir} 2943*cdf0e10cSrcweir 2944*cdf0e10cSrcweir1; 2945