19780544fSAndrew Rist#************************************************************** 29780544fSAndrew Rist# 39780544fSAndrew Rist# Licensed to the Apache Software Foundation (ASF) under one 49780544fSAndrew Rist# or more contributor license agreements. See the NOTICE file 59780544fSAndrew Rist# distributed with this work for additional information 69780544fSAndrew Rist# regarding copyright ownership. The ASF licenses this file 79780544fSAndrew Rist# to you under the Apache License, Version 2.0 (the 89780544fSAndrew Rist# "License"); you may not use this file except in compliance 99780544fSAndrew Rist# with the License. You may obtain a copy of the License at 109780544fSAndrew Rist# 119780544fSAndrew Rist# http://www.apache.org/licenses/LICENSE-2.0 129780544fSAndrew Rist# 139780544fSAndrew Rist# Unless required by applicable law or agreed to in writing, 149780544fSAndrew Rist# software distributed under the License is distributed on an 159780544fSAndrew Rist# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 169780544fSAndrew Rist# KIND, either express or implied. See the License for the 179780544fSAndrew Rist# specific language governing permissions and limitations 189780544fSAndrew Rist# under the License. 199780544fSAndrew Rist# 209780544fSAndrew Rist#************************************************************** 219780544fSAndrew Rist 229780544fSAndrew Rist 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################################################### 444*86e1cf34SPedro Giffuni# Substituting all occurrences of "<" by "<" 445*86e1cf34SPedro Giffuni# and all occurrences 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################################################### 459*86e1cf34SPedro Giffuni# Substituting all occurrences 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 { 5990374af79SAndre Fischer $installer::logger::Info->print("... 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"; 614b274bc22SAndre Fischer $installer::logger::Lang->print($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"; 674b274bc22SAndre Fischer $installer::logger::Lang->print($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 { 7370374af79SAndre Fischer $installer::logger::Info->print("... 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"; 749b274bc22SAndre Fischer $installer::logger::Lang->print($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 8670374af79SAndre Fischer $installer::logger::Info->printf("... %s ...\n", $systemcall); 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"; 876b274bc22SAndre Fischer $installer::logger::Lang->print($infoline); 877cdf0e10cSrcweir 878cdf0e10cSrcweir if ( $logreturn ) 879cdf0e10cSrcweir { 880b274bc22SAndre Fischer foreach my $line (@returns) 881b274bc22SAndre Fischer { 882b274bc22SAndre Fischer $installer::logger::Lang->print($line); 883b274bc22SAndre Fischer } 884cdf0e10cSrcweir } 885cdf0e10cSrcweir 886cdf0e10cSrcweir if ($returnvalue) 887cdf0e10cSrcweir { 888cdf0e10cSrcweir $infoline = "ERROR: $systemcall\n"; 889b274bc22SAndre Fischer $installer::logger::Lang->print($infoline); 890cdf0e10cSrcweir $error_occured = 1; 891cdf0e10cSrcweir } 892cdf0e10cSrcweir else 893cdf0e10cSrcweir { 894cdf0e10cSrcweir $infoline = "SUCCESS: $systemcall\n"; 895b274bc22SAndre Fischer $installer::logger::Lang->print($infoline); 896cdf0e10cSrcweir } 897cdf0e10cSrcweir 898cdf0e10cSrcweir return \@returns; 899cdf0e10cSrcweir} 900cdf0e10cSrcweir 901cdf0e10cSrcweir####################################################### 902cdf0e10cSrcweir# Executing one system call 903cdf0e10cSrcweir####################################################### 904cdf0e10cSrcweir 905cdf0e10cSrcweirsub make_systemcall_allowing_error 906cdf0e10cSrcweir{ 907cdf0e10cSrcweir my ( $systemcall, $logreturn, $can_fail ) = @_; 908cdf0e10cSrcweir 909cdf0e10cSrcweir my @returns = (); 910cdf0e10cSrcweir 9110374af79SAndre Fischer $installer::logger::Info->printf("... %s ...\n", $systemcall); 912cdf0e10cSrcweir 913cdf0e10cSrcweir open (REG, "$systemcall"); 914cdf0e10cSrcweir while (<REG>) {push(@returns, $_); } 915cdf0e10cSrcweir close (REG); 916cdf0e10cSrcweir 917cdf0e10cSrcweir my $returnvalue = $?; # $? contains the return value of the systemcall 918cdf0e10cSrcweir 919cdf0e10cSrcweir my $infoline = "Systemcall: $systemcall\n"; 920b274bc22SAndre Fischer $installer::logger::Lang->print($infoline); 921cdf0e10cSrcweir 922cdf0e10cSrcweir if ( $logreturn ) 923cdf0e10cSrcweir { 924b274bc22SAndre Fischer foreach my $line (@returns) 925b274bc22SAndre Fischer { 926b274bc22SAndre Fischer $installer::logger::Lang->print($line); 927b274bc22SAndre Fischer } 928cdf0e10cSrcweir } 929cdf0e10cSrcweir 930cdf0e10cSrcweir if ($returnvalue) 931cdf0e10cSrcweir { 932cdf0e10cSrcweir if ( $can_fail ) 933cdf0e10cSrcweir { 934cdf0e10cSrcweir $infoline = "WARNING: Failed system call: $systemcall\n"; 935b274bc22SAndre Fischer $installer::logger::Lang->print($infoline); 936cdf0e10cSrcweir $error_occured = 1; 937cdf0e10cSrcweir } 938cdf0e10cSrcweir else 939cdf0e10cSrcweir { 940cdf0e10cSrcweir $infoline = "ERROR: $systemcall\n"; 941b274bc22SAndre Fischer $installer::logger::Lang->print($infoline); 942cdf0e10cSrcweir $error_occured = 1; 943cdf0e10cSrcweir } 944cdf0e10cSrcweir } 945cdf0e10cSrcweir else 946cdf0e10cSrcweir { 947cdf0e10cSrcweir $infoline = "SUCCESS: $systemcall\n"; 948b274bc22SAndre Fischer $installer::logger::Lang->print($infoline); 949cdf0e10cSrcweir } 950cdf0e10cSrcweir 951cdf0e10cSrcweir return (\@returns, $returnvalue); 952cdf0e10cSrcweir} 953cdf0e10cSrcweir 954cdf0e10cSrcweir################################################### 955cdf0e10cSrcweir# Setting product name tag 956cdf0e10cSrcweir################################################### 957cdf0e10cSrcweir 958cdf0e10cSrcweirsub get_product_tag 959cdf0e10cSrcweir{ 960cdf0e10cSrcweir my ($allvariables, $indent) = @_; 961cdf0e10cSrcweir 962cdf0e10cSrcweir my $productname = $allvariables->{'LCONEWORDPRODUCTNAME'}; 963cdf0e10cSrcweir my $tag = $indent . "<product " . "name=" . "\"" . $productname . "\">" . "\n"; 964cdf0e10cSrcweir 965cdf0e10cSrcweir return $tag; 966cdf0e10cSrcweir} 967cdf0e10cSrcweir 968cdf0e10cSrcweir################################################### 969cdf0e10cSrcweir# Macro tags 970cdf0e10cSrcweir################################################### 971cdf0e10cSrcweir 972cdf0e10cSrcweirsub set_macro_tag 973cdf0e10cSrcweir{ 974cdf0e10cSrcweir my ($allvariables, $indent, $key) = @_; 975cdf0e10cSrcweir 976cdf0e10cSrcweir my $property = ""; 977cdf0e10cSrcweir my $value = ""; 978cdf0e10cSrcweir 979cdf0e10cSrcweir if ( $key eq "product_name" ) { $property = "PRODUCTNAME"; } 980cdf0e10cSrcweir elsif ( $key eq "product_version" ) { $property = "PRODUCTVERSION"; } 981cdf0e10cSrcweir elsif ( $key eq "product_suffix" ) { $property = "PRODUCTEXTENSION"; } 982cdf0e10cSrcweir elsif ( $key eq "product_fullname" ) { $property = "FULLPRODUCTNAME"; } 983cdf0e10cSrcweir 984cdf0e10cSrcweir if (( $property eq "PRODUCTNAME" ) || ( $property eq "PRODUCTVERSION" ) || ( $property eq "PRODUCTEXTENSION" )) 985cdf0e10cSrcweir { 986cdf0e10cSrcweir $value = $allvariables->{$property}; 987cdf0e10cSrcweir } 988cdf0e10cSrcweir 989cdf0e10cSrcweir if ( $property eq "FULLPRODUCTNAME" ) 990cdf0e10cSrcweir { 991cdf0e10cSrcweir $value = $allvariables->{"PRODUCTNAME"} . " " . $allvariables->{"PRODUCTVERSION"}; 992cdf0e10cSrcweir if ( $allvariables->{"PRODUCTEXTENSION"} ) { $value = $value . " " . $allvariables->{"PRODUCTEXTENSION"}; } 993cdf0e10cSrcweir } 994cdf0e10cSrcweir 995cdf0e10cSrcweir my $tag = $indent . "<macro " . "key=" . "\"" . $key . "\">" . $value . "\<\/macro\>" . "\n"; 996cdf0e10cSrcweir 997cdf0e10cSrcweir return $tag; 998cdf0e10cSrcweir 999cdf0e10cSrcweir} 1000cdf0e10cSrcweir 1001cdf0e10cSrcweir################################################### 1002cdf0e10cSrcweir# Setting the minor of the product version 1003cdf0e10cSrcweir# Required to check for Major Upgrades. 1004cdf0e10cSrcweir################################################### 1005cdf0e10cSrcweir 1006cdf0e10cSrcweirsub set_minor_tag 1007cdf0e10cSrcweir{ 1008cdf0e10cSrcweir my ($allvariables, $indent) = @_; 1009cdf0e10cSrcweir 1010cdf0e10cSrcweir my $productminor = 0; 1011cdf0e10cSrcweir if ( $allvariables->{"PACKAGEVERSION"} ) 1012cdf0e10cSrcweir { 1013cdf0e10cSrcweir if ( $allvariables->{"PACKAGEVERSION"} =~ /^\s*\d+\.(\d+)/ ) { $productminor = $1; } 1014cdf0e10cSrcweir } 1015cdf0e10cSrcweir my $tag = $indent . "<productminor>" . $productminor . "</productminor>" . "\n"; 1016cdf0e10cSrcweir 1017cdf0e10cSrcweir return $tag; 1018cdf0e10cSrcweir} 1019cdf0e10cSrcweir 1020cdf0e10cSrcweir################################################### 1021cdf0e10cSrcweir# Setting the update behaviour 1022cdf0e10cSrcweir################################################### 1023cdf0e10cSrcweir 1024cdf0e10cSrcweirsub set_update_tag 1025cdf0e10cSrcweir{ 1026cdf0e10cSrcweir my ($allvariables, $indent) = @_; 1027cdf0e10cSrcweir 1028cdf0e10cSrcweir my $updateflag = "false"; 1029cdf0e10cSrcweir if ( $allvariables->{"DONTUPDATE"} ) { $updateflag = "true"; } 1030cdf0e10cSrcweir my $tag = $indent . "<dontupdate>" . $updateflag . "</dontupdate>" . "\n"; 1031cdf0e10cSrcweir 1032cdf0e10cSrcweir return $tag; 1033cdf0e10cSrcweir} 1034cdf0e10cSrcweir 1035cdf0e10cSrcweir################################################### 1036cdf0e10cSrcweir# Setting the license dialog behaviour 1037cdf0e10cSrcweir################################################### 1038cdf0e10cSrcweir 1039cdf0e10cSrcweirsub set_hideeula_tag 1040cdf0e10cSrcweir{ 1041cdf0e10cSrcweir my ($allvariables, $indent) = @_; 1042cdf0e10cSrcweir 1043cdf0e10cSrcweir my $hidelicenseflag = "false"; 1044cdf0e10cSrcweir if ( $allvariables->{"HIDELICENSEDIALOG"} ) { $hidelicenseflag = "true"; } 1045cdf0e10cSrcweir my $tag = $indent . "<hideeula>" . $hidelicenseflag . "</hideeula>" . "\n"; 1046cdf0e10cSrcweir 1047cdf0e10cSrcweir return $tag; 1048cdf0e10cSrcweir} 1049cdf0e10cSrcweir 1050cdf0e10cSrcweir################################################### 1051cdf0e10cSrcweir# Setting default directory 1052cdf0e10cSrcweir################################################### 1053cdf0e10cSrcweir 1054cdf0e10cSrcweirsub set_defaultdir_tag 1055cdf0e10cSrcweir{ 1056cdf0e10cSrcweir my ($allvariables, $indent) = @_; 1057cdf0e10cSrcweir 1058cdf0e10cSrcweir my $defaultdir = ""; 1059cdf0e10cSrcweir if ( $allvariables->{"DEFAULTDESTPATH"} ) { $defaultdir = $allvariables->{"DEFAULTDESTPATH"}; } 1060cdf0e10cSrcweir my $tag = $indent . "<defaultdir>" . $defaultdir . "</defaultdir>" . "\n"; 1061cdf0e10cSrcweir 1062cdf0e10cSrcweir return $tag; 1063cdf0e10cSrcweir} 1064cdf0e10cSrcweir 1065cdf0e10cSrcweir################################################### 1066cdf0e10cSrcweir# Setting product directory 1067cdf0e10cSrcweir################################################### 1068cdf0e10cSrcweir 1069cdf0e10cSrcweirsub set_productdir_tag 1070cdf0e10cSrcweir{ 1071cdf0e10cSrcweir my ($allvariables, $indent) = @_; 1072cdf0e10cSrcweir 1073cdf0e10cSrcweir my $productdir = ""; 1074cdf0e10cSrcweir if ( $allvariables->{"UNIXPRODUCTNAME"} ) 1075cdf0e10cSrcweir { 1076cdf0e10cSrcweir $productdir = $allvariables->{"UNIXPRODUCTNAME"}; 1077cdf0e10cSrcweir 1078cdf0e10cSrcweir if ( $allvariables->{"BRANDPACKAGEVERSION"} ) 1079cdf0e10cSrcweir { 1080cdf0e10cSrcweir $productdir = $productdir . $allvariables->{"BRANDPACKAGEVERSION"}; 1081cdf0e10cSrcweir# if ( $allvariables->{"LCPRODUCTEXTENSION"} ) { $productdir = $productdir . $allvariables->{"LCPRODUCTEXTENSION"}; } 1082cdf0e10cSrcweir } 1083cdf0e10cSrcweir else 1084cdf0e10cSrcweir { 1085cdf0e10cSrcweir if ( $allvariables->{"PRODUCTVERSION"} ) 1086cdf0e10cSrcweir { 1087cdf0e10cSrcweir $productdir = $productdir . $allvariables->{"PRODUCTVERSION"}; 1088cdf0e10cSrcweir } 1089cdf0e10cSrcweir } 1090cdf0e10cSrcweir } 1091cdf0e10cSrcweir my $tag = $indent . "<productdir>" . $productdir . "</productdir>" . "\n"; 1092cdf0e10cSrcweir 1093cdf0e10cSrcweir return $tag; 1094cdf0e10cSrcweir} 1095cdf0e10cSrcweir 1096cdf0e10cSrcweir##################################################### 1097cdf0e10cSrcweir# Setting the package directory in installation set 1098cdf0e10cSrcweir##################################################### 1099cdf0e10cSrcweir 1100cdf0e10cSrcweirsub set_packagedir_tag 1101cdf0e10cSrcweir{ 1102cdf0e10cSrcweir my ($indent) = @_; 1103cdf0e10cSrcweir 1104cdf0e10cSrcweir my $tag = $indent . "<packagedirectory>" . $installer::globals::epmoutpath . "</packagedirectory>" . "\n"; 1105cdf0e10cSrcweir 1106cdf0e10cSrcweir return $tag; 1107cdf0e10cSrcweir} 1108cdf0e10cSrcweir 1109cdf0e10cSrcweir################################################### 1110cdf0e10cSrcweir# Setting the packagetype of installation set 1111cdf0e10cSrcweir################################################### 1112cdf0e10cSrcweir 1113cdf0e10cSrcweirsub set_packagetype_tag 1114cdf0e10cSrcweir{ 1115cdf0e10cSrcweir my ($indent) = @_; 1116cdf0e10cSrcweir 1117cdf0e10cSrcweir my $tag = $indent . "<packageformat>" . $installer::globals::packageformat . "</packageformat>" . "\n"; 1118cdf0e10cSrcweir 1119cdf0e10cSrcweir return $tag; 1120cdf0e10cSrcweir} 1121cdf0e10cSrcweir 1122cdf0e10cSrcweir################################################### 1123cdf0e10cSrcweir# Setting the architecture of installation set 1124cdf0e10cSrcweir################################################### 1125cdf0e10cSrcweir 1126cdf0e10cSrcweirsub set_architecture_tag 1127cdf0e10cSrcweir{ 1128cdf0e10cSrcweir my ($indent) = @_; 1129cdf0e10cSrcweir 1130cdf0e10cSrcweir my $architecture = ""; 1131cdf0e10cSrcweir if ( $installer::globals::issolarissparcbuild ) { $architecture = "sparc"; } 1132cdf0e10cSrcweir if ( $installer::globals::issolarisx86build ) { $architecture = "i386"; } 1133cdf0e10cSrcweir 1134cdf0e10cSrcweir my $tag = $indent . "<architecture>" . $architecture . "</architecture>" . "\n"; 1135cdf0e10cSrcweir 1136cdf0e10cSrcweir return $tag; 1137cdf0e10cSrcweir} 1138cdf0e10cSrcweir 1139cdf0e10cSrcweir################################################### 1140cdf0e10cSrcweir# Setting the multi language tag 1141cdf0e10cSrcweir################################################### 1142cdf0e10cSrcweir 1143cdf0e10cSrcweirsub set_multilanguage_tag 1144cdf0e10cSrcweir{ 1145cdf0e10cSrcweir my ($indent) = @_; 1146cdf0e10cSrcweir 1147cdf0e10cSrcweir my $value = "false"; 1148cdf0e10cSrcweir if ( $installer::globals::ismultilingual == 1 ) { $value = "true"; } 1149cdf0e10cSrcweir 1150cdf0e10cSrcweir my $tag = $indent . "<multilingual>" . $value . "</multilingual>" . "\n"; 1151cdf0e10cSrcweir 1152cdf0e10cSrcweir return $tag; 1153cdf0e10cSrcweir} 1154cdf0e10cSrcweir 1155cdf0e10cSrcweir################################################### 1156cdf0e10cSrcweir# Setting the language tag 1157cdf0e10cSrcweir################################################### 1158cdf0e10cSrcweir 1159cdf0e10cSrcweirsub set_language_tag 1160cdf0e10cSrcweir{ 1161cdf0e10cSrcweir my ($languagestringref, $indent) = @_; 1162cdf0e10cSrcweir 1163cdf0e10cSrcweir my $tag = $indent . "<languages>" . $$languagestringref . "</languages>" . "\n"; 1164cdf0e10cSrcweir 1165cdf0e10cSrcweir return $tag; 1166cdf0e10cSrcweir} 1167cdf0e10cSrcweir 1168cdf0e10cSrcweir################################################### 1169cdf0e10cSrcweir# Collecting content for product xpd file 1170cdf0e10cSrcweir################################################### 1171cdf0e10cSrcweir 1172cdf0e10cSrcweir# <?xml version='1.0' encoding='utf-8'?> 1173cdf0e10cSrcweir# 1174cdf0e10cSrcweir# <!-- General application description --> 1175cdf0e10cSrcweir# 1176cdf0e10cSrcweir# <product name="openoffice"> 1177cdf0e10cSrcweir# <macro key="product_name">Sun OpenOffice.org</macro> 1178cdf0e10cSrcweir# <macro key="product_version">1.0</macro> 1179cdf0e10cSrcweir# <macro key="product_suffix">Mephisto</macro> 1180cdf0e10cSrcweir# <macro key="product_fullname">Sun OpenOffice.org 1.0 Mephisto</macro> 1181cdf0e10cSrcweir# <defaultdir>/opt/Sun/OpenOffice.org-Mephisto</defaultdir> 1182cdf0e10cSrcweir# </product> 1183cdf0e10cSrcweir 1184cdf0e10cSrcweirsub get_setup_file_content 1185cdf0e10cSrcweir{ 1186cdf0e10cSrcweir my ($allvariables, $languagestringref) = @_; 1187cdf0e10cSrcweir 1188cdf0e10cSrcweir my @xpdfile = (); 1189cdf0e10cSrcweir my $noindent = ""; 1190cdf0e10cSrcweir my $singleindent = " "; 1191cdf0e10cSrcweir 1192cdf0e10cSrcweir my $line = "<?xml version='1.0' encoding='utf-8'?>\n\n"; 1193cdf0e10cSrcweir push(@xpdfile, $line); 1194cdf0e10cSrcweir $line = "<!-- General application description -->\n\n"; 1195cdf0e10cSrcweir push(@xpdfile, $line); 1196cdf0e10cSrcweir 1197cdf0e10cSrcweir my $tag = get_product_tag($allvariables, $noindent); 1198cdf0e10cSrcweir push(@xpdfile, $tag); 1199cdf0e10cSrcweir 1200cdf0e10cSrcweir $tag = set_macro_tag($allvariables, $singleindent, "product_name"); 1201cdf0e10cSrcweir push(@xpdfile, $tag); 1202cdf0e10cSrcweir $tag = set_macro_tag($allvariables, $singleindent, "product_version"); 1203cdf0e10cSrcweir push(@xpdfile, $tag); 1204cdf0e10cSrcweir $tag = set_macro_tag($allvariables, $singleindent, "product_suffix"); 1205cdf0e10cSrcweir push(@xpdfile, $tag); 1206cdf0e10cSrcweir $tag = set_macro_tag($allvariables, $singleindent, "product_fullname"); 1207cdf0e10cSrcweir push(@xpdfile, $tag); 1208cdf0e10cSrcweir 1209cdf0e10cSrcweir $tag = set_defaultdir_tag($allvariables, $singleindent); 1210cdf0e10cSrcweir push(@xpdfile, $tag); 1211cdf0e10cSrcweir 1212cdf0e10cSrcweir $tag = set_productdir_tag($allvariables, $singleindent); 1213cdf0e10cSrcweir push(@xpdfile, $tag); 1214cdf0e10cSrcweir 1215cdf0e10cSrcweir $tag = set_minor_tag($allvariables, $singleindent); 1216cdf0e10cSrcweir push(@xpdfile, $tag); 1217cdf0e10cSrcweir 1218cdf0e10cSrcweir $tag = set_update_tag($allvariables, $singleindent); 1219cdf0e10cSrcweir push(@xpdfile, $tag); 1220cdf0e10cSrcweir 1221cdf0e10cSrcweir $tag = set_packagedir_tag($singleindent); 1222cdf0e10cSrcweir push(@xpdfile, $tag); 1223cdf0e10cSrcweir 1224cdf0e10cSrcweir $tag = set_packagetype_tag($singleindent); 1225cdf0e10cSrcweir push(@xpdfile, $tag); 1226cdf0e10cSrcweir 1227cdf0e10cSrcweir $tag = set_architecture_tag($singleindent); 1228cdf0e10cSrcweir push(@xpdfile, $tag); 1229cdf0e10cSrcweir 1230cdf0e10cSrcweir $tag = set_multilanguage_tag($singleindent); 1231cdf0e10cSrcweir push(@xpdfile, $tag); 1232cdf0e10cSrcweir 1233cdf0e10cSrcweir $tag = set_language_tag($languagestringref, $singleindent); 1234cdf0e10cSrcweir push(@xpdfile, $tag); 1235cdf0e10cSrcweir 1236cdf0e10cSrcweir $tag = set_hideeula_tag($allvariables, $singleindent); 1237cdf0e10cSrcweir push(@xpdfile, $tag); 1238cdf0e10cSrcweir 1239cdf0e10cSrcweir $tag = get_end_tag("product", $noindent); 1240cdf0e10cSrcweir push(@xpdfile, $tag); 1241cdf0e10cSrcweir 1242cdf0e10cSrcweir return \@xpdfile; 1243cdf0e10cSrcweir} 1244cdf0e10cSrcweir 1245cdf0e10cSrcweir################################################### 1246cdf0e10cSrcweir# Collecting content for xpd file 1247cdf0e10cSrcweir################################################### 1248cdf0e10cSrcweir 1249cdf0e10cSrcweirsub get_file_content 1250cdf0e10cSrcweir{ 1251cdf0e10cSrcweir my ( $module, $packagename, $solslanguage, $linkpackage, $isemptyparent, $subdir, $islanguagemodule, $onelanguage, $xpdinfo ) = @_; 1252cdf0e10cSrcweir 1253cdf0e10cSrcweir my @xpdfile = (); 1254cdf0e10cSrcweir my $value = ""; 1255cdf0e10cSrcweir my $line = ""; 1256cdf0e10cSrcweir my $noindent = ""; 1257cdf0e10cSrcweir my $singleindent = " "; 1258cdf0e10cSrcweir my $doubleindent = $singleindent . $singleindent; 1259cdf0e10cSrcweir 1260cdf0e10cSrcweir my ( $tag, $parentgid ) = get_package_tag($module, $noindent, $linkpackage); 1261cdf0e10cSrcweir push(@xpdfile, $tag); 1262cdf0e10cSrcweir 1263cdf0e10cSrcweir # start of installunit tag -> using info from scp module 1264cdf0e10cSrcweir 1265cdf0e10cSrcweir $tag = get_display_tag($module, $singleindent); 1266cdf0e10cSrcweir push(@xpdfile, $tag); 1267cdf0e10cSrcweir 1268cdf0e10cSrcweir $value = get_sortkey_value($module); 1269cdf0e10cSrcweir $line = get_tag_line($doubleindent, "sortkey", $value); 1270cdf0e10cSrcweir push(@xpdfile, $line); 1271cdf0e10cSrcweir 1272cdf0e10cSrcweir $value = get_default_value($module); 1273cdf0e10cSrcweir $line = get_tag_line($doubleindent, "default", $value); 1274cdf0e10cSrcweir push(@xpdfile, $line); 1275cdf0e10cSrcweir 1276cdf0e10cSrcweir $value = get_showinuserinstall_value($module); 1277cdf0e10cSrcweir $line = get_tag_line($doubleindent, "showinuserinstall", $value); 1278cdf0e10cSrcweir push(@xpdfile, $line); 1279cdf0e10cSrcweir 1280cdf0e10cSrcweir $value = get_userinstallonly_value($module); 1281cdf0e10cSrcweir $line = get_tag_line($doubleindent, "showinuserinstallonly", $value); 1282cdf0e10cSrcweir push(@xpdfile, $line); 1283cdf0e10cSrcweir 1284cdf0e10cSrcweir $value = get_dontuninstall_value($module); 1285cdf0e10cSrcweir $line = get_tag_line($doubleindent, "dontuninstall", $value); 1286cdf0e10cSrcweir push(@xpdfile, $line); 1287cdf0e10cSrcweir 1288cdf0e10cSrcweir $value = get_checksolaris_value($module); 1289cdf0e10cSrcweir $line = get_tag_line($doubleindent, "checksolaris", $value); 1290cdf0e10cSrcweir push(@xpdfile, $line); 1291cdf0e10cSrcweir 1292cdf0e10cSrcweir $value = get_isupdatepackage_value($module); 1293cdf0e10cSrcweir $line = get_tag_line($doubleindent, "isupdatepackage", $value); 1294cdf0e10cSrcweir push(@xpdfile, $line); 1295cdf0e10cSrcweir 1296cdf0e10cSrcweir $value = get_showmultilingualonly_value($module); 1297cdf0e10cSrcweir $line = get_tag_line($doubleindent, "showmultilingualonly", $value); 1298cdf0e10cSrcweir push(@xpdfile, $line); 1299cdf0e10cSrcweir 1300cdf0e10cSrcweir $value = get_applicationmodule_value($module); 1301cdf0e10cSrcweir $line = get_tag_line($doubleindent, "applicationmodule", $value); 1302cdf0e10cSrcweir push(@xpdfile, $line); 1303cdf0e10cSrcweir 1304cdf0e10cSrcweir $value = get_isjavamodule_value($module); 1305cdf0e10cSrcweir $line = get_tag_line($doubleindent, "isjavapackage", $value); 1306cdf0e10cSrcweir push(@xpdfile, $line); 1307cdf0e10cSrcweir 1308cdf0e10cSrcweir $value = get_installcanfail_value($module); 1309cdf0e10cSrcweir $line = get_tag_line($doubleindent, "installcanfail", $value); 1310cdf0e10cSrcweir push(@xpdfile, $line); 1311cdf0e10cSrcweir 1312cdf0e10cSrcweir $value = get_forceintoupdate_value($module); 1313cdf0e10cSrcweir $line = get_tag_line($doubleindent, "forceintoupdate", $value); 1314cdf0e10cSrcweir push(@xpdfile, $line); 1315cdf0e10cSrcweir 1316cdf0e10cSrcweir $value = get_useforce_value($module); 1317cdf0e10cSrcweir $line = get_tag_line($doubleindent, "useforce", $value); 1318cdf0e10cSrcweir push(@xpdfile, $line); 1319cdf0e10cSrcweir 1320cdf0e10cSrcweir # iterating over all languages to get names and descriptions 1321cdf0e10cSrcweir collect_lang_values($doubleindent, $module, \@xpdfile, "Name", "name"); 1322cdf0e10cSrcweir collect_lang_values($doubleindent, $module, \@xpdfile, "Description", "description"); 1323cdf0e10cSrcweir 1324cdf0e10cSrcweir $tag = get_end_tag("display", $singleindent); 1325cdf0e10cSrcweir push(@xpdfile, $tag); 1326cdf0e10cSrcweir 1327cdf0e10cSrcweir # end of display tag 1328cdf0e10cSrcweir 1329cdf0e10cSrcweir if ( ! $isemptyparent ) 1330cdf0e10cSrcweir { 1331cdf0e10cSrcweir # start of installunit tag -> using info from package defined in packagelist 1332cdf0e10cSrcweir 1333cdf0e10cSrcweir $tag = get_installunit_tag($singleindent); 1334cdf0e10cSrcweir push(@xpdfile, $tag); 1335cdf0e10cSrcweir 1336cdf0e10cSrcweir $value = get_size_value($packagename, $xpdinfo); 1337cdf0e10cSrcweir $line = get_tag_line($doubleindent, "size", $value); 1338cdf0e10cSrcweir push(@xpdfile, $line); 1339cdf0e10cSrcweir 1340cdf0e10cSrcweir $value = get_order_value($module); 1341cdf0e10cSrcweir $line = get_tag_line($doubleindent, "installorder", $value); 1342cdf0e10cSrcweir push(@xpdfile, $line); 1343cdf0e10cSrcweir 1344cdf0e10cSrcweir $value = get_md5_value($packagename, $xpdinfo); 1345cdf0e10cSrcweir $line = get_tag_line($doubleindent, "md5", $value); 1346cdf0e10cSrcweir push(@xpdfile, $line); 1347cdf0e10cSrcweir 1348cdf0e10cSrcweir $value = get_name_value($packagename); 1349cdf0e10cSrcweir $line = get_tag_line($doubleindent, "name", $value); 1350cdf0e10cSrcweir push(@xpdfile, $line); 1351cdf0e10cSrcweir 1352cdf0e10cSrcweir $value = get_fullpkgname_value($packagename, $xpdinfo); 1353cdf0e10cSrcweir $line = get_tag_line($doubleindent, "fullpkgname", $value); 1354cdf0e10cSrcweir push(@xpdfile, $line); 1355cdf0e10cSrcweir 1356cdf0e10cSrcweir $value = get_pkgversion_value($packagename, $xpdinfo); 1357cdf0e10cSrcweir $line = get_tag_line($doubleindent, "pkgversion", $value); 1358cdf0e10cSrcweir push(@xpdfile, $line); 1359cdf0e10cSrcweir 1360cdf0e10cSrcweir $value = get_subdir_value($packagename, $subdir, $module); 1361cdf0e10cSrcweir $line = get_tag_line($doubleindent, "subdir", $value); 1362cdf0e10cSrcweir push(@xpdfile, $line); 1363cdf0e10cSrcweir 1364cdf0e10cSrcweir $value = get_relocatable_value($module); 1365cdf0e10cSrcweir $line = get_tag_line($doubleindent, "relocatable", $value); 1366cdf0e10cSrcweir push(@xpdfile, $line); 1367cdf0e10cSrcweir 1368cdf0e10cSrcweir $value = get_languagespecific_value($islanguagemodule); 1369cdf0e10cSrcweir $line = get_tag_line($doubleindent, "languagespecific", $value); 1370cdf0e10cSrcweir push(@xpdfile, $line); 1371cdf0e10cSrcweir 1372cdf0e10cSrcweir $value = $onelanguage; 1373cdf0e10cSrcweir $line = get_tag_line($doubleindent, "language", $value); 1374cdf0e10cSrcweir push(@xpdfile, $line); 1375cdf0e10cSrcweir 1376cdf0e10cSrcweir $line = get_tag_line($doubleindent, "solarislanguage", $solslanguage); 1377cdf0e10cSrcweir push(@xpdfile, $line); 1378cdf0e10cSrcweir 1379cdf0e10cSrcweir $tag = get_end_tag("installunit", $singleindent); 1380cdf0e10cSrcweir push(@xpdfile, $tag); 1381cdf0e10cSrcweir 1382cdf0e10cSrcweir # end of installunit tag 1383cdf0e10cSrcweir } 1384cdf0e10cSrcweir 1385cdf0e10cSrcweir $tag = get_end_tag("package", $noindent); 1386cdf0e10cSrcweir push(@xpdfile, $tag); 1387cdf0e10cSrcweir 1388cdf0e10cSrcweir return ( \@xpdfile, $parentgid ); 1389cdf0e10cSrcweir} 1390cdf0e10cSrcweir 1391cdf0e10cSrcweir################################################### 1392cdf0e10cSrcweir# Setting xpd file name 1393cdf0e10cSrcweir################################################### 1394cdf0e10cSrcweir 1395cdf0e10cSrcweirsub get_xpd_filename 1396cdf0e10cSrcweir{ 1397cdf0e10cSrcweir my ($modulegid, $linkpackage) = @_; 1398cdf0e10cSrcweir 1399cdf0e10cSrcweir if ( $linkpackage ) { $modulegid = $modulegid . "u"; } 1400cdf0e10cSrcweir 1401cdf0e10cSrcweir my $filename = $modulegid . ".xpd"; 1402cdf0e10cSrcweir 1403cdf0e10cSrcweir return $filename; 1404cdf0e10cSrcweir} 1405cdf0e10cSrcweir 1406cdf0e10cSrcweir################################################### 1407cdf0e10cSrcweir# Determine, which package was created newly 1408cdf0e10cSrcweir################################################### 1409cdf0e10cSrcweir 1410cdf0e10cSrcweirsub determine_new_packagename 1411cdf0e10cSrcweir{ 1412cdf0e10cSrcweir my ( $installdir, $subdir, $xpdinfo ) = @_; 1413cdf0e10cSrcweir 1414cdf0e10cSrcweir my $newpackage = ""; 1415cdf0e10cSrcweir $installdir =~ s/\Q$installer::globals::separator\E\s*$//; 1416cdf0e10cSrcweir my $directory = $installdir . $installer::globals::separator . $subdir; 1417cdf0e10cSrcweir $directory =~ s/\Q$installer::globals::separator\E\s*$//; 1418cdf0e10cSrcweir 1419cdf0e10cSrcweir if ( $xpdinfo->{'RealPackageName'} ) 1420cdf0e10cSrcweir { 1421cdf0e10cSrcweir $newpackage = $directory . $installer::globals::separator . $xpdinfo->{'RealPackageName'}; 1422cdf0e10cSrcweir push(@installer::globals::currentcontent, $newpackage); 1423cdf0e10cSrcweir return $newpackage; 1424cdf0e10cSrcweir } 1425cdf0e10cSrcweir 1426cdf0e10cSrcweir my ($newcontent, $allcontent) = installer::systemactions::find_new_content_in_directory($directory, \@installer::globals::currentcontent); 1427cdf0e10cSrcweir @installer::globals::currentcontent = (); 1428cdf0e10cSrcweir foreach my $element ( @{$allcontent} ) { push(@installer::globals::currentcontent, $element); } 1429cdf0e10cSrcweir 1430cdf0e10cSrcweir my $newentriesnumber = $#{$newcontent} + 1; 1431cdf0e10cSrcweir if ( $newentriesnumber > 1 ) { installer::exiter::exit_program("ERROR: More than one new package in directory $directory", "determine_new_packagename (xpdinstaller)"); } 1432cdf0e10cSrcweir elsif ( $newentriesnumber < 1 ) { installer::exiter::exit_program("ERROR: No new package in directory $directory", "determine_new_packagename (xpdinstaller)"); } 1433cdf0e10cSrcweir $newpackage = ${$newcontent}[0]; 1434cdf0e10cSrcweir 1435cdf0e10cSrcweir return $newpackage; 1436cdf0e10cSrcweir} 1437cdf0e10cSrcweir 1438cdf0e10cSrcweir################################################### 1439cdf0e10cSrcweir# Checking, if the parentgid is defined in 1440cdf0e10cSrcweir# another package 1441cdf0e10cSrcweir################################################### 1442cdf0e10cSrcweir 1443cdf0e10cSrcweirsub is_empty_parent 1444cdf0e10cSrcweir{ 1445cdf0e10cSrcweir my ($gid, $packages) = @_; 1446cdf0e10cSrcweir 1447cdf0e10cSrcweir my $is_empty_parent = 1; 1448cdf0e10cSrcweir 1449cdf0e10cSrcweir for ( my $k = 0; $k <= $#{$packages}; $k++ ) 1450cdf0e10cSrcweir { 1451cdf0e10cSrcweir my $onepackage = ${$packages}[$k]; 1452cdf0e10cSrcweir my $packagegid = $onepackage->{'module'}; 1453cdf0e10cSrcweir 1454cdf0e10cSrcweir if ( $packagegid eq $gid ) 1455cdf0e10cSrcweir { 1456cdf0e10cSrcweir $is_empty_parent = 0; 1457cdf0e10cSrcweir last; 1458cdf0e10cSrcweir } 1459cdf0e10cSrcweir } 1460cdf0e10cSrcweir 1461cdf0e10cSrcweir return $is_empty_parent; 1462cdf0e10cSrcweir} 1463cdf0e10cSrcweir 1464cdf0e10cSrcweir################################################### 1465cdf0e10cSrcweir# Creating additional xpd files for empty parents 1466cdf0e10cSrcweir################################################### 1467cdf0e10cSrcweir 1468cdf0e10cSrcweirsub create_emptyparents_xpd_file 1469cdf0e10cSrcweir{ 1470cdf0e10cSrcweir my ($parentgid, $modulesarrayref, $xpddir) = @_; 1471cdf0e10cSrcweir 1472cdf0e10cSrcweir my $module = get_module($parentgid, $modulesarrayref); 1473cdf0e10cSrcweir my $grandpagid = ""; 1474cdf0e10cSrcweir 1475cdf0e10cSrcweir if ( $module ne "" ) 1476cdf0e10cSrcweir { 1477cdf0e10cSrcweir my $packagename = ""; 1478cdf0e10cSrcweir # all content saved in scp is now available and can be used to create the xpd file 1479cdf0e10cSrcweir my ( $xpdfile, $newparentgid ) = get_file_content($module, $packagename, "", 0, 1, "", 0, "", ""); 1480cdf0e10cSrcweir 1481cdf0e10cSrcweir $grandpagid = $newparentgid; 1482cdf0e10cSrcweir 1483cdf0e10cSrcweir my $xpdfilename = get_xpd_filename($parentgid, 0); 1484cdf0e10cSrcweir $xpdfilename = $xpddir . $installer::globals::separator . $xpdfilename; 1485cdf0e10cSrcweir 1486cdf0e10cSrcweir installer::files::save_file($xpdfilename, $xpdfile); 1487cdf0e10cSrcweir push(@installer::globals::allxpdfiles, $xpdfilename); 1488cdf0e10cSrcweir my $infoline = "Saving xpd file: $xpdfilename\n"; 1489b274bc22SAndre Fischer $installer::logger::Lang->print($infoline); 1490cdf0e10cSrcweir } 1491cdf0e10cSrcweir 1492cdf0e10cSrcweir # push(@installer::globals::emptyxpdparents, $parentgid); 1493cdf0e10cSrcweir push( @installer::globals::createdxpdfiles, $parentgid); 1494cdf0e10cSrcweir 1495cdf0e10cSrcweir return $grandpagid; 1496cdf0e10cSrcweir} 1497cdf0e10cSrcweir 1498cdf0e10cSrcweir################################################### 1499cdf0e10cSrcweir# Creating additional xpd files for empty parents 1500cdf0e10cSrcweir################################################### 1501cdf0e10cSrcweir 1502cdf0e10cSrcweirsub filter_content_from_xpdfile 1503cdf0e10cSrcweir{ 1504cdf0e10cSrcweir my ($xpdfile) = @_; 1505cdf0e10cSrcweir 1506cdf0e10cSrcweir my @newxpdfile = (); 1507cdf0e10cSrcweir 1508cdf0e10cSrcweir my $include = 1; 1509cdf0e10cSrcweir 1510cdf0e10cSrcweir for ( my $i = 0; $i <= $#{$xpdfile}; $i++ ) 1511cdf0e10cSrcweir { 1512cdf0e10cSrcweir my $line = ${$xpdfile}[$i]; 1513cdf0e10cSrcweir 1514cdf0e10cSrcweir if (( $line =~ /^\s*\<installunit/ ) && ( $include )) { $include = 0; } 1515cdf0e10cSrcweir if ( $include ) { push(@newxpdfile, $line); } 1516cdf0e10cSrcweir if (( $line =~ /^\s*\<\/installunit/ ) && ( ! $include )) { $include = 1; } 1517cdf0e10cSrcweir } 1518cdf0e10cSrcweir 1519cdf0e10cSrcweir return \@newxpdfile; 1520cdf0e10cSrcweir} 1521cdf0e10cSrcweir 1522cdf0e10cSrcweir########################################################################## 1523cdf0e10cSrcweir# Changing the parent inside the xpd file 1524cdf0e10cSrcweir# Old: <package name="gid_Module_Root" parent="root"> 1525cdf0e10cSrcweir# New: <package name="gid_Module_Root_Files_1" parent="gid_Module_Root"> 1526cdf0e10cSrcweir########################################################################## 1527cdf0e10cSrcweir 1528cdf0e10cSrcweirsub change_parent_in_xpdfile 1529cdf0e10cSrcweir{ 1530cdf0e10cSrcweir my ($xpdfile, $modulename) = @_; 1531cdf0e10cSrcweir 1532cdf0e10cSrcweir for ( my $i = 0; $i <= $#{$xpdfile}; $i++ ) 1533cdf0e10cSrcweir { 1534cdf0e10cSrcweir if ( ${$xpdfile}[$i] =~ /^\s*\<package name\s*=\s*\"(\S+?)\"\s+parent\s*=\s*\"(\S+?)\"\s*\>\s*$/ ) 1535cdf0e10cSrcweir { 1536cdf0e10cSrcweir my $oldname = $1; 1537cdf0e10cSrcweir my $oldparent = $2; 1538cdf0e10cSrcweir 1539cdf0e10cSrcweir my $newname = $modulename; 1540cdf0e10cSrcweir my $newparent = $oldname; 1541cdf0e10cSrcweir 1542cdf0e10cSrcweir ${$xpdfile}[$i] =~ s/\"\Q$oldname\E\"/\"$newname\"/; 1543cdf0e10cSrcweir ${$xpdfile}[$i] =~ s/\"\Q$oldparent\E\"/\"$newparent\"/; 1544cdf0e10cSrcweir 1545cdf0e10cSrcweir last; 1546cdf0e10cSrcweir } 1547cdf0e10cSrcweir } 1548cdf0e10cSrcweir} 1549cdf0e10cSrcweir 1550cdf0e10cSrcweir################################################### 1551cdf0e10cSrcweir# Creating one xpd file for each package 1552cdf0e10cSrcweir################################################### 1553cdf0e10cSrcweir 1554cdf0e10cSrcweirsub create_xpd_file 1555cdf0e10cSrcweir{ 1556cdf0e10cSrcweir my ($onepackage, $allpackages, $languagestringref, $allvariables, $modulesarrayref, $installdir, $subdir, $linkpackage, $xpdinfo) = @_; 1557cdf0e10cSrcweir 1558cdf0e10cSrcweir my $infoline = ""; 1559cdf0e10cSrcweir # creating the directory 1560cdf0e10cSrcweir my $xpddir = installer::systemactions::create_directories("xpdinstaller", $languagestringref); 1561cdf0e10cSrcweir $xpddir =~ s/\/\s*$//; 1562cdf0e10cSrcweir $installer::globals::xpddir = $xpddir; 1563cdf0e10cSrcweir # push(@installer::globals::removedirs, $xpddir); 1564cdf0e10cSrcweir 1565cdf0e10cSrcweir my $modulegid = $onepackage->{'module'}; 1566cdf0e10cSrcweir 1567cdf0e10cSrcweir my $onelanguage = ""; # 1568cdf0e10cSrcweir my $solslanguage = ""; # 1569cdf0e10cSrcweir my $islanguagemodule = 0; # 1570cdf0e10cSrcweir if ( $onepackage->{'islanguagemodule'} ) { $islanguagemodule = $onepackage->{'islanguagemodule'}; } # 1571cdf0e10cSrcweir if ( $islanguagemodule ) # 1572cdf0e10cSrcweir { 1573cdf0e10cSrcweir $onelanguage = $onepackage->{'language'}; # 1574cdf0e10cSrcweir if ( $installer::globals::issolarispkgbuild ) { $solslanguage = installer::epmfile::get_solaris_language_for_langpack($onelanguage); } # 1575cdf0e10cSrcweir } 1576cdf0e10cSrcweir 1577cdf0e10cSrcweir installer::logger::include_header_into_logfile("Creating xpd file ($modulegid):"); 1578cdf0e10cSrcweir 1579cdf0e10cSrcweir my $module = get_module($modulegid, $modulesarrayref); 1580cdf0e10cSrcweir 1581cdf0e10cSrcweir if ( $module ne "" ) 1582cdf0e10cSrcweir { 1583cdf0e10cSrcweir my $packagename = determine_new_packagename($installdir, $subdir, $xpdinfo); 1584cdf0e10cSrcweir 1585cdf0e10cSrcweir # all content saved in scp is now available and can be used to create the xpd file 1586cdf0e10cSrcweir my ( $xpdfile, $parentgid ) = get_file_content($module, $packagename, $solslanguage, $linkpackage, 0, "", $islanguagemodule, $onelanguage, $xpdinfo); 1587cdf0e10cSrcweir 1588cdf0e10cSrcweir my $xpdfilename = get_xpd_filename($modulegid, $linkpackage); 1589cdf0e10cSrcweir $xpdfilename = $xpddir . $installer::globals::separator . $xpdfilename; 1590cdf0e10cSrcweir 1591cdf0e10cSrcweir # Very special handling for Root module: 1592cdf0e10cSrcweir # Because packages should only be assigned to leaves and not to knods, 1593cdf0e10cSrcweir # the root module is divided into a knod without package and a new 1594cdf0e10cSrcweir # leave with package. The name of the leave is defined at $module->{'XpdPackageName'}. 1595cdf0e10cSrcweir if ( $module->{'XpdPackageName'} ) 1596cdf0e10cSrcweir { 1597cdf0e10cSrcweir my $newxpdfilename = get_xpd_filename($module->{'XpdPackageName'}, 0); 1598cdf0e10cSrcweir $newxpdfilename = $xpddir . $installer::globals::separator . $newxpdfilename; 1599cdf0e10cSrcweir my $emptyfilecontent = filter_content_from_xpdfile($xpdfile); 1600cdf0e10cSrcweir 1601cdf0e10cSrcweir installer::files::save_file($xpdfilename, $emptyfilecontent); 1602cdf0e10cSrcweir push(@installer::globals::allxpdfiles, $xpdfilename); 1603cdf0e10cSrcweir $infoline = "Saving xpd file: $xpdfilename\n"; 1604b274bc22SAndre Fischer $installer::logger::Lang->print($infoline); 1605cdf0e10cSrcweir 1606cdf0e10cSrcweir $xpdfilename = $newxpdfilename; 1607cdf0e10cSrcweir change_parent_in_xpdfile($xpdfile, $module->{'XpdPackageName'}); 1608cdf0e10cSrcweir } 1609cdf0e10cSrcweir 1610cdf0e10cSrcweir installer::files::save_file($xpdfilename, $xpdfile); 1611cdf0e10cSrcweir push( @installer::globals::createdxpdfiles, $modulegid); 1612cdf0e10cSrcweir push(@installer::globals::allxpdfiles, $xpdfilename); 1613cdf0e10cSrcweir $infoline = "Saving xpd file: $xpdfilename\n"; 1614b274bc22SAndre Fischer $installer::logger::Lang->print($infoline); 1615cdf0e10cSrcweir 1616cdf0e10cSrcweir my $grandpagid = "root"; 1617cdf0e10cSrcweir if ( $parentgid ne "root" ) 1618cdf0e10cSrcweir { 1619cdf0e10cSrcweir my $create_missing_parent = is_empty_parent($parentgid, $allpackages); 1620cdf0e10cSrcweir 1621cdf0e10cSrcweir # if (( $create_missing_parent ) && ( ! installer::existence::exists_in_array($parentgid, \@installer::globals::emptyxpdparents) )) 1622cdf0e10cSrcweir if (( $create_missing_parent ) && ( ! installer::existence::exists_in_array($parentgid, \@installer::globals::createdxpdfiles) )) 1623cdf0e10cSrcweir { 1624cdf0e10cSrcweir $grandpagid = create_emptyparents_xpd_file($parentgid, $modulesarrayref, $xpddir); 1625cdf0e10cSrcweir } 1626cdf0e10cSrcweir } 1627cdf0e10cSrcweir 1628cdf0e10cSrcweir if ( $grandpagid ne "root" ) 1629cdf0e10cSrcweir { 1630cdf0e10cSrcweir my $create_missing_parent = is_empty_parent($grandpagid, $allpackages); 1631cdf0e10cSrcweir 1632cdf0e10cSrcweir # if (( $create_missing_parent ) && ( ! installer::existence::exists_in_array($parentgid, \@installer::globals::emptyxpdparents) )) 1633cdf0e10cSrcweir if (( $create_missing_parent ) && ( ! installer::existence::exists_in_array($grandpagid, \@installer::globals::createdxpdfiles) )) 1634cdf0e10cSrcweir { 1635cdf0e10cSrcweir create_emptyparents_xpd_file($grandpagid, $modulesarrayref, $xpddir); 1636cdf0e10cSrcweir } 1637cdf0e10cSrcweir } 1638cdf0e10cSrcweir } 1639cdf0e10cSrcweir else 1640cdf0e10cSrcweir { 1641cdf0e10cSrcweir installer::exiter::exit_program("ERROR: No module definition found for gid: $modulegid", "create_xpd_file (xpdinstaller)"); 1642cdf0e10cSrcweir } 1643cdf0e10cSrcweir 1644cdf0e10cSrcweir} 1645cdf0e10cSrcweir 1646cdf0e10cSrcweir################################################### 1647cdf0e10cSrcweir# Creating a xpd file for a copied package 1648cdf0e10cSrcweir################################################### 1649cdf0e10cSrcweir 1650cdf0e10cSrcweirsub create_xpd_file_for_childproject 1651cdf0e10cSrcweir{ 1652cdf0e10cSrcweir my ($module, $destdir, $packagename, $allvariableshashref, $modulesarrayref) = @_; 1653cdf0e10cSrcweir 1654cdf0e10cSrcweir my $modulegid = $module->{'gid'}; 1655cdf0e10cSrcweir 1656cdf0e10cSrcweir my $currentdir = cwd(); 1657cdf0e10cSrcweir $destdir =~ s/\/\s*$//; 1658cdf0e10cSrcweir $currentdir =~ s/\/\s*$//; 1659cdf0e10cSrcweir 1660cdf0e10cSrcweir my $completepackage = $currentdir . $installer::globals::separator . $destdir . $installer::globals::separator . $packagename; 1661cdf0e10cSrcweir 1662cdf0e10cSrcweir # all content saved in scp is now available and can be used to create the xpd file 1663cdf0e10cSrcweir my ( $xpdfile, $parentgid ) = get_file_content($module, $completepackage, "", 0, 0, "", 0, "", ""); 1664cdf0e10cSrcweir 1665cdf0e10cSrcweir my $xpdfilename = get_xpd_filename($modulegid, 0); 1666cdf0e10cSrcweir $xpdfilename = $installer::globals::xpddir . $installer::globals::separator . $xpdfilename; 1667cdf0e10cSrcweir 1668cdf0e10cSrcweir installer::files::save_file($xpdfilename, $xpdfile); 1669cdf0e10cSrcweir push( @installer::globals::createdxpdfiles, $modulegid); 1670cdf0e10cSrcweir push(@installer::globals::allxpdfiles, $xpdfilename); 1671cdf0e10cSrcweir my $infoline = "Saving xpd file: $xpdfilename\n"; 1672b274bc22SAndre Fischer $installer::logger::Lang->print($infoline); 1673cdf0e10cSrcweir 1674cdf0e10cSrcweir if ( $parentgid ne "root" ) 1675cdf0e10cSrcweir { 1676cdf0e10cSrcweir # my $create_missing_parent = is_empty_parent($parentgid, $allpackages); 1677cdf0e10cSrcweir my $create_missing_parent = 1; # -> Always missing parent by child projects! 1678cdf0e10cSrcweir # Parent is now created, if it was not created before. Attention: Parent module must not come later. 1679cdf0e10cSrcweir if (( $create_missing_parent ) && ( ! installer::existence::exists_in_array($parentgid, \@installer::globals::createdxpdfiles) )) 1680cdf0e10cSrcweir { 1681cdf0e10cSrcweir create_emptyparents_xpd_file($parentgid, $modulesarrayref, $installer::globals::xpddir); 1682cdf0e10cSrcweir } 1683cdf0e10cSrcweir } 1684cdf0e10cSrcweir} 1685cdf0e10cSrcweir 1686cdf0e10cSrcweir############################################################## 1687cdf0e10cSrcweir# Creating a xpd file for copied system integration package 1688cdf0e10cSrcweir############################################################## 1689cdf0e10cSrcweir 1690cdf0e10cSrcweirsub create_xpd_file_for_systemintegration 1691cdf0e10cSrcweir{ 1692cdf0e10cSrcweir my ($module, $newcontent, $modulesarrayref, $subdir) = @_; 1693cdf0e10cSrcweir 1694cdf0e10cSrcweir my $parentgid = $module->{'gid'}; 1695cdf0e10cSrcweir 1696cdf0e10cSrcweir # Create new visible module from scp info and create 1697cdf0e10cSrcweir # new hidden module for each package inside in tar file 1698cdf0e10cSrcweir 1699cdf0e10cSrcweir for ( my $i = 0; $i <= $#{$newcontent}; $i++ ) 1700cdf0e10cSrcweir { 1701cdf0e10cSrcweir my $newpackagename = ${$newcontent}[$i]; 1702cdf0e10cSrcweir 1703cdf0e10cSrcweir # installer::pathanalyzer::make_absolute_filename_to_relative_filename(\$newpackagename); 1704cdf0e10cSrcweir 1705cdf0e10cSrcweir my $infoline = "Creating xpd file for package: $newpackagename\n"; 1706b274bc22SAndre Fischer $installer::logger::Lang->print($infoline); 1707cdf0e10cSrcweir 1708cdf0e10cSrcweir my $childmodule = installer::worker::copy_hash_from_references($module); 1709cdf0e10cSrcweir $childmodule->{'ParentID'} = $module->{'gid'}; # the module gid is the new parent 1710cdf0e10cSrcweir $childmodule->{'InstallOrder'} = $installer::globals::defaultsystemintinstallorder; 1711cdf0e10cSrcweir my $number = $i + 1; 1712cdf0e10cSrcweir my $modulegid = $module->{'gid'} . "_child_" . $number; # setting a dynamic new gid 1713cdf0e10cSrcweir $childmodule->{'gid'} = $modulegid; 1714cdf0e10cSrcweir $childmodule->{'Styles'} =~ s/\)/\,HIDDEN_ROOT\)/; 1715cdf0e10cSrcweir # iterating over all languages to get names and descriptions 1716cdf0e10cSrcweir remove_lang_values($childmodule, "Name"); 1717cdf0e10cSrcweir remove_lang_values($childmodule, "Description"); 1718cdf0e10cSrcweir 1719cdf0e10cSrcweir my $shortpackagename = $newpackagename; 1720cdf0e10cSrcweir installer::pathanalyzer::make_absolute_filename_to_relative_filename(\$shortpackagename); 1721cdf0e10cSrcweir $childmodule->{'PackageName'} = $shortpackagename; 1722cdf0e10cSrcweir $childmodule->{'Name'} = $modulegid; 1723cdf0e10cSrcweir $childmodule->{'Description'} = $modulegid; 1724cdf0e10cSrcweir 1725cdf0e10cSrcweir # Checking, if installorder can be set: 1726cdf0e10cSrcweir # scp syntax: InstallOrder = "desktop:1050, suse:1060"; 1727cdf0e10cSrcweir # The string before the number can be compared with $shortpackagename 1728cdf0e10cSrcweir if ( $module->{'InstallOrder'} ) 1729cdf0e10cSrcweir { 1730cdf0e10cSrcweir my $installorder = $module->{'InstallOrder'}; 1731cdf0e10cSrcweir $installorder =~ s/^\s*\"//g; 1732cdf0e10cSrcweir $installorder =~ s/\"\s*$//g; 1733cdf0e10cSrcweir # $installorder is comma separated list 1734cdf0e10cSrcweir my $allorders = installer::converter::convert_stringlist_into_array(\$installorder, ","); 1735cdf0e10cSrcweir for ( my $j = 0; $j <= $#{$allorders}; $j++ ) 1736cdf0e10cSrcweir { 1737cdf0e10cSrcweir my $oneitem = ${$allorders}[$j]; 1738cdf0e10cSrcweir if ( $oneitem =~ /^\s*(\S+?)\s*:\s*(\S+?)\s*$/ ) 1739cdf0e10cSrcweir { 1740cdf0e10cSrcweir my $name = $1; 1741cdf0e10cSrcweir my $order = $2; 1742cdf0e10cSrcweir 1743cdf0e10cSrcweir if ( $shortpackagename =~ /\Q$name\E/ ) { $childmodule->{'InstallOrder'} = $order; } 1744cdf0e10cSrcweir } 1745cdf0e10cSrcweir } 1746cdf0e10cSrcweir } 1747cdf0e10cSrcweir 1748cdf0e10cSrcweir # all content saved in scp is now available and can be used to create the xpd file 1749cdf0e10cSrcweir my ( $xpdfile, $parentgid_ ) = get_file_content($childmodule, $newpackagename, "", 0, 0, $subdir, 0, "", ""); 1750cdf0e10cSrcweir 1751cdf0e10cSrcweir my $xpdfilename = get_xpd_filename($modulegid, 0); 1752cdf0e10cSrcweir $xpdfilename = $installer::globals::xpddir . $installer::globals::separator . $xpdfilename; 1753cdf0e10cSrcweir 1754cdf0e10cSrcweir installer::files::save_file($xpdfilename, $xpdfile); 1755cdf0e10cSrcweir push(@installer::globals::allxpdfiles, $xpdfilename); 1756cdf0e10cSrcweir $infoline = "Saving xpd file: $xpdfilename\n"; 1757b274bc22SAndre Fischer $installer::logger::Lang->print($infoline); 1758cdf0e10cSrcweir } 1759cdf0e10cSrcweir 1760cdf0e10cSrcweir # Creating the top level visible xpd file 1761cdf0e10cSrcweir create_emptyparents_xpd_file($parentgid, $modulesarrayref, $installer::globals::xpddir); 1762cdf0e10cSrcweir} 1763cdf0e10cSrcweir 1764cdf0e10cSrcweir############################################################## 1765cdf0e10cSrcweir# Copying xpd files into installation set 1766cdf0e10cSrcweir############################################################## 1767cdf0e10cSrcweir 1768cdf0e10cSrcweirsub copy_xpd_files 1769cdf0e10cSrcweir{ 1770cdf0e10cSrcweir my ( $destdir ) = @_; 1771cdf0e10cSrcweir 1772cdf0e10cSrcweir for ( my $i = 0; $i <= $#installer::globals::allxpdfiles; $i++ ) 1773cdf0e10cSrcweir { 1774cdf0e10cSrcweir if ( ! -f $installer::globals::allxpdfiles[$i] ) { installer::exiter::exit_program("ERROR: Could not find xpd file: $installer::globals::allxpdfiles[$i]!", "copy_xpd_files"); } 1775cdf0e10cSrcweir installer::systemactions::copy_one_file($installer::globals::allxpdfiles[$i], $destdir); 1776cdf0e10cSrcweir } 1777cdf0e10cSrcweir} 1778cdf0e10cSrcweir 1779cdf0e10cSrcweir############################################################## 1780cdf0e10cSrcweir# Copying all xpd files into the installation set 1781cdf0e10cSrcweir############################################################## 1782cdf0e10cSrcweir 1783cdf0e10cSrcweirsub copy_xpd_files_into_installset 1784cdf0e10cSrcweir{ 1785cdf0e10cSrcweir my ($installdir) = @_; 1786cdf0e10cSrcweir 1787cdf0e10cSrcweir $installdir =~ s/\Q$installer::globals::separator\E\s*$//; 1788cdf0e10cSrcweir 1789cdf0e10cSrcweir my $instdir = $installdir . $installer::globals::separator . "installdata"; 1790cdf0e10cSrcweir installer::systemactions::create_directory($instdir); 1791cdf0e10cSrcweir 1792cdf0e10cSrcweir my $xpddir = $instdir . $installer::globals::separator . "xpd"; 1793cdf0e10cSrcweir installer::systemactions::create_directory($xpddir); 1794cdf0e10cSrcweir copy_xpd_files($xpddir); 1795cdf0e10cSrcweir} 1796cdf0e10cSrcweir 1797cdf0e10cSrcweir############################################################## 1798cdf0e10cSrcweir# Creating base xpd file with product information 1799cdf0e10cSrcweir############################################################## 1800cdf0e10cSrcweir 1801cdf0e10cSrcweirsub create_setup_xpd 1802cdf0e10cSrcweir{ 1803cdf0e10cSrcweir my ($allvariables, $languagestringref) = @_; 1804cdf0e10cSrcweir 1805cdf0e10cSrcweir my ( $xpdfile ) = get_setup_file_content($allvariables, $languagestringref); 1806cdf0e10cSrcweir 1807cdf0e10cSrcweir my $xpdfilename = $installer::globals::productxpdfile; 1808cdf0e10cSrcweir $xpdfilename = $installer::globals::xpddir . $installer::globals::separator . $xpdfilename; 1809cdf0e10cSrcweir 1810cdf0e10cSrcweir installer::files::save_file($xpdfilename, $xpdfile); 1811cdf0e10cSrcweir push(@installer::globals::allxpdfiles, $xpdfilename); 1812cdf0e10cSrcweir my $infoline = "Saving xpd file: $xpdfilename\n"; 1813b274bc22SAndre Fischer $installer::logger::Lang->print($infoline); 1814cdf0e10cSrcweir} 1815cdf0e10cSrcweir 1816cdf0e10cSrcweir################################################### 1817cdf0e10cSrcweir# Copying the files needed by the xpd installer 1818cdf0e10cSrcweir# into the installation directory 1819cdf0e10cSrcweir################################################### 1820cdf0e10cSrcweir 1821cdf0e10cSrcweirsub create_xpd_installer 1822cdf0e10cSrcweir{ 1823cdf0e10cSrcweir my ( $installdir, $allvariables, $languagestringref) = @_; 1824cdf0e10cSrcweir 1825cdf0e10cSrcweir installer::logger::include_header_into_logfile("Creating xpd installer:"); 1826cdf0e10cSrcweir 1827cdf0e10cSrcweir # create setup.xpd file 1828cdf0e10cSrcweir create_setup_xpd($allvariables, $languagestringref); 1829cdf0e10cSrcweir 1830cdf0e10cSrcweir # copy xpd files into installation set 1831cdf0e10cSrcweir copy_xpd_files_into_installset($installdir); 1832cdf0e10cSrcweir} 1833cdf0e10cSrcweir 1834cdf0e10cSrcweir1; 1835