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