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 23cdf0e10cSrcweirpackage installer::xpdinstaller; 24cdf0e10cSrcweir 25cdf0e10cSrcweiruse Cwd; 26cdf0e10cSrcweiruse installer::converter; 27cdf0e10cSrcweiruse installer::exiter; 28cdf0e10cSrcweiruse installer::globals; 29cdf0e10cSrcweiruse installer::languages; 30cdf0e10cSrcweiruse installer::logger; 31cdf0e10cSrcweiruse installer::pathanalyzer; 32cdf0e10cSrcweiruse installer::remover; 33cdf0e10cSrcweiruse installer::systemactions; 34cdf0e10cSrcweir 35cdf0e10cSrcweir 36cdf0e10cSrcweir####################################################### 37cdf0e10cSrcweir# Searching for the module name and description in the 38cdf0e10cSrcweir# modules collector 39cdf0e10cSrcweir####################################################### 40cdf0e10cSrcweir 41cdf0e10cSrcweirsub get_module_name_description 42cdf0e10cSrcweir{ 43cdf0e10cSrcweir my ($modulesarrayref, $onelanguage, $gid, $type) = @_; 44cdf0e10cSrcweir 45cdf0e10cSrcweir my $found = 0; 46cdf0e10cSrcweir 47cdf0e10cSrcweir my $newstring = ""; 48cdf0e10cSrcweir 49cdf0e10cSrcweir for ( my $i = 0; $i <= $#{$modulesarrayref}; $i++ ) 50cdf0e10cSrcweir { 51cdf0e10cSrcweir my $onemodule = ${$modulesarrayref}[$i]; 52cdf0e10cSrcweir 53cdf0e10cSrcweir if ( $onemodule->{'gid'} eq $gid ) 54cdf0e10cSrcweir { 55cdf0e10cSrcweir my $typestring = $type . " " . "(" . $onelanguage . ")"; 56cdf0e10cSrcweir if ( $onemodule->{$typestring} ) { $newstring = $onemodule->{$typestring}; } 57cdf0e10cSrcweir $found = 1; 58cdf0e10cSrcweir } 59cdf0e10cSrcweir 60cdf0e10cSrcweir if ( $found ) { last; } 61cdf0e10cSrcweir } 62cdf0e10cSrcweir 63cdf0e10cSrcweir # defaulting to english 64cdf0e10cSrcweir 65cdf0e10cSrcweir if ( ! $found ) 66cdf0e10cSrcweir { 67cdf0e10cSrcweir my $defaultlanguage = "en-US"; 68cdf0e10cSrcweir 69cdf0e10cSrcweir for ( my $i = 0; $i <= $#{$modulesarrayref}; $i++ ) 70cdf0e10cSrcweir { 71cdf0e10cSrcweir my $onemodule = ${$modulesarrayref}[$i]; 72cdf0e10cSrcweir 73cdf0e10cSrcweir if ( $onemodule->{'gid'} eq $gid ) 74cdf0e10cSrcweir { 75cdf0e10cSrcweir my $typestring = $type . " " . "(" . $defaultlanguage . ")"; 76cdf0e10cSrcweir if ( $onemodule->{$typestring} ) { $newstring = $onemodule->{$typestring}; } 77cdf0e10cSrcweir $found = 1; 78cdf0e10cSrcweir } 79cdf0e10cSrcweir 80cdf0e10cSrcweir if ( $found ) { last; } 81cdf0e10cSrcweir } 82cdf0e10cSrcweir } 83cdf0e10cSrcweir 84cdf0e10cSrcweir return $newstring; 85cdf0e10cSrcweir} 86cdf0e10cSrcweir 87cdf0e10cSrcweir################################################### 88cdf0e10cSrcweir# Finding module, specified by the gid 89cdf0e10cSrcweir################################################### 90cdf0e10cSrcweir 91cdf0e10cSrcweirsub get_module 92cdf0e10cSrcweir{ 93cdf0e10cSrcweir my ($modulegid, $modulesarrayref) = @_; 94cdf0e10cSrcweir 95cdf0e10cSrcweir my $found = 0; 96cdf0e10cSrcweir my $searchmodule = ""; 97cdf0e10cSrcweir 98cdf0e10cSrcweir for ( my $i = 0; $i <= $#{$modulesarrayref}; $i++ ) 99cdf0e10cSrcweir { 100cdf0e10cSrcweir my $onemodule = ${$modulesarrayref}[$i]; 101cdf0e10cSrcweir 102cdf0e10cSrcweir if ( $onemodule->{'gid'} eq $modulegid ) 103cdf0e10cSrcweir { 104cdf0e10cSrcweir $searchmodule = $onemodule; 105cdf0e10cSrcweir $found = 1; 106cdf0e10cSrcweir last; 107cdf0e10cSrcweir } 108cdf0e10cSrcweir 109cdf0e10cSrcweir # if ( ! $found ) { installer::exiter::exit_program("ERROR: Could not find module belonging to gid $modulegid!", "get_module (xpdinstaller)"); } 110cdf0e10cSrcweir } 111cdf0e10cSrcweir 112cdf0e10cSrcweir return $searchmodule; 113cdf0e10cSrcweir} 114cdf0e10cSrcweir 115cdf0e10cSrcweir################################################### 116cdf0e10cSrcweir# Creating package start tag 117cdf0e10cSrcweir################################################### 118cdf0e10cSrcweir 119cdf0e10cSrcweirsub get_package_tag 120cdf0e10cSrcweir{ 121cdf0e10cSrcweir my ( $module, $indent, $linkpackage ) = @_; 122cdf0e10cSrcweir 123cdf0e10cSrcweir my $modulegid = $module->{'gid'}; 124cdf0e10cSrcweir if ( $linkpackage ) { $modulegid = $modulegid . "u"; } 125cdf0e10cSrcweir my $parentgid = ""; 126cdf0e10cSrcweir if ( $module->{'ParentID'} ) { $parentgid = $module->{'ParentID'}; } 127cdf0e10cSrcweir if ( $parentgid eq "" ) { $parentgid = "root"; } 128cdf0e10cSrcweir if ( $module->{'XPDParentID'} ) { $parentgid = $module->{'XPDParentID'}; } # changing parent of "Prg" and "Opt" to "root" 129cdf0e10cSrcweir 130cdf0e10cSrcweir my $tag = $indent . "<package " . "name=" . "\"" . $modulegid . "\" " . "parent=" . "\"" . $parentgid . "\">" . "\n"; 131cdf0e10cSrcweir 132cdf0e10cSrcweir return ( $tag, $parentgid ); 133cdf0e10cSrcweir} 134cdf0e10cSrcweir 135cdf0e10cSrcweir################################################### 136cdf0e10cSrcweir# Creating display start tag 137cdf0e10cSrcweir################################################### 138cdf0e10cSrcweir 139cdf0e10cSrcweirsub get_display_tag 140cdf0e10cSrcweir{ 141cdf0e10cSrcweir my ( $module, $indent ) = @_; 142cdf0e10cSrcweir 143cdf0e10cSrcweir # Styles=(HIDDEN_ROOT) 144cdf0e10cSrcweir my $styles = ""; 145cdf0e10cSrcweir my $type = ""; 146cdf0e10cSrcweir if ( $module->{'Styles'} ) { $styles = $module->{'Styles'}; } 147cdf0e10cSrcweir if ( $styles =~ /\bHIDDEN_ROOT\b/ ) { $type = "hidden"; } 148cdf0e10cSrcweir else { $type = "show"; } 149cdf0e10cSrcweir 150cdf0e10cSrcweir # special handling for language modules. Only visible in multilingual installation set. 151cdf0e10cSrcweir if (( $styles =~ /\bSHOW_MULTILINGUAL_ONLY\b/ ) && ( ! $installer::globals::ismultilingual )) { $type = "hidden"; } 152cdf0e10cSrcweir 153cdf0e10cSrcweir # special handling for the root module, which has no parent 154cdf0e10cSrcweir my $parentgid = ""; 155cdf0e10cSrcweir if ( $module->{'ParentID'} ) { $parentgid = $module->{'ParentID'}; } 156cdf0e10cSrcweir if ( $parentgid eq "" ) { $type = "hidden"; } 157cdf0e10cSrcweir 158cdf0e10cSrcweir my $tag = $indent . "<display " . "type=" . "\"" . $type . "\"" . ">" . "\n"; 159cdf0e10cSrcweir 160cdf0e10cSrcweir return $tag; 161cdf0e10cSrcweir} 162cdf0e10cSrcweir 163cdf0e10cSrcweir################################################### 164cdf0e10cSrcweir# Creating installunit start tag 165cdf0e10cSrcweir################################################### 166cdf0e10cSrcweir 167cdf0e10cSrcweirsub get_installunit_tag 168cdf0e10cSrcweir{ 169cdf0e10cSrcweir my ( $indent ) = @_; 170cdf0e10cSrcweir 171cdf0e10cSrcweir my $type = $installer::globals::packageformat; 172cdf0e10cSrcweir 173cdf0e10cSrcweir my $tag = $indent . "<installunit " . "type=" . "\"" . $type . "\"" . ">" . "\n"; 174cdf0e10cSrcweir 175cdf0e10cSrcweir return $tag; 176cdf0e10cSrcweir} 177cdf0e10cSrcweir 178cdf0e10cSrcweir################################################### 179cdf0e10cSrcweir# Creating simple start tags 180cdf0e10cSrcweir################################################### 181cdf0e10cSrcweir 182cdf0e10cSrcweirsub get_start_tag 183cdf0e10cSrcweir{ 184cdf0e10cSrcweir my ( $tag, $indent ) = @_; 185cdf0e10cSrcweir 186cdf0e10cSrcweir my $starttag = $indent . "<" . $tag . ">" . "\n"; 187cdf0e10cSrcweir return $starttag; 188cdf0e10cSrcweir} 189cdf0e10cSrcweir 190cdf0e10cSrcweir################################################### 191cdf0e10cSrcweir# Creating end tags 192cdf0e10cSrcweir################################################### 193cdf0e10cSrcweir 194cdf0e10cSrcweirsub get_end_tag 195cdf0e10cSrcweir{ 196cdf0e10cSrcweir my ( $tag, $indent ) = @_; 197cdf0e10cSrcweir 198cdf0e10cSrcweir my $endtag = $indent . "</" . $tag . ">" . "\n"; 199cdf0e10cSrcweir return $endtag; 200cdf0e10cSrcweir} 201cdf0e10cSrcweir 202cdf0e10cSrcweir################################################### 203cdf0e10cSrcweir# Creating simple complete tag 204cdf0e10cSrcweir################################################### 205cdf0e10cSrcweir 206cdf0e10cSrcweirsub get_tag_line 207cdf0e10cSrcweir{ 208cdf0e10cSrcweir my ( $indent, $name, $value ) = @_; 209cdf0e10cSrcweir $value = '' unless defined $value; 210cdf0e10cSrcweir 211cdf0e10cSrcweir my $line = $indent . "<" . $name . ">" . $value . "</" . $name . ">" . "\n"; 212cdf0e10cSrcweir 213cdf0e10cSrcweir} 214cdf0e10cSrcweir 215cdf0e10cSrcweir################################################### 216cdf0e10cSrcweir# Asking module for sortkey entry 217cdf0e10cSrcweir################################################### 218cdf0e10cSrcweir 219cdf0e10cSrcweirsub get_sortkey_value 220cdf0e10cSrcweir{ 221cdf0e10cSrcweir my ( $module ) = @_; 222cdf0e10cSrcweir 223cdf0e10cSrcweir my $value = "9999"; 224cdf0e10cSrcweir 225cdf0e10cSrcweir if ( $module->{'Sortkey'} ) { $value = $module->{'Sortkey'}; } 226cdf0e10cSrcweir 227cdf0e10cSrcweir return $value; 228cdf0e10cSrcweir} 229cdf0e10cSrcweir 230cdf0e10cSrcweir################################################### 231cdf0e10cSrcweir# Asking module for default entry 232cdf0e10cSrcweir################################################### 233cdf0e10cSrcweir 234cdf0e10cSrcweirsub get_default_value 235cdf0e10cSrcweir{ 236cdf0e10cSrcweir my ( $module ) = @_; 237cdf0e10cSrcweir 238cdf0e10cSrcweir my $value = ""; 239cdf0e10cSrcweir 240cdf0e10cSrcweir if ( $module->{'Default'} ) { $value = $module->{'Default'}; } # is YES or NO 241cdf0e10cSrcweir 242cdf0e10cSrcweir if ( $value =~ /\bNO\b/i ) { $value = "false"; } 243cdf0e10cSrcweir else { $value = "true"; } 244cdf0e10cSrcweir 245cdf0e10cSrcweir return $value; 246cdf0e10cSrcweir} 247cdf0e10cSrcweir 248cdf0e10cSrcweir################################################### 249cdf0e10cSrcweir# Asking module for showinuserinstall entry 250cdf0e10cSrcweir# scp style: DONTSHOWINUSERINSTALL 251cdf0e10cSrcweir################################################### 252cdf0e10cSrcweir 253cdf0e10cSrcweirsub get_showinuserinstall_value 254cdf0e10cSrcweir{ 255cdf0e10cSrcweir my ( $module ) = @_; 256cdf0e10cSrcweir 257cdf0e10cSrcweir my $value = "true"; 258cdf0e10cSrcweir 259cdf0e10cSrcweir my $styles = ""; 260cdf0e10cSrcweir if ( $module->{'Styles'} ) { $styles = $module->{'Styles'}; } 261cdf0e10cSrcweir if ( $styles =~ /\bDONTSHOWINUSERINSTALL\b/ ) { $value = "false"; } 262cdf0e10cSrcweir 263cdf0e10cSrcweir return $value; 264cdf0e10cSrcweir} 265cdf0e10cSrcweir 266cdf0e10cSrcweir################################################### 267cdf0e10cSrcweir# Asking module for showinuserinstall entry 268cdf0e10cSrcweir# scp style: USERINSTALLONLY 269cdf0e10cSrcweir################################################### 270cdf0e10cSrcweir 271cdf0e10cSrcweirsub get_userinstallonly_value 272cdf0e10cSrcweir{ 273cdf0e10cSrcweir my ( $module ) = @_; 274cdf0e10cSrcweir 275cdf0e10cSrcweir my $value = "false"; 276cdf0e10cSrcweir 277cdf0e10cSrcweir my $styles = ""; 278cdf0e10cSrcweir if ( $module->{'Styles'} ) { $styles = $module->{'Styles'}; } 279cdf0e10cSrcweir if ( $styles =~ /\bUSERINSTALLONLY\b/ ) { $value = "true"; } 280cdf0e10cSrcweir 281cdf0e10cSrcweir return $value; 282cdf0e10cSrcweir} 283cdf0e10cSrcweir 284cdf0e10cSrcweir################################################### 285cdf0e10cSrcweir# Asking module for dontuninstall entry 286cdf0e10cSrcweir# scp style: DONTUNINSTALL 287cdf0e10cSrcweir################################################### 288cdf0e10cSrcweir 289cdf0e10cSrcweirsub get_dontuninstall_value 290cdf0e10cSrcweir{ 291cdf0e10cSrcweir my ( $module ) = @_; 292cdf0e10cSrcweir 293cdf0e10cSrcweir my $value = "false"; 294cdf0e10cSrcweir 295cdf0e10cSrcweir my $styles = ""; 296cdf0e10cSrcweir if ( $module->{'Styles'} ) { $styles = $module->{'Styles'}; } 297cdf0e10cSrcweir if ( $styles =~ /\bDONTUNINSTALL\b/ ) { $value = "true"; } 298cdf0e10cSrcweir 299cdf0e10cSrcweir return $value; 300cdf0e10cSrcweir} 301cdf0e10cSrcweir 302cdf0e10cSrcweir################################################### 303cdf0e10cSrcweir# Asking module for XpdCheckSolaris entry 304cdf0e10cSrcweir# (belongs to scp module) 305cdf0e10cSrcweir################################################### 306cdf0e10cSrcweir 307cdf0e10cSrcweirsub get_checksolaris_value 308cdf0e10cSrcweir{ 309cdf0e10cSrcweir my ( $module ) = @_; 310cdf0e10cSrcweir 311cdf0e10cSrcweir my $value = ""; 312cdf0e10cSrcweir if ( $module->{'XpdCheckSolaris'} ) { $value = $module->{'XpdCheckSolaris'}; } 313cdf0e10cSrcweir 314cdf0e10cSrcweir return $value; 315cdf0e10cSrcweir} 316cdf0e10cSrcweir 317cdf0e10cSrcweir################################################### 318cdf0e10cSrcweir# Asking module for isupdatepackage entry 319cdf0e10cSrcweir# scp style: ISUPDATEPACKAGE 320cdf0e10cSrcweir################################################### 321cdf0e10cSrcweir 322cdf0e10cSrcweirsub get_isupdatepackage_value 323cdf0e10cSrcweir{ 324cdf0e10cSrcweir my ( $module ) = @_; 325cdf0e10cSrcweir 326cdf0e10cSrcweir my $value = "false"; 327cdf0e10cSrcweir 328cdf0e10cSrcweir my $styles = ""; 329cdf0e10cSrcweir if ( $module->{'Styles'} ) { $styles = $module->{'Styles'}; } 330cdf0e10cSrcweir if ( $styles =~ /\bISUPDATEPACKAGE\b/ ) { $value = "true"; } 331cdf0e10cSrcweir 332cdf0e10cSrcweir return $value; 333cdf0e10cSrcweir} 334cdf0e10cSrcweir 335cdf0e10cSrcweir################################################### 336cdf0e10cSrcweir# Asking module for showmultilingualonly entry 337cdf0e10cSrcweir# scp style: SHOW_MULTILINGUAL_ONLY 338cdf0e10cSrcweir################################################### 339cdf0e10cSrcweir 340cdf0e10cSrcweirsub get_showmultilingualonly_value 341cdf0e10cSrcweir{ 342cdf0e10cSrcweir my ( $module ) = @_; 343cdf0e10cSrcweir 344cdf0e10cSrcweir my $value = "false"; 345cdf0e10cSrcweir 346cdf0e10cSrcweir my $styles = ""; 347cdf0e10cSrcweir if ( $module->{'Styles'} ) { $styles = $module->{'Styles'}; } 348cdf0e10cSrcweir if ( $styles =~ /\bSHOW_MULTILINGUAL_ONLY\b/ ) { $value = "true"; } 349cdf0e10cSrcweir 350cdf0e10cSrcweir return $value; 351cdf0e10cSrcweir} 352cdf0e10cSrcweir 353cdf0e10cSrcweir################################################### 354cdf0e10cSrcweir# Asking module for showmultilingualonly entry 355cdf0e10cSrcweir# scp style: SHOW_MULTILINGUAL_ONLY 356cdf0e10cSrcweir################################################### 357cdf0e10cSrcweir 358cdf0e10cSrcweirsub get_applicationmodule_value 359cdf0e10cSrcweir{ 360cdf0e10cSrcweir my ( $module ) = @_; 361cdf0e10cSrcweir 362cdf0e10cSrcweir my $value = "false"; 363cdf0e10cSrcweir 364cdf0e10cSrcweir my $styles = ""; 365cdf0e10cSrcweir if ( $module->{'Styles'} ) { $styles = $module->{'Styles'}; } 366cdf0e10cSrcweir if ( $styles =~ /\bAPPLICATIONMODULE\b/ ) { $value = "true"; } 367cdf0e10cSrcweir 368cdf0e10cSrcweir return $value; 369cdf0e10cSrcweir} 370cdf0e10cSrcweir 371cdf0e10cSrcweir################################################### 372cdf0e10cSrcweir# Asking module for java module entry 373cdf0e10cSrcweir# scp style: JAVAMODULE 374cdf0e10cSrcweir################################################### 375cdf0e10cSrcweir 376cdf0e10cSrcweirsub get_isjavamodule_value 377cdf0e10cSrcweir{ 378cdf0e10cSrcweir my ( $module ) = @_; 379cdf0e10cSrcweir 380cdf0e10cSrcweir my $value = "false"; 381cdf0e10cSrcweir 382cdf0e10cSrcweir my $styles = ""; 383cdf0e10cSrcweir if ( $module->{'Styles'} ) { $styles = $module->{'Styles'}; } 384cdf0e10cSrcweir if ( $styles =~ /\bJAVAMODULE\b/ ) { $value = "true"; } 385cdf0e10cSrcweir 386cdf0e10cSrcweir return $value; 387cdf0e10cSrcweir} 388cdf0e10cSrcweir 389cdf0e10cSrcweir##################################################################### 390cdf0e10cSrcweir# Asking module, if installation shall use --force 391cdf0e10cSrcweir# scp style: USEFORCE (Linux only) 392cdf0e10cSrcweir##################################################################### 393cdf0e10cSrcweir 394cdf0e10cSrcweirsub get_useforce_value 395cdf0e10cSrcweir{ 396cdf0e10cSrcweir my ( $module ) = @_; 397cdf0e10cSrcweir 398cdf0e10cSrcweir my $value = "false"; 399cdf0e10cSrcweir 400cdf0e10cSrcweir my $styles = ""; 401cdf0e10cSrcweir if ( $module->{'Styles'} ) { $styles = $module->{'Styles'}; } 402cdf0e10cSrcweir if ( $styles =~ /\bUSEFORCE\b/ ) { $value = "true"; } 403cdf0e10cSrcweir 404cdf0e10cSrcweir return $value; 405cdf0e10cSrcweir} 406cdf0e10cSrcweir 407cdf0e10cSrcweir################################################### 408cdf0e10cSrcweir# Asking module, if installation can fail 409cdf0e10cSrcweir# scp style: INSTALLCANFAIL 410cdf0e10cSrcweir################################################### 411cdf0e10cSrcweir 412cdf0e10cSrcweirsub get_installcanfail_value 413cdf0e10cSrcweir{ 414cdf0e10cSrcweir my ( $module ) = @_; 415cdf0e10cSrcweir 416cdf0e10cSrcweir my $value = "false"; 417cdf0e10cSrcweir 418cdf0e10cSrcweir my $styles = ""; 419cdf0e10cSrcweir if ( $module->{'Styles'} ) { $styles = $module->{'Styles'}; } 420cdf0e10cSrcweir if ( $styles =~ /\bINSTALLCANFAIL\b/ ) { $value = "true"; } 421cdf0e10cSrcweir 422cdf0e10cSrcweir return $value; 423cdf0e10cSrcweir} 424cdf0e10cSrcweir 425cdf0e10cSrcweir################################################### 426cdf0e10cSrcweir# Asking module, if installation can fail 427cdf0e10cSrcweir# scp style: INSTALLCANFAIL 428cdf0e10cSrcweir################################################### 429cdf0e10cSrcweir 430cdf0e10cSrcweirsub get_forceintoupdate_value 431cdf0e10cSrcweir{ 432cdf0e10cSrcweir my ( $module ) = @_; 433cdf0e10cSrcweir 434cdf0e10cSrcweir my $value = "false"; 435cdf0e10cSrcweir 436cdf0e10cSrcweir my $styles = ""; 437cdf0e10cSrcweir if ( $module->{'Styles'} ) { $styles = $module->{'Styles'}; } 438cdf0e10cSrcweir if ( $styles =~ /\bFORCEINTOUPDATE\b/ ) { $value = "true"; } 439cdf0e10cSrcweir 440cdf0e10cSrcweir return $value; 441cdf0e10cSrcweir} 442cdf0e10cSrcweir 443cdf0e10cSrcweir################################################### 444cdf0e10cSrcweir# Substituting all occurences of "<" by "<" 445cdf0e10cSrcweir# and all occurences of ">" by ">" 446cdf0e10cSrcweir################################################### 447cdf0e10cSrcweir 448cdf0e10cSrcweirsub replace_brackets_in_string 449cdf0e10cSrcweir{ 450cdf0e10cSrcweir my ( $string ) = @_; 451cdf0e10cSrcweir 452cdf0e10cSrcweir if ( $string =~ /\</ ) { $string =~ s/\</\<\;/g; } 453cdf0e10cSrcweir if ( $string =~ /\>/ ) { $string =~ s/\>/\>\;/g; } 454cdf0e10cSrcweir 455cdf0e10cSrcweir return $string; 456cdf0e10cSrcweir} 457cdf0e10cSrcweir 458cdf0e10cSrcweir################################################### 459cdf0e10cSrcweir# Substituting all occurences of "\uUXYZ" by 460cdf0e10cSrcweir# "&#xUXYZ;", because the use xml saxparser does 461cdf0e10cSrcweir# not know anything about this encoding. Therfore 462cdf0e10cSrcweir# the xml file can keep standard encoding "UTF-8" 463cdf0e10cSrcweir# and all strings with "\uUXYZ" do not need to 464cdf0e10cSrcweir# be converted from the Java installer. 465cdf0e10cSrcweir################################################### 466cdf0e10cSrcweir 467cdf0e10cSrcweirsub replace_javaencoding_in_string 468cdf0e10cSrcweir{ 469cdf0e10cSrcweir my ( $string ) = @_; 470cdf0e10cSrcweir 471cdf0e10cSrcweir while ( $string =~ /(\\u\w\w\w\w)/ ) 472cdf0e10cSrcweir { 473cdf0e10cSrcweir my $oldvalue = $1; 474cdf0e10cSrcweir my $newvalue = ""; 475cdf0e10cSrcweir if ( $oldvalue =~ /\\u(\w\w\w\w)/ ) 476cdf0e10cSrcweir { 477cdf0e10cSrcweir my $number = $1; 478cdf0e10cSrcweir $newvalue = "&#x" . $number . ";"; 479cdf0e10cSrcweir } 480cdf0e10cSrcweir 481cdf0e10cSrcweir $string =~ s/\Q$oldvalue\E/$newvalue/; 482cdf0e10cSrcweir } 483cdf0e10cSrcweir 484cdf0e10cSrcweir return $string; 485cdf0e10cSrcweir} 486cdf0e10cSrcweir 487cdf0e10cSrcweir################################################### 488cdf0e10cSrcweir# Collecting language dependent entries from scp 489cdf0e10cSrcweir# (Name and Description) 490cdf0e10cSrcweir################################################### 491cdf0e10cSrcweir 492cdf0e10cSrcweirsub collect_lang_values 493cdf0e10cSrcweir{ 494cdf0e10cSrcweir my ($indent, $module, $xpdfile, $searchentry, $saveentry) = @_; 495cdf0e10cSrcweir 496cdf0e10cSrcweir foreach $key (keys %{$module}) 497cdf0e10cSrcweir { 498cdf0e10cSrcweir my $write_line = 0; 499cdf0e10cSrcweir my $javalanguage = ""; 500cdf0e10cSrcweir 501cdf0e10cSrcweir if ( $key =~ /^\s*\Q$searchentry\E\s+\((\S+)\)\s*$/ ) # this are the language dependent keys 502cdf0e10cSrcweir { 503cdf0e10cSrcweir $language = $1; 504cdf0e10cSrcweir $javalanguage = installer::languages::get_java_language($language); 505cdf0e10cSrcweir $write_line = 1; 506cdf0e10cSrcweir } 507cdf0e10cSrcweir elsif ( $key =~ /^\s*\Q$searchentry\E\s*$/ ) # this are the language independent keys 508cdf0e10cSrcweir { 509cdf0e10cSrcweir $javalanguage = "en_US"; 510cdf0e10cSrcweir $write_line = 1; 511cdf0e10cSrcweir } 512cdf0e10cSrcweir 513cdf0e10cSrcweir if ( $write_line ) 514cdf0e10cSrcweir { 515cdf0e10cSrcweir my $value = $module->{$key}; 516cdf0e10cSrcweir $value = replace_brackets_in_string($value); 517cdf0e10cSrcweir $value = replace_javaencoding_in_string($value); 518cdf0e10cSrcweir my $line = $indent . "<" . $saveentry . " lang=" . "\"" . $javalanguage . "\"" . ">" . $value . "<\/" . $saveentry . ">" . "\n"; 519cdf0e10cSrcweir push(@{$xpdfile}, $line); 520cdf0e10cSrcweir } 521cdf0e10cSrcweir } 522cdf0e10cSrcweir} 523cdf0e10cSrcweir 524cdf0e10cSrcweir################################################### 525cdf0e10cSrcweir# Removing language dependent entries from 526cdf0e10cSrcweir# module hash (Name and Description) 527cdf0e10cSrcweir################################################### 528cdf0e10cSrcweir 529cdf0e10cSrcweirsub remove_lang_values 530cdf0e10cSrcweir{ 531cdf0e10cSrcweir my ($module, $searchentry) = @_; 532cdf0e10cSrcweir 533cdf0e10cSrcweir my $key = ""; 534cdf0e10cSrcweir 535cdf0e10cSrcweir foreach $key (keys %{$module}) 536cdf0e10cSrcweir { 537cdf0e10cSrcweir if ( $key =~ /^\s*\Q$searchentry\E\s+\((\S+)\)\s*$/ ) # this are the language dependent keys 538cdf0e10cSrcweir { 539cdf0e10cSrcweir delete($module->{$key}); 540cdf0e10cSrcweir } 541cdf0e10cSrcweir } 542cdf0e10cSrcweir} 543cdf0e10cSrcweir 544cdf0e10cSrcweir################################################### 545cdf0e10cSrcweir# Setting package install order 546cdf0e10cSrcweir################################################### 547cdf0e10cSrcweir 548cdf0e10cSrcweirsub get_order_value 549cdf0e10cSrcweir{ 550cdf0e10cSrcweir my ( $module ) = @_; 551cdf0e10cSrcweir 552cdf0e10cSrcweir my $value = "1000"; # Setting the default value 553cdf0e10cSrcweir 554cdf0e10cSrcweir if ( $module->{'InstallOrder'} ) { $value = $module->{'InstallOrder'}; } 555cdf0e10cSrcweir 556cdf0e10cSrcweir return $value; 557cdf0e10cSrcweir} 558cdf0e10cSrcweir 559cdf0e10cSrcweir################################################### 560cdf0e10cSrcweir# Checking size of package 561cdf0e10cSrcweir################################################### 562cdf0e10cSrcweir 563cdf0e10cSrcweirsub get_size_value 564cdf0e10cSrcweir{ 565cdf0e10cSrcweir my ( $packagename, $xpdinfo ) = @_; 566cdf0e10cSrcweir 567cdf0e10cSrcweir my $value = ""; 568cdf0e10cSrcweir 569cdf0e10cSrcweir if ( $xpdinfo->{'FileSize'} ) 570cdf0e10cSrcweir { 571cdf0e10cSrcweir $value = $xpdinfo->{'FileSize'}; 572cdf0e10cSrcweir return $value; 573cdf0e10cSrcweir } 574cdf0e10cSrcweir 575cdf0e10cSrcweir my $isrpmfile = 0; 576cdf0e10cSrcweir if ( $packagename =~ /\.rpm\s*$/ ) { $isrpmfile = 1; } 577cdf0e10cSrcweir 578cdf0e10cSrcweir if (( $installer::globals::islinuxrpmbuild ) && ( $isrpmfile )) 579cdf0e10cSrcweir { 580cdf0e10cSrcweir # if ( ! $installer::globals::rpmquerycommand ) { installer::exiter::exit_program("ERROR: rpm not found for querying packages!", "get_size_value"); } 581cdf0e10cSrcweir if ( ! $installer::globals::rpmquerycommand ) { $installer::globals::rpmquerycommand = "rpm"; } 582cdf0e10cSrcweir 583cdf0e10cSrcweir my $systemcall = "$installer::globals::rpmquerycommand -qp --queryformat \"\[\%\{FILESIZES\}\\n\]\" $packagename 2\>\&1 |"; 584cdf0e10cSrcweir my $ld_library_backup = $ENV{LD_LIBRARY_PATH}; 585cdf0e10cSrcweir if ( defined $ENV{SYSBASE}) { 586cdf0e10cSrcweir my $sysbase = $ENV{SYSBASE}; 587cdf0e10cSrcweir if ( !defined ($ld_library_backup) or ("$ld_library_backup" eq "") ) { 588cdf0e10cSrcweir $ld_library_backup = "" if ! defined $ld_library_backup; 589cdf0e10cSrcweir $ENV{LD_LIBRARY_PATH} = "$sysbase/usr/lib"; 590cdf0e10cSrcweir } else { 591cdf0e10cSrcweir $ENV{LD_LIBRARY_PATH} = "$ld_library_backup:$sysbase/lib"; 592cdf0e10cSrcweir } 593cdf0e10cSrcweir } 594cdf0e10cSrcweir my ($rpmout, $error) = make_systemcall_allowing_error($systemcall, 0, 1); 595cdf0e10cSrcweir $ENV{LD_LIBRARY_PATH} = $ld_library_backup; 596cdf0e10cSrcweir # Evaluating an error, because of rpm problems with removed LD_LIBRARY_PATH 597cdf0e10cSrcweir if ( $error ) 598cdf0e10cSrcweir { 599cdf0e10cSrcweir installer::logger::print_message( "... trying /usr/bin/rpm ...\n" ); 600cdf0e10cSrcweir my $systemcall = "/usr/bin/rpm -qp --queryformat \"\[\%\{FILESIZES\}\\n\]\" $packagename 2\>\&1 |"; 601cdf0e10cSrcweir ($rpmout, $error) = make_systemcall_allowing_error($systemcall, 0, 0); 602cdf0e10cSrcweir if ( $error ) { installer::exiter::exit_program("ERROR: rpm failed to query package!", "get_size_value"); } 603cdf0e10cSrcweir } 604cdf0e10cSrcweir $value = do_sum($rpmout); # adding all filesizes in bytes 605cdf0e10cSrcweir $value = $value/1000; 606cdf0e10cSrcweir 607cdf0e10cSrcweir my $ganzzahl = int $value; 608cdf0e10cSrcweir if ($ganzzahl < $value) { $value = $ganzzahl + 1; } 609cdf0e10cSrcweir else { $value = $ganzzahl; } 610cdf0e10cSrcweir 611cdf0e10cSrcweir my $rpmname = $packagename; 612cdf0e10cSrcweir installer::pathanalyzer::make_absolute_filename_to_relative_filename(\$rpmname); 613cdf0e10cSrcweir $infoline = "Filesize $rpmname : $value\n"; 614cdf0e10cSrcweir push( @installer::globals::logfileinfo, $infoline); 615cdf0e10cSrcweir } 616cdf0e10cSrcweir 617cdf0e10cSrcweir if ( $installer::globals::issolarispkgbuild ) 618cdf0e10cSrcweir { 619cdf0e10cSrcweir my $filename = "pkgmap"; 620cdf0e10cSrcweir $filename = $packagename . $installer::globals::separator . $filename; 621cdf0e10cSrcweir $file = installer::files::read_file($filename); 622cdf0e10cSrcweir 623cdf0e10cSrcweir for ( my $i = 0; $i <= $#{$file}; $i++ ) 624cdf0e10cSrcweir { 625cdf0e10cSrcweir my $line = ${$file}[$i]; 626cdf0e10cSrcweir if ( $line =~ /^\s*\:\s+\d+\s+(\d+?)\s+/ ) 627cdf0e10cSrcweir { 628cdf0e10cSrcweir $value = $1; 629cdf0e10cSrcweir if ( ! ( $value%2 == 0 )) { $value = $value + 1; } 630cdf0e10cSrcweir $value = $value/2; # not blocks, but kB 631cdf0e10cSrcweir last; 632cdf0e10cSrcweir } 633cdf0e10cSrcweir } 634cdf0e10cSrcweir } 635cdf0e10cSrcweir 636cdf0e10cSrcweir if ( $value eq "" ) { $value = "0"; } 637cdf0e10cSrcweir 638cdf0e10cSrcweir return $value; 639cdf0e10cSrcweir} 640cdf0e10cSrcweir 641cdf0e10cSrcweir################################################### 642cdf0e10cSrcweir# Checking md5 of package 643cdf0e10cSrcweir################################################### 644cdf0e10cSrcweir 645cdf0e10cSrcweirsub get_md5_value 646cdf0e10cSrcweir{ 647cdf0e10cSrcweir my ( $packagename, $xpdinfo ) = @_; 648cdf0e10cSrcweir 649cdf0e10cSrcweir my $value = ""; 650cdf0e10cSrcweir 651cdf0e10cSrcweir if ( $xpdinfo->{'md5sum'} ) 652cdf0e10cSrcweir { 653cdf0e10cSrcweir $value = $xpdinfo->{'md5sum'}; 654cdf0e10cSrcweir return $value; 655cdf0e10cSrcweir } 656cdf0e10cSrcweir 657cdf0e10cSrcweir if ( $installer::globals::islinuxrpmbuild ) 658cdf0e10cSrcweir { 659cdf0e10cSrcweir my $md5file = "/usr/bin/md5sum"; 660cdf0e10cSrcweir 661cdf0e10cSrcweir if ( -x $md5file ) 662cdf0e10cSrcweir { 663cdf0e10cSrcweir my $systemcall = "$md5file $packagename 2\>\&1 |"; 664cdf0e10cSrcweir my $md5out = make_systemcall($systemcall, 1); 665cdf0e10cSrcweir $value = ${$md5out}[0]; 666cdf0e10cSrcweir if ( $value =~ /^\s*(\S+?)\s+.*$/ ) 667cdf0e10cSrcweir { 668cdf0e10cSrcweir $value = $1; 669cdf0e10cSrcweir } 670cdf0e10cSrcweir 671cdf0e10cSrcweir my $rpmname = $packagename; 672cdf0e10cSrcweir installer::pathanalyzer::make_absolute_filename_to_relative_filename(\$rpmname); 673cdf0e10cSrcweir $infoline = "md5sum of $rpmname : $value\n"; 674cdf0e10cSrcweir push( @installer::globals::logfileinfo, $infoline); 675cdf0e10cSrcweir } 676cdf0e10cSrcweir } 677cdf0e10cSrcweir 678cdf0e10cSrcweir return $value; 679cdf0e10cSrcweir} 680cdf0e10cSrcweir 681cdf0e10cSrcweir################################################### 682cdf0e10cSrcweir# Checking name of package 683cdf0e10cSrcweir################################################### 684cdf0e10cSrcweir 685cdf0e10cSrcweirsub get_name_value 686cdf0e10cSrcweir{ 687cdf0e10cSrcweir my ( $packagename ) = @_; 688cdf0e10cSrcweir 689cdf0e10cSrcweir my $value = $packagename; 690cdf0e10cSrcweir 691cdf0e10cSrcweir # $packagename contains the complete path to the package 692cdf0e10cSrcweir # Only the name of file or directory is required 693cdf0e10cSrcweir 694cdf0e10cSrcweir installer::pathanalyzer::make_absolute_filename_to_relative_filename(\$value); 695cdf0e10cSrcweir 696cdf0e10cSrcweir return $value; 697cdf0e10cSrcweir} 698cdf0e10cSrcweir 699cdf0e10cSrcweir################################################### 700cdf0e10cSrcweir# Checking full package name (Linux only) 701cdf0e10cSrcweir################################################### 702cdf0e10cSrcweir 703cdf0e10cSrcweirsub get_fullpkgname_value 704cdf0e10cSrcweir{ 705cdf0e10cSrcweir my ( $packagename, $xpdinfo ) = @_; 706cdf0e10cSrcweir 707cdf0e10cSrcweir my $value = ""; 708cdf0e10cSrcweir my $isrpmfile = 0; 709cdf0e10cSrcweir if ( $packagename =~ /\.rpm\s*$/ ) { $isrpmfile = 1; } 710cdf0e10cSrcweir 711cdf0e10cSrcweir if (( $installer::globals::islinuxrpmbuild ) && ( $isrpmfile )) 712cdf0e10cSrcweir { 713cdf0e10cSrcweir if ( $xpdinfo->{'FullPackageName'} ) 714cdf0e10cSrcweir { 715cdf0e10cSrcweir $value = $xpdinfo->{'FullPackageName'}; 716cdf0e10cSrcweir return $value; 717cdf0e10cSrcweir } 718cdf0e10cSrcweir 719cdf0e10cSrcweir # if ( ! $installer::globals::rpmquerycommand ) { installer::exiter::exit_program("ERROR: rpm not found for querying packages!", "get_fullpkgname_value"); } 720cdf0e10cSrcweir if ( ! $installer::globals::rpmquerycommand ) { $installer::globals::rpmquerycommand = "rpm"; } 721cdf0e10cSrcweir my $systemcall = "$installer::globals::rpmquerycommand -qp $packagename |"; 722cdf0e10cSrcweir my $ld_library_backup = $ENV{LD_LIBRARY_PATH}; 723cdf0e10cSrcweir if ( defined $ENV{SYSBASE}) { 724cdf0e10cSrcweir my $sysbase = $ENV{SYSBASE}; 725cdf0e10cSrcweir if ( !defined ($ld_library_backup) or ("$ld_library_backup" eq "") ) { 726cdf0e10cSrcweir $ld_library_backup = "" if ! defined $ld_library_backup; 727cdf0e10cSrcweir $ENV{LD_LIBRARY_PATH} = "$sysbase/usr/lib"; 728cdf0e10cSrcweir } else { 729cdf0e10cSrcweir $ENV{LD_LIBRARY_PATH} = "$ld_library_backup:$sysbase/lib"; 730cdf0e10cSrcweir } 731cdf0e10cSrcweir } 732cdf0e10cSrcweir my ($returnarray, $error) = make_systemcall_allowing_error($systemcall, 0, 1); 733cdf0e10cSrcweir $ENV{LD_LIBRARY_PATH} = $ld_library_backup; 734cdf0e10cSrcweir # Evaluating an error, because of rpm problems with removed LD_LIBRARY_PATH 735cdf0e10cSrcweir if ( $error ) 736cdf0e10cSrcweir { 737cdf0e10cSrcweir installer::logger::print_message( "... trying /usr/bin/rpm ...\n" ); 738cdf0e10cSrcweir my $systemcall = "/usr/bin/rpm -qp $packagename |"; 739cdf0e10cSrcweir ($returnarray, $error) = make_systemcall_allowing_error($systemcall, 0, 0); 740cdf0e10cSrcweir if ( $error ) { installer::exiter::exit_program("ERROR: rpm failed to query package!", "get_fullpkgname_value"); } 741cdf0e10cSrcweir } 742cdf0e10cSrcweir $value = ${$returnarray}[0]; 743cdf0e10cSrcweir installer::remover::remove_leading_and_ending_whitespaces(\$value); 744cdf0e10cSrcweir 745cdf0e10cSrcweir my $rpmname = $packagename; 746cdf0e10cSrcweir installer::pathanalyzer::make_absolute_filename_to_relative_filename(\$rpmname); 747cdf0e10cSrcweir 748cdf0e10cSrcweir $infoline = "Full package name from $rpmname: $value\n"; 749cdf0e10cSrcweir push( @installer::globals::logfileinfo, $infoline); 750cdf0e10cSrcweir } 751cdf0e10cSrcweir 752cdf0e10cSrcweir return $value; 753cdf0e10cSrcweir} 754cdf0e10cSrcweir 755cdf0e10cSrcweir################################################### 756cdf0e10cSrcweir# Checking package version (Solaris only) 757cdf0e10cSrcweir################################################### 758cdf0e10cSrcweir 759cdf0e10cSrcweirsub get_pkgversion_value 760cdf0e10cSrcweir{ 761cdf0e10cSrcweir my ( $completepackagename, $xpdinfo ) = @_; 762cdf0e10cSrcweir 763cdf0e10cSrcweir my $value = ""; 764cdf0e10cSrcweir 765cdf0e10cSrcweir if ( $xpdinfo->{'PkgVersion'} ) 766cdf0e10cSrcweir { 767cdf0e10cSrcweir $value = $xpdinfo->{'PkgVersion'}; 768cdf0e10cSrcweir return $value; 769cdf0e10cSrcweir } 770cdf0e10cSrcweir 771cdf0e10cSrcweir if ( $installer::globals::issolarispkgbuild ) 772cdf0e10cSrcweir { 773cdf0e10cSrcweir my $pkgfile = "pkgparam"; 774cdf0e10cSrcweir my $packagepath = $completepackagename; 775cdf0e10cSrcweir installer::pathanalyzer::get_path_from_fullqualifiedname(\$packagepath); 776cdf0e10cSrcweir 777cdf0e10cSrcweir my $packagename = $completepackagename; 778cdf0e10cSrcweir installer::pathanalyzer::make_absolute_filename_to_relative_filename(\$packagename); 779cdf0e10cSrcweir 780cdf0e10cSrcweir my $systemcall = "$pkgfile -d $packagepath $packagename param VERSION 2\>\&1 |"; 781cdf0e10cSrcweir my $returnarray = make_systemcall($systemcall, 0); 782cdf0e10cSrcweir 783cdf0e10cSrcweir $value = ${$returnarray}[0]; 784cdf0e10cSrcweir installer::remover::remove_leading_and_ending_whitespaces(\$value); 785cdf0e10cSrcweir } 786cdf0e10cSrcweir 787cdf0e10cSrcweir return $value; 788cdf0e10cSrcweir} 789cdf0e10cSrcweir 790cdf0e10cSrcweir################################################### 791cdf0e10cSrcweir# Writing subdirectory into xpd file 792cdf0e10cSrcweir################################################### 793cdf0e10cSrcweir 794cdf0e10cSrcweirsub get_subdir_value 795cdf0e10cSrcweir{ 796cdf0e10cSrcweir my ( $packagename, $subdir, $module ) = @_; 797cdf0e10cSrcweir 798cdf0e10cSrcweir my $value = ""; 799cdf0e10cSrcweir 800cdf0e10cSrcweir if ( $subdir ) { $value = $subdir; } 801cdf0e10cSrcweir 802cdf0e10cSrcweir if ( $module->{'Subdir'} ) { $value = $module->{'Subdir'}; } 803cdf0e10cSrcweir 804cdf0e10cSrcweir return $value; 805cdf0e10cSrcweir} 806cdf0e10cSrcweir 807cdf0e10cSrcweir################################################### 808cdf0e10cSrcweir# Checking if package is relocatable 809cdf0e10cSrcweir################################################### 810cdf0e10cSrcweir 811cdf0e10cSrcweirsub get_relocatable_value 812cdf0e10cSrcweir{ 813cdf0e10cSrcweir my ( $module ) = @_; 814cdf0e10cSrcweir 815cdf0e10cSrcweir my $value = "true"; 816cdf0e10cSrcweir 817cdf0e10cSrcweir my $styles = ""; 818cdf0e10cSrcweir if ( $module->{'Styles'} ) { $styles = $module->{'Styles'}; } 819cdf0e10cSrcweir if ( $styles =~ /\bNOTRELOCATABLE\b/ ) { $value = "false"; } 820cdf0e10cSrcweir 821cdf0e10cSrcweir return $value; 822cdf0e10cSrcweir} 823cdf0e10cSrcweir 824cdf0e10cSrcweir################################################### 825cdf0e10cSrcweir# Checking if package is relocatable 826cdf0e10cSrcweir################################################### 827cdf0e10cSrcweir 828cdf0e10cSrcweirsub get_languagespecific_value 829cdf0e10cSrcweir{ 830cdf0e10cSrcweir my ( $islanguagemodule ) = @_; 831cdf0e10cSrcweir 832cdf0e10cSrcweir my $value = "false"; 833cdf0e10cSrcweir 834cdf0e10cSrcweir if ( defined $islanguagemodule && $islanguagemodule == 1 ) { $value = "true"; } 835cdf0e10cSrcweir 836cdf0e10cSrcweir return $value; 837cdf0e10cSrcweir} 838cdf0e10cSrcweir 839cdf0e10cSrcweir####################################################### 840cdf0e10cSrcweir# Adding the values of the array 841cdf0e10cSrcweir####################################################### 842cdf0e10cSrcweir 843cdf0e10cSrcweirsub do_sum 844cdf0e10cSrcweir{ 845cdf0e10cSrcweir my ( $allnumbers ) = @_; 846cdf0e10cSrcweir 847cdf0e10cSrcweir my $sum = 0; 848cdf0e10cSrcweir 849cdf0e10cSrcweir for ( my $i = 0; $i <= $#{$allnumbers}; $i++ ) 850cdf0e10cSrcweir { 851cdf0e10cSrcweir $sum = $sum + ${$allnumbers}[$i]; 852cdf0e10cSrcweir } 853cdf0e10cSrcweir 854cdf0e10cSrcweir return $sum; 855cdf0e10cSrcweir} 856cdf0e10cSrcweir 857cdf0e10cSrcweir####################################################### 858cdf0e10cSrcweir# Executing one system call 859cdf0e10cSrcweir####################################################### 860cdf0e10cSrcweir 861cdf0e10cSrcweirsub make_systemcall 862cdf0e10cSrcweir{ 863cdf0e10cSrcweir my ( $systemcall, $logreturn ) = @_; 864cdf0e10cSrcweir 865cdf0e10cSrcweir my @returns = (); 866cdf0e10cSrcweir 867cdf0e10cSrcweir installer::logger::print_message( "... $systemcall ...\n" ); 868cdf0e10cSrcweir 869cdf0e10cSrcweir open (REG, "$systemcall"); 870cdf0e10cSrcweir while (<REG>) {push(@returns, $_); } 871cdf0e10cSrcweir close (REG); 872cdf0e10cSrcweir 873cdf0e10cSrcweir my $returnvalue = $?; # $? contains the return value of the systemcall 874cdf0e10cSrcweir 875cdf0e10cSrcweir my $infoline = "Systemcall: $systemcall\n"; 876cdf0e10cSrcweir push( @installer::globals::logfileinfo, $infoline); 877cdf0e10cSrcweir 878cdf0e10cSrcweir if ( $logreturn ) 879cdf0e10cSrcweir { 880cdf0e10cSrcweir for ( my $j = 0; $j <= $#returns; $j++ ) { push( @installer::globals::logfileinfo, "$returns[$j]"); } 881cdf0e10cSrcweir } 882cdf0e10cSrcweir 883cdf0e10cSrcweir if ($returnvalue) 884cdf0e10cSrcweir { 885cdf0e10cSrcweir $infoline = "ERROR: $systemcall\n"; 886cdf0e10cSrcweir push( @installer::globals::logfileinfo, $infoline); 887cdf0e10cSrcweir $error_occured = 1; 888cdf0e10cSrcweir } 889cdf0e10cSrcweir else 890cdf0e10cSrcweir { 891cdf0e10cSrcweir $infoline = "SUCCESS: $systemcall\n"; 892cdf0e10cSrcweir push( @installer::globals::logfileinfo, $infoline); 893cdf0e10cSrcweir } 894cdf0e10cSrcweir 895cdf0e10cSrcweir return \@returns; 896cdf0e10cSrcweir} 897cdf0e10cSrcweir 898cdf0e10cSrcweir####################################################### 899cdf0e10cSrcweir# Executing one system call 900cdf0e10cSrcweir####################################################### 901cdf0e10cSrcweir 902cdf0e10cSrcweirsub make_systemcall_allowing_error 903cdf0e10cSrcweir{ 904cdf0e10cSrcweir my ( $systemcall, $logreturn, $can_fail ) = @_; 905cdf0e10cSrcweir 906cdf0e10cSrcweir my @returns = (); 907cdf0e10cSrcweir 908cdf0e10cSrcweir installer::logger::print_message( "... $systemcall ...\n" ); 909cdf0e10cSrcweir 910cdf0e10cSrcweir open (REG, "$systemcall"); 911cdf0e10cSrcweir while (<REG>) {push(@returns, $_); } 912cdf0e10cSrcweir close (REG); 913cdf0e10cSrcweir 914cdf0e10cSrcweir my $returnvalue = $?; # $? contains the return value of the systemcall 915cdf0e10cSrcweir 916cdf0e10cSrcweir my $infoline = "Systemcall: $systemcall\n"; 917cdf0e10cSrcweir push( @installer::globals::logfileinfo, $infoline); 918cdf0e10cSrcweir 919cdf0e10cSrcweir if ( $logreturn ) 920cdf0e10cSrcweir { 921cdf0e10cSrcweir for ( my $j = 0; $j <= $#returns; $j++ ) { push( @installer::globals::logfileinfo, "$returns[$j]"); } 922cdf0e10cSrcweir } 923cdf0e10cSrcweir 924cdf0e10cSrcweir if ($returnvalue) 925cdf0e10cSrcweir { 926cdf0e10cSrcweir if ( $can_fail ) 927cdf0e10cSrcweir { 928cdf0e10cSrcweir $infoline = "WARNING: Failed system call: $systemcall\n"; 929cdf0e10cSrcweir push( @installer::globals::logfileinfo, $infoline); 930cdf0e10cSrcweir $error_occured = 1; 931cdf0e10cSrcweir } 932cdf0e10cSrcweir else 933cdf0e10cSrcweir { 934cdf0e10cSrcweir $infoline = "ERROR: $systemcall\n"; 935cdf0e10cSrcweir push( @installer::globals::logfileinfo, $infoline); 936cdf0e10cSrcweir $error_occured = 1; 937cdf0e10cSrcweir } 938cdf0e10cSrcweir } 939cdf0e10cSrcweir else 940cdf0e10cSrcweir { 941cdf0e10cSrcweir $infoline = "SUCCESS: $systemcall\n"; 942cdf0e10cSrcweir push( @installer::globals::logfileinfo, $infoline); 943cdf0e10cSrcweir } 944cdf0e10cSrcweir 945cdf0e10cSrcweir return (\@returns, $returnvalue); 946cdf0e10cSrcweir} 947cdf0e10cSrcweir 948cdf0e10cSrcweir################################################### 949cdf0e10cSrcweir# Setting product name tag 950cdf0e10cSrcweir################################################### 951cdf0e10cSrcweir 952cdf0e10cSrcweirsub get_product_tag 953cdf0e10cSrcweir{ 954cdf0e10cSrcweir my ($allvariables, $indent) = @_; 955cdf0e10cSrcweir 956cdf0e10cSrcweir my $productname = $allvariables->{'LCONEWORDPRODUCTNAME'}; 957cdf0e10cSrcweir my $tag = $indent . "<product " . "name=" . "\"" . $productname . "\">" . "\n"; 958cdf0e10cSrcweir 959cdf0e10cSrcweir return $tag; 960cdf0e10cSrcweir} 961cdf0e10cSrcweir 962cdf0e10cSrcweir################################################### 963cdf0e10cSrcweir# Macro tags 964cdf0e10cSrcweir################################################### 965cdf0e10cSrcweir 966cdf0e10cSrcweirsub set_macro_tag 967cdf0e10cSrcweir{ 968cdf0e10cSrcweir my ($allvariables, $indent, $key) = @_; 969cdf0e10cSrcweir 970cdf0e10cSrcweir my $property = ""; 971cdf0e10cSrcweir my $value = ""; 972cdf0e10cSrcweir 973cdf0e10cSrcweir if ( $key eq "product_name" ) { $property = "PRODUCTNAME"; } 974cdf0e10cSrcweir elsif ( $key eq "product_version" ) { $property = "PRODUCTVERSION"; } 975cdf0e10cSrcweir elsif ( $key eq "product_suffix" ) { $property = "PRODUCTEXTENSION"; } 976cdf0e10cSrcweir elsif ( $key eq "product_fullname" ) { $property = "FULLPRODUCTNAME"; } 977cdf0e10cSrcweir 978cdf0e10cSrcweir if (( $property eq "PRODUCTNAME" ) || ( $property eq "PRODUCTVERSION" ) || ( $property eq "PRODUCTEXTENSION" )) 979cdf0e10cSrcweir { 980cdf0e10cSrcweir $value = $allvariables->{$property}; 981cdf0e10cSrcweir } 982cdf0e10cSrcweir 983cdf0e10cSrcweir if ( $property eq "FULLPRODUCTNAME" ) 984cdf0e10cSrcweir { 985cdf0e10cSrcweir $value = $allvariables->{"PRODUCTNAME"} . " " . $allvariables->{"PRODUCTVERSION"}; 986cdf0e10cSrcweir if ( $allvariables->{"PRODUCTEXTENSION"} ) { $value = $value . " " . $allvariables->{"PRODUCTEXTENSION"}; } 987cdf0e10cSrcweir } 988cdf0e10cSrcweir 989cdf0e10cSrcweir my $tag = $indent . "<macro " . "key=" . "\"" . $key . "\">" . $value . "\<\/macro\>" . "\n"; 990cdf0e10cSrcweir 991cdf0e10cSrcweir return $tag; 992cdf0e10cSrcweir 993cdf0e10cSrcweir} 994cdf0e10cSrcweir 995cdf0e10cSrcweir################################################### 996cdf0e10cSrcweir# Setting the minor of the product version 997cdf0e10cSrcweir# Required to check for Major Upgrades. 998cdf0e10cSrcweir################################################### 999cdf0e10cSrcweir 1000cdf0e10cSrcweirsub set_minor_tag 1001cdf0e10cSrcweir{ 1002cdf0e10cSrcweir my ($allvariables, $indent) = @_; 1003cdf0e10cSrcweir 1004cdf0e10cSrcweir my $productminor = 0; 1005cdf0e10cSrcweir if ( $allvariables->{"PACKAGEVERSION"} ) 1006cdf0e10cSrcweir { 1007cdf0e10cSrcweir if ( $allvariables->{"PACKAGEVERSION"} =~ /^\s*\d+\.(\d+)/ ) { $productminor = $1; } 1008cdf0e10cSrcweir } 1009cdf0e10cSrcweir my $tag = $indent . "<productminor>" . $productminor . "</productminor>" . "\n"; 1010cdf0e10cSrcweir 1011cdf0e10cSrcweir return $tag; 1012cdf0e10cSrcweir} 1013cdf0e10cSrcweir 1014cdf0e10cSrcweir################################################### 1015cdf0e10cSrcweir# Setting the update behaviour 1016cdf0e10cSrcweir################################################### 1017cdf0e10cSrcweir 1018cdf0e10cSrcweirsub set_update_tag 1019cdf0e10cSrcweir{ 1020cdf0e10cSrcweir my ($allvariables, $indent) = @_; 1021cdf0e10cSrcweir 1022cdf0e10cSrcweir my $updateflag = "false"; 1023cdf0e10cSrcweir if ( $allvariables->{"DONTUPDATE"} ) { $updateflag = "true"; } 1024cdf0e10cSrcweir my $tag = $indent . "<dontupdate>" . $updateflag . "</dontupdate>" . "\n"; 1025cdf0e10cSrcweir 1026cdf0e10cSrcweir return $tag; 1027cdf0e10cSrcweir} 1028cdf0e10cSrcweir 1029cdf0e10cSrcweir################################################### 1030cdf0e10cSrcweir# Setting the license dialog behaviour 1031cdf0e10cSrcweir################################################### 1032cdf0e10cSrcweir 1033cdf0e10cSrcweirsub set_hideeula_tag 1034cdf0e10cSrcweir{ 1035cdf0e10cSrcweir my ($allvariables, $indent) = @_; 1036cdf0e10cSrcweir 1037cdf0e10cSrcweir my $hidelicenseflag = "false"; 1038cdf0e10cSrcweir if ( $allvariables->{"HIDELICENSEDIALOG"} ) { $hidelicenseflag = "true"; } 1039cdf0e10cSrcweir my $tag = $indent . "<hideeula>" . $hidelicenseflag . "</hideeula>" . "\n"; 1040cdf0e10cSrcweir 1041cdf0e10cSrcweir return $tag; 1042cdf0e10cSrcweir} 1043cdf0e10cSrcweir 1044cdf0e10cSrcweir################################################### 1045cdf0e10cSrcweir# Setting default directory 1046cdf0e10cSrcweir################################################### 1047cdf0e10cSrcweir 1048cdf0e10cSrcweirsub set_defaultdir_tag 1049cdf0e10cSrcweir{ 1050cdf0e10cSrcweir my ($allvariables, $indent) = @_; 1051cdf0e10cSrcweir 1052cdf0e10cSrcweir my $defaultdir = ""; 1053cdf0e10cSrcweir if ( $allvariables->{"DEFAULTDESTPATH"} ) { $defaultdir = $allvariables->{"DEFAULTDESTPATH"}; } 1054cdf0e10cSrcweir my $tag = $indent . "<defaultdir>" . $defaultdir . "</defaultdir>" . "\n"; 1055cdf0e10cSrcweir 1056cdf0e10cSrcweir return $tag; 1057cdf0e10cSrcweir} 1058cdf0e10cSrcweir 1059cdf0e10cSrcweir################################################### 1060cdf0e10cSrcweir# Setting product directory 1061cdf0e10cSrcweir################################################### 1062cdf0e10cSrcweir 1063cdf0e10cSrcweirsub set_productdir_tag 1064cdf0e10cSrcweir{ 1065cdf0e10cSrcweir my ($allvariables, $indent) = @_; 1066cdf0e10cSrcweir 1067cdf0e10cSrcweir my $productdir = ""; 1068cdf0e10cSrcweir if ( $allvariables->{"UNIXPRODUCTNAME"} ) 1069cdf0e10cSrcweir { 1070cdf0e10cSrcweir $productdir = $allvariables->{"UNIXPRODUCTNAME"}; 1071cdf0e10cSrcweir 1072cdf0e10cSrcweir if ( $allvariables->{"BRANDPACKAGEVERSION"} ) 1073cdf0e10cSrcweir { 1074cdf0e10cSrcweir $productdir = $productdir . $allvariables->{"BRANDPACKAGEVERSION"}; 1075cdf0e10cSrcweir# if ( $allvariables->{"LCPRODUCTEXTENSION"} ) { $productdir = $productdir . $allvariables->{"LCPRODUCTEXTENSION"}; } 1076cdf0e10cSrcweir } 1077cdf0e10cSrcweir else 1078cdf0e10cSrcweir { 1079cdf0e10cSrcweir if ( $allvariables->{"PRODUCTVERSION"} ) 1080cdf0e10cSrcweir { 1081cdf0e10cSrcweir $productdir = $productdir . $allvariables->{"PRODUCTVERSION"}; 1082cdf0e10cSrcweir } 1083cdf0e10cSrcweir } 1084cdf0e10cSrcweir } 1085cdf0e10cSrcweir my $tag = $indent . "<productdir>" . $productdir . "</productdir>" . "\n"; 1086cdf0e10cSrcweir 1087cdf0e10cSrcweir return $tag; 1088cdf0e10cSrcweir} 1089cdf0e10cSrcweir 1090cdf0e10cSrcweir##################################################### 1091cdf0e10cSrcweir# Setting the package directory in installation set 1092cdf0e10cSrcweir##################################################### 1093cdf0e10cSrcweir 1094cdf0e10cSrcweirsub set_packagedir_tag 1095cdf0e10cSrcweir{ 1096cdf0e10cSrcweir my ($indent) = @_; 1097cdf0e10cSrcweir 1098cdf0e10cSrcweir my $tag = $indent . "<packagedirectory>" . $installer::globals::epmoutpath . "</packagedirectory>" . "\n"; 1099cdf0e10cSrcweir 1100cdf0e10cSrcweir return $tag; 1101cdf0e10cSrcweir} 1102cdf0e10cSrcweir 1103cdf0e10cSrcweir################################################### 1104cdf0e10cSrcweir# Setting the packagetype of installation set 1105cdf0e10cSrcweir################################################### 1106cdf0e10cSrcweir 1107cdf0e10cSrcweirsub set_packagetype_tag 1108cdf0e10cSrcweir{ 1109cdf0e10cSrcweir my ($indent) = @_; 1110cdf0e10cSrcweir 1111cdf0e10cSrcweir my $tag = $indent . "<packageformat>" . $installer::globals::packageformat . "</packageformat>" . "\n"; 1112cdf0e10cSrcweir 1113cdf0e10cSrcweir return $tag; 1114cdf0e10cSrcweir} 1115cdf0e10cSrcweir 1116cdf0e10cSrcweir################################################### 1117cdf0e10cSrcweir# Setting the architecture of installation set 1118cdf0e10cSrcweir################################################### 1119cdf0e10cSrcweir 1120cdf0e10cSrcweirsub set_architecture_tag 1121cdf0e10cSrcweir{ 1122cdf0e10cSrcweir my ($indent) = @_; 1123cdf0e10cSrcweir 1124cdf0e10cSrcweir my $architecture = ""; 1125cdf0e10cSrcweir if ( $installer::globals::issolarissparcbuild ) { $architecture = "sparc"; } 1126cdf0e10cSrcweir if ( $installer::globals::issolarisx86build ) { $architecture = "i386"; } 1127cdf0e10cSrcweir 1128cdf0e10cSrcweir my $tag = $indent . "<architecture>" . $architecture . "</architecture>" . "\n"; 1129cdf0e10cSrcweir 1130cdf0e10cSrcweir return $tag; 1131cdf0e10cSrcweir} 1132cdf0e10cSrcweir 1133cdf0e10cSrcweir################################################### 1134cdf0e10cSrcweir# Setting the multi language tag 1135cdf0e10cSrcweir################################################### 1136cdf0e10cSrcweir 1137cdf0e10cSrcweirsub set_multilanguage_tag 1138cdf0e10cSrcweir{ 1139cdf0e10cSrcweir my ($indent) = @_; 1140cdf0e10cSrcweir 1141cdf0e10cSrcweir my $value = "false"; 1142cdf0e10cSrcweir if ( $installer::globals::ismultilingual == 1 ) { $value = "true"; } 1143cdf0e10cSrcweir 1144cdf0e10cSrcweir my $tag = $indent . "<multilingual>" . $value . "</multilingual>" . "\n"; 1145cdf0e10cSrcweir 1146cdf0e10cSrcweir return $tag; 1147cdf0e10cSrcweir} 1148cdf0e10cSrcweir 1149cdf0e10cSrcweir################################################### 1150cdf0e10cSrcweir# Setting the language tag 1151cdf0e10cSrcweir################################################### 1152cdf0e10cSrcweir 1153cdf0e10cSrcweirsub set_language_tag 1154cdf0e10cSrcweir{ 1155cdf0e10cSrcweir my ($languagestringref, $indent) = @_; 1156cdf0e10cSrcweir 1157cdf0e10cSrcweir my $tag = $indent . "<languages>" . $$languagestringref . "</languages>" . "\n"; 1158cdf0e10cSrcweir 1159cdf0e10cSrcweir return $tag; 1160cdf0e10cSrcweir} 1161cdf0e10cSrcweir 1162cdf0e10cSrcweir################################################### 1163cdf0e10cSrcweir# Collecting content for product xpd file 1164cdf0e10cSrcweir################################################### 1165cdf0e10cSrcweir 1166cdf0e10cSrcweir# <?xml version='1.0' encoding='utf-8'?> 1167cdf0e10cSrcweir# 1168cdf0e10cSrcweir# <!-- General application description --> 1169cdf0e10cSrcweir# 1170cdf0e10cSrcweir# <product name="openoffice"> 1171cdf0e10cSrcweir# <macro key="product_name">Sun OpenOffice.org</macro> 1172cdf0e10cSrcweir# <macro key="product_version">1.0</macro> 1173cdf0e10cSrcweir# <macro key="product_suffix">Mephisto</macro> 1174cdf0e10cSrcweir# <macro key="product_fullname">Sun OpenOffice.org 1.0 Mephisto</macro> 1175cdf0e10cSrcweir# <defaultdir>/opt/Sun/OpenOffice.org-Mephisto</defaultdir> 1176cdf0e10cSrcweir# </product> 1177cdf0e10cSrcweir 1178cdf0e10cSrcweirsub get_setup_file_content 1179cdf0e10cSrcweir{ 1180cdf0e10cSrcweir my ($allvariables, $languagestringref) = @_; 1181cdf0e10cSrcweir 1182cdf0e10cSrcweir my @xpdfile = (); 1183cdf0e10cSrcweir my $noindent = ""; 1184cdf0e10cSrcweir my $singleindent = " "; 1185cdf0e10cSrcweir 1186cdf0e10cSrcweir my $line = "<?xml version='1.0' encoding='utf-8'?>\n\n"; 1187cdf0e10cSrcweir push(@xpdfile, $line); 1188cdf0e10cSrcweir $line = "<!-- General application description -->\n\n"; 1189cdf0e10cSrcweir push(@xpdfile, $line); 1190cdf0e10cSrcweir 1191cdf0e10cSrcweir my $tag = get_product_tag($allvariables, $noindent); 1192cdf0e10cSrcweir push(@xpdfile, $tag); 1193cdf0e10cSrcweir 1194cdf0e10cSrcweir $tag = set_macro_tag($allvariables, $singleindent, "product_name"); 1195cdf0e10cSrcweir push(@xpdfile, $tag); 1196cdf0e10cSrcweir $tag = set_macro_tag($allvariables, $singleindent, "product_version"); 1197cdf0e10cSrcweir push(@xpdfile, $tag); 1198cdf0e10cSrcweir $tag = set_macro_tag($allvariables, $singleindent, "product_suffix"); 1199cdf0e10cSrcweir push(@xpdfile, $tag); 1200cdf0e10cSrcweir $tag = set_macro_tag($allvariables, $singleindent, "product_fullname"); 1201cdf0e10cSrcweir push(@xpdfile, $tag); 1202cdf0e10cSrcweir 1203cdf0e10cSrcweir $tag = set_defaultdir_tag($allvariables, $singleindent); 1204cdf0e10cSrcweir push(@xpdfile, $tag); 1205cdf0e10cSrcweir 1206cdf0e10cSrcweir $tag = set_productdir_tag($allvariables, $singleindent); 1207cdf0e10cSrcweir push(@xpdfile, $tag); 1208cdf0e10cSrcweir 1209cdf0e10cSrcweir $tag = set_minor_tag($allvariables, $singleindent); 1210cdf0e10cSrcweir push(@xpdfile, $tag); 1211cdf0e10cSrcweir 1212cdf0e10cSrcweir $tag = set_update_tag($allvariables, $singleindent); 1213cdf0e10cSrcweir push(@xpdfile, $tag); 1214cdf0e10cSrcweir 1215cdf0e10cSrcweir $tag = set_packagedir_tag($singleindent); 1216cdf0e10cSrcweir push(@xpdfile, $tag); 1217cdf0e10cSrcweir 1218cdf0e10cSrcweir $tag = set_packagetype_tag($singleindent); 1219cdf0e10cSrcweir push(@xpdfile, $tag); 1220cdf0e10cSrcweir 1221cdf0e10cSrcweir $tag = set_architecture_tag($singleindent); 1222cdf0e10cSrcweir push(@xpdfile, $tag); 1223cdf0e10cSrcweir 1224cdf0e10cSrcweir $tag = set_multilanguage_tag($singleindent); 1225cdf0e10cSrcweir push(@xpdfile, $tag); 1226cdf0e10cSrcweir 1227cdf0e10cSrcweir $tag = set_language_tag($languagestringref, $singleindent); 1228cdf0e10cSrcweir push(@xpdfile, $tag); 1229cdf0e10cSrcweir 1230cdf0e10cSrcweir $tag = set_hideeula_tag($allvariables, $singleindent); 1231cdf0e10cSrcweir push(@xpdfile, $tag); 1232cdf0e10cSrcweir 1233cdf0e10cSrcweir $tag = get_end_tag("product", $noindent); 1234cdf0e10cSrcweir push(@xpdfile, $tag); 1235cdf0e10cSrcweir 1236cdf0e10cSrcweir return \@xpdfile; 1237cdf0e10cSrcweir} 1238cdf0e10cSrcweir 1239cdf0e10cSrcweir################################################### 1240cdf0e10cSrcweir# Collecting content for xpd file 1241cdf0e10cSrcweir################################################### 1242cdf0e10cSrcweir 1243cdf0e10cSrcweirsub get_file_content 1244cdf0e10cSrcweir{ 1245cdf0e10cSrcweir my ( $module, $packagename, $solslanguage, $linkpackage, $isemptyparent, $subdir, $islanguagemodule, $onelanguage, $xpdinfo ) = @_; 1246cdf0e10cSrcweir 1247cdf0e10cSrcweir my @xpdfile = (); 1248cdf0e10cSrcweir my $value = ""; 1249cdf0e10cSrcweir my $line = ""; 1250cdf0e10cSrcweir my $noindent = ""; 1251cdf0e10cSrcweir my $singleindent = " "; 1252cdf0e10cSrcweir my $doubleindent = $singleindent . $singleindent; 1253cdf0e10cSrcweir 1254cdf0e10cSrcweir my ( $tag, $parentgid ) = get_package_tag($module, $noindent, $linkpackage); 1255cdf0e10cSrcweir push(@xpdfile, $tag); 1256cdf0e10cSrcweir 1257cdf0e10cSrcweir # start of installunit tag -> using info from scp module 1258cdf0e10cSrcweir 1259cdf0e10cSrcweir $tag = get_display_tag($module, $singleindent); 1260cdf0e10cSrcweir push(@xpdfile, $tag); 1261cdf0e10cSrcweir 1262cdf0e10cSrcweir $value = get_sortkey_value($module); 1263cdf0e10cSrcweir $line = get_tag_line($doubleindent, "sortkey", $value); 1264cdf0e10cSrcweir push(@xpdfile, $line); 1265cdf0e10cSrcweir 1266cdf0e10cSrcweir $value = get_default_value($module); 1267cdf0e10cSrcweir $line = get_tag_line($doubleindent, "default", $value); 1268cdf0e10cSrcweir push(@xpdfile, $line); 1269cdf0e10cSrcweir 1270cdf0e10cSrcweir $value = get_showinuserinstall_value($module); 1271cdf0e10cSrcweir $line = get_tag_line($doubleindent, "showinuserinstall", $value); 1272cdf0e10cSrcweir push(@xpdfile, $line); 1273cdf0e10cSrcweir 1274cdf0e10cSrcweir $value = get_userinstallonly_value($module); 1275cdf0e10cSrcweir $line = get_tag_line($doubleindent, "showinuserinstallonly", $value); 1276cdf0e10cSrcweir push(@xpdfile, $line); 1277cdf0e10cSrcweir 1278cdf0e10cSrcweir $value = get_dontuninstall_value($module); 1279cdf0e10cSrcweir $line = get_tag_line($doubleindent, "dontuninstall", $value); 1280cdf0e10cSrcweir push(@xpdfile, $line); 1281cdf0e10cSrcweir 1282cdf0e10cSrcweir $value = get_checksolaris_value($module); 1283cdf0e10cSrcweir $line = get_tag_line($doubleindent, "checksolaris", $value); 1284cdf0e10cSrcweir push(@xpdfile, $line); 1285cdf0e10cSrcweir 1286cdf0e10cSrcweir $value = get_isupdatepackage_value($module); 1287cdf0e10cSrcweir $line = get_tag_line($doubleindent, "isupdatepackage", $value); 1288cdf0e10cSrcweir push(@xpdfile, $line); 1289cdf0e10cSrcweir 1290cdf0e10cSrcweir $value = get_showmultilingualonly_value($module); 1291cdf0e10cSrcweir $line = get_tag_line($doubleindent, "showmultilingualonly", $value); 1292cdf0e10cSrcweir push(@xpdfile, $line); 1293cdf0e10cSrcweir 1294cdf0e10cSrcweir $value = get_applicationmodule_value($module); 1295cdf0e10cSrcweir $line = get_tag_line($doubleindent, "applicationmodule", $value); 1296cdf0e10cSrcweir push(@xpdfile, $line); 1297cdf0e10cSrcweir 1298cdf0e10cSrcweir $value = get_isjavamodule_value($module); 1299cdf0e10cSrcweir $line = get_tag_line($doubleindent, "isjavapackage", $value); 1300cdf0e10cSrcweir push(@xpdfile, $line); 1301cdf0e10cSrcweir 1302cdf0e10cSrcweir $value = get_installcanfail_value($module); 1303cdf0e10cSrcweir $line = get_tag_line($doubleindent, "installcanfail", $value); 1304cdf0e10cSrcweir push(@xpdfile, $line); 1305cdf0e10cSrcweir 1306cdf0e10cSrcweir $value = get_forceintoupdate_value($module); 1307cdf0e10cSrcweir $line = get_tag_line($doubleindent, "forceintoupdate", $value); 1308cdf0e10cSrcweir push(@xpdfile, $line); 1309cdf0e10cSrcweir 1310cdf0e10cSrcweir $value = get_useforce_value($module); 1311cdf0e10cSrcweir $line = get_tag_line($doubleindent, "useforce", $value); 1312cdf0e10cSrcweir push(@xpdfile, $line); 1313cdf0e10cSrcweir 1314cdf0e10cSrcweir # iterating over all languages to get names and descriptions 1315cdf0e10cSrcweir collect_lang_values($doubleindent, $module, \@xpdfile, "Name", "name"); 1316cdf0e10cSrcweir collect_lang_values($doubleindent, $module, \@xpdfile, "Description", "description"); 1317cdf0e10cSrcweir 1318cdf0e10cSrcweir $tag = get_end_tag("display", $singleindent); 1319cdf0e10cSrcweir push(@xpdfile, $tag); 1320cdf0e10cSrcweir 1321cdf0e10cSrcweir # end of display tag 1322cdf0e10cSrcweir 1323cdf0e10cSrcweir if ( ! $isemptyparent ) 1324cdf0e10cSrcweir { 1325cdf0e10cSrcweir # start of installunit tag -> using info from package defined in packagelist 1326cdf0e10cSrcweir 1327cdf0e10cSrcweir $tag = get_installunit_tag($singleindent); 1328cdf0e10cSrcweir push(@xpdfile, $tag); 1329cdf0e10cSrcweir 1330cdf0e10cSrcweir $value = get_size_value($packagename, $xpdinfo); 1331cdf0e10cSrcweir $line = get_tag_line($doubleindent, "size", $value); 1332cdf0e10cSrcweir push(@xpdfile, $line); 1333cdf0e10cSrcweir 1334cdf0e10cSrcweir $value = get_order_value($module); 1335cdf0e10cSrcweir $line = get_tag_line($doubleindent, "installorder", $value); 1336cdf0e10cSrcweir push(@xpdfile, $line); 1337cdf0e10cSrcweir 1338cdf0e10cSrcweir $value = get_md5_value($packagename, $xpdinfo); 1339cdf0e10cSrcweir $line = get_tag_line($doubleindent, "md5", $value); 1340cdf0e10cSrcweir push(@xpdfile, $line); 1341cdf0e10cSrcweir 1342cdf0e10cSrcweir $value = get_name_value($packagename); 1343cdf0e10cSrcweir $line = get_tag_line($doubleindent, "name", $value); 1344cdf0e10cSrcweir push(@xpdfile, $line); 1345cdf0e10cSrcweir 1346cdf0e10cSrcweir $value = get_fullpkgname_value($packagename, $xpdinfo); 1347cdf0e10cSrcweir $line = get_tag_line($doubleindent, "fullpkgname", $value); 1348cdf0e10cSrcweir push(@xpdfile, $line); 1349cdf0e10cSrcweir 1350cdf0e10cSrcweir $value = get_pkgversion_value($packagename, $xpdinfo); 1351cdf0e10cSrcweir $line = get_tag_line($doubleindent, "pkgversion", $value); 1352cdf0e10cSrcweir push(@xpdfile, $line); 1353cdf0e10cSrcweir 1354cdf0e10cSrcweir $value = get_subdir_value($packagename, $subdir, $module); 1355cdf0e10cSrcweir $line = get_tag_line($doubleindent, "subdir", $value); 1356cdf0e10cSrcweir push(@xpdfile, $line); 1357cdf0e10cSrcweir 1358cdf0e10cSrcweir $value = get_relocatable_value($module); 1359cdf0e10cSrcweir $line = get_tag_line($doubleindent, "relocatable", $value); 1360cdf0e10cSrcweir push(@xpdfile, $line); 1361cdf0e10cSrcweir 1362cdf0e10cSrcweir $value = get_languagespecific_value($islanguagemodule); 1363cdf0e10cSrcweir $line = get_tag_line($doubleindent, "languagespecific", $value); 1364cdf0e10cSrcweir push(@xpdfile, $line); 1365cdf0e10cSrcweir 1366cdf0e10cSrcweir $value = $onelanguage; 1367cdf0e10cSrcweir $line = get_tag_line($doubleindent, "language", $value); 1368cdf0e10cSrcweir push(@xpdfile, $line); 1369cdf0e10cSrcweir 1370cdf0e10cSrcweir $line = get_tag_line($doubleindent, "solarislanguage", $solslanguage); 1371cdf0e10cSrcweir push(@xpdfile, $line); 1372cdf0e10cSrcweir 1373cdf0e10cSrcweir $tag = get_end_tag("installunit", $singleindent); 1374cdf0e10cSrcweir push(@xpdfile, $tag); 1375cdf0e10cSrcweir 1376cdf0e10cSrcweir # end of installunit tag 1377cdf0e10cSrcweir } 1378cdf0e10cSrcweir 1379cdf0e10cSrcweir $tag = get_end_tag("package", $noindent); 1380cdf0e10cSrcweir push(@xpdfile, $tag); 1381cdf0e10cSrcweir 1382cdf0e10cSrcweir return ( \@xpdfile, $parentgid ); 1383cdf0e10cSrcweir} 1384cdf0e10cSrcweir 1385cdf0e10cSrcweir################################################### 1386cdf0e10cSrcweir# Setting xpd file name 1387cdf0e10cSrcweir################################################### 1388cdf0e10cSrcweir 1389cdf0e10cSrcweirsub get_xpd_filename 1390cdf0e10cSrcweir{ 1391cdf0e10cSrcweir my ($modulegid, $linkpackage) = @_; 1392cdf0e10cSrcweir 1393cdf0e10cSrcweir if ( $linkpackage ) { $modulegid = $modulegid . "u"; } 1394cdf0e10cSrcweir 1395cdf0e10cSrcweir my $filename = $modulegid . ".xpd"; 1396cdf0e10cSrcweir 1397cdf0e10cSrcweir return $filename; 1398cdf0e10cSrcweir} 1399cdf0e10cSrcweir 1400cdf0e10cSrcweir################################################### 1401cdf0e10cSrcweir# Determine, which package was created newly 1402cdf0e10cSrcweir################################################### 1403cdf0e10cSrcweir 1404cdf0e10cSrcweirsub determine_new_packagename 1405cdf0e10cSrcweir{ 1406cdf0e10cSrcweir my ( $installdir, $subdir, $xpdinfo ) = @_; 1407cdf0e10cSrcweir 1408cdf0e10cSrcweir my $newpackage = ""; 1409cdf0e10cSrcweir $installdir =~ s/\Q$installer::globals::separator\E\s*$//; 1410cdf0e10cSrcweir my $directory = $installdir . $installer::globals::separator . $subdir; 1411cdf0e10cSrcweir $directory =~ s/\Q$installer::globals::separator\E\s*$//; 1412cdf0e10cSrcweir 1413cdf0e10cSrcweir if ( $xpdinfo->{'RealPackageName'} ) 1414cdf0e10cSrcweir { 1415cdf0e10cSrcweir $newpackage = $directory . $installer::globals::separator . $xpdinfo->{'RealPackageName'}; 1416cdf0e10cSrcweir push(@installer::globals::currentcontent, $newpackage); 1417cdf0e10cSrcweir return $newpackage; 1418cdf0e10cSrcweir } 1419cdf0e10cSrcweir 1420cdf0e10cSrcweir my ($newcontent, $allcontent) = installer::systemactions::find_new_content_in_directory($directory, \@installer::globals::currentcontent); 1421cdf0e10cSrcweir @installer::globals::currentcontent = (); 1422cdf0e10cSrcweir foreach my $element ( @{$allcontent} ) { push(@installer::globals::currentcontent, $element); } 1423cdf0e10cSrcweir 1424cdf0e10cSrcweir my $newentriesnumber = $#{$newcontent} + 1; 1425cdf0e10cSrcweir if ( $newentriesnumber > 1 ) { installer::exiter::exit_program("ERROR: More than one new package in directory $directory", "determine_new_packagename (xpdinstaller)"); } 1426cdf0e10cSrcweir elsif ( $newentriesnumber < 1 ) { installer::exiter::exit_program("ERROR: No new package in directory $directory", "determine_new_packagename (xpdinstaller)"); } 1427cdf0e10cSrcweir $newpackage = ${$newcontent}[0]; 1428cdf0e10cSrcweir 1429cdf0e10cSrcweir return $newpackage; 1430cdf0e10cSrcweir} 1431cdf0e10cSrcweir 1432cdf0e10cSrcweir################################################### 1433cdf0e10cSrcweir# Checking, if the parentgid is defined in 1434cdf0e10cSrcweir# another package 1435cdf0e10cSrcweir################################################### 1436cdf0e10cSrcweir 1437cdf0e10cSrcweirsub is_empty_parent 1438cdf0e10cSrcweir{ 1439cdf0e10cSrcweir my ($gid, $packages) = @_; 1440cdf0e10cSrcweir 1441cdf0e10cSrcweir my $is_empty_parent = 1; 1442cdf0e10cSrcweir 1443cdf0e10cSrcweir for ( my $k = 0; $k <= $#{$packages}; $k++ ) 1444cdf0e10cSrcweir { 1445cdf0e10cSrcweir my $onepackage = ${$packages}[$k]; 1446cdf0e10cSrcweir my $packagegid = $onepackage->{'module'}; 1447cdf0e10cSrcweir 1448cdf0e10cSrcweir if ( $packagegid eq $gid ) 1449cdf0e10cSrcweir { 1450cdf0e10cSrcweir $is_empty_parent = 0; 1451cdf0e10cSrcweir last; 1452cdf0e10cSrcweir } 1453cdf0e10cSrcweir } 1454cdf0e10cSrcweir 1455cdf0e10cSrcweir return $is_empty_parent; 1456cdf0e10cSrcweir} 1457cdf0e10cSrcweir 1458cdf0e10cSrcweir################################################### 1459cdf0e10cSrcweir# Creating additional xpd files for empty parents 1460cdf0e10cSrcweir################################################### 1461cdf0e10cSrcweir 1462cdf0e10cSrcweirsub create_emptyparents_xpd_file 1463cdf0e10cSrcweir{ 1464cdf0e10cSrcweir my ($parentgid, $modulesarrayref, $xpddir) = @_; 1465cdf0e10cSrcweir 1466cdf0e10cSrcweir my $module = get_module($parentgid, $modulesarrayref); 1467cdf0e10cSrcweir my $grandpagid = ""; 1468cdf0e10cSrcweir 1469cdf0e10cSrcweir if ( $module ne "" ) 1470cdf0e10cSrcweir { 1471cdf0e10cSrcweir my $packagename = ""; 1472cdf0e10cSrcweir # all content saved in scp is now available and can be used to create the xpd file 1473cdf0e10cSrcweir my ( $xpdfile, $newparentgid ) = get_file_content($module, $packagename, "", 0, 1, "", 0, "", ""); 1474cdf0e10cSrcweir 1475cdf0e10cSrcweir $grandpagid = $newparentgid; 1476cdf0e10cSrcweir 1477cdf0e10cSrcweir my $xpdfilename = get_xpd_filename($parentgid, 0); 1478cdf0e10cSrcweir $xpdfilename = $xpddir . $installer::globals::separator . $xpdfilename; 1479cdf0e10cSrcweir 1480cdf0e10cSrcweir installer::files::save_file($xpdfilename, $xpdfile); 1481cdf0e10cSrcweir push(@installer::globals::allxpdfiles, $xpdfilename); 1482cdf0e10cSrcweir my $infoline = "Saving xpd file: $xpdfilename\n"; 1483cdf0e10cSrcweir push(@installer::globals::logfileinfo, $infoline); 1484cdf0e10cSrcweir } 1485cdf0e10cSrcweir 1486cdf0e10cSrcweir # push(@installer::globals::emptyxpdparents, $parentgid); 1487cdf0e10cSrcweir push( @installer::globals::createdxpdfiles, $parentgid); 1488cdf0e10cSrcweir 1489cdf0e10cSrcweir return $grandpagid; 1490cdf0e10cSrcweir} 1491cdf0e10cSrcweir 1492cdf0e10cSrcweir################################################### 1493cdf0e10cSrcweir# Creating additional xpd files for empty parents 1494cdf0e10cSrcweir################################################### 1495cdf0e10cSrcweir 1496cdf0e10cSrcweirsub filter_content_from_xpdfile 1497cdf0e10cSrcweir{ 1498cdf0e10cSrcweir my ($xpdfile) = @_; 1499cdf0e10cSrcweir 1500cdf0e10cSrcweir my @newxpdfile = (); 1501cdf0e10cSrcweir 1502cdf0e10cSrcweir my $include = 1; 1503cdf0e10cSrcweir 1504cdf0e10cSrcweir for ( my $i = 0; $i <= $#{$xpdfile}; $i++ ) 1505cdf0e10cSrcweir { 1506cdf0e10cSrcweir my $line = ${$xpdfile}[$i]; 1507cdf0e10cSrcweir 1508cdf0e10cSrcweir if (( $line =~ /^\s*\<installunit/ ) && ( $include )) { $include = 0; } 1509cdf0e10cSrcweir if ( $include ) { push(@newxpdfile, $line); } 1510cdf0e10cSrcweir if (( $line =~ /^\s*\<\/installunit/ ) && ( ! $include )) { $include = 1; } 1511cdf0e10cSrcweir } 1512cdf0e10cSrcweir 1513cdf0e10cSrcweir return \@newxpdfile; 1514cdf0e10cSrcweir} 1515cdf0e10cSrcweir 1516cdf0e10cSrcweir########################################################################## 1517cdf0e10cSrcweir# Changing the parent inside the xpd file 1518cdf0e10cSrcweir# Old: <package name="gid_Module_Root" parent="root"> 1519cdf0e10cSrcweir# New: <package name="gid_Module_Root_Files_1" parent="gid_Module_Root"> 1520cdf0e10cSrcweir########################################################################## 1521cdf0e10cSrcweir 1522cdf0e10cSrcweirsub change_parent_in_xpdfile 1523cdf0e10cSrcweir{ 1524cdf0e10cSrcweir my ($xpdfile, $modulename) = @_; 1525cdf0e10cSrcweir 1526cdf0e10cSrcweir for ( my $i = 0; $i <= $#{$xpdfile}; $i++ ) 1527cdf0e10cSrcweir { 1528cdf0e10cSrcweir if ( ${$xpdfile}[$i] =~ /^\s*\<package name\s*=\s*\"(\S+?)\"\s+parent\s*=\s*\"(\S+?)\"\s*\>\s*$/ ) 1529cdf0e10cSrcweir { 1530cdf0e10cSrcweir my $oldname = $1; 1531cdf0e10cSrcweir my $oldparent = $2; 1532cdf0e10cSrcweir 1533cdf0e10cSrcweir my $newname = $modulename; 1534cdf0e10cSrcweir my $newparent = $oldname; 1535cdf0e10cSrcweir 1536cdf0e10cSrcweir ${$xpdfile}[$i] =~ s/\"\Q$oldname\E\"/\"$newname\"/; 1537cdf0e10cSrcweir ${$xpdfile}[$i] =~ s/\"\Q$oldparent\E\"/\"$newparent\"/; 1538cdf0e10cSrcweir 1539cdf0e10cSrcweir last; 1540cdf0e10cSrcweir } 1541cdf0e10cSrcweir } 1542cdf0e10cSrcweir} 1543cdf0e10cSrcweir 1544cdf0e10cSrcweir################################################### 1545cdf0e10cSrcweir# Creating one xpd file for each package 1546cdf0e10cSrcweir################################################### 1547cdf0e10cSrcweir 1548cdf0e10cSrcweirsub create_xpd_file 1549cdf0e10cSrcweir{ 1550cdf0e10cSrcweir my ($onepackage, $allpackages, $languagestringref, $allvariables, $modulesarrayref, $installdir, $subdir, $linkpackage, $xpdinfo) = @_; 1551cdf0e10cSrcweir 1552cdf0e10cSrcweir my $infoline = ""; 1553cdf0e10cSrcweir # creating the directory 1554cdf0e10cSrcweir my $xpddir = installer::systemactions::create_directories("xpdinstaller", $languagestringref); 1555cdf0e10cSrcweir $xpddir =~ s/\/\s*$//; 1556cdf0e10cSrcweir $installer::globals::xpddir = $xpddir; 1557cdf0e10cSrcweir # push(@installer::globals::removedirs, $xpddir); 1558cdf0e10cSrcweir 1559cdf0e10cSrcweir my $modulegid = $onepackage->{'module'}; 1560cdf0e10cSrcweir 1561cdf0e10cSrcweir my $onelanguage = ""; # 1562cdf0e10cSrcweir my $solslanguage = ""; # 1563cdf0e10cSrcweir my $islanguagemodule = 0; # 1564cdf0e10cSrcweir if ( $onepackage->{'islanguagemodule'} ) { $islanguagemodule = $onepackage->{'islanguagemodule'}; } # 1565cdf0e10cSrcweir if ( $islanguagemodule ) # 1566cdf0e10cSrcweir { 1567cdf0e10cSrcweir $onelanguage = $onepackage->{'language'}; # 1568cdf0e10cSrcweir if ( $installer::globals::issolarispkgbuild ) { $solslanguage = installer::epmfile::get_solaris_language_for_langpack($onelanguage); } # 1569cdf0e10cSrcweir } 1570cdf0e10cSrcweir 1571cdf0e10cSrcweir installer::logger::include_header_into_logfile("Creating xpd file ($modulegid):"); 1572cdf0e10cSrcweir 1573cdf0e10cSrcweir my $module = get_module($modulegid, $modulesarrayref); 1574cdf0e10cSrcweir 1575cdf0e10cSrcweir if ( $module ne "" ) 1576cdf0e10cSrcweir { 1577cdf0e10cSrcweir my $packagename = determine_new_packagename($installdir, $subdir, $xpdinfo); 1578cdf0e10cSrcweir 1579cdf0e10cSrcweir # all content saved in scp is now available and can be used to create the xpd file 1580cdf0e10cSrcweir my ( $xpdfile, $parentgid ) = get_file_content($module, $packagename, $solslanguage, $linkpackage, 0, "", $islanguagemodule, $onelanguage, $xpdinfo); 1581cdf0e10cSrcweir 1582cdf0e10cSrcweir my $xpdfilename = get_xpd_filename($modulegid, $linkpackage); 1583cdf0e10cSrcweir $xpdfilename = $xpddir . $installer::globals::separator . $xpdfilename; 1584cdf0e10cSrcweir 1585cdf0e10cSrcweir # Very special handling for Root module: 1586cdf0e10cSrcweir # Because packages should only be assigned to leaves and not to knods, 1587cdf0e10cSrcweir # the root module is divided into a knod without package and a new 1588cdf0e10cSrcweir # leave with package. The name of the leave is defined at $module->{'XpdPackageName'}. 1589cdf0e10cSrcweir if ( $module->{'XpdPackageName'} ) 1590cdf0e10cSrcweir { 1591cdf0e10cSrcweir my $newxpdfilename = get_xpd_filename($module->{'XpdPackageName'}, 0); 1592cdf0e10cSrcweir $newxpdfilename = $xpddir . $installer::globals::separator . $newxpdfilename; 1593cdf0e10cSrcweir my $emptyfilecontent = filter_content_from_xpdfile($xpdfile); 1594cdf0e10cSrcweir 1595cdf0e10cSrcweir installer::files::save_file($xpdfilename, $emptyfilecontent); 1596cdf0e10cSrcweir push(@installer::globals::allxpdfiles, $xpdfilename); 1597cdf0e10cSrcweir $infoline = "Saving xpd file: $xpdfilename\n"; 1598cdf0e10cSrcweir push( @installer::globals::logfileinfo, $infoline); 1599cdf0e10cSrcweir 1600cdf0e10cSrcweir $xpdfilename = $newxpdfilename; 1601cdf0e10cSrcweir change_parent_in_xpdfile($xpdfile, $module->{'XpdPackageName'}); 1602cdf0e10cSrcweir } 1603cdf0e10cSrcweir 1604cdf0e10cSrcweir installer::files::save_file($xpdfilename, $xpdfile); 1605cdf0e10cSrcweir push( @installer::globals::createdxpdfiles, $modulegid); 1606cdf0e10cSrcweir push(@installer::globals::allxpdfiles, $xpdfilename); 1607cdf0e10cSrcweir $infoline = "Saving xpd file: $xpdfilename\n"; 1608cdf0e10cSrcweir push( @installer::globals::logfileinfo, $infoline); 1609cdf0e10cSrcweir 1610cdf0e10cSrcweir my $grandpagid = "root"; 1611cdf0e10cSrcweir if ( $parentgid ne "root" ) 1612cdf0e10cSrcweir { 1613cdf0e10cSrcweir my $create_missing_parent = is_empty_parent($parentgid, $allpackages); 1614cdf0e10cSrcweir 1615cdf0e10cSrcweir # if (( $create_missing_parent ) && ( ! installer::existence::exists_in_array($parentgid, \@installer::globals::emptyxpdparents) )) 1616cdf0e10cSrcweir if (( $create_missing_parent ) && ( ! installer::existence::exists_in_array($parentgid, \@installer::globals::createdxpdfiles) )) 1617cdf0e10cSrcweir { 1618cdf0e10cSrcweir $grandpagid = create_emptyparents_xpd_file($parentgid, $modulesarrayref, $xpddir); 1619cdf0e10cSrcweir } 1620cdf0e10cSrcweir } 1621cdf0e10cSrcweir 1622cdf0e10cSrcweir if ( $grandpagid ne "root" ) 1623cdf0e10cSrcweir { 1624cdf0e10cSrcweir my $create_missing_parent = is_empty_parent($grandpagid, $allpackages); 1625cdf0e10cSrcweir 1626cdf0e10cSrcweir # if (( $create_missing_parent ) && ( ! installer::existence::exists_in_array($parentgid, \@installer::globals::emptyxpdparents) )) 1627cdf0e10cSrcweir if (( $create_missing_parent ) && ( ! installer::existence::exists_in_array($grandpagid, \@installer::globals::createdxpdfiles) )) 1628cdf0e10cSrcweir { 1629cdf0e10cSrcweir create_emptyparents_xpd_file($grandpagid, $modulesarrayref, $xpddir); 1630cdf0e10cSrcweir } 1631cdf0e10cSrcweir } 1632cdf0e10cSrcweir } 1633cdf0e10cSrcweir else 1634cdf0e10cSrcweir { 1635cdf0e10cSrcweir installer::exiter::exit_program("ERROR: No module definition found for gid: $modulegid", "create_xpd_file (xpdinstaller)"); 1636cdf0e10cSrcweir } 1637cdf0e10cSrcweir 1638cdf0e10cSrcweir} 1639cdf0e10cSrcweir 1640cdf0e10cSrcweir################################################### 1641cdf0e10cSrcweir# Creating a xpd file for a copied package 1642cdf0e10cSrcweir################################################### 1643cdf0e10cSrcweir 1644cdf0e10cSrcweirsub create_xpd_file_for_childproject 1645cdf0e10cSrcweir{ 1646cdf0e10cSrcweir my ($module, $destdir, $packagename, $allvariableshashref, $modulesarrayref) = @_; 1647cdf0e10cSrcweir 1648cdf0e10cSrcweir my $modulegid = $module->{'gid'}; 1649cdf0e10cSrcweir 1650cdf0e10cSrcweir my $currentdir = cwd(); 1651cdf0e10cSrcweir $destdir =~ s/\/\s*$//; 1652cdf0e10cSrcweir $currentdir =~ s/\/\s*$//; 1653cdf0e10cSrcweir 1654cdf0e10cSrcweir my $completepackage = $currentdir . $installer::globals::separator . $destdir . $installer::globals::separator . $packagename; 1655cdf0e10cSrcweir 1656cdf0e10cSrcweir # all content saved in scp is now available and can be used to create the xpd file 1657cdf0e10cSrcweir my ( $xpdfile, $parentgid ) = get_file_content($module, $completepackage, "", 0, 0, "", 0, "", ""); 1658cdf0e10cSrcweir 1659cdf0e10cSrcweir my $xpdfilename = get_xpd_filename($modulegid, 0); 1660cdf0e10cSrcweir $xpdfilename = $installer::globals::xpddir . $installer::globals::separator . $xpdfilename; 1661cdf0e10cSrcweir 1662cdf0e10cSrcweir installer::files::save_file($xpdfilename, $xpdfile); 1663cdf0e10cSrcweir push( @installer::globals::createdxpdfiles, $modulegid); 1664cdf0e10cSrcweir push(@installer::globals::allxpdfiles, $xpdfilename); 1665cdf0e10cSrcweir my $infoline = "Saving xpd file: $xpdfilename\n"; 1666cdf0e10cSrcweir push( @installer::globals::logfileinfo, $infoline); 1667cdf0e10cSrcweir 1668cdf0e10cSrcweir if ( $parentgid ne "root" ) 1669cdf0e10cSrcweir { 1670cdf0e10cSrcweir # my $create_missing_parent = is_empty_parent($parentgid, $allpackages); 1671cdf0e10cSrcweir my $create_missing_parent = 1; # -> Always missing parent by child projects! 1672cdf0e10cSrcweir # Parent is now created, if it was not created before. Attention: Parent module must not come later. 1673cdf0e10cSrcweir if (( $create_missing_parent ) && ( ! installer::existence::exists_in_array($parentgid, \@installer::globals::createdxpdfiles) )) 1674cdf0e10cSrcweir { 1675cdf0e10cSrcweir create_emptyparents_xpd_file($parentgid, $modulesarrayref, $installer::globals::xpddir); 1676cdf0e10cSrcweir } 1677cdf0e10cSrcweir } 1678cdf0e10cSrcweir} 1679cdf0e10cSrcweir 1680cdf0e10cSrcweir############################################################## 1681cdf0e10cSrcweir# Creating a xpd file for copied system integration package 1682cdf0e10cSrcweir############################################################## 1683cdf0e10cSrcweir 1684cdf0e10cSrcweirsub create_xpd_file_for_systemintegration 1685cdf0e10cSrcweir{ 1686cdf0e10cSrcweir my ($module, $newcontent, $modulesarrayref, $subdir) = @_; 1687cdf0e10cSrcweir 1688cdf0e10cSrcweir my $parentgid = $module->{'gid'}; 1689cdf0e10cSrcweir 1690cdf0e10cSrcweir # Create new visible module from scp info and create 1691cdf0e10cSrcweir # new hidden module for each package inside in tar file 1692cdf0e10cSrcweir 1693cdf0e10cSrcweir for ( my $i = 0; $i <= $#{$newcontent}; $i++ ) 1694cdf0e10cSrcweir { 1695cdf0e10cSrcweir my $newpackagename = ${$newcontent}[$i]; 1696cdf0e10cSrcweir 1697cdf0e10cSrcweir # installer::pathanalyzer::make_absolute_filename_to_relative_filename(\$newpackagename); 1698cdf0e10cSrcweir 1699cdf0e10cSrcweir my $infoline = "Creating xpd file for package: $newpackagename\n"; 1700cdf0e10cSrcweir push( @installer::globals::logfileinfo, $infoline); 1701cdf0e10cSrcweir 1702cdf0e10cSrcweir my $childmodule = installer::worker::copy_hash_from_references($module); 1703cdf0e10cSrcweir $childmodule->{'ParentID'} = $module->{'gid'}; # the module gid is the new parent 1704cdf0e10cSrcweir $childmodule->{'InstallOrder'} = $installer::globals::defaultsystemintinstallorder; 1705cdf0e10cSrcweir my $number = $i + 1; 1706cdf0e10cSrcweir my $modulegid = $module->{'gid'} . "_child_" . $number; # setting a dynamic new gid 1707cdf0e10cSrcweir $childmodule->{'gid'} = $modulegid; 1708cdf0e10cSrcweir $childmodule->{'Styles'} =~ s/\)/\,HIDDEN_ROOT\)/; 1709cdf0e10cSrcweir # iterating over all languages to get names and descriptions 1710cdf0e10cSrcweir remove_lang_values($childmodule, "Name"); 1711cdf0e10cSrcweir remove_lang_values($childmodule, "Description"); 1712cdf0e10cSrcweir 1713cdf0e10cSrcweir my $shortpackagename = $newpackagename; 1714cdf0e10cSrcweir installer::pathanalyzer::make_absolute_filename_to_relative_filename(\$shortpackagename); 1715cdf0e10cSrcweir $childmodule->{'PackageName'} = $shortpackagename; 1716cdf0e10cSrcweir $childmodule->{'Name'} = $modulegid; 1717cdf0e10cSrcweir $childmodule->{'Description'} = $modulegid; 1718cdf0e10cSrcweir 1719cdf0e10cSrcweir # Checking, if installorder can be set: 1720cdf0e10cSrcweir # scp syntax: InstallOrder = "desktop:1050, suse:1060"; 1721cdf0e10cSrcweir # The string before the number can be compared with $shortpackagename 1722cdf0e10cSrcweir if ( $module->{'InstallOrder'} ) 1723cdf0e10cSrcweir { 1724cdf0e10cSrcweir my $installorder = $module->{'InstallOrder'}; 1725cdf0e10cSrcweir $installorder =~ s/^\s*\"//g; 1726cdf0e10cSrcweir $installorder =~ s/\"\s*$//g; 1727cdf0e10cSrcweir # $installorder is comma separated list 1728cdf0e10cSrcweir my $allorders = installer::converter::convert_stringlist_into_array(\$installorder, ","); 1729cdf0e10cSrcweir for ( my $j = 0; $j <= $#{$allorders}; $j++ ) 1730cdf0e10cSrcweir { 1731cdf0e10cSrcweir my $oneitem = ${$allorders}[$j]; 1732cdf0e10cSrcweir if ( $oneitem =~ /^\s*(\S+?)\s*:\s*(\S+?)\s*$/ ) 1733cdf0e10cSrcweir { 1734cdf0e10cSrcweir my $name = $1; 1735cdf0e10cSrcweir my $order = $2; 1736cdf0e10cSrcweir 1737cdf0e10cSrcweir if ( $shortpackagename =~ /\Q$name\E/ ) { $childmodule->{'InstallOrder'} = $order; } 1738cdf0e10cSrcweir } 1739cdf0e10cSrcweir } 1740cdf0e10cSrcweir } 1741cdf0e10cSrcweir 1742cdf0e10cSrcweir # all content saved in scp is now available and can be used to create the xpd file 1743cdf0e10cSrcweir my ( $xpdfile, $parentgid_ ) = get_file_content($childmodule, $newpackagename, "", 0, 0, $subdir, 0, "", ""); 1744cdf0e10cSrcweir 1745cdf0e10cSrcweir my $xpdfilename = get_xpd_filename($modulegid, 0); 1746cdf0e10cSrcweir $xpdfilename = $installer::globals::xpddir . $installer::globals::separator . $xpdfilename; 1747cdf0e10cSrcweir 1748cdf0e10cSrcweir installer::files::save_file($xpdfilename, $xpdfile); 1749cdf0e10cSrcweir push(@installer::globals::allxpdfiles, $xpdfilename); 1750cdf0e10cSrcweir $infoline = "Saving xpd file: $xpdfilename\n"; 1751cdf0e10cSrcweir push( @installer::globals::logfileinfo, $infoline); 1752cdf0e10cSrcweir } 1753cdf0e10cSrcweir 1754cdf0e10cSrcweir # Creating the top level visible xpd file 1755cdf0e10cSrcweir create_emptyparents_xpd_file($parentgid, $modulesarrayref, $installer::globals::xpddir); 1756cdf0e10cSrcweir} 1757cdf0e10cSrcweir 1758cdf0e10cSrcweir############################################################## 1759cdf0e10cSrcweir# Copying xpd files into installation set 1760cdf0e10cSrcweir############################################################## 1761cdf0e10cSrcweir 1762cdf0e10cSrcweirsub copy_xpd_files 1763cdf0e10cSrcweir{ 1764cdf0e10cSrcweir my ( $destdir ) = @_; 1765cdf0e10cSrcweir 1766cdf0e10cSrcweir for ( my $i = 0; $i <= $#installer::globals::allxpdfiles; $i++ ) 1767cdf0e10cSrcweir { 1768cdf0e10cSrcweir if ( ! -f $installer::globals::allxpdfiles[$i] ) { installer::exiter::exit_program("ERROR: Could not find xpd file: $installer::globals::allxpdfiles[$i]!", "copy_xpd_files"); } 1769cdf0e10cSrcweir installer::systemactions::copy_one_file($installer::globals::allxpdfiles[$i], $destdir); 1770cdf0e10cSrcweir } 1771cdf0e10cSrcweir} 1772cdf0e10cSrcweir 1773cdf0e10cSrcweir############################################################## 1774cdf0e10cSrcweir# Copying all xpd files into the installation set 1775cdf0e10cSrcweir############################################################## 1776cdf0e10cSrcweir 1777cdf0e10cSrcweirsub copy_xpd_files_into_installset 1778cdf0e10cSrcweir{ 1779cdf0e10cSrcweir my ($installdir) = @_; 1780cdf0e10cSrcweir 1781cdf0e10cSrcweir $installdir =~ s/\Q$installer::globals::separator\E\s*$//; 1782cdf0e10cSrcweir 1783cdf0e10cSrcweir my $instdir = $installdir . $installer::globals::separator . "installdata"; 1784cdf0e10cSrcweir installer::systemactions::create_directory($instdir); 1785cdf0e10cSrcweir 1786cdf0e10cSrcweir my $xpddir = $instdir . $installer::globals::separator . "xpd"; 1787cdf0e10cSrcweir installer::systemactions::create_directory($xpddir); 1788cdf0e10cSrcweir copy_xpd_files($xpddir); 1789cdf0e10cSrcweir} 1790cdf0e10cSrcweir 1791cdf0e10cSrcweir############################################################## 1792cdf0e10cSrcweir# Creating base xpd file with product information 1793cdf0e10cSrcweir############################################################## 1794cdf0e10cSrcweir 1795cdf0e10cSrcweirsub create_setup_xpd 1796cdf0e10cSrcweir{ 1797cdf0e10cSrcweir my ($allvariables, $languagestringref) = @_; 1798cdf0e10cSrcweir 1799cdf0e10cSrcweir my ( $xpdfile ) = get_setup_file_content($allvariables, $languagestringref); 1800cdf0e10cSrcweir 1801cdf0e10cSrcweir my $xpdfilename = $installer::globals::productxpdfile; 1802cdf0e10cSrcweir $xpdfilename = $installer::globals::xpddir . $installer::globals::separator . $xpdfilename; 1803cdf0e10cSrcweir 1804cdf0e10cSrcweir installer::files::save_file($xpdfilename, $xpdfile); 1805cdf0e10cSrcweir push(@installer::globals::allxpdfiles, $xpdfilename); 1806cdf0e10cSrcweir my $infoline = "Saving xpd file: $xpdfilename\n"; 1807cdf0e10cSrcweir push( @installer::globals::logfileinfo, $infoline); 1808cdf0e10cSrcweir} 1809cdf0e10cSrcweir 1810cdf0e10cSrcweir################################################### 1811cdf0e10cSrcweir# Copying the files needed by the xpd installer 1812cdf0e10cSrcweir# into the installation directory 1813cdf0e10cSrcweir################################################### 1814cdf0e10cSrcweir 1815cdf0e10cSrcweirsub create_xpd_installer 1816cdf0e10cSrcweir{ 1817cdf0e10cSrcweir my ( $installdir, $allvariables, $languagestringref) = @_; 1818cdf0e10cSrcweir 1819cdf0e10cSrcweir installer::logger::include_header_into_logfile("Creating xpd installer:"); 1820cdf0e10cSrcweir 1821cdf0e10cSrcweir # create setup.xpd file 1822cdf0e10cSrcweir create_setup_xpd($allvariables, $languagestringref); 1823cdf0e10cSrcweir 1824cdf0e10cSrcweir # copy xpd files into installation set 1825cdf0e10cSrcweir copy_xpd_files_into_installset($installdir); 1826cdf0e10cSrcweir} 1827cdf0e10cSrcweir 1828cdf0e10cSrcweir1; 1829