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::windows::component; 29*cdf0e10cSrcweir 30*cdf0e10cSrcweiruse installer::converter; 31*cdf0e10cSrcweiruse installer::existence; 32*cdf0e10cSrcweiruse installer::exiter; 33*cdf0e10cSrcweiruse installer::files; 34*cdf0e10cSrcweiruse installer::globals; 35*cdf0e10cSrcweiruse installer::windows::idtglobal; 36*cdf0e10cSrcweiruse installer::windows::language; 37*cdf0e10cSrcweir 38*cdf0e10cSrcweir############################################################## 39*cdf0e10cSrcweir# Returning a globally unique ID (GUID) for a component 40*cdf0e10cSrcweir# If the component is new, a unique guid has to be created. 41*cdf0e10cSrcweir# If the component already exists, the guid has to be 42*cdf0e10cSrcweir# taken from a list component <-> guid 43*cdf0e10cSrcweir# Sample for a guid: {B68FD953-3CEF-4489-8269-8726848056E8} 44*cdf0e10cSrcweir############################################################## 45*cdf0e10cSrcweir 46*cdf0e10cSrcweirsub get_component_guid 47*cdf0e10cSrcweir{ 48*cdf0e10cSrcweir my ( $componentname, $componentidhashref ) = @_; 49*cdf0e10cSrcweir 50*cdf0e10cSrcweir # At this time only a template 51*cdf0e10cSrcweir my $returnvalue = "\{COMPONENTGUID\}"; 52*cdf0e10cSrcweir 53*cdf0e10cSrcweir if (( $installer::globals::updatedatabase ) && ( exists($componentidhashref->{$componentname}) )) 54*cdf0e10cSrcweir { 55*cdf0e10cSrcweir $returnvalue = $componentidhashref->{$componentname}; 56*cdf0e10cSrcweir } 57*cdf0e10cSrcweir 58*cdf0e10cSrcweir # Returning a ComponentID, that is assigned in scp project 59*cdf0e10cSrcweir if ( exists($installer::globals::componentid{$componentname}) ) 60*cdf0e10cSrcweir { 61*cdf0e10cSrcweir $returnvalue = "\{" . $installer::globals::componentid{$componentname} . "\}"; 62*cdf0e10cSrcweir } 63*cdf0e10cSrcweir 64*cdf0e10cSrcweir return $returnvalue; 65*cdf0e10cSrcweir} 66*cdf0e10cSrcweir 67*cdf0e10cSrcweir############################################################## 68*cdf0e10cSrcweir# Returning the directory for a file component. 69*cdf0e10cSrcweir############################################################## 70*cdf0e10cSrcweir 71*cdf0e10cSrcweirsub get_file_component_directory 72*cdf0e10cSrcweir{ 73*cdf0e10cSrcweir my ($componentname, $filesref, $dirref) = @_; 74*cdf0e10cSrcweir 75*cdf0e10cSrcweir my ($onefile, $component, $onedir, $hostname, $uniquedir); 76*cdf0e10cSrcweir my $found = 0; 77*cdf0e10cSrcweir 78*cdf0e10cSrcweir for ( my $i = 0; $i <= $#{$filesref}; $i++ ) 79*cdf0e10cSrcweir { 80*cdf0e10cSrcweir $onefile = ${$filesref}[$i]; 81*cdf0e10cSrcweir $component = $onefile->{'componentname'}; 82*cdf0e10cSrcweir 83*cdf0e10cSrcweir if ( $component eq $componentname ) 84*cdf0e10cSrcweir { 85*cdf0e10cSrcweir $found = 1; 86*cdf0e10cSrcweir last; 87*cdf0e10cSrcweir } 88*cdf0e10cSrcweir } 89*cdf0e10cSrcweir 90*cdf0e10cSrcweir if (!($found)) 91*cdf0e10cSrcweir { 92*cdf0e10cSrcweir # This component can be ignored, if it exists in a version with extension "_pff" (this was renamed in file::get_sequence_for_file() ) 93*cdf0e10cSrcweir my $ignore_this_component = 0; 94*cdf0e10cSrcweir my $origcomponentname = $componentname; 95*cdf0e10cSrcweir my $componentname = $componentname . "_pff"; 96*cdf0e10cSrcweir 97*cdf0e10cSrcweir for ( my $j = 0; $j <= $#{$filesref}; $j++ ) 98*cdf0e10cSrcweir { 99*cdf0e10cSrcweir $onefile = ${$filesref}[$j]; 100*cdf0e10cSrcweir $component = $onefile->{'componentname'}; 101*cdf0e10cSrcweir 102*cdf0e10cSrcweir if ( $component eq $componentname ) 103*cdf0e10cSrcweir { 104*cdf0e10cSrcweir $ignore_this_component = 1; 105*cdf0e10cSrcweir last; 106*cdf0e10cSrcweir } 107*cdf0e10cSrcweir } 108*cdf0e10cSrcweir 109*cdf0e10cSrcweir if ( $ignore_this_component ) { return "IGNORE_COMP"; } 110*cdf0e10cSrcweir else { installer::exiter::exit_program("ERROR: Did not find component \"$origcomponentname\" in file collection", "get_file_component_directory"); } 111*cdf0e10cSrcweir } 112*cdf0e10cSrcweir 113*cdf0e10cSrcweir my $localstyles = ""; 114*cdf0e10cSrcweir 115*cdf0e10cSrcweir if ( $onefile->{'Styles'} ) { $localstyles = $onefile->{'Styles'}; } 116*cdf0e10cSrcweir 117*cdf0e10cSrcweir if ( $localstyles =~ /\bFONT\b/ ) # special handling for font files 118*cdf0e10cSrcweir { 119*cdf0e10cSrcweir return $installer::globals::fontsfolder; 120*cdf0e10cSrcweir } 121*cdf0e10cSrcweir 122*cdf0e10cSrcweir my $destdir = ""; 123*cdf0e10cSrcweir 124*cdf0e10cSrcweir if ( $onefile->{'Dir'} ) { $destdir = $onefile->{'Dir'}; } 125*cdf0e10cSrcweir 126*cdf0e10cSrcweir if ( $destdir =~ /\bPREDEFINED_OSSHELLNEWDIR\b/ ) # special handling for shellnew files 127*cdf0e10cSrcweir { 128*cdf0e10cSrcweir return $installer::globals::templatefolder; 129*cdf0e10cSrcweir } 130*cdf0e10cSrcweir 131*cdf0e10cSrcweir my $destination = $onefile->{'destination'}; 132*cdf0e10cSrcweir 133*cdf0e10cSrcweir installer::pathanalyzer::get_path_from_fullqualifiedname(\$destination); 134*cdf0e10cSrcweir 135*cdf0e10cSrcweir $destination =~ s/\Q$installer::globals::separator\E\s*$//; 136*cdf0e10cSrcweir 137*cdf0e10cSrcweir # This path has to be defined in the directory collection at "HostName" 138*cdf0e10cSrcweir 139*cdf0e10cSrcweir if ($destination eq "") # files in the installation root 140*cdf0e10cSrcweir { 141*cdf0e10cSrcweir $uniquedir = "INSTALLLOCATION"; 142*cdf0e10cSrcweir } 143*cdf0e10cSrcweir else 144*cdf0e10cSrcweir { 145*cdf0e10cSrcweir $found = 0; 146*cdf0e10cSrcweir 147*cdf0e10cSrcweir for ( my $i = 0; $i <= $#{$dirref}; $i++ ) 148*cdf0e10cSrcweir { 149*cdf0e10cSrcweir $onedir = ${$dirref}[$i]; 150*cdf0e10cSrcweir $hostname = $onedir->{'HostName'}; 151*cdf0e10cSrcweir 152*cdf0e10cSrcweir if ( $hostname eq $destination ) 153*cdf0e10cSrcweir { 154*cdf0e10cSrcweir $found = 1; 155*cdf0e10cSrcweir last; 156*cdf0e10cSrcweir } 157*cdf0e10cSrcweir } 158*cdf0e10cSrcweir 159*cdf0e10cSrcweir if (!($found)) 160*cdf0e10cSrcweir { 161*cdf0e10cSrcweir installer::exiter::exit_program("ERROR: Did not find destination $destination in directory collection", "get_file_component_directory"); 162*cdf0e10cSrcweir } 163*cdf0e10cSrcweir 164*cdf0e10cSrcweir $uniquedir = $onedir->{'uniquename'}; 165*cdf0e10cSrcweir 166*cdf0e10cSrcweir if ( $uniquedir eq $installer::globals::officeinstalldirectory ) 167*cdf0e10cSrcweir { 168*cdf0e10cSrcweir $uniquedir = "INSTALLLOCATION"; 169*cdf0e10cSrcweir } 170*cdf0e10cSrcweir } 171*cdf0e10cSrcweir 172*cdf0e10cSrcweir $onefile->{'uniquedirname'} = $uniquedir; # saving it in the file collection 173*cdf0e10cSrcweir 174*cdf0e10cSrcweir return $uniquedir 175*cdf0e10cSrcweir} 176*cdf0e10cSrcweir 177*cdf0e10cSrcweir############################################################## 178*cdf0e10cSrcweir# Returning the directory for a registry component. 179*cdf0e10cSrcweir# This cannot be a useful value 180*cdf0e10cSrcweir############################################################## 181*cdf0e10cSrcweir 182*cdf0e10cSrcweirsub get_registry_component_directory 183*cdf0e10cSrcweir{ 184*cdf0e10cSrcweir my $componentdir = "INSTALLLOCATION"; 185*cdf0e10cSrcweir 186*cdf0e10cSrcweir return $componentdir; 187*cdf0e10cSrcweir} 188*cdf0e10cSrcweir 189*cdf0e10cSrcweir############################################################## 190*cdf0e10cSrcweir# Returning the attributes for a file component. 191*cdf0e10cSrcweir# Always 8 in this first try? 192*cdf0e10cSrcweir############################################################## 193*cdf0e10cSrcweir 194*cdf0e10cSrcweirsub get_file_component_attributes 195*cdf0e10cSrcweir{ 196*cdf0e10cSrcweir my ($componentname, $filesref, $allvariables) = @_; 197*cdf0e10cSrcweir 198*cdf0e10cSrcweir my $attributes; 199*cdf0e10cSrcweir 200*cdf0e10cSrcweir $attributes = 2; 201*cdf0e10cSrcweir 202*cdf0e10cSrcweir # special handling for font files 203*cdf0e10cSrcweir 204*cdf0e10cSrcweir my $onefile; 205*cdf0e10cSrcweir my $found = 0; 206*cdf0e10cSrcweir 207*cdf0e10cSrcweir for ( my $i = 0; $i <= $#{$filesref}; $i++ ) 208*cdf0e10cSrcweir { 209*cdf0e10cSrcweir $onefile = ${$filesref}[$i]; 210*cdf0e10cSrcweir my $component = $onefile->{'componentname'}; 211*cdf0e10cSrcweir 212*cdf0e10cSrcweir if ( $component eq $componentname ) 213*cdf0e10cSrcweir { 214*cdf0e10cSrcweir $found = 1; 215*cdf0e10cSrcweir last; 216*cdf0e10cSrcweir } 217*cdf0e10cSrcweir } 218*cdf0e10cSrcweir 219*cdf0e10cSrcweir if (!($found)) 220*cdf0e10cSrcweir { 221*cdf0e10cSrcweir installer::exiter::exit_program("ERROR: Did not find component in file collection", "get_file_component_attributes"); 222*cdf0e10cSrcweir } 223*cdf0e10cSrcweir 224*cdf0e10cSrcweir my $localstyles = ""; 225*cdf0e10cSrcweir 226*cdf0e10cSrcweir if ( $onefile->{'Styles'} ) { $localstyles = $onefile->{'Styles'}; } 227*cdf0e10cSrcweir 228*cdf0e10cSrcweir if ( $localstyles =~ /\bFONT\b/ ) 229*cdf0e10cSrcweir { 230*cdf0e10cSrcweir $attributes = 16; # font files will not be deinstalled 231*cdf0e10cSrcweir } 232*cdf0e10cSrcweir 233*cdf0e10cSrcweir if ( $localstyles =~ /\bASSEMBLY\b/ ) 234*cdf0e10cSrcweir { 235*cdf0e10cSrcweir $attributes = 0; # Assembly files cannot run from source 236*cdf0e10cSrcweir } 237*cdf0e10cSrcweir 238*cdf0e10cSrcweir if (( $onefile->{'Dir'} =~ /\bPREDEFINED_OSSHELLNEWDIR\b/ ) || ( $onefile->{'needs_user_registry_key'} )) 239*cdf0e10cSrcweir { 240*cdf0e10cSrcweir $attributes = 4; # Files in shellnew dir and in non advertised startmenu entries must have user registry key as KeyPath 241*cdf0e10cSrcweir } 242*cdf0e10cSrcweir 243*cdf0e10cSrcweir # Adding 256, if this is a 64 bit installation set. 244*cdf0e10cSrcweir if (( $allvariables->{'64BITPRODUCT'} ) && ( $allvariables->{'64BITPRODUCT'} == 1 )) { $attributes = $attributes + 256; } 245*cdf0e10cSrcweir 246*cdf0e10cSrcweir return $attributes 247*cdf0e10cSrcweir} 248*cdf0e10cSrcweir 249*cdf0e10cSrcweir############################################################## 250*cdf0e10cSrcweir# Returning the attributes for a registry component. 251*cdf0e10cSrcweir# Always 4, indicating, the keypath is a defined in 252*cdf0e10cSrcweir# table registry 253*cdf0e10cSrcweir############################################################## 254*cdf0e10cSrcweir 255*cdf0e10cSrcweirsub get_registry_component_attributes 256*cdf0e10cSrcweir{ 257*cdf0e10cSrcweir my ($componentname, $allvariables) = @_; 258*cdf0e10cSrcweir 259*cdf0e10cSrcweir my $attributes; 260*cdf0e10cSrcweir 261*cdf0e10cSrcweir $attributes = 4; 262*cdf0e10cSrcweir 263*cdf0e10cSrcweir # Adding 256, if this is a 64 bit installation set. 264*cdf0e10cSrcweir if (( $allvariables->{'64BITPRODUCT'} ) && ( $allvariables->{'64BITPRODUCT'} == 1 )) { $attributes = $attributes + 256; } 265*cdf0e10cSrcweir 266*cdf0e10cSrcweir if ( exists($installer::globals::dontdeletecomponents{$componentname}) ) { $attributes = $attributes + 16; } 267*cdf0e10cSrcweir 268*cdf0e10cSrcweir return $attributes 269*cdf0e10cSrcweir} 270*cdf0e10cSrcweir 271*cdf0e10cSrcweir############################################################## 272*cdf0e10cSrcweir# Returning the conditions for a component. 273*cdf0e10cSrcweir# This is important for language dependent components 274*cdf0e10cSrcweir# in multilingual installation sets. 275*cdf0e10cSrcweir############################################################## 276*cdf0e10cSrcweir 277*cdf0e10cSrcweirsub get_file_component_condition 278*cdf0e10cSrcweir{ 279*cdf0e10cSrcweir my ($componentname, $filesref) = @_; 280*cdf0e10cSrcweir 281*cdf0e10cSrcweir my $condition = ""; 282*cdf0e10cSrcweir 283*cdf0e10cSrcweir if (exists($installer::globals::componentcondition{$componentname})) 284*cdf0e10cSrcweir { 285*cdf0e10cSrcweir $condition = $installer::globals::componentcondition{$componentname}; 286*cdf0e10cSrcweir } 287*cdf0e10cSrcweir 288*cdf0e10cSrcweir # there can be also tree conditions for multilayer products 289*cdf0e10cSrcweir if (exists($installer::globals::treeconditions{$componentname})) 290*cdf0e10cSrcweir { 291*cdf0e10cSrcweir if ( $condition eq "" ) 292*cdf0e10cSrcweir { 293*cdf0e10cSrcweir $condition = $installer::globals::treeconditions{$componentname}; 294*cdf0e10cSrcweir } 295*cdf0e10cSrcweir else 296*cdf0e10cSrcweir { 297*cdf0e10cSrcweir $condition = "($condition) And ($installer::globals::treeconditions{$componentname})"; 298*cdf0e10cSrcweir } 299*cdf0e10cSrcweir } 300*cdf0e10cSrcweir 301*cdf0e10cSrcweir return $condition 302*cdf0e10cSrcweir} 303*cdf0e10cSrcweir 304*cdf0e10cSrcweir############################################################## 305*cdf0e10cSrcweir# Returning the conditions for a registry component. 306*cdf0e10cSrcweir############################################################## 307*cdf0e10cSrcweir 308*cdf0e10cSrcweirsub get_component_condition 309*cdf0e10cSrcweir{ 310*cdf0e10cSrcweir my ($componentname) = @_; 311*cdf0e10cSrcweir 312*cdf0e10cSrcweir my $condition; 313*cdf0e10cSrcweir 314*cdf0e10cSrcweir $condition = ""; # Always ? 315*cdf0e10cSrcweir 316*cdf0e10cSrcweir if (exists($installer::globals::componentcondition{$componentname})) 317*cdf0e10cSrcweir { 318*cdf0e10cSrcweir $condition = $installer::globals::componentcondition{$componentname}; 319*cdf0e10cSrcweir } 320*cdf0e10cSrcweir 321*cdf0e10cSrcweir return $condition 322*cdf0e10cSrcweir} 323*cdf0e10cSrcweir 324*cdf0e10cSrcweir#################################################################### 325*cdf0e10cSrcweir# Returning the keypath for a component. 326*cdf0e10cSrcweir# This will be the name of the first file/registry, found in the 327*cdf0e10cSrcweir# collection $itemsref 328*cdf0e10cSrcweir# Attention: This has to be the unique (file)name, not the 329*cdf0e10cSrcweir# real filename! 330*cdf0e10cSrcweir#################################################################### 331*cdf0e10cSrcweir 332*cdf0e10cSrcweirsub get_component_keypath 333*cdf0e10cSrcweir{ 334*cdf0e10cSrcweir my ($componentname, $itemsref, $componentidkeypathhashref) = @_; 335*cdf0e10cSrcweir 336*cdf0e10cSrcweir my $oneitem; 337*cdf0e10cSrcweir my $found = 0; 338*cdf0e10cSrcweir my $infoline = ""; 339*cdf0e10cSrcweir 340*cdf0e10cSrcweir for ( my $i = 0; $i <= $#{$itemsref}; $i++ ) 341*cdf0e10cSrcweir { 342*cdf0e10cSrcweir $oneitem = ${$itemsref}[$i]; 343*cdf0e10cSrcweir my $component = $oneitem->{'componentname'}; 344*cdf0e10cSrcweir 345*cdf0e10cSrcweir if ( $component eq $componentname ) 346*cdf0e10cSrcweir { 347*cdf0e10cSrcweir $found = 1; 348*cdf0e10cSrcweir last; 349*cdf0e10cSrcweir } 350*cdf0e10cSrcweir } 351*cdf0e10cSrcweir 352*cdf0e10cSrcweir if (!($found)) 353*cdf0e10cSrcweir { 354*cdf0e10cSrcweir installer::exiter::exit_program("ERROR: Did not find component in file/registry collection, function get_component_keypath", "get_component_keypath"); 355*cdf0e10cSrcweir } 356*cdf0e10cSrcweir 357*cdf0e10cSrcweir my $keypath = $oneitem->{'uniquename'}; # "uniquename", not "Name" 358*cdf0e10cSrcweir 359*cdf0e10cSrcweir # Special handling for updates from existing databases, because KeyPath must not change 360*cdf0e10cSrcweir if (( $installer::globals::updatedatabase ) && ( exists($componentidkeypathhashref->{$componentname}) )) 361*cdf0e10cSrcweir { 362*cdf0e10cSrcweir $keypath = $componentidkeypathhashref->{$componentname}; 363*cdf0e10cSrcweir # -> check, if this is a valid key path?! 364*cdf0e10cSrcweir if ( $keypath ne $oneitem->{'uniquename'} ) 365*cdf0e10cSrcweir { 366*cdf0e10cSrcweir # Warning: This keypath was changed because of info from old database 367*cdf0e10cSrcweir $infoline = "WARNING: The KeyPath for component \"$componentname\" was changed from \"$oneitem->{'uniquename'}\" to \"$keypath\" because of information from update database"; 368*cdf0e10cSrcweir push(@installer::globals::logfileinfo, $infoline); 369*cdf0e10cSrcweir } 370*cdf0e10cSrcweir } 371*cdf0e10cSrcweir 372*cdf0e10cSrcweir # Special handling for components in PREDEFINED_OSSHELLNEWDIR. These components 373*cdf0e10cSrcweir # need as KeyPath a RegistryItem in HKCU 374*cdf0e10cSrcweir if ( $oneitem->{'userregkeypath'} ) { $keypath = $oneitem->{'userregkeypath'}; } 375*cdf0e10cSrcweir 376*cdf0e10cSrcweir # saving it in the file and registry collection 377*cdf0e10cSrcweir $oneitem->{'keypath'} = $keypath; 378*cdf0e10cSrcweir 379*cdf0e10cSrcweir return $keypath 380*cdf0e10cSrcweir} 381*cdf0e10cSrcweir 382*cdf0e10cSrcweir################################################################### 383*cdf0e10cSrcweir# Creating the file Componen.idt dynamically 384*cdf0e10cSrcweir# Content: 385*cdf0e10cSrcweir# Component ComponentId Directory_ Attributes Condition KeyPath 386*cdf0e10cSrcweir################################################################### 387*cdf0e10cSrcweir 388*cdf0e10cSrcweirsub create_component_table 389*cdf0e10cSrcweir{ 390*cdf0e10cSrcweir my ($filesref, $registryref, $dirref, $allfilecomponentsref, $allregistrycomponents, $basedir, $componentidhashref, $componentidkeypathhashref, $allvariables) = @_; 391*cdf0e10cSrcweir 392*cdf0e10cSrcweir my @componenttable = (); 393*cdf0e10cSrcweir 394*cdf0e10cSrcweir my ($oneline, $infoline); 395*cdf0e10cSrcweir 396*cdf0e10cSrcweir installer::windows::idtglobal::write_idt_header(\@componenttable, "component"); 397*cdf0e10cSrcweir 398*cdf0e10cSrcweir # collect_layer_conditions(); 399*cdf0e10cSrcweir 400*cdf0e10cSrcweir 401*cdf0e10cSrcweir # File components 402*cdf0e10cSrcweir 403*cdf0e10cSrcweir for ( my $i = 0; $i <= $#{$allfilecomponentsref}; $i++ ) 404*cdf0e10cSrcweir { 405*cdf0e10cSrcweir my %onecomponent = (); 406*cdf0e10cSrcweir 407*cdf0e10cSrcweir $onecomponent{'name'} = ${$allfilecomponentsref}[$i]; 408*cdf0e10cSrcweir $onecomponent{'guid'} = get_component_guid($onecomponent{'name'}, $componentidhashref); 409*cdf0e10cSrcweir $onecomponent{'directory'} = get_file_component_directory($onecomponent{'name'}, $filesref, $dirref); 410*cdf0e10cSrcweir if ( $onecomponent{'directory'} eq "IGNORE_COMP" ) { next; } 411*cdf0e10cSrcweir $onecomponent{'attributes'} = get_file_component_attributes($onecomponent{'name'}, $filesref, $allvariables); 412*cdf0e10cSrcweir $onecomponent{'condition'} = get_file_component_condition($onecomponent{'name'}, $filesref); 413*cdf0e10cSrcweir $onecomponent{'keypath'} = get_component_keypath($onecomponent{'name'}, $filesref, $componentidkeypathhashref); 414*cdf0e10cSrcweir 415*cdf0e10cSrcweir $oneline = $onecomponent{'name'} . "\t" . $onecomponent{'guid'} . "\t" . $onecomponent{'directory'} . "\t" 416*cdf0e10cSrcweir . $onecomponent{'attributes'} . "\t" . $onecomponent{'condition'} . "\t" . $onecomponent{'keypath'} . "\n"; 417*cdf0e10cSrcweir 418*cdf0e10cSrcweir push(@componenttable, $oneline); 419*cdf0e10cSrcweir } 420*cdf0e10cSrcweir 421*cdf0e10cSrcweir # Registry components 422*cdf0e10cSrcweir 423*cdf0e10cSrcweir for ( my $i = 0; $i <= $#{$allregistrycomponents}; $i++ ) 424*cdf0e10cSrcweir { 425*cdf0e10cSrcweir my %onecomponent = (); 426*cdf0e10cSrcweir 427*cdf0e10cSrcweir $onecomponent{'name'} = ${$allregistrycomponents}[$i]; 428*cdf0e10cSrcweir $onecomponent{'guid'} = get_component_guid($onecomponent{'name'}, $componentidhashref); 429*cdf0e10cSrcweir $onecomponent{'directory'} = get_registry_component_directory(); 430*cdf0e10cSrcweir $onecomponent{'attributes'} = get_registry_component_attributes($onecomponent{'name'}, $allvariables); 431*cdf0e10cSrcweir $onecomponent{'condition'} = get_component_condition($onecomponent{'name'}); 432*cdf0e10cSrcweir $onecomponent{'keypath'} = get_component_keypath($onecomponent{'name'}, $registryref, $componentidkeypathhashref); 433*cdf0e10cSrcweir 434*cdf0e10cSrcweir $oneline = $onecomponent{'name'} . "\t" . $onecomponent{'guid'} . "\t" . $onecomponent{'directory'} . "\t" 435*cdf0e10cSrcweir . $onecomponent{'attributes'} . "\t" . $onecomponent{'condition'} . "\t" . $onecomponent{'keypath'} . "\n"; 436*cdf0e10cSrcweir 437*cdf0e10cSrcweir push(@componenttable, $oneline); 438*cdf0e10cSrcweir } 439*cdf0e10cSrcweir 440*cdf0e10cSrcweir # Saving the file 441*cdf0e10cSrcweir 442*cdf0e10cSrcweir my $componenttablename = $basedir . $installer::globals::separator . "Componen.idt"; 443*cdf0e10cSrcweir installer::files::save_file($componenttablename ,\@componenttable); 444*cdf0e10cSrcweir $infoline = "Created idt file: $componenttablename\n"; 445*cdf0e10cSrcweir push(@installer::globals::logfileinfo, $infoline); 446*cdf0e10cSrcweir} 447*cdf0e10cSrcweir 448*cdf0e10cSrcweir#################################################################################### 449*cdf0e10cSrcweir# Returning a component for a scp module gid. 450*cdf0e10cSrcweir# Pairs are saved in the files collector. 451*cdf0e10cSrcweir#################################################################################### 452*cdf0e10cSrcweir 453*cdf0e10cSrcweirsub get_component_name_from_modulegid 454*cdf0e10cSrcweir{ 455*cdf0e10cSrcweir my ($modulegid, $filesref) = @_; 456*cdf0e10cSrcweir 457*cdf0e10cSrcweir my $componentname = ""; 458*cdf0e10cSrcweir 459*cdf0e10cSrcweir for ( my $i = 0; $i <= $#{$filesref}; $i++ ) 460*cdf0e10cSrcweir { 461*cdf0e10cSrcweir my $onefile = ${$filesref}[$i]; 462*cdf0e10cSrcweir 463*cdf0e10cSrcweir if ( $onefile->{'modules'} ) 464*cdf0e10cSrcweir { 465*cdf0e10cSrcweir my $filemodules = $onefile->{'modules'}; 466*cdf0e10cSrcweir my $filemodulesarrayref = installer::converter::convert_stringlist_into_array_without_newline(\$filemodules, ","); 467*cdf0e10cSrcweir 468*cdf0e10cSrcweir if (installer::existence::exists_in_array($modulegid, $filemodulesarrayref)) 469*cdf0e10cSrcweir { 470*cdf0e10cSrcweir $componentname = $onefile->{'componentname'}; 471*cdf0e10cSrcweir last; 472*cdf0e10cSrcweir } 473*cdf0e10cSrcweir } 474*cdf0e10cSrcweir } 475*cdf0e10cSrcweir 476*cdf0e10cSrcweir return $componentname; 477*cdf0e10cSrcweir} 478*cdf0e10cSrcweir 479*cdf0e10cSrcweir#################################################################################### 480*cdf0e10cSrcweir# Updating the file Environm.idt dynamically 481*cdf0e10cSrcweir# Content: 482*cdf0e10cSrcweir# Environment Name Value Component_ 483*cdf0e10cSrcweir#################################################################################### 484*cdf0e10cSrcweir 485*cdf0e10cSrcweirsub set_component_in_environment_table 486*cdf0e10cSrcweir{ 487*cdf0e10cSrcweir my ($basedir, $filesref) = @_; 488*cdf0e10cSrcweir 489*cdf0e10cSrcweir my $infoline = ""; 490*cdf0e10cSrcweir 491*cdf0e10cSrcweir my $environmentfilename = $basedir . $installer::globals::separator . "Environm.idt"; 492*cdf0e10cSrcweir 493*cdf0e10cSrcweir if ( -f $environmentfilename ) # only do something, if file exists 494*cdf0e10cSrcweir { 495*cdf0e10cSrcweir my $environmentfile = installer::files::read_file($environmentfilename); 496*cdf0e10cSrcweir 497*cdf0e10cSrcweir for ( my $i = 3; $i <= $#{$environmentfile}; $i++ ) # starting in line 4 of Environm.idt 498*cdf0e10cSrcweir { 499*cdf0e10cSrcweir if ( ${$environmentfile}[$i] =~ /^\s*(.*?)\t(.*?)\t(.*?)\t(.*?)\s*$/ ) 500*cdf0e10cSrcweir { 501*cdf0e10cSrcweir my $modulegid = $4; # in Environment table a scp module gid can be used as component replacement 502*cdf0e10cSrcweir 503*cdf0e10cSrcweir my $componentname = get_component_name_from_modulegid($modulegid, $filesref); 504*cdf0e10cSrcweir 505*cdf0e10cSrcweir if ( $componentname ) # only do something if a component could be found 506*cdf0e10cSrcweir { 507*cdf0e10cSrcweir $infoline = "Updated Environment table:\n"; 508*cdf0e10cSrcweir push(@installer::globals::logfileinfo, $infoline); 509*cdf0e10cSrcweir $infoline = "Old line: ${$environmentfile}[$i]\n"; 510*cdf0e10cSrcweir push(@installer::globals::logfileinfo, $infoline); 511*cdf0e10cSrcweir 512*cdf0e10cSrcweir ${$environmentfile}[$i] =~ s/$modulegid/$componentname/; 513*cdf0e10cSrcweir 514*cdf0e10cSrcweir $infoline = "New line: ${$environmentfile}[$i]\n"; 515*cdf0e10cSrcweir push(@installer::globals::logfileinfo, $infoline); 516*cdf0e10cSrcweir 517*cdf0e10cSrcweir } 518*cdf0e10cSrcweir } 519*cdf0e10cSrcweir } 520*cdf0e10cSrcweir 521*cdf0e10cSrcweir # Saving the file 522*cdf0e10cSrcweir 523*cdf0e10cSrcweir installer::files::save_file($environmentfilename ,$environmentfile); 524*cdf0e10cSrcweir $infoline = "Updated idt file: $environmentfilename\n"; 525*cdf0e10cSrcweir push(@installer::globals::logfileinfo, $infoline); 526*cdf0e10cSrcweir 527*cdf0e10cSrcweir } 528*cdf0e10cSrcweir} 529*cdf0e10cSrcweir 530*cdf0e10cSrcweir1;