19780544fSAndrew Rist#************************************************************** 29780544fSAndrew Rist# 39780544fSAndrew Rist# Licensed to the Apache Software Foundation (ASF) under one 49780544fSAndrew Rist# or more contributor license agreements. See the NOTICE file 59780544fSAndrew Rist# distributed with this work for additional information 69780544fSAndrew Rist# regarding copyright ownership. The ASF licenses this file 79780544fSAndrew Rist# to you under the Apache License, Version 2.0 (the 89780544fSAndrew Rist# "License"); you may not use this file except in compliance 99780544fSAndrew Rist# with the License. You may obtain a copy of the License at 109780544fSAndrew Rist# 119780544fSAndrew Rist# http://www.apache.org/licenses/LICENSE-2.0 129780544fSAndrew Rist# 139780544fSAndrew Rist# Unless required by applicable law or agreed to in writing, 149780544fSAndrew Rist# software distributed under the License is distributed on an 159780544fSAndrew Rist# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 169780544fSAndrew Rist# KIND, either express or implied. See the License for the 179780544fSAndrew Rist# specific language governing permissions and limitations 189780544fSAndrew Rist# under the License. 199780544fSAndrew Rist# 209780544fSAndrew Rist#************************************************************** 219780544fSAndrew Rist 229780544fSAndrew Rist 23cdf0e10cSrcweir 24cdf0e10cSrcweirpackage installer::setupscript; 25cdf0e10cSrcweir 26cdf0e10cSrcweiruse installer::existence; 27cdf0e10cSrcweiruse installer::exiter; 28cdf0e10cSrcweiruse installer::globals; 29cdf0e10cSrcweiruse installer::logger; 30cdf0e10cSrcweiruse installer::remover; 31cdf0e10cSrcweiruse installer::scriptitems; 32cdf0e10cSrcweiruse installer::ziplist; 33cdf0e10cSrcweir 34dba1a2e4SAndre Fischeruse strict; 35dba1a2e4SAndre Fischer 36cdf0e10cSrcweir####################################################### 37cdf0e10cSrcweir# Set setup script name, if not defined as parameter 38cdf0e10cSrcweir####################################################### 39cdf0e10cSrcweir 40cdf0e10cSrcweirsub set_setupscript_name 41cdf0e10cSrcweir{ 42cdf0e10cSrcweir my ( $allsettingsarrayref, $includepatharrayref ) = @_; 43cdf0e10cSrcweir 44cdf0e10cSrcweir my $scriptnameref = installer::ziplist::getinfofromziplist($allsettingsarrayref, "script"); 45cdf0e10cSrcweir 46cdf0e10cSrcweir my $scriptname = $$scriptnameref; 47cdf0e10cSrcweir 48cdf0e10cSrcweir if ( $scriptname eq "" ) # not defined on command line and not in product list 49cdf0e10cSrcweir { 50cdf0e10cSrcweir installer::exiter::exit_program("ERROR: Setup script not defined on command line (-l) and not in product list!", "set_setupscript_name"); 51cdf0e10cSrcweir } 52cdf0e10cSrcweir 53cdf0e10cSrcweir if ( $installer::globals::compiler =~ /wnt/ ) 54cdf0e10cSrcweir { 55cdf0e10cSrcweir $scriptname .= ".inf"; 56cdf0e10cSrcweir } 57cdf0e10cSrcweir else 58cdf0e10cSrcweir { 59cdf0e10cSrcweir $scriptname .= ".ins"; 60cdf0e10cSrcweir } 61cdf0e10cSrcweir 62cdf0e10cSrcweir # and now the complete path for the setup script is needed 63cdf0e10cSrcweir # The log file cannot be used, because this is the language independent section 64cdf0e10cSrcweir 65cdf0e10cSrcweir $scriptnameref = installer::scriptitems::get_sourcepath_from_filename_and_includepath(\$scriptname, $includepatharrayref, 1); 66cdf0e10cSrcweir 67cdf0e10cSrcweir $installer::globals::setupscriptname = $$scriptnameref; 68cdf0e10cSrcweir 69cdf0e10cSrcweir if ( $installer::globals::setupscriptname eq "" ) 70cdf0e10cSrcweir { 71cdf0e10cSrcweir installer::exiter::exit_program("ERROR: Script $scriptname not found!", "set_setupscript_name"); 72cdf0e10cSrcweir } 73cdf0e10cSrcweir} 74cdf0e10cSrcweir 75cdf0e10cSrcweir##################################################################### 76cdf0e10cSrcweir# Reading script variables from installation object of script file 77cdf0e10cSrcweir##################################################################### 78cdf0e10cSrcweir 79dba1a2e4SAndre Fischersub get_all_scriptvariables_from_installation_object ($$) 80cdf0e10cSrcweir{ 81dba1a2e4SAndre Fischer my ($scriptref, $script_filename) = @_; 82cdf0e10cSrcweir 83*1ba1fd99SAndre Fischer my $installobjectvariables = {}; 84*1ba1fd99SAndre Fischer 85*1ba1fd99SAndre Fischer my $firstline = $scriptref->[0]; 86*1ba1fd99SAndre Fischer if ($firstline !~ /^\s*Installation\s+\w+\s*$/) 87*1ba1fd99SAndre Fischer { 88*1ba1fd99SAndre Fischer installer::logger::PrintError("did not find 'Installation' keyword in first line of %s\n", 89*1ba1fd99SAndre Fischer $script_filename); 90*1ba1fd99SAndre Fischer } 91*1ba1fd99SAndre Fischer foreach my $line (@$scriptref) 92*1ba1fd99SAndre Fischer { 93*1ba1fd99SAndre Fischer next if $line =~ /^\s*Installation\s+\w+\s*$/; # Already processed. 94*1ba1fd99SAndre Fischer last if $line =~ /^\s*End\s*$/; 95*1ba1fd99SAndre Fischer 96*1ba1fd99SAndre Fischer if ($line =~ /^\s*(\w+)\s+\=\s*\"?(.*?)\"?\s*\;\s*$/ ) 97*1ba1fd99SAndre Fischer { 98*1ba1fd99SAndre Fischer my ($key, $value) = ($1, $2); 99cdf0e10cSrcweir 100*1ba1fd99SAndre Fischer $installobjectvariables->{uc($key)} = $value; 101*1ba1fd99SAndre Fischer } 102cdf0e10cSrcweir 103cdf0e10cSrcweir } 104cdf0e10cSrcweir 105*1ba1fd99SAndre Fischer return $installobjectvariables; 106cdf0e10cSrcweir} 107cdf0e10cSrcweir 108cdf0e10cSrcweir###################################################################### 109cdf0e10cSrcweir# Including LCPRODUCTNAME into the array 110cdf0e10cSrcweir###################################################################### 111cdf0e10cSrcweir 112*1ba1fd99SAndre Fischersub add_lowercase_productname_setupscriptvariable ($) 113cdf0e10cSrcweir{ 114cdf0e10cSrcweir my ( $variablesref ) = @_; 115cdf0e10cSrcweir 116*1ba1fd99SAndre Fischer my %additional_variables = (); 117*1ba1fd99SAndre Fischer 118*1ba1fd99SAndre Fischer while (my ($key, $value) = each %$variablesref) 119cdf0e10cSrcweir { 120*1ba1fd99SAndre Fischer if ($key eq "PRODUCTNAME") 121*1ba1fd99SAndre Fischer { 122*1ba1fd99SAndre Fischer $additional_variables{"LCPRODUCTNAME"} = lc($value); 123*1ba1fd99SAndre Fischer my $original = $value; 124*1ba1fd99SAndre Fischer $value =~ s/\s+//g; 125*1ba1fd99SAndre Fischer $additional_variables{"ONEWORDPRODUCTNAME"} = $value; 126*1ba1fd99SAndre Fischer $additional_variables{"LCONEWORDPRODUCTNAME"} = lc($value); 127*1ba1fd99SAndre Fischer $value = $original; 128*1ba1fd99SAndre Fischer $value =~ s/(^\s+|\s+$)//g; 129*1ba1fd99SAndre Fischer $value =~ s/ /\%20/g; 130*1ba1fd99SAndre Fischer $additional_variables{"MASKEDPRODUCTNAME"} = $value; 131*1ba1fd99SAndre Fischer $value = $original; 132*1ba1fd99SAndre Fischer $value =~ s/\s/\_/g; 133*1ba1fd99SAndre Fischer $additional_variables{"UNIXPRODUCTNAME"} = lc($value); 134*1ba1fd99SAndre Fischer $additional_variables{"SYSTEMINTUNIXPACKAGENAME"} = lc($value); 135*1ba1fd99SAndre Fischer $additional_variables{"UNIXPACKAGENAME"} = lc($value); 136*1ba1fd99SAndre Fischer $value = $original; 137*1ba1fd99SAndre Fischer $value =~ s/\s/\_/g; 138*1ba1fd99SAndre Fischer $value =~ s/\.//g; 139*1ba1fd99SAndre Fischer $additional_variables{"WITHOUTDOTUNIXPRODUCTNAME"} = lc($value); 140*1ba1fd99SAndre Fischer $additional_variables{"WITHOUTDOTUNIXPACKAGENAME"} = lc($value); 141*1ba1fd99SAndre Fischer $additional_variables{"SOLARISBRANDPACKAGENAME"} = lc($value); 142*1ba1fd99SAndre Fischer } 143*1ba1fd99SAndre Fischer elsif ($key eq "PRODUCTEXTENSION") 144*1ba1fd99SAndre Fischer { 145*1ba1fd99SAndre Fischer $additional_variables{"LCPRODUCTEXTENSION"} = lc($value); 146*1ba1fd99SAndre Fischer } 147*1ba1fd99SAndre Fischer elsif ($key eq "PRODUCTVERSION") 148*1ba1fd99SAndre Fischer { 149*1ba1fd99SAndre Fischer $value =~ s/\.//g; 150*1ba1fd99SAndre Fischer $additional_variables{"WITHOUTDOTPRODUCTVERSION"} = $value; 151*1ba1fd99SAndre Fischer } 152*1ba1fd99SAndre Fischer elsif ($key eq "OOOBASEVERSION") 153*1ba1fd99SAndre Fischer { 154*1ba1fd99SAndre Fischer $value =~ s/\.//g; 155*1ba1fd99SAndre Fischer $additional_variables{"WITHOUTDOTOOOBASEVERSION"} = $value; 156cdf0e10cSrcweir } 157cdf0e10cSrcweir } 158*1ba1fd99SAndre Fischer 159*1ba1fd99SAndre Fischer while (my ($key, $value) = each %additional_variables) 160*1ba1fd99SAndre Fischer { 161*1ba1fd99SAndre Fischer $variablesref->{$key} = $value; 162*1ba1fd99SAndre Fischer } 163cdf0e10cSrcweir} 164cdf0e10cSrcweir 165cdf0e10cSrcweir###################################################################### 166cdf0e10cSrcweir# Resolving the new introduced lowercase script variables 167cdf0e10cSrcweir###################################################################### 168cdf0e10cSrcweir 169*1ba1fd99SAndre Fischersub resolve_lowercase_productname_setupscriptvariable ($) 170cdf0e10cSrcweir{ 171*1ba1fd99SAndre Fischer my ($variablesref) = @_; 172cdf0e10cSrcweir 173*1ba1fd99SAndre Fischer while (my ($key,$value) = each %$variablesref) 174*1ba1fd99SAndre Fischer { 175*1ba1fd99SAndre Fischer if ($value =~ /\$\{(.*?)\}/) 176cdf0e10cSrcweir { 177*1ba1fd99SAndre Fischer my $varname = $1; 178*1ba1fd99SAndre Fischer my $replacement = $variablesref->{$varname}; 179*1ba1fd99SAndre Fischer my $new_value = $value; 180*1ba1fd99SAndre Fischer $new_value =~ s/\$\{\Q$varname\E\}/$replacement/g; 181*1ba1fd99SAndre Fischer $variablesref->{$key} = $new_value; 182cdf0e10cSrcweir } 183cdf0e10cSrcweir } 184cdf0e10cSrcweir} 185cdf0e10cSrcweir 186*1ba1fd99SAndre Fischer 187*1ba1fd99SAndre Fischer 188*1ba1fd99SAndre Fischer 189cdf0e10cSrcweir###################################################################### 190cdf0e10cSrcweir# Replacing all setup script variables inside the setup script file 191cdf0e10cSrcweir###################################################################### 192cdf0e10cSrcweir 193*1ba1fd99SAndre Fischersub replace_all_setupscriptvariables_in_script ($$) 194cdf0e10cSrcweir{ 195*1ba1fd99SAndre Fischer my ($script_lines, $variables) = @_; 196cdf0e10cSrcweir 197cdf0e10cSrcweir installer::logger::include_header_into_globallogfile("Replacing variables in setup script (start)"); 198cdf0e10cSrcweir 199cdf0e10cSrcweir # This is far faster than running a regexp for each line 200*1ba1fd99SAndre Fischer my $bigstring = join("", @$script_lines); 201cdf0e10cSrcweir 202*1ba1fd99SAndre Fischer while (my ($key,$value) = each %$variables) 203cdf0e10cSrcweir { 204cdf0e10cSrcweir # Attention: It must be possible to substitute "%PRODUCTNAMEn", "%PRODUCTNAME%PRODUCTVERSIONabc" 205*1ba1fd99SAndre Fischer my $count = ($bigstring =~ s/%$key/$value/g); 206*1ba1fd99SAndre Fischer if ($count > 0) 207*1ba1fd99SAndre Fischer { 208*1ba1fd99SAndre Fischer $installer::logger::Lang->printf("replaced %s %d times\n", $key, $count); 209*1ba1fd99SAndre Fischer } 210cdf0e10cSrcweir } 211cdf0e10cSrcweir 212cdf0e10cSrcweir my @newlines = split /\n/, $bigstring; 213cdf0e10cSrcweir 214cdf0e10cSrcweir # now check for any mis-named '%' variables that we have left 215cdf0e10cSrcweir my $num = 0; 216*1ba1fd99SAndre Fischer foreach my $line (@newlines) 217cdf0e10cSrcweir { 218cdf0e10cSrcweir $num++; 219*1ba1fd99SAndre Fischer if ($line =~ /\%\w+/) 220cdf0e10cSrcweir { 221*1ba1fd99SAndre Fischer if (( $line =~ /%1/ ) || ( $line =~ /%2/ ) || ( $line =~ /%verify/ )) 222b274bc22SAndre Fischer { 223b274bc22SAndre Fischer next; 224b274bc22SAndre Fischer } 225*1ba1fd99SAndre Fischer $installer::logger::Info->printf( 226*1ba1fd99SAndre Fischer "WARNING: mis-named or un-known %%-variable in setup script at line %s:\n",$num); 227*1ba1fd99SAndre Fischer $installer::logger::Info->printf("%s\n", $line); 228cdf0e10cSrcweir } 229cdf0e10cSrcweir } 230cdf0e10cSrcweir 231cdf0e10cSrcweir installer::logger::include_header_into_globallogfile("Replacing variables in setup script (end)"); 232cdf0e10cSrcweir 233*1ba1fd99SAndre Fischer return \@newlines; 234cdf0e10cSrcweir} 235cdf0e10cSrcweir 236cdf0e10cSrcweir####################################################################### 237cdf0e10cSrcweir# Collecting all items of the type "searchitem" from the setup script 238cdf0e10cSrcweir####################################################################### 239cdf0e10cSrcweir 240cdf0e10cSrcweirsub get_all_items_from_script 241cdf0e10cSrcweir{ 242cdf0e10cSrcweir my ($scriptref, $searchitem) = @_; 243cdf0e10cSrcweir 244cdf0e10cSrcweir my @allitemarray = (); 245cdf0e10cSrcweir 246cdf0e10cSrcweir my ($itemkey, $itemvalue, $valuecounter); 247cdf0e10cSrcweir 248cdf0e10cSrcweir for ( my $i = 0; $i <= $#{$scriptref}; $i++ ) 249cdf0e10cSrcweir { 250cdf0e10cSrcweir my $line = ${$scriptref}[$i]; 251cdf0e10cSrcweir 252cdf0e10cSrcweir if ( $line =~ /^\s*\Q$searchitem\E\s+(\S+)\s*$/ ) 253cdf0e10cSrcweir { 254cdf0e10cSrcweir my $gid = $1; 255cdf0e10cSrcweir my $counter = $i + 1; 256cdf0e10cSrcweir 257cdf0e10cSrcweir my %oneitemhash = (); 258cdf0e10cSrcweir my $ismultilang = 0; 259cdf0e10cSrcweir 260cdf0e10cSrcweir $oneitemhash{'gid'} = $gid; 261cdf0e10cSrcweir 262cdf0e10cSrcweir while (!( $line =~ /^\s*End\s*$/ )) 263cdf0e10cSrcweir { 264cdf0e10cSrcweir if ( $counter > $#{$scriptref} ) { 265cdf0e10cSrcweir installer::exiter::exit_program("Invalid setup script file. End of file reached before 'End' line of '$searchitem' section.", "get_all_items_from_script"); 266cdf0e10cSrcweir } 267cdf0e10cSrcweir $line = ${$scriptref}[$counter]; 268cdf0e10cSrcweir $counter++; 269cdf0e10cSrcweir 270cdf0e10cSrcweir if ( $line =~ /^\s*(.+?)\s*\=\s*(.+?)\s*\;\s*$/ ) # only oneliner! 271cdf0e10cSrcweir { 272cdf0e10cSrcweir $itemkey = $1; 273cdf0e10cSrcweir $itemvalue = $2; 274cdf0e10cSrcweir 275cdf0e10cSrcweir installer::remover::remove_leading_and_ending_quotationmarks(\$itemvalue); 276cdf0e10cSrcweir $itemvalue =~ s/\s*$//; # removing ending whitespaces. Could be introduced by empty variables. 277cdf0e10cSrcweir 278cdf0e10cSrcweir $oneitemhash{$itemkey} = $itemvalue; 279cdf0e10cSrcweir 280cdf0e10cSrcweir if ( $itemkey =~ /^\s*\S+\s+\(\S+\)\s*$/ ) 281cdf0e10cSrcweir { 282cdf0e10cSrcweir $ismultilang = 1; 283cdf0e10cSrcweir } 284cdf0e10cSrcweir } 285cdf0e10cSrcweir else 286cdf0e10cSrcweir { 287cdf0e10cSrcweir if ( $searchitem eq "Module" ) # more than one line, for instance files at modules! 288cdf0e10cSrcweir { 289cdf0e10cSrcweir if (( $line =~ /^\s*(.+?)\s*\=\s*\(/ ) && (!($line =~ /\)\;\s*$ / ))) 290cdf0e10cSrcweir { 291cdf0e10cSrcweir if ( $line =~ /^\s*(.+?)\s*\=\s*(.+)/ ) # the first line 292cdf0e10cSrcweir { 293cdf0e10cSrcweir $itemkey = $1; 294cdf0e10cSrcweir $itemvalue = $2; 295cdf0e10cSrcweir $itemvalue =~ s/\s*$//; 296cdf0e10cSrcweir } 297cdf0e10cSrcweir 298cdf0e10cSrcweir # collecting the complete itemvalue 299cdf0e10cSrcweir 300cdf0e10cSrcweir $valuecounter = $counter; 301cdf0e10cSrcweir $line = ${$scriptref}[$valuecounter]; 302cdf0e10cSrcweir installer::remover::remove_leading_and_ending_whitespaces(\$line); 303cdf0e10cSrcweir $itemvalue = $itemvalue . $line; 304cdf0e10cSrcweir 305cdf0e10cSrcweir while (!( $line =~ /\)\;\s*$/ )) 306cdf0e10cSrcweir { 307cdf0e10cSrcweir $valuecounter++; 308cdf0e10cSrcweir $line = ${$scriptref}[$valuecounter]; 309cdf0e10cSrcweir installer::remover::remove_leading_and_ending_whitespaces(\$line); 310cdf0e10cSrcweir $itemvalue = $itemvalue . $line; 311cdf0e10cSrcweir } 312cdf0e10cSrcweir 313cdf0e10cSrcweir # removing ending ";" 314cdf0e10cSrcweir $itemvalue =~ s/\;\s*$//; 315cdf0e10cSrcweir 316cdf0e10cSrcweir $oneitemhash{$itemkey} = $itemvalue; 317cdf0e10cSrcweir 318cdf0e10cSrcweir if ( $itemkey =~ /^\s*\S+\s+\(\S+\)\s*$/ ) 319cdf0e10cSrcweir { 320cdf0e10cSrcweir $ismultilang = 1; 321cdf0e10cSrcweir } 322cdf0e10cSrcweir } 323cdf0e10cSrcweir } 324cdf0e10cSrcweir } 325cdf0e10cSrcweir } 326cdf0e10cSrcweir 327cdf0e10cSrcweir $oneitemhash{'ismultilingual'} = $ismultilang; 328cdf0e10cSrcweir 329cdf0e10cSrcweir push(@allitemarray, \%oneitemhash); 330cdf0e10cSrcweir } 331cdf0e10cSrcweir } 332cdf0e10cSrcweir 333cdf0e10cSrcweir return \@allitemarray; 334cdf0e10cSrcweir} 335cdf0e10cSrcweir 336cdf0e10cSrcweir###################################################################### 337cdf0e10cSrcweir# Collecting all folder at folderitems, that are predefined values 338cdf0e10cSrcweir# For example: PREDEFINED_AUTOSTART 339cdf0e10cSrcweir###################################################################### 340cdf0e10cSrcweir 341cdf0e10cSrcweirsub add_predefined_folder 342cdf0e10cSrcweir{ 343cdf0e10cSrcweir my ( $folderitemref, $folderref ) = @_; 344cdf0e10cSrcweir 345cdf0e10cSrcweir for ( my $i = 0; $i <= $#{$folderitemref}; $i++ ) 346cdf0e10cSrcweir { 347cdf0e10cSrcweir my $folderitem = ${$folderitemref}[$i]; 348cdf0e10cSrcweir my $folderid = $folderitem->{'FolderID'}; 349cdf0e10cSrcweir 350cdf0e10cSrcweir if ( $folderid =~ /PREDEFINED_/ ) 351cdf0e10cSrcweir { 352cdf0e10cSrcweir if (! installer::existence::exists_in_array_of_hashes("gid", $folderid, $folderref)) 353cdf0e10cSrcweir { 354cdf0e10cSrcweir my %folder = (); 355cdf0e10cSrcweir $folder{'ismultilingual'} = "0"; 356cdf0e10cSrcweir $folder{'Name'} = ""; 357cdf0e10cSrcweir $folder{'gid'} = $folderid; 358cdf0e10cSrcweir 359cdf0e10cSrcweir push(@{$folderref}, \%folder); 360cdf0e10cSrcweir } 361cdf0e10cSrcweir } 362cdf0e10cSrcweir } 363cdf0e10cSrcweir} 364cdf0e10cSrcweir 365cdf0e10cSrcweir##################################################################################### 366cdf0e10cSrcweir# If folderitems are non-advertised, the component needs to have a registry key 367cdf0e10cSrcweir# below HKCU as key path. Therefore it is required, to mark the file belonging 368cdf0e10cSrcweir# to a non-advertised shortcut, that a special userreg_xxx registry key can be 369cdf0e10cSrcweir# created during packing process. 370cdf0e10cSrcweir##################################################################################### 371cdf0e10cSrcweir 372cdf0e10cSrcweirsub prepare_non_advertised_files 373cdf0e10cSrcweir{ 374cdf0e10cSrcweir my ( $folderitemref, $filesref ) = @_; 375cdf0e10cSrcweir 376cdf0e10cSrcweir for ( my $i = 0; $i <= $#{$folderitemref}; $i++ ) 377cdf0e10cSrcweir { 378cdf0e10cSrcweir my $folderitem = ${$folderitemref}[$i]; 379cdf0e10cSrcweir my $styles = ""; 380cdf0e10cSrcweir if ( $folderitem->{'Styles'} ) { $styles = $folderitem->{'Styles'}; } 381cdf0e10cSrcweir 382cdf0e10cSrcweir if ( $styles =~ /\bNON_ADVERTISED\b/ ) 383cdf0e10cSrcweir { 384cdf0e10cSrcweir my $fileid = $folderitem->{'FileID'}; 385cdf0e10cSrcweir if ( $folderitem->{'ComponentIDFile'} ) { $fileid = $folderitem->{'ComponentIDFile'}; } 386cdf0e10cSrcweir my $onefile = installer::worker::find_file_by_id($filesref, $fileid); 387cdf0e10cSrcweir 388cdf0e10cSrcweir # Attention: If $onefile with "FileID" is not found, this is not always an error. 389cdf0e10cSrcweir # FileID can also contain an executable file, for example msiexec.exe. 390cdf0e10cSrcweir if ( $onefile ne "" ) { $onefile->{'needs_user_registry_key'} = 1; } 391cdf0e10cSrcweir } 392cdf0e10cSrcweir } 393cdf0e10cSrcweir} 394cdf0e10cSrcweir 395cdf0e10cSrcweir##################################################################################### 396cdf0e10cSrcweir# Adding all variables defined in the installation object into the hash 397cdf0e10cSrcweir# of all variables from the zip list file. 398cdf0e10cSrcweir# This is needed if variables are defined in the installation object, 399cdf0e10cSrcweir# but not in the zip list file. 400cdf0e10cSrcweir# If there is a definition in the zip list file and in the installation 401cdf0e10cSrcweir# object, the installation object is more important 402cdf0e10cSrcweir##################################################################################### 403cdf0e10cSrcweir 404*1ba1fd99SAndre Fischersub add_installationobject_to_variables ($$) 405cdf0e10cSrcweir{ 406*1ba1fd99SAndre Fischer my ($variables, $script_variables) = @_; 407cdf0e10cSrcweir 408*1ba1fd99SAndre Fischer while (my ($key, $value) = each %$script_variables) 409cdf0e10cSrcweir { 410*1ba1fd99SAndre Fischer $variables->{$key} = $value; # overwrite existing values from zip.lst 411cdf0e10cSrcweir } 412cdf0e10cSrcweir} 413cdf0e10cSrcweir 414cdf0e10cSrcweir##################################################################################### 415cdf0e10cSrcweir# Adding all variables, that must be defined, but are not defined until now. 416cdf0e10cSrcweir# List of this varibles: @installer::globals::forced_properties 417cdf0e10cSrcweir##################################################################################### 418cdf0e10cSrcweir 419cdf0e10cSrcweirsub add_forced_properties 420cdf0e10cSrcweir{ 421cdf0e10cSrcweir my ($allvariables) = @_; 422cdf0e10cSrcweir 423cdf0e10cSrcweir my $property; 424cdf0e10cSrcweir foreach $property ( @installer::globals::forced_properties ) 425cdf0e10cSrcweir { 426cdf0e10cSrcweir if ( ! exists($allvariables->{$property}) ) { $allvariables->{$property} = ""; } 427cdf0e10cSrcweir } 428cdf0e10cSrcweir} 429cdf0e10cSrcweir 430cdf0e10cSrcweir##################################################################################### 431cdf0e10cSrcweir# Some properties are created automatically. It should be possible to 432cdf0e10cSrcweir# overwrite them, with PRESET properties. For example UNIXPRODUCTNAME 433cdf0e10cSrcweir# with PRESETUNIXPRODUCTNAME, if this is defined and the automatic process 434cdf0e10cSrcweir# does not deliver the desired results. 435cdf0e10cSrcweir##################################################################################### 436cdf0e10cSrcweir 437cdf0e10cSrcweirsub replace_preset_properties 438cdf0e10cSrcweir{ 439cdf0e10cSrcweir my ($allvariables) = @_; 440cdf0e10cSrcweir 441cdf0e10cSrcweir # SOLARISBRANDPACKAGENAME 442cdf0e10cSrcweir # needs to be replaced by 443cdf0e10cSrcweir # PRESETSOLARISBRANDPACKAGENAME 444cdf0e10cSrcweir 445cdf0e10cSrcweir my @presetproperties = (); 446cdf0e10cSrcweir push(@presetproperties, "SOLARISBRANDPACKAGENAME"); 447cdf0e10cSrcweir push(@presetproperties, "SYSTEMINTUNIXPACKAGENAME"); 448cdf0e10cSrcweir 449cdf0e10cSrcweir 450dba1a2e4SAndre Fischer foreach my $property (@presetproperties) 451cdf0e10cSrcweir { 452cdf0e10cSrcweir my $presetproperty = "PRESET" . $property; 453cdf0e10cSrcweir if (( exists($allvariables->{$presetproperty}) ) && ( $allvariables->{$presetproperty} ne "" )) 454cdf0e10cSrcweir { 455cdf0e10cSrcweir $allvariables->{$property} = $allvariables->{$presetproperty}; 456cdf0e10cSrcweir } 457cdf0e10cSrcweir } 458cdf0e10cSrcweir} 459cdf0e10cSrcweir 460cdf0e10cSrcweir1; 461