1*9780544fSAndrew Rist#************************************************************** 2*9780544fSAndrew Rist# 3*9780544fSAndrew Rist# Licensed to the Apache Software Foundation (ASF) under one 4*9780544fSAndrew Rist# or more contributor license agreements. See the NOTICE file 5*9780544fSAndrew Rist# distributed with this work for additional information 6*9780544fSAndrew Rist# regarding copyright ownership. The ASF licenses this file 7*9780544fSAndrew Rist# to you under the Apache License, Version 2.0 (the 8*9780544fSAndrew Rist# "License"); you may not use this file except in compliance 9*9780544fSAndrew Rist# with the License. You may obtain a copy of the License at 10*9780544fSAndrew Rist# 11*9780544fSAndrew Rist# http://www.apache.org/licenses/LICENSE-2.0 12*9780544fSAndrew Rist# 13*9780544fSAndrew Rist# Unless required by applicable law or agreed to in writing, 14*9780544fSAndrew Rist# software distributed under the License is distributed on an 15*9780544fSAndrew Rist# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 16*9780544fSAndrew Rist# KIND, either express or implied. See the License for the 17*9780544fSAndrew Rist# specific language governing permissions and limitations 18*9780544fSAndrew Rist# under the License. 19*9780544fSAndrew Rist# 20*9780544fSAndrew Rist#************************************************************** 21*9780544fSAndrew Rist 22*9780544fSAndrew Rist 23cdf0e10cSrcweir 24cdf0e10cSrcweirpackage installer::windows::idtglobal; 25cdf0e10cSrcweir 26cdf0e10cSrcweiruse Cwd; 27cdf0e10cSrcweiruse installer::converter; 28cdf0e10cSrcweiruse installer::existence; 29cdf0e10cSrcweiruse installer::exiter; 30cdf0e10cSrcweiruse installer::files; 31cdf0e10cSrcweiruse installer::globals; 32cdf0e10cSrcweiruse installer::pathanalyzer; 33cdf0e10cSrcweiruse installer::remover; 34cdf0e10cSrcweiruse installer::scriptitems; 35cdf0e10cSrcweiruse installer::systemactions; 36cdf0e10cSrcweiruse installer::windows::language; 37cdf0e10cSrcweir 38cdf0e10cSrcweir############################################################## 39cdf0e10cSrcweir# Shorten the gid for a feature. 40cdf0e10cSrcweir# Attention: Maximum length is 38 41cdf0e10cSrcweir############################################################## 42cdf0e10cSrcweir 43cdf0e10cSrcweirsub shorten_feature_gid 44cdf0e10cSrcweir{ 45cdf0e10cSrcweir my ($stringref) = @_; 46cdf0e10cSrcweir 47cdf0e10cSrcweir $$stringref =~ s/gid_Module_/gm_/; 48cdf0e10cSrcweir $$stringref =~ s/_Extension_/_ex_/; 49cdf0e10cSrcweir $$stringref =~ s/_Root_/_r_/; 50cdf0e10cSrcweir $$stringref =~ s/_Prg_/_p_/; 51cdf0e10cSrcweir $$stringref =~ s/_Optional_/_o_/; 52cdf0e10cSrcweir $$stringref =~ s/_Tools_/_tl_/; 53cdf0e10cSrcweir $$stringref =~ s/_Wrt_Flt_/_w_f_/; 54cdf0e10cSrcweir $$stringref =~ s/_Javafilter_/_jf_/; 55cdf0e10cSrcweir $$stringref =~ s/_Productivity_/_pr_/; 564f647325SEike Rathke $$stringref =~ s/_Replacement_/_rpl_/; 57cdf0e10cSrcweir} 58cdf0e10cSrcweir 59cdf0e10cSrcweir############################################ 60cdf0e10cSrcweir# Getting the next free number, that 61cdf0e10cSrcweir# can be added. 62cdf0e10cSrcweir# Sample: 01-44-~1.DAT, 01-44-~2.DAT, ... 63cdf0e10cSrcweir############################################ 64cdf0e10cSrcweir 65cdf0e10cSrcweirsub get_next_free_number 66cdf0e10cSrcweir{ 67cdf0e10cSrcweir my ($name, $shortnamesref) = @_; 68cdf0e10cSrcweir 69cdf0e10cSrcweir my $counter = 0; 70cdf0e10cSrcweir my $dontsave = 0; 71cdf0e10cSrcweir my $alreadyexists; 72cdf0e10cSrcweir my ($newname, $shortname); 73cdf0e10cSrcweir 74cdf0e10cSrcweir do 75cdf0e10cSrcweir { 76cdf0e10cSrcweir $alreadyexists = 0; 77cdf0e10cSrcweir $counter++; 78cdf0e10cSrcweir $newname = $name . $counter; 79cdf0e10cSrcweir 80cdf0e10cSrcweir for ( my $i = 0; $i <= $#{$shortnamesref}; $i++ ) 81cdf0e10cSrcweir { 82cdf0e10cSrcweir $shortname = ${$shortnamesref}[$i]; 83cdf0e10cSrcweir 84cdf0e10cSrcweir if ( uc($shortname) eq uc($newname) ) # case insensitive 85cdf0e10cSrcweir { 86cdf0e10cSrcweir $alreadyexists = 1; 87cdf0e10cSrcweir last; 88cdf0e10cSrcweir } 89cdf0e10cSrcweir } 90cdf0e10cSrcweir } 91cdf0e10cSrcweir until (!($alreadyexists)); 92cdf0e10cSrcweir 93cdf0e10cSrcweir if (( $counter > 9 ) && ( length($name) > 6 )) { $dontsave = 1; } 94cdf0e10cSrcweir if (( $counter > 99 ) && ( length($name) > 5 )) { $dontsave = 1; } 95cdf0e10cSrcweir 96cdf0e10cSrcweir if (!($dontsave)) 97cdf0e10cSrcweir { 98cdf0e10cSrcweir push(@{$shortnamesref}, $newname); # adding the new shortname to the array of shortnames 99cdf0e10cSrcweir } 100cdf0e10cSrcweir 101cdf0e10cSrcweir return $counter 102cdf0e10cSrcweir} 103cdf0e10cSrcweir 104cdf0e10cSrcweir############################################ 105cdf0e10cSrcweir# Getting the next free number, that 106cdf0e10cSrcweir# can be added. 107cdf0e10cSrcweir# Sample: 01-44-~1.DAT, 01-44-~2.DAT, ... 108cdf0e10cSrcweir############################################ 109cdf0e10cSrcweir 110cdf0e10cSrcweirsub get_next_free_number_with_hash 111cdf0e10cSrcweir{ 112cdf0e10cSrcweir my ($name, $shortnamesref, $ext) = @_; 113cdf0e10cSrcweir 114cdf0e10cSrcweir my $counter = 0; 115cdf0e10cSrcweir my $dontsave = 0; 116cdf0e10cSrcweir my $saved = 0; 117cdf0e10cSrcweir my $alreadyexists; 118cdf0e10cSrcweir my ($newname, $shortname); 119cdf0e10cSrcweir 120cdf0e10cSrcweir do 121cdf0e10cSrcweir { 122cdf0e10cSrcweir $alreadyexists = 0; 123cdf0e10cSrcweir $counter++; 124cdf0e10cSrcweir $newname = $name . $counter; 125cdf0e10cSrcweir $newname = uc($newname); # case insensitive, always upper case 126cdf0e10cSrcweir if ( exists($shortnamesref->{$newname}) || 127cdf0e10cSrcweir exists($installer::globals::savedrev83mapping{$newname.$ext}) ) 128cdf0e10cSrcweir { 129cdf0e10cSrcweir $alreadyexists = 1; 130cdf0e10cSrcweir } 131cdf0e10cSrcweir } 132cdf0e10cSrcweir until (!($alreadyexists)); 133cdf0e10cSrcweir 134cdf0e10cSrcweir if (( $counter > 9 ) && ( length($name) > 6 )) { $dontsave = 1; } 135cdf0e10cSrcweir if (( $counter > 99 ) && ( length($name) > 5 )) { $dontsave = 1; } 136cdf0e10cSrcweir 137cdf0e10cSrcweir if (!($dontsave)) 138cdf0e10cSrcweir { 139cdf0e10cSrcweir # push(@{$shortnamesref}, $newname); # adding the new shortname to the array of shortnames 140cdf0e10cSrcweir $shortnamesref->{$newname} = 1; # adding the new shortname to the array of shortnames, always uppercase 141cdf0e10cSrcweir $saved = 1; 142cdf0e10cSrcweir } 143cdf0e10cSrcweir 144cdf0e10cSrcweir return ( $counter, $saved ) 145cdf0e10cSrcweir} 146cdf0e10cSrcweir 147cdf0e10cSrcweir######################################### 148cdf0e10cSrcweir# 8.3 for filenames and directories 149cdf0e10cSrcweir######################################### 150cdf0e10cSrcweir 151cdf0e10cSrcweirsub make_eight_three_conform 152cdf0e10cSrcweir{ 153cdf0e10cSrcweir my ($inputstring, $pattern, $shortnamesref) = @_; 154cdf0e10cSrcweir 155cdf0e10cSrcweir # all shortnames are collected in $shortnamesref, because of uniqueness 156cdf0e10cSrcweir 157cdf0e10cSrcweir my ($name, $namelength, $number); 158cdf0e10cSrcweir my $conformstring = ""; 159cdf0e10cSrcweir my $changed = 0; 160cdf0e10cSrcweir 161cdf0e10cSrcweir if (( $inputstring =~ /^\s*(.*?)\.(.*?)\s*$/ ) && ( $pattern eq "file" )) # files with a dot 162cdf0e10cSrcweir { 163cdf0e10cSrcweir $name = $1; 164cdf0e10cSrcweir my $extension = $2; 165cdf0e10cSrcweir 166cdf0e10cSrcweir $namelength = length($name); 167cdf0e10cSrcweir my $extensionlength = length($extension); 168cdf0e10cSrcweir 169cdf0e10cSrcweir if ( $extensionlength > 3 ) 170cdf0e10cSrcweir { 171cdf0e10cSrcweir # simply taking the first three letters 172cdf0e10cSrcweir $extension = substr($extension, 0, 3); # name, offset, length 173cdf0e10cSrcweir } 174cdf0e10cSrcweir 175cdf0e10cSrcweir # Attention: readme.html -> README~1.HTM 176cdf0e10cSrcweir 177cdf0e10cSrcweir if (( $namelength > 8 ) || ( $extensionlength > 3 )) 178cdf0e10cSrcweir { 179cdf0e10cSrcweir # taking the first six letters 180cdf0e10cSrcweir $name = substr($name, 0, 6); # name, offset, length 181cdf0e10cSrcweir $name =~ s/\s*$//; # removing ending whitespaces 182cdf0e10cSrcweir $name = $name . "\~"; 183cdf0e10cSrcweir $number = get_next_free_number($name, $shortnamesref); 184cdf0e10cSrcweir 185cdf0e10cSrcweir # if $number>9 the new name would be "abcdef~10.xyz", which is 9+3, and therefore not allowed 186cdf0e10cSrcweir 187cdf0e10cSrcweir if ( $number > 9 ) 188cdf0e10cSrcweir { 189cdf0e10cSrcweir $name = substr($name, 0, 5); # name, offset, length 190cdf0e10cSrcweir $name =~ s/\s*$//; # removing ending whitespaces 191cdf0e10cSrcweir $name = $name . "\~"; 192cdf0e10cSrcweir $number = get_next_free_number($name, $shortnamesref); 193cdf0e10cSrcweir 194cdf0e10cSrcweir if ( $number > 99 ) 195cdf0e10cSrcweir { 196cdf0e10cSrcweir $name = substr($name, 0, 4); # name, offset, length 197cdf0e10cSrcweir $name =~ s/\s*$//; # removing ending whitespaces 198cdf0e10cSrcweir $name = $name . "\~"; 199cdf0e10cSrcweir $number = get_next_free_number($name, $shortnamesref); 200cdf0e10cSrcweir } 201cdf0e10cSrcweir } 202cdf0e10cSrcweir 203cdf0e10cSrcweir $name = $name . "$number"; 204cdf0e10cSrcweir 205cdf0e10cSrcweir $changed = 1; 206cdf0e10cSrcweir } 207cdf0e10cSrcweir 208cdf0e10cSrcweir $conformstring = $name . "\." . $extension; 209cdf0e10cSrcweir 210cdf0e10cSrcweir if ( $changed ) { $conformstring= uc($conformstring); } 211cdf0e10cSrcweir } 212cdf0e10cSrcweir else # no dot in filename or directory (also used for shortcuts) 213cdf0e10cSrcweir { 214cdf0e10cSrcweir $name = $inputstring; 215cdf0e10cSrcweir $namelength = length($name); 216cdf0e10cSrcweir 217cdf0e10cSrcweir if ( $namelength > 8 ) 218cdf0e10cSrcweir { 219cdf0e10cSrcweir # taking the first six letters 220cdf0e10cSrcweir $name = substr($name, 0, 6); # name, offset, length 221cdf0e10cSrcweir $name =~ s/\s*$//; # removing ending whitespaces 222cdf0e10cSrcweir $name = $name . "\~"; 223cdf0e10cSrcweir $number = get_next_free_number($name, $shortnamesref); 224cdf0e10cSrcweir 225cdf0e10cSrcweir # if $number>9 the new name would be "abcdef~10.xyz", which is 9+3, and therefore not allowed 226cdf0e10cSrcweir 227cdf0e10cSrcweir if ( $number > 9 ) 228cdf0e10cSrcweir { 229cdf0e10cSrcweir $name = substr($name, 0, 5); # name, offset, length 230cdf0e10cSrcweir $name =~ s/\s*$//; # removing ending whitespaces 231cdf0e10cSrcweir $name = $name . "\~"; 232cdf0e10cSrcweir $number = get_next_free_number($name, $shortnamesref); 233cdf0e10cSrcweir 234cdf0e10cSrcweir if ( $number > 99 ) 235cdf0e10cSrcweir { 236cdf0e10cSrcweir $name = substr($name, 0, 4); # name, offset, length 237cdf0e10cSrcweir $name =~ s/\s*$//; # removing ending whitespaces 238cdf0e10cSrcweir $name = $name . "\~"; 239cdf0e10cSrcweir $number = get_next_free_number($name, $shortnamesref); 240cdf0e10cSrcweir } 241cdf0e10cSrcweir } 242cdf0e10cSrcweir 243cdf0e10cSrcweir $name = $name . "$number"; 244cdf0e10cSrcweir $changed = 1; 245cdf0e10cSrcweir if ( $pattern eq "dir" ) { $name =~ s/\./\_/g; } # in directories replacing "." with "_" 246cdf0e10cSrcweir } 247cdf0e10cSrcweir 248cdf0e10cSrcweir $conformstring = $name; 249cdf0e10cSrcweir 250cdf0e10cSrcweir if ( $changed ) { $conformstring = uc($name); } 251cdf0e10cSrcweir } 252cdf0e10cSrcweir 253cdf0e10cSrcweir return $conformstring; 254cdf0e10cSrcweir} 255cdf0e10cSrcweir 256cdf0e10cSrcweir######################################### 257cdf0e10cSrcweir# 8.3 for filenames and directories 258cdf0e10cSrcweir# $shortnamesref is a hash in this case 259cdf0e10cSrcweir# -> performance reasons 260cdf0e10cSrcweir######################################### 261cdf0e10cSrcweir 262cdf0e10cSrcweirsub make_eight_three_conform_with_hash 263cdf0e10cSrcweir{ 264cdf0e10cSrcweir my ($inputstring, $pattern, $shortnamesref) = @_; 265cdf0e10cSrcweir 266cdf0e10cSrcweir # all shortnames are collected in $shortnamesref, because of uniqueness (a hash!) 267cdf0e10cSrcweir 268cdf0e10cSrcweir my ($name, $namelength, $number); 269cdf0e10cSrcweir my $conformstring = ""; 270cdf0e10cSrcweir my $changed = 0; 271cdf0e10cSrcweir my $saved; 272cdf0e10cSrcweir 273cdf0e10cSrcweir # if (( $inputstring =~ /^\s*(.*?)\.(.*?)\s*$/ ) && ( $pattern eq "file" )) # files with a dot 274cdf0e10cSrcweir if (( $inputstring =~ /^\s*(.*)\.(.*?)\s*$/ ) && ( $pattern eq "file" )) # files with a dot 275cdf0e10cSrcweir { 276cdf0e10cSrcweir # extension has to be non-greedy, but name is. This is important to find the last dot in the filename 277cdf0e10cSrcweir $name = $1; 278cdf0e10cSrcweir my $extension = $2; 279cdf0e10cSrcweir 280cdf0e10cSrcweir if ( $name =~ /^\s*(.*?)\s*$/ ) { $name = $1; } # now the name is also non-greedy 281cdf0e10cSrcweir $name =~ s/\.//g; # no dots in 8+3 conform filename 282cdf0e10cSrcweir 283cdf0e10cSrcweir $namelength = length($name); 284cdf0e10cSrcweir my $extensionlength = length($extension); 285cdf0e10cSrcweir 286cdf0e10cSrcweir if ( $extensionlength > 3 ) 287cdf0e10cSrcweir { 288cdf0e10cSrcweir # simply taking the first three letters 289cdf0e10cSrcweir $extension = substr($extension, 0, 3); # name, offset, length 290cdf0e10cSrcweir $changed = 1; 291cdf0e10cSrcweir } 292cdf0e10cSrcweir 293cdf0e10cSrcweir # Attention: readme.html -> README~1.HTM 294cdf0e10cSrcweir 295cdf0e10cSrcweir if (( $namelength > 8 ) || ( $extensionlength > 3 )) 296cdf0e10cSrcweir { 297cdf0e10cSrcweir # taking the first six letters, if filename is longer than 6 characters 298cdf0e10cSrcweir if ( $namelength > 6 ) 299cdf0e10cSrcweir { 300cdf0e10cSrcweir $name = substr($name, 0, 6); # name, offset, length 301cdf0e10cSrcweir $name =~ s/\s*$//; # removing ending whitespaces 302cdf0e10cSrcweir $name = $name . "\~"; 303cdf0e10cSrcweir ($number, $saved) = get_next_free_number_with_hash($name, $shortnamesref, '.'.uc($extension)); 304cdf0e10cSrcweir 305cdf0e10cSrcweir # if $number>9 the new name would be "abcdef~10.xyz", which is 9+3, and therefore not allowed 306cdf0e10cSrcweir 307cdf0e10cSrcweir if ( ! $saved ) 308cdf0e10cSrcweir { 309cdf0e10cSrcweir $name = substr($name, 0, 5); # name, offset, length 310cdf0e10cSrcweir $name =~ s/\s*$//; # removing ending whitespaces 311cdf0e10cSrcweir $name = $name . "\~"; 312cdf0e10cSrcweir ($number, $saved) = get_next_free_number_with_hash($name, $shortnamesref, '.'.uc($extension)); 313cdf0e10cSrcweir 314cdf0e10cSrcweir # if $number>99 the new name would be "abcde~100.xyz", which is 9+3, and therefore not allowed 315cdf0e10cSrcweir 316cdf0e10cSrcweir if ( ! $saved ) 317cdf0e10cSrcweir { 318cdf0e10cSrcweir $name = substr($name, 0, 4); # name, offset, length 319cdf0e10cSrcweir $name =~ s/\s*$//; # removing ending whitespaces 320cdf0e10cSrcweir $name = $name . "\~"; 321cdf0e10cSrcweir ($number, $saved) = get_next_free_number_with_hash($name, $shortnamesref, '.'.uc($extension)); 322cdf0e10cSrcweir 323cdf0e10cSrcweir if ( ! $saved ) 324cdf0e10cSrcweir { 325cdf0e10cSrcweir installer::exiter::exit_program("ERROR: Could not set 8+3 conform name for $inputstring !", "make_eight_three_conform_with_hash"); 326cdf0e10cSrcweir } 327cdf0e10cSrcweir } 328cdf0e10cSrcweir } 329cdf0e10cSrcweir 330cdf0e10cSrcweir $name = $name . "$number"; 331cdf0e10cSrcweir $changed = 1; 332cdf0e10cSrcweir } 333cdf0e10cSrcweir } 334cdf0e10cSrcweir 335cdf0e10cSrcweir $conformstring = $name . "\." . $extension; 336cdf0e10cSrcweir 337cdf0e10cSrcweir if ( $changed ) { $conformstring= uc($conformstring); } 338cdf0e10cSrcweir } 339cdf0e10cSrcweir else # no dot in filename or directory (also used for shortcuts) 340cdf0e10cSrcweir { 341cdf0e10cSrcweir $name = $inputstring; 342cdf0e10cSrcweir $namelength = length($name); 343cdf0e10cSrcweir 344cdf0e10cSrcweir if ( $namelength > 8 ) 345cdf0e10cSrcweir { 346cdf0e10cSrcweir # taking the first six letters 347cdf0e10cSrcweir $name = substr($name, 0, 6); # name, offset, length 348cdf0e10cSrcweir $name =~ s/\s*$//; # removing ending whitespaces 349cdf0e10cSrcweir $name = $name . "\~"; 350cdf0e10cSrcweir ( $number, $saved ) = get_next_free_number_with_hash($name, $shortnamesref, ''); 351cdf0e10cSrcweir 352cdf0e10cSrcweir # if $number>9 the new name would be "abcdef~10", which is 9+0, and therefore not allowed 353cdf0e10cSrcweir 354cdf0e10cSrcweir if ( ! $saved ) 355cdf0e10cSrcweir { 356cdf0e10cSrcweir $name = substr($name, 0, 5); # name, offset, length 357cdf0e10cSrcweir $name =~ s/\s*$//; # removing ending whitespaces 358cdf0e10cSrcweir $name = $name . "\~"; 359cdf0e10cSrcweir ( $number, $saved ) = get_next_free_number_with_hash($name, $shortnamesref, ''); 360cdf0e10cSrcweir 361cdf0e10cSrcweir # if $number>99 the new name would be "abcde~100", which is 9+0, and therefore not allowed 362cdf0e10cSrcweir 363cdf0e10cSrcweir if ( ! $saved ) 364cdf0e10cSrcweir { 365cdf0e10cSrcweir $name = substr($name, 0, 4); # name, offset, length 366cdf0e10cSrcweir $name =~ s/\s*$//; # removing ending whitespaces 367cdf0e10cSrcweir $name = $name . "\~"; 368cdf0e10cSrcweir ( $number, $saved ) = get_next_free_number_with_hash($name, $shortnamesref, ''); 369cdf0e10cSrcweir 370cdf0e10cSrcweir if ( ! $saved ) { installer::exiter::exit_program("ERROR: Could not set 8+3 conform name for $inputstring !", "make_eight_three_conform_with_hash"); } 371cdf0e10cSrcweir } 372cdf0e10cSrcweir } 373cdf0e10cSrcweir 374cdf0e10cSrcweir $name = $name . "$number"; 375cdf0e10cSrcweir $changed = 1; 376cdf0e10cSrcweir if ( $pattern eq "dir" ) { $name =~ s/\./\_/g; } # in directories replacing "." with "_" 377cdf0e10cSrcweir } 378cdf0e10cSrcweir 379cdf0e10cSrcweir $conformstring = $name; 380cdf0e10cSrcweir 381cdf0e10cSrcweir if ( $changed ) { $conformstring = uc($name); } 382cdf0e10cSrcweir } 383cdf0e10cSrcweir 384cdf0e10cSrcweir return $conformstring; 385cdf0e10cSrcweir} 386cdf0e10cSrcweir 387cdf0e10cSrcweir######################################### 388cdf0e10cSrcweir# Writing the header for idt files 389cdf0e10cSrcweir######################################### 390cdf0e10cSrcweir 391cdf0e10cSrcweirsub write_idt_header 392cdf0e10cSrcweir{ 393cdf0e10cSrcweir my ($idtref, $definestring) = @_; 394cdf0e10cSrcweir 395cdf0e10cSrcweir my $oneline; 396cdf0e10cSrcweir 397cdf0e10cSrcweir if ( $definestring eq "file" ) 398cdf0e10cSrcweir { 399cdf0e10cSrcweir $oneline = "File\tComponent_\tFileName\tFileSize\tVersion\tLanguage\tAttributes\tSequence\n"; 400cdf0e10cSrcweir push(@{$idtref}, $oneline); 401cdf0e10cSrcweir $oneline = "s72\ts72\tl255\ti4\tS72\tS20\tI2\ti2\n"; 402cdf0e10cSrcweir push(@{$idtref}, $oneline); 403cdf0e10cSrcweir $oneline = "File\tFile\n"; 404cdf0e10cSrcweir push(@{$idtref}, $oneline); 405cdf0e10cSrcweir } 406cdf0e10cSrcweir 407cdf0e10cSrcweir if ( $definestring eq "filehash" ) 408cdf0e10cSrcweir { 409cdf0e10cSrcweir $oneline = "File_\tOptions\tHashPart1\tHashPart2\tHashPart3\tHashPart4\n"; 410cdf0e10cSrcweir push(@{$idtref}, $oneline); 411cdf0e10cSrcweir $oneline = "s72\ti2\ti4\ti4\ti4\ti4\n"; 412cdf0e10cSrcweir push(@{$idtref}, $oneline); 413cdf0e10cSrcweir $oneline = "MsiFileHash\tFile_\n"; 414cdf0e10cSrcweir push(@{$idtref}, $oneline); 415cdf0e10cSrcweir } 416cdf0e10cSrcweir 417cdf0e10cSrcweir if ( $definestring eq "directory" ) 418cdf0e10cSrcweir { 419cdf0e10cSrcweir $oneline = "Directory\tDirectory_Parent\tDefaultDir\n"; 420cdf0e10cSrcweir push(@{$idtref}, $oneline); 421cdf0e10cSrcweir $oneline = "s72\tS72\tl255\n"; 422cdf0e10cSrcweir push(@{$idtref}, $oneline); 423cdf0e10cSrcweir $oneline = "Directory\tDirectory\n"; 424cdf0e10cSrcweir push(@{$idtref}, $oneline); 425cdf0e10cSrcweir } 426cdf0e10cSrcweir 427cdf0e10cSrcweir if ( $definestring eq "component" ) 428cdf0e10cSrcweir { 429cdf0e10cSrcweir $oneline = "Component\tComponentId\tDirectory_\tAttributes\tCondition\tKeyPath\n"; 430cdf0e10cSrcweir push(@{$idtref}, $oneline); 431cdf0e10cSrcweir $oneline = "s72\tS38\ts72\ti2\tS255\tS72\n"; 432cdf0e10cSrcweir push(@{$idtref}, $oneline); 433cdf0e10cSrcweir $oneline = "Component\tComponent\n"; 434cdf0e10cSrcweir push(@{$idtref}, $oneline); 435cdf0e10cSrcweir } 436cdf0e10cSrcweir 437cdf0e10cSrcweir if ( $definestring eq "feature" ) 438cdf0e10cSrcweir { 439cdf0e10cSrcweir $oneline = "Feature\tFeature_Parent\tTitle\tDescription\tDisplay\tLevel\tDirectory_\tAttributes\n"; 440cdf0e10cSrcweir push(@{$idtref}, $oneline); 441cdf0e10cSrcweir $oneline = "s38\tS38\tL64\tL255\tI2\ti2\tS72\ti2\n"; 442cdf0e10cSrcweir push(@{$idtref}, $oneline); 443cdf0e10cSrcweir $oneline = "WINDOWSENCODINGTEMPLATE\tFeature\tFeature\n"; 444cdf0e10cSrcweir push(@{$idtref}, $oneline); 445cdf0e10cSrcweir } 446cdf0e10cSrcweir 447cdf0e10cSrcweir if ( $definestring eq "featurecomponent" ) 448cdf0e10cSrcweir { 449cdf0e10cSrcweir $oneline = "Feature_\tComponent_\n"; 450cdf0e10cSrcweir push(@{$idtref}, $oneline); 451cdf0e10cSrcweir $oneline = "s38\ts72\n"; 452cdf0e10cSrcweir push(@{$idtref}, $oneline); 453cdf0e10cSrcweir $oneline = "FeatureComponents\tFeature_\tComponent_\n"; 454cdf0e10cSrcweir push(@{$idtref}, $oneline); 455cdf0e10cSrcweir } 456cdf0e10cSrcweir 457cdf0e10cSrcweir if ( $definestring eq "media" ) 458cdf0e10cSrcweir { 459cdf0e10cSrcweir $oneline = "DiskId\tLastSequence\tDiskPrompt\tCabinet\tVolumeLabel\tSource\n"; 460cdf0e10cSrcweir push(@{$idtref}, $oneline); 461cdf0e10cSrcweir $oneline = "i2\ti2\tL64\tS255\tS32\tS72\n"; 462cdf0e10cSrcweir push(@{$idtref}, $oneline); 463cdf0e10cSrcweir $oneline = "Media\tDiskId\n"; 464cdf0e10cSrcweir push(@{$idtref}, $oneline); 465cdf0e10cSrcweir } 466cdf0e10cSrcweir 467cdf0e10cSrcweir if ( $definestring eq "font" ) 468cdf0e10cSrcweir { 469cdf0e10cSrcweir $oneline = "File_\tFontTitle\n"; 470cdf0e10cSrcweir push(@{$idtref}, $oneline); 471cdf0e10cSrcweir $oneline = "s72\tS128\n"; 472cdf0e10cSrcweir push(@{$idtref}, $oneline); 473cdf0e10cSrcweir $oneline = "Font\tFile_\n"; 474cdf0e10cSrcweir push(@{$idtref}, $oneline); 475cdf0e10cSrcweir } 476cdf0e10cSrcweir 477cdf0e10cSrcweir if ( $definestring eq "shortcut" ) 478cdf0e10cSrcweir { 479cdf0e10cSrcweir $oneline = "Shortcut\tDirectory_\tName\tComponent_\tTarget\tArguments\tDescription\tHotkey\tIcon_\tIconIndex\tShowCmd\tWkDir\n"; 480cdf0e10cSrcweir push(@{$idtref}, $oneline); 481cdf0e10cSrcweir $oneline = "s72\ts72\tl128\ts72\ts72\tS255\tL255\tI2\tS72\tI2\tI2\tS72\n"; 482cdf0e10cSrcweir push(@{$idtref}, $oneline); 483cdf0e10cSrcweir $oneline = "WINDOWSENCODINGTEMPLATE\tShortcut\tShortcut\n"; 484cdf0e10cSrcweir push(@{$idtref}, $oneline); 485cdf0e10cSrcweir } 486cdf0e10cSrcweir 487cdf0e10cSrcweir if ( $definestring eq "registry" ) 488cdf0e10cSrcweir { 489cdf0e10cSrcweir $oneline = "Registry\tRoot\tKey\tName\tValue\tComponent_\n"; 490cdf0e10cSrcweir push(@{$idtref}, $oneline); 491cdf0e10cSrcweir $oneline = "s72\ti2\tl255\tL255\tL0\ts72\n"; 492cdf0e10cSrcweir push(@{$idtref}, $oneline); 493cdf0e10cSrcweir $oneline = "Registry\tRegistry\n"; 494cdf0e10cSrcweir push(@{$idtref}, $oneline); 495cdf0e10cSrcweir } 496cdf0e10cSrcweir 497cdf0e10cSrcweir if ( $definestring eq "reg64" ) 498cdf0e10cSrcweir { 499cdf0e10cSrcweir $oneline = "Registry\tRoot\tKey\tName\tValue\tComponent_\n"; 500cdf0e10cSrcweir push(@{$idtref}, $oneline); 501cdf0e10cSrcweir $oneline = "s72\ti2\tl255\tL255\tL0\ts72\n"; 502cdf0e10cSrcweir push(@{$idtref}, $oneline); 503cdf0e10cSrcweir $oneline = "Reg64\tRegistry\n"; 504cdf0e10cSrcweir push(@{$idtref}, $oneline); 505cdf0e10cSrcweir } 506cdf0e10cSrcweir 507cdf0e10cSrcweir if ( $definestring eq "createfolder" ) 508cdf0e10cSrcweir { 509cdf0e10cSrcweir $oneline = "Directory_\tComponent_\n"; 510cdf0e10cSrcweir push(@{$idtref}, $oneline); 511cdf0e10cSrcweir $oneline = "s72\ts72\n"; 512cdf0e10cSrcweir push(@{$idtref}, $oneline); 513cdf0e10cSrcweir $oneline = "CreateFolder\tDirectory_\tComponent_\n"; 514cdf0e10cSrcweir push(@{$idtref}, $oneline); 515cdf0e10cSrcweir } 516cdf0e10cSrcweir 517cdf0e10cSrcweir if ( $definestring eq "removefile" ) 518cdf0e10cSrcweir { 519cdf0e10cSrcweir $oneline = "FileKey\tComponent_\tFileName\tDirProperty\tInstallMode\n"; 520cdf0e10cSrcweir push(@{$idtref}, $oneline); 521cdf0e10cSrcweir $oneline = "s72\ts72\tL255\ts72\ti2\n"; 522cdf0e10cSrcweir push(@{$idtref}, $oneline); 523cdf0e10cSrcweir $oneline = "RemoveFile\tFileKey\n"; 524cdf0e10cSrcweir push(@{$idtref}, $oneline); 525cdf0e10cSrcweir } 526cdf0e10cSrcweir 527cdf0e10cSrcweir if ( $definestring eq "upgrade" ) 528cdf0e10cSrcweir { 529cdf0e10cSrcweir $oneline = "UpgradeCode\tVersionMin\tVersionMax\tLanguage\tAttributes\tRemove\tActionProperty\n"; 530cdf0e10cSrcweir push(@{$idtref}, $oneline); 531cdf0e10cSrcweir $oneline = "s38\tS20\tS20\tS255\ti4\tS255\ts72\n"; 532cdf0e10cSrcweir push(@{$idtref}, $oneline); 533cdf0e10cSrcweir $oneline = "Upgrade\tUpgradeCode\tVersionMin\tVersionMax\tLanguage\tAttributes\n"; 534cdf0e10cSrcweir push(@{$idtref}, $oneline); 535cdf0e10cSrcweir } 536cdf0e10cSrcweir 537cdf0e10cSrcweir if ( $definestring eq "icon" ) 538cdf0e10cSrcweir { 539cdf0e10cSrcweir $oneline = "Name\tData\n"; 540cdf0e10cSrcweir push(@{$idtref}, $oneline); 541cdf0e10cSrcweir $oneline = "s72\tv0\n"; 542cdf0e10cSrcweir push(@{$idtref}, $oneline); 543cdf0e10cSrcweir $oneline = "Icon\tName\n"; 544cdf0e10cSrcweir push(@{$idtref}, $oneline); 545cdf0e10cSrcweir } 546cdf0e10cSrcweir 547cdf0e10cSrcweir if ( $definestring eq "inifile" ) 548cdf0e10cSrcweir { 549cdf0e10cSrcweir $oneline = "IniFile\tFileName\tDirProperty\tSection\tKey\tValue\tAction\tComponent_\n"; 550cdf0e10cSrcweir push(@{$idtref}, $oneline); 551cdf0e10cSrcweir $oneline = "s72\tl255\tS72\tl96\tl128\tl255\ti2\ts72\n"; 552cdf0e10cSrcweir push(@{$idtref}, $oneline); 553cdf0e10cSrcweir $oneline = "IniFile\tIniFile\n"; 554cdf0e10cSrcweir push(@{$idtref}, $oneline); 555cdf0e10cSrcweir } 556cdf0e10cSrcweir 557cdf0e10cSrcweir if ( $definestring eq "selfreg" ) 558cdf0e10cSrcweir { 559cdf0e10cSrcweir $oneline = "File_\tCost\n"; 560cdf0e10cSrcweir push(@{$idtref}, $oneline); 561cdf0e10cSrcweir $oneline = "s72\tI2\n"; 562cdf0e10cSrcweir push(@{$idtref}, $oneline); 563cdf0e10cSrcweir $oneline = "SelfReg\tFile_\n"; 564cdf0e10cSrcweir push(@{$idtref}, $oneline); 565cdf0e10cSrcweir } 566cdf0e10cSrcweir 567cdf0e10cSrcweir if ( $definestring eq "msiassembly" ) 568cdf0e10cSrcweir { 569cdf0e10cSrcweir $oneline = "Component_\tFeature_\tFile_Manifest\tFile_Application\tAttributes\n"; 570cdf0e10cSrcweir push(@{$idtref}, $oneline); 571cdf0e10cSrcweir $oneline = "s72\ts38\tS72\tS72\tI2\n"; 572cdf0e10cSrcweir push(@{$idtref}, $oneline); 573cdf0e10cSrcweir $oneline = "MsiAssembly\tComponent_\n"; 574cdf0e10cSrcweir push(@{$idtref}, $oneline); 575cdf0e10cSrcweir } 576cdf0e10cSrcweir 577cdf0e10cSrcweir if ( $definestring eq "msiassemblyname" ) 578cdf0e10cSrcweir { 579cdf0e10cSrcweir $oneline = "Component_\tName\tValue\n"; 580cdf0e10cSrcweir push(@{$idtref}, $oneline); 581cdf0e10cSrcweir $oneline = "s72\ts255\ts255\n"; 582cdf0e10cSrcweir push(@{$idtref}, $oneline); 583cdf0e10cSrcweir $oneline = "MsiAssemblyName\tComponent_\tName\n"; 584cdf0e10cSrcweir push(@{$idtref}, $oneline); 585cdf0e10cSrcweir } 586cdf0e10cSrcweir 587cdf0e10cSrcweir if ( $definestring eq "appsearch" ) 588cdf0e10cSrcweir { 589cdf0e10cSrcweir $oneline = "Property\tSignature_\n"; 590cdf0e10cSrcweir push(@{$idtref}, $oneline); 591cdf0e10cSrcweir $oneline = "s72\ts72\n"; 592cdf0e10cSrcweir push(@{$idtref}, $oneline); 593cdf0e10cSrcweir $oneline = "AppSearch\tProperty\tSignature_\n"; 594cdf0e10cSrcweir push(@{$idtref}, $oneline); 595cdf0e10cSrcweir } 596cdf0e10cSrcweir 597cdf0e10cSrcweir if ( $definestring eq "reglocat" ) 598cdf0e10cSrcweir { 599cdf0e10cSrcweir $oneline = "Signature_\tRoot\tKey\tName\tType\n"; 600cdf0e10cSrcweir push(@{$idtref}, $oneline); 601cdf0e10cSrcweir $oneline = "s72\ti2\ts255\tS255\tI2\n"; 602cdf0e10cSrcweir push(@{$idtref}, $oneline); 603cdf0e10cSrcweir $oneline = "RegLocator\tSignature_\n"; 604cdf0e10cSrcweir push(@{$idtref}, $oneline); 605cdf0e10cSrcweir } 606cdf0e10cSrcweir 607cdf0e10cSrcweir if ( $definestring eq "signatur" ) 608cdf0e10cSrcweir { 609cdf0e10cSrcweir $oneline = "Signature\tFileName\tMinVersion\tMaxVersion\tMinSize\tMaxSize\tMinDate\tMaxDate\tLanguages\n"; 610cdf0e10cSrcweir push(@{$idtref}, $oneline); 611cdf0e10cSrcweir $oneline = "s72\ts255\tS20\tS20\tI4\tI4\tI4\tI4\tS255\n"; 612cdf0e10cSrcweir push(@{$idtref}, $oneline); 613cdf0e10cSrcweir $oneline = "Signature\tSignature\n"; 614cdf0e10cSrcweir push(@{$idtref}, $oneline); 615cdf0e10cSrcweir } 616cdf0e10cSrcweir 617cdf0e10cSrcweir} 618cdf0e10cSrcweir 619cdf0e10cSrcweir############################################################## 620cdf0e10cSrcweir# Returning the name of the rranslation file for a 621cdf0e10cSrcweir# given language. 622cdf0e10cSrcweir# Sample: "01" oder "en-US" -> "1033.txt" 623cdf0e10cSrcweir############################################################## 624cdf0e10cSrcweir 625cdf0e10cSrcweirsub get_languagefilename 626cdf0e10cSrcweir{ 627cdf0e10cSrcweir my ($idtfilename, $basedir) = @_; 628cdf0e10cSrcweir 629cdf0e10cSrcweir # $idtfilename =~ s/\.idt/\.ulf/; 630cdf0e10cSrcweir $idtfilename =~ s/\.idt/\.mlf/; 631cdf0e10cSrcweir 632cdf0e10cSrcweir my $languagefilename = $basedir . $installer::globals::separator . $idtfilename; 633cdf0e10cSrcweir 634cdf0e10cSrcweir return $languagefilename; 635cdf0e10cSrcweir} 636cdf0e10cSrcweir 637cdf0e10cSrcweir############################################################## 638cdf0e10cSrcweir# Returning the complete block in all languages 639cdf0e10cSrcweir# for a specified string 640cdf0e10cSrcweir############################################################## 641cdf0e10cSrcweir 642cdf0e10cSrcweirsub get_language_block_from_language_file 643cdf0e10cSrcweir{ 644cdf0e10cSrcweir my ($searchstring, $languagefile) = @_; 645cdf0e10cSrcweir 646cdf0e10cSrcweir my @language_block = (); 647cdf0e10cSrcweir 648cdf0e10cSrcweir for ( my $i = 0; $i <= $#{$languagefile}; $i++ ) 649cdf0e10cSrcweir { 650cdf0e10cSrcweir if ( ${$languagefile}[$i] =~ /^\s*\[\s*$searchstring\s*\]\s*$/ ) 651cdf0e10cSrcweir { 652cdf0e10cSrcweir my $counter = $i; 653cdf0e10cSrcweir 654cdf0e10cSrcweir push(@language_block, ${$languagefile}[$counter]); 655cdf0e10cSrcweir $counter++; 656cdf0e10cSrcweir 657cdf0e10cSrcweir while (( $counter <= $#{$languagefile} ) && (!( ${$languagefile}[$counter] =~ /^\s*\[/ ))) 658cdf0e10cSrcweir { 659cdf0e10cSrcweir push(@language_block, ${$languagefile}[$counter]); 660cdf0e10cSrcweir $counter++; 661cdf0e10cSrcweir } 662cdf0e10cSrcweir 663cdf0e10cSrcweir last; 664cdf0e10cSrcweir } 665cdf0e10cSrcweir } 666cdf0e10cSrcweir 667cdf0e10cSrcweir return \@language_block; 668cdf0e10cSrcweir} 669cdf0e10cSrcweir 670cdf0e10cSrcweir############################################################## 671cdf0e10cSrcweir# Returning a specific language string from the block 672cdf0e10cSrcweir# of all translations 673cdf0e10cSrcweir############################################################## 674cdf0e10cSrcweir 675cdf0e10cSrcweirsub get_language_string_from_language_block 676cdf0e10cSrcweir{ 677cdf0e10cSrcweir my ($language_block, $language, $oldstring) = @_; 678cdf0e10cSrcweir 679cdf0e10cSrcweir my $newstring = ""; 680cdf0e10cSrcweir 681cdf0e10cSrcweir for ( my $i = 0; $i <= $#{$language_block}; $i++ ) 682cdf0e10cSrcweir { 683cdf0e10cSrcweir if ( ${$language_block}[$i] =~ /^\s*$language\s*\=\s*\"(.*)\"\s*$/ ) 684cdf0e10cSrcweir { 685cdf0e10cSrcweir $newstring = $1; 686cdf0e10cSrcweir last; 687cdf0e10cSrcweir } 688cdf0e10cSrcweir } 689cdf0e10cSrcweir 690cdf0e10cSrcweir if ( $newstring eq "" ) 691cdf0e10cSrcweir { 692cdf0e10cSrcweir $language = "en-US"; # defaulting to english 693cdf0e10cSrcweir 694cdf0e10cSrcweir for ( my $i = 0; $i <= $#{$language_block}; $i++ ) 695cdf0e10cSrcweir { 696cdf0e10cSrcweir if ( ${$language_block}[$i] =~ /^\s*$language\s*\=\s*\"(.*)\"\s*$/ ) 697cdf0e10cSrcweir { 698cdf0e10cSrcweir $newstring = $1; 699cdf0e10cSrcweir last; 700cdf0e10cSrcweir } 701cdf0e10cSrcweir } 702cdf0e10cSrcweir } 703cdf0e10cSrcweir 704cdf0e10cSrcweir return $newstring; 705cdf0e10cSrcweir} 706cdf0e10cSrcweir 707cdf0e10cSrcweir############################################################## 708cdf0e10cSrcweir# Returning a specific code from the block 709cdf0e10cSrcweir# of all codes. No defaulting to english! 710cdf0e10cSrcweir############################################################## 711cdf0e10cSrcweir 712cdf0e10cSrcweirsub get_code_from_code_block 713cdf0e10cSrcweir{ 714cdf0e10cSrcweir my ($codeblock, $language) = @_; 715cdf0e10cSrcweir 716cdf0e10cSrcweir my $newstring = ""; 717cdf0e10cSrcweir 718cdf0e10cSrcweir for ( my $i = 0; $i <= $#{$codeblock}; $i++ ) 719cdf0e10cSrcweir { 720cdf0e10cSrcweir if ( ${$codeblock}[$i] =~ /^\s*$language\s*\=\s*\"(.*)\"\s*$/ ) 721cdf0e10cSrcweir { 722cdf0e10cSrcweir $newstring = $1; 723cdf0e10cSrcweir last; 724cdf0e10cSrcweir } 725cdf0e10cSrcweir } 726cdf0e10cSrcweir 727cdf0e10cSrcweir return $newstring; 728cdf0e10cSrcweir} 729cdf0e10cSrcweir 730cdf0e10cSrcweir############################################################## 731cdf0e10cSrcweir# Translating an idt file 732cdf0e10cSrcweir############################################################## 733cdf0e10cSrcweir 734cdf0e10cSrcweirsub translate_idtfile 735cdf0e10cSrcweir{ 736cdf0e10cSrcweir my ($idtfile, $languagefile, $onelanguage) = @_; 737cdf0e10cSrcweir 738cdf0e10cSrcweir for ( my $i = 0; $i <= $#{$idtfile}; $i++ ) 739cdf0e10cSrcweir { 740cdf0e10cSrcweir my @allstrings = (); 741cdf0e10cSrcweir 742cdf0e10cSrcweir my $oneline = ${$idtfile}[$i]; 743cdf0e10cSrcweir 744cdf0e10cSrcweir while ( $oneline =~ /\b(OOO_\w+)\b/ ) 745cdf0e10cSrcweir { 746cdf0e10cSrcweir my $replacestring = $1; 747cdf0e10cSrcweir push(@allstrings, $replacestring); 748cdf0e10cSrcweir $oneline =~ s/$replacestring//; 749cdf0e10cSrcweir } 750cdf0e10cSrcweir 751cdf0e10cSrcweir my $oldstring; 752cdf0e10cSrcweir 753cdf0e10cSrcweir foreach $oldstring (@allstrings) 754cdf0e10cSrcweir { 755cdf0e10cSrcweir my $language_block = get_language_block_from_language_file($oldstring, $languagefile); 756cdf0e10cSrcweir my $newstring = get_language_string_from_language_block($language_block, $onelanguage, $oldstring); 757cdf0e10cSrcweir 758cdf0e10cSrcweir # if (!( $newstring eq "" )) { ${$idtfile}[$i] =~ s/$oldstring/$newstring/; } 759cdf0e10cSrcweir ${$idtfile}[$i] =~ s/$oldstring/$newstring/; # always substitute, even if $newstring eq "" (there are empty strings for control.idt) 760cdf0e10cSrcweir } 761cdf0e10cSrcweir } 762cdf0e10cSrcweir} 763cdf0e10cSrcweir 764cdf0e10cSrcweir############################################################## 765cdf0e10cSrcweir# Copying all needed files to create a msi database 766cdf0e10cSrcweir# into one language specific directory 767cdf0e10cSrcweir############################################################## 768cdf0e10cSrcweir 769cdf0e10cSrcweirsub prepare_language_idt_directory 770cdf0e10cSrcweir{ 771cdf0e10cSrcweir my ($destinationdir, $newidtdir, $onelanguage, $filesref, $iconfilecollector, $binarytablefiles, $allvariables) = @_; 772cdf0e10cSrcweir 773cdf0e10cSrcweir # Copying all idt-files from the source $installer::globals::idttemplatepath to the destination $destinationdir 774cdf0e10cSrcweir # Copying all files in the subdirectory "Binary" 775cdf0e10cSrcweir # Copying all files in the subdirectory "Icon" 776cdf0e10cSrcweir 777cdf0e10cSrcweir my $infoline = ""; 778cdf0e10cSrcweir 779cdf0e10cSrcweir installer::systemactions::copy_directory($installer::globals::idttemplatepath, $destinationdir); 780cdf0e10cSrcweir 781cdf0e10cSrcweir if ( -d $installer::globals::idttemplatepath . $installer::globals::separator . "Binary") 782cdf0e10cSrcweir { 783cdf0e10cSrcweir installer::systemactions::create_directory($destinationdir . $installer::globals::separator . "Binary"); 784cdf0e10cSrcweir installer::systemactions::copy_directory($installer::globals::idttemplatepath . $installer::globals::separator . "Binary", $destinationdir . $installer::globals::separator . "Binary"); 785cdf0e10cSrcweir 786cdf0e10cSrcweir if ((( $installer::globals::patch ) && ( $allvariables->{'WINDOWSPATCHBITMAPDIRECTORY'} )) || ( $allvariables->{'WINDOWSBITMAPDIRECTORY'} )) 787cdf0e10cSrcweir { 788cdf0e10cSrcweir my $bitmapdir = ""; 789cdf0e10cSrcweir if ( $allvariables->{'WINDOWSPATCHBITMAPDIRECTORY'} ) { $bitmapdir = $allvariables->{'WINDOWSPATCHBITMAPDIRECTORY'}; } 790cdf0e10cSrcweir if ( $allvariables->{'WINDOWSBITMAPDIRECTORY'} ) { $bitmapdir = $allvariables->{'WINDOWSBITMAPDIRECTORY'}; } 791cdf0e10cSrcweir 792cdf0e10cSrcweir my $newsourcedir = $installer::globals::unpackpath . $installer::globals::separator . $bitmapdir; # path setting in list file dependent from unpackpath !? 793cdf0e10cSrcweir $infoline = "\nOverwriting files in directory \"" . $destinationdir . $installer::globals::separator . "Binary" . "\" with files from directory \"" . $newsourcedir . "\".\n"; 794cdf0e10cSrcweir push( @installer::globals::logfileinfo, $infoline); 795cdf0e10cSrcweir if ( ! -d $newsourcedir ) 796cdf0e10cSrcweir { 797cdf0e10cSrcweir my $currentdir = cwd(); 798cdf0e10cSrcweir installer::exiter::exit_program("ERROR: Directory $newsourcedir does not exist! Current directory is: $currentdir", "prepare_language_idt_directory"); 799cdf0e10cSrcweir } 800cdf0e10cSrcweir installer::systemactions::copy_directory($newsourcedir, $destinationdir . $installer::globals::separator . "Binary"); 801cdf0e10cSrcweir } 802cdf0e10cSrcweir } 803cdf0e10cSrcweir 804cdf0e10cSrcweir installer::systemactions::create_directory($destinationdir . $installer::globals::separator . "Icon"); 805cdf0e10cSrcweir 806cdf0e10cSrcweir if ( -d $installer::globals::idttemplatepath . $installer::globals::separator . "Icon") 807cdf0e10cSrcweir { 808cdf0e10cSrcweir installer::systemactions::copy_directory($installer::globals::idttemplatepath . $installer::globals::separator . "Icon", $destinationdir . $installer::globals::separator . "Icon"); 809cdf0e10cSrcweir } 810cdf0e10cSrcweir 811cdf0e10cSrcweir # Copying all files in $iconfilecollector, that describe icons of folderitems 812cdf0e10cSrcweir 813cdf0e10cSrcweir for ( my $i = 0; $i <= $#{$iconfilecollector}; $i++ ) 814cdf0e10cSrcweir { 815cdf0e10cSrcweir my $iconfilename = ${$iconfilecollector}[$i]; 816cdf0e10cSrcweir installer::pathanalyzer::make_absolute_filename_to_relative_filename(\$iconfilename); 817cdf0e10cSrcweir installer::systemactions::copy_one_file(${$iconfilecollector}[$i], $destinationdir . $installer::globals::separator . "Icon" . $installer::globals::separator . $iconfilename); 818cdf0e10cSrcweir } 819cdf0e10cSrcweir 820cdf0e10cSrcweir # Copying all files in $binarytablefiles in the binary directory 821cdf0e10cSrcweir 822cdf0e10cSrcweir for ( my $i = 0; $i <= $#{$binarytablefiles}; $i++ ) 823cdf0e10cSrcweir { 824cdf0e10cSrcweir my $binaryfile = ${$binarytablefiles}[$i]; 825cdf0e10cSrcweir my $binaryfilepath = $binaryfile->{'sourcepath'}; 826cdf0e10cSrcweir my $binaryfilename = $binaryfilepath; 827cdf0e10cSrcweir installer::pathanalyzer::make_absolute_filename_to_relative_filename(\$binaryfilename); 828cdf0e10cSrcweir installer::systemactions::copy_one_file($binaryfilepath, $destinationdir . $installer::globals::separator . "Binary" . $installer::globals::separator . $binaryfilename); 829cdf0e10cSrcweir } 830cdf0e10cSrcweir 831cdf0e10cSrcweir # Copying all new created and language independent idt-files to the destination $destinationdir. 832cdf0e10cSrcweir # Example: "File.idt" 833cdf0e10cSrcweir 834cdf0e10cSrcweir installer::systemactions::copy_directory_with_fileextension($newidtdir, $destinationdir, "idt"); 835cdf0e10cSrcweir 836cdf0e10cSrcweir # Copying all new created and language dependent idt-files to the destination $destinationdir. 837cdf0e10cSrcweir # Example: "Feature.idt.01" 838cdf0e10cSrcweir 839cdf0e10cSrcweir installer::systemactions::copy_directory_with_fileextension($newidtdir, $destinationdir, $onelanguage); 840cdf0e10cSrcweir installer::systemactions::rename_files_with_fileextension($destinationdir, $onelanguage); 841cdf0e10cSrcweir 842cdf0e10cSrcweir} 843cdf0e10cSrcweir 844cdf0e10cSrcweir############################################################## 845cdf0e10cSrcweir# Returning the source path of the rtf licensefile for 846cdf0e10cSrcweir# a specified language 847cdf0e10cSrcweir############################################################## 848cdf0e10cSrcweir 849cdf0e10cSrcweirsub get_rtflicensefilesource 850cdf0e10cSrcweir{ 851cdf0e10cSrcweir my ($language, $includepatharrayref) = @_; 852cdf0e10cSrcweir 853cdf0e10cSrcweir my $licensefilename = "license_" . $language . ".rtf"; 854cdf0e10cSrcweir 855cdf0e10cSrcweir my $sourcefileref = installer::scriptitems::get_sourcepath_from_filename_and_includepath(\$licensefilename, $includepatharrayref, 1); 856cdf0e10cSrcweir 857cdf0e10cSrcweir if ($$sourcefileref eq "") { installer::exiter::exit_program("ERROR: Could not find $licensefilename!", "get_rtflicensefilesource"); } 858cdf0e10cSrcweir 859cdf0e10cSrcweir my $infoline = "Using licensefile: $$sourcefileref\n"; 860cdf0e10cSrcweir push( @installer::globals::logfileinfo, $infoline); 861cdf0e10cSrcweir 862cdf0e10cSrcweir return $$sourcefileref; 863cdf0e10cSrcweir} 864cdf0e10cSrcweir 865cdf0e10cSrcweir############################################################## 866cdf0e10cSrcweir# Returning the source path of the licensefile for 867cdf0e10cSrcweir# a specified language 868cdf0e10cSrcweir############################################################## 869cdf0e10cSrcweir 870cdf0e10cSrcweirsub get_licensefilesource 871cdf0e10cSrcweir{ 872cdf0e10cSrcweir my ($language, $filesref) = @_; 873cdf0e10cSrcweir 874cdf0e10cSrcweir my $licensefilename = "license_" . $language . ".txt"; 875cdf0e10cSrcweir my $sourcepath = ""; 876cdf0e10cSrcweir my $foundlicensefile = 0; 877cdf0e10cSrcweir 878cdf0e10cSrcweir for ( my $i = 0; $i <= $#{$filesref}; $i++ ) 879cdf0e10cSrcweir { 880cdf0e10cSrcweir my $onefile = ${$filesref}[$i]; 881cdf0e10cSrcweir my $filename = $onefile->{'Name'}; 882cdf0e10cSrcweir 883cdf0e10cSrcweir if ($filename eq $licensefilename) 884cdf0e10cSrcweir { 885cdf0e10cSrcweir $sourcepath = $onefile->{'sourcepath'}; 886cdf0e10cSrcweir $foundlicensefile = 1; 887cdf0e10cSrcweir last; 888cdf0e10cSrcweir } 889cdf0e10cSrcweir } 890cdf0e10cSrcweir 891cdf0e10cSrcweir if ( ! $foundlicensefile ) { installer::exiter::exit_program("ERROR: Did not find file $licensefilename in file collector!", "get_licensefilesource"); } 892cdf0e10cSrcweir 893cdf0e10cSrcweir return $sourcepath; 894cdf0e10cSrcweir} 895cdf0e10cSrcweir 896cdf0e10cSrcweir############################################################## 897cdf0e10cSrcweir# A simple converter to create the license text 898cdf0e10cSrcweir# in rtf format 899cdf0e10cSrcweir############################################################## 900cdf0e10cSrcweir 901cdf0e10cSrcweirsub get_rtf_licensetext 902cdf0e10cSrcweir{ 903cdf0e10cSrcweir my ($licensefile) = @_; 904cdf0e10cSrcweir 905cdf0e10cSrcweir # A very simple rtf converter 906cdf0e10cSrcweir 907cdf0e10cSrcweir # The static header 908cdf0e10cSrcweir 909cdf0e10cSrcweir my $rtf_licensetext = '{\rtf1\ansi\deff0'; 910cdf0e10cSrcweir $rtf_licensetext = $rtf_licensetext . '{\fonttbl{\f0\froman\fprq2\fcharset0 Times New Roman;}}'; 911cdf0e10cSrcweir $rtf_licensetext = $rtf_licensetext . '{\colortbl\red0\green0\blue0;\red255\green255\blue255;\red128\green128\blue128;}'; 912cdf0e10cSrcweir $rtf_licensetext = $rtf_licensetext . '{\stylesheet{\s1\snext1 Standard;}}'; 913cdf0e10cSrcweir $rtf_licensetext = $rtf_licensetext . '{\info{\comment StarWriter}{\vern5690}}\deftab709'; 914cdf0e10cSrcweir $rtf_licensetext = $rtf_licensetext . '{\*\pgdsctbl'; 915cdf0e10cSrcweir $rtf_licensetext = $rtf_licensetext . '{\pgdsc0\pgdscuse195\pgwsxn11905\pghsxn16837\marglsxn1134\margrsxn1134\margtsxn1134\margbsxn1134\pgdscnxt0 Standard;}}'; 916cdf0e10cSrcweir $rtf_licensetext = $rtf_licensetext . '\paperh16837\paperw11905\margl1134\margr1134\margt1134\margb1134\sectd\sbknone\pgwsxn11905\pghsxn16837\marglsxn1134\margrsxn1134\margtsxn1134\margbsxn1134\ftnbj\ftnstart1\ftnrstcont\ftnnar\aenddoc\aftnrstcont\aftnstart1\aftnnrlc'; 917cdf0e10cSrcweir $rtf_licensetext = $rtf_licensetext . '\pard\plain \s1'; 918cdf0e10cSrcweir 919cdf0e10cSrcweir for ( my $i = 0; $i <= $#{$licensefile}; $i++ ) 920cdf0e10cSrcweir { 921cdf0e10cSrcweir my $oneline = ${$licensefile}[$i]; 922cdf0e10cSrcweir # if ( $oneline =~ /^\s*$/ ) { $oneline = '\par'; } # empty lines 923cdf0e10cSrcweir 924cdf0e10cSrcweir if ( $i == 0 ) { $oneline =~ s/^\W*//; } 925cdf0e10cSrcweir 926cdf0e10cSrcweir $oneline =~ s/\t/ /g; # no tabs allowed, converting to four spaces 927cdf0e10cSrcweir $oneline =~ s/\n$//g; # no newline at line end 928cdf0e10cSrcweir 929cdf0e10cSrcweir# $oneline =~ s/�/\\\'e4/g; # converting "�" 930cdf0e10cSrcweir# $oneline =~ s/�/\\\'f6/g; # converting "�" 931cdf0e10cSrcweir# $oneline =~ s/�/\\\'fc/g; # converting "�" 932cdf0e10cSrcweir# $oneline =~ s/�/\\\'df/g; # converting "�" 933cdf0e10cSrcweir 934cdf0e10cSrcweir # german replacements 935cdf0e10cSrcweir 936cdf0e10cSrcweir $oneline =~ s/\�\�/\\\'c4/g; # converting "�" 937cdf0e10cSrcweir $oneline =~ s/\�\�/\\\'d6/g; # converting "�" 938cdf0e10cSrcweir $oneline =~ s/\�\�/\\\'dc/g; # converting "�" 939cdf0e10cSrcweir $oneline =~ s/\�\�/\\\'e4/g; # converting "�" 940cdf0e10cSrcweir $oneline =~ s/\�\�/\\\'f6/g; # converting "�" 941cdf0e10cSrcweir $oneline =~ s/\�\�/\\\'fc/g; # converting "�" 942cdf0e10cSrcweir $oneline =~ s/\�\�/\\\'df/g; # converting "�" 943cdf0e10cSrcweir 944cdf0e10cSrcweir # french replacements 945cdf0e10cSrcweir 946cdf0e10cSrcweir $oneline =~ s/\�\�/\\\'c9/g; 947cdf0e10cSrcweir $oneline =~ s/\�\�/\\\'c0/g; 948cdf0e10cSrcweir $oneline =~ s/\�\�/\\\'ab/g; 949cdf0e10cSrcweir $oneline =~ s/\�\�/\\\'bb/g; 950cdf0e10cSrcweir $oneline =~ s/\�\�/\\\'e9/g; 951cdf0e10cSrcweir $oneline =~ s/\�\�/\\\'e8/g; 952cdf0e10cSrcweir $oneline =~ s/\�\�/\\\'e0/g; 953cdf0e10cSrcweir $oneline =~ s/\�\�/\\\'f4/g; 954cdf0e10cSrcweir $oneline =~ s/\�\�/\\\'e7/g; 955cdf0e10cSrcweir $oneline =~ s/\�\�/\\\'ea/g; 956cdf0e10cSrcweir $oneline =~ s/\�\�/\\\'ca/g; 957cdf0e10cSrcweir $oneline =~ s/\�\�/\\\'fb/g; 958cdf0e10cSrcweir $oneline =~ s/\�\�/\\\'f9/g; 959cdf0e10cSrcweir $oneline =~ s/\�\�/\\\'ee/g; 960cdf0e10cSrcweir 961cdf0e10cSrcweir # quotation marks 962cdf0e10cSrcweir 963cdf0e10cSrcweir $oneline =~ s/\�\�\�/\\\'84/g; 964cdf0e10cSrcweir $oneline =~ s/\�\�\�/\\ldblquote/g; 965cdf0e10cSrcweir $oneline =~ s/\�\�\�/\\rquote/g; 966cdf0e10cSrcweir 967cdf0e10cSrcweir 968cdf0e10cSrcweir $oneline =~ s/\�\�/\\\~/g; 969cdf0e10cSrcweir 970cdf0e10cSrcweir $oneline = '\par ' . $oneline; 971cdf0e10cSrcweir 972cdf0e10cSrcweir $rtf_licensetext = $rtf_licensetext . $oneline; 973cdf0e10cSrcweir } 974cdf0e10cSrcweir 975cdf0e10cSrcweir # and the end 976cdf0e10cSrcweir 977cdf0e10cSrcweir $rtf_licensetext = $rtf_licensetext . '\par \par }'; 978cdf0e10cSrcweir 979cdf0e10cSrcweir return $rtf_licensetext; 980cdf0e10cSrcweir} 981cdf0e10cSrcweir 982cdf0e10cSrcweir############################################################## 983cdf0e10cSrcweir# A simple converter to create a license txt string from 984cdf0e10cSrcweir# the rtf format 985cdf0e10cSrcweir############################################################## 986cdf0e10cSrcweir 987cdf0e10cSrcweirsub make_string_licensetext 988cdf0e10cSrcweir{ 989cdf0e10cSrcweir my ($licensefile) = @_; 990cdf0e10cSrcweir 991cdf0e10cSrcweir my $rtf_licensetext = ""; 992cdf0e10cSrcweir 993cdf0e10cSrcweir for ( my $i = 0; $i <= $#{$licensefile}; $i++ ) 994cdf0e10cSrcweir { 995cdf0e10cSrcweir my $oneline = ${$licensefile}[$i]; 996cdf0e10cSrcweir $oneline =~ s/\s*$//g; # no whitespace at line end 997cdf0e10cSrcweir 998cdf0e10cSrcweir $rtf_licensetext = $rtf_licensetext . $oneline . " "; 999cdf0e10cSrcweir } 1000cdf0e10cSrcweir 1001cdf0e10cSrcweir return $rtf_licensetext; 1002cdf0e10cSrcweir} 1003cdf0e10cSrcweir 1004cdf0e10cSrcweir############################################################## 1005cdf0e10cSrcweir# Setting the path, where the soffice.exe is installed, into 1006cdf0e10cSrcweir# the CustomAction table 1007cdf0e10cSrcweir############################################################## 1008cdf0e10cSrcweir 1009cdf0e10cSrcweirsub add_officedir_to_database 1010cdf0e10cSrcweir{ 1011cdf0e10cSrcweir my ($basedir, $allvariables) = @_; 1012cdf0e10cSrcweir 1013cdf0e10cSrcweir my $customactionfilename = $basedir . $installer::globals::separator . "CustomAc.idt"; 1014cdf0e10cSrcweir 1015cdf0e10cSrcweir my $customacfile = installer::files::read_file($customactionfilename); 1016cdf0e10cSrcweir 1017cdf0e10cSrcweir my $found = 0; 1018cdf0e10cSrcweir 1019cdf0e10cSrcweir # Updating the values 1020cdf0e10cSrcweir 1021cdf0e10cSrcweir if ( $installer::globals::officeinstalldirectoryset ) 1022cdf0e10cSrcweir { 1023cdf0e10cSrcweir $found = 0; 1024cdf0e10cSrcweir 1025cdf0e10cSrcweir for ( my $i = 0; $i <= $#{$customacfile}; $i++ ) 1026cdf0e10cSrcweir { 1027cdf0e10cSrcweir if ( ${$customacfile}[$i] =~ /\bOFFICEDIRECTORYGID\b/ ) 1028cdf0e10cSrcweir { 1029cdf0e10cSrcweir ${$customacfile}[$i] =~ s/\bOFFICEDIRECTORYGID\b/$installer::globals::officeinstalldirectory/; 1030cdf0e10cSrcweir $found = 1; 1031cdf0e10cSrcweir } 1032cdf0e10cSrcweir } 1033cdf0e10cSrcweir 1034cdf0e10cSrcweir if (( ! $found ) && ( ! $allvariables->{'IGNOREDIRECTORYLAYER'} )) 1035cdf0e10cSrcweir { 1036cdf0e10cSrcweir installer::exiter::exit_program("ERROR: \"OFFICEDIRECTORYGID\" not found in \"$customactionfilename\" !", "add_officedir_to_database"); 1037cdf0e10cSrcweir } 1038cdf0e10cSrcweir } 1039cdf0e10cSrcweir 1040cdf0e10cSrcweir # Saving the file 1041cdf0e10cSrcweir 1042cdf0e10cSrcweir installer::files::save_file($customactionfilename ,$customacfile); 1043cdf0e10cSrcweir my $infoline = "Updated idt file: $customactionfilename\n"; 1044cdf0e10cSrcweir push(@installer::globals::logfileinfo, $infoline); 1045cdf0e10cSrcweir 1046cdf0e10cSrcweir} 1047cdf0e10cSrcweir 1048cdf0e10cSrcweir############################################################## 1049cdf0e10cSrcweir# Including the license text into the table control.idt 1050cdf0e10cSrcweir############################################################## 1051cdf0e10cSrcweir 1052cdf0e10cSrcweirsub add_licensefile_to_database 1053cdf0e10cSrcweir{ 1054cdf0e10cSrcweir my ($licensefile, $controltable) = @_; 1055cdf0e10cSrcweir 1056cdf0e10cSrcweir # Nine tabs before the license text and two tabs after it 1057cdf0e10cSrcweir # The license text has to be included into the dialog 1058cdf0e10cSrcweir # LicenseAgreement into the control Memo. 1059cdf0e10cSrcweir 1060cdf0e10cSrcweir my $foundlicenseline = 0; 1061cdf0e10cSrcweir my ($number, $line); 1062cdf0e10cSrcweir 1063cdf0e10cSrcweir for ( my $i = 0; $i <= $#{$controltable}; $i++ ) 1064cdf0e10cSrcweir { 1065cdf0e10cSrcweir $line = ${$controltable}[$i]; 1066cdf0e10cSrcweir 1067cdf0e10cSrcweir if ( $line =~ /^\s*\bLicenseAgreement\b\t\bMemo\t/ ) 1068cdf0e10cSrcweir { 1069cdf0e10cSrcweir $foundlicenseline = 1; 1070cdf0e10cSrcweir $number = $i; 1071cdf0e10cSrcweir last; 1072cdf0e10cSrcweir } 1073cdf0e10cSrcweir } 1074cdf0e10cSrcweir 1075cdf0e10cSrcweir if (!($foundlicenseline)) 1076cdf0e10cSrcweir { 1077cdf0e10cSrcweir installer::exiter::exit_program("ERROR: Line for license file in Control.idt not found!", "add_licensefile_to_database"); 1078cdf0e10cSrcweir } 1079cdf0e10cSrcweir else 1080cdf0e10cSrcweir { 1081cdf0e10cSrcweir my %control = (); 1082cdf0e10cSrcweir 1083cdf0e10cSrcweir if ( $line =~ /^\s*(.*?)\t(.*?)\t(.*?)\t(.*?)\t(.*?)\t(.*?)\t(.*?)\t(.*?)\t(.*?)\t(.*?)\t(.*?)\t(.*?)\s*$/ ) 1084cdf0e10cSrcweir { 1085cdf0e10cSrcweir $control{'Dialog_'} = $1; 1086cdf0e10cSrcweir $control{'Control'} = $2; 1087cdf0e10cSrcweir $control{'Type'} = $3; 1088cdf0e10cSrcweir $control{'X'} = $4; 1089cdf0e10cSrcweir $control{'Y'} = $5; 1090cdf0e10cSrcweir $control{'Width'} = $6; 1091cdf0e10cSrcweir $control{'Height'} = $7; 1092cdf0e10cSrcweir $control{'Attributes'} = $8; 1093cdf0e10cSrcweir $control{'Property'} = $9; 1094cdf0e10cSrcweir $control{'Text'} = $10; 1095cdf0e10cSrcweir $control{'Control_Next'} = $11; 1096cdf0e10cSrcweir $control{'Help'} = $12; 1097cdf0e10cSrcweir } 1098cdf0e10cSrcweir else 1099cdf0e10cSrcweir { 1100cdf0e10cSrcweir installer::exiter::exit_program("ERROR: Could not split line correctly!", "add_licensefile_to_database"); 1101cdf0e10cSrcweir } 1102cdf0e10cSrcweir 1103cdf0e10cSrcweir # my $licensetext = get_rtf_licensetext($licensefile); 1104cdf0e10cSrcweir my $licensetext = make_string_licensetext($licensefile); 1105cdf0e10cSrcweir 1106cdf0e10cSrcweir $control{'Text'} = $licensetext; 1107cdf0e10cSrcweir 1108cdf0e10cSrcweir my $newline = $control{'Dialog_'} . "\t" . $control{'Control'} . "\t" . $control{'Type'} . "\t" . 1109cdf0e10cSrcweir $control{'X'} . "\t" . $control{'Y'} . "\t" . $control{'Width'} . "\t" . 1110cdf0e10cSrcweir $control{'Height'} . "\t" . $control{'Attributes'} . "\t" . $control{'Property'} . "\t" . 1111cdf0e10cSrcweir $control{'Text'} . "\t" . $control{'Control_Next'} . "\t" . $control{'Help'} . "\n"; 1112cdf0e10cSrcweir 1113cdf0e10cSrcweir ${$controltable}[$number] = $newline 1114cdf0e10cSrcweir } 1115cdf0e10cSrcweir} 1116cdf0e10cSrcweir 1117cdf0e10cSrcweir################################################################################################ 1118cdf0e10cSrcweir# Including the checkboxes for the language selection dialog 1119cdf0e10cSrcweir# into the table control.idt . This is only relevant for 1120cdf0e10cSrcweir# multilingual installation sets. 1121cdf0e10cSrcweir# 1122cdf0e10cSrcweir# old: 1123cdf0e10cSrcweir# LanguageSelection CheckBox1 CheckBox 22 60 15 24 3 IS1033 CheckBox2 1124cdf0e10cSrcweir# LanguageSelection Text1 Text 40 60 70 15 65539 OOO_CONTROL_LANG_1033 1125cdf0e10cSrcweir# LanguageSelection CheckBox2 CheckBox 22 90 15 24 3 IS1031 Next 1126cdf0e10cSrcweir# LanguageSelection Text2 Text 40 90 70 15 65539 OOO_CONTROL_LANG_1031 1127cdf0e10cSrcweir# new: 1128cdf0e10cSrcweir# LanguageSelection CheckBox1 CheckBox 22 60 15 24 3 IS1033 Text CheckBox2 1129cdf0e10cSrcweir# LanguageSelection CheckBox2 CheckBox 22 90 15 24 3 IS1031 Text Next 1130cdf0e10cSrcweir################################################################################################ 1131cdf0e10cSrcweir 1132cdf0e10cSrcweirsub add_language_checkboxes_to_database 1133cdf0e10cSrcweir{ 1134cdf0e10cSrcweir my ($controltable, $languagesarrayref) = @_; 1135cdf0e10cSrcweir 1136cdf0e10cSrcweir # for each language, two lines have to be inserted 1137cdf0e10cSrcweir 1138cdf0e10cSrcweir for ( my $i = 0; $i <= $#{$languagesarrayref}; $i++ ) 1139cdf0e10cSrcweir { 1140cdf0e10cSrcweir my $last = 0; 1141cdf0e10cSrcweir if ( $i == $#{$languagesarrayref} ) { $last = 1; } # special handling for the last 1142cdf0e10cSrcweir 1143cdf0e10cSrcweir my $onelanguage = ${$languagesarrayref}[$i]; 1144cdf0e10cSrcweir my $windowslanguage = installer::windows::language::get_windows_language($onelanguage); 1145cdf0e10cSrcweir 1146cdf0e10cSrcweir # my $is_english = 0; 1147cdf0e10cSrcweir # if ( $windowslanguage eq "1033" ) { $is_english = 1; } 1148cdf0e10cSrcweir 1149cdf0e10cSrcweir my $checkboxattribute = "3"; 1150cdf0e10cSrcweir # if ( $is_english ) { $checkboxattribute = "1"; } # english is not deselectable 1151cdf0e10cSrcweir 1152cdf0e10cSrcweir my $count = $i + 1; 1153cdf0e10cSrcweir my $nextcount = $i + 2; 1154cdf0e10cSrcweir my $checkboxcount = "CheckBox" . $count; 1155cdf0e10cSrcweir 1156cdf0e10cSrcweir my $multiplier = 20; 1157cdf0e10cSrcweir my $offset = 60; 1158cdf0e10cSrcweir if ( $#{$languagesarrayref} > 7 ) 1159cdf0e10cSrcweir { 1160cdf0e10cSrcweir $multiplier = 15; # smaller differences for more than 7 languages 1161cdf0e10cSrcweir $offset = 50; # smaller offset for more than 7 languages 1162cdf0e10cSrcweir } 1163cdf0e10cSrcweir 1164cdf0e10cSrcweir my $yvalue = $offset + $i * $multiplier; 1165cdf0e10cSrcweir 1166cdf0e10cSrcweir my $property = "IS" . $windowslanguage; 1167cdf0e10cSrcweir # if ( ! exists($installer::globals::languageproperties{$property}) ) { installer::exiter::exit_program("ERROR: Could not find property \"$property\" in the list of language properties!", "add_language_checkboxes_to_database"); } 1168cdf0e10cSrcweir 1169cdf0e10cSrcweir my $controlnext = ""; 1170cdf0e10cSrcweir if ( $last ) { $controlnext = "Next"; } 1171cdf0e10cSrcweir else { $controlnext = "CheckBox" . $nextcount; } 1172cdf0e10cSrcweir 1173cdf0e10cSrcweir my $stringname = "OOO_CONTROL_LANG_" . $windowslanguage; 1174cdf0e10cSrcweir 1175cdf0e10cSrcweir my $line1 = "LanguageSelection" . "\t" . $checkboxcount . "\t" . "CheckBox" . "\t" . 1176cdf0e10cSrcweir "22" . "\t" . $yvalue . "\t" . "200" . "\t" . "15" . "\t" . $checkboxattribute . "\t" . 1177cdf0e10cSrcweir $property . "\t" . $stringname . "\t" . $controlnext . "\t" . "\n"; 1178cdf0e10cSrcweir 1179cdf0e10cSrcweir push(@{$controltable}, $line1); 1180cdf0e10cSrcweir 1181cdf0e10cSrcweir # my $textcount = "Text" . $count; 1182cdf0e10cSrcweir # my $stringname = "OOO_CONTROL_LANG_" . $windowslanguage; 1183cdf0e10cSrcweir # 1184cdf0e10cSrcweir # $yvalue = $yvalue + 2; # text 2 pixel lower than checkbox 1185cdf0e10cSrcweir # 1186cdf0e10cSrcweir # my $line2 = "LanguageSelection" . "\t" . $textcount . "\t" . "Text" . "\t" . 1187cdf0e10cSrcweir # "40" . "\t" . $yvalue . "\t" . "70" . "\t" . "15" . "\t" . "65539" . "\t" . 1188cdf0e10cSrcweir # "\t" . $stringname . "\t" . "\t" . "\n"; 1189cdf0e10cSrcweir # 1190cdf0e10cSrcweir # push(@{$controltable}, $line2); 1191cdf0e10cSrcweir } 1192cdf0e10cSrcweir} 1193cdf0e10cSrcweir 1194cdf0e10cSrcweir################################################################### 1195cdf0e10cSrcweir# Determining the last position in a sequencetable 1196cdf0e10cSrcweir# into the tables CustomAc.idt and InstallE.idt. 1197cdf0e10cSrcweir################################################################### 1198cdf0e10cSrcweir 1199cdf0e10cSrcweirsub get_last_position_in_sequencetable 1200cdf0e10cSrcweir{ 1201cdf0e10cSrcweir my ($sequencetable) = @_; 1202cdf0e10cSrcweir 1203cdf0e10cSrcweir my $position = 0; 1204cdf0e10cSrcweir 1205cdf0e10cSrcweir for ( my $i = 0; $i <= $#{$sequencetable}; $i++ ) 1206cdf0e10cSrcweir { 1207cdf0e10cSrcweir my $line = ${$sequencetable}[$i]; 1208cdf0e10cSrcweir 1209cdf0e10cSrcweir if ( $line =~ /^\s*\w+\t.*\t\s*(\d+)\s$/ ) 1210cdf0e10cSrcweir { 1211cdf0e10cSrcweir my $newposition = $1; 1212cdf0e10cSrcweir if ( $newposition > $position ) { $position = $newposition; } 1213cdf0e10cSrcweir } 1214cdf0e10cSrcweir } 1215cdf0e10cSrcweir 1216cdf0e10cSrcweir return $position; 1217cdf0e10cSrcweir} 1218cdf0e10cSrcweir 1219cdf0e10cSrcweir######################################################################### 1220cdf0e10cSrcweir# Determining the position of a specified Action in the sequencetable 1221cdf0e10cSrcweir######################################################################### 1222cdf0e10cSrcweir 1223cdf0e10cSrcweirsub get_position_in_sequencetable 1224cdf0e10cSrcweir{ 1225cdf0e10cSrcweir my ($action, $sequencetable) = @_; 1226cdf0e10cSrcweir 1227cdf0e10cSrcweir my $position = 0; 1228cdf0e10cSrcweir 1229cdf0e10cSrcweir $action =~ s/^\s*behind_//; 1230cdf0e10cSrcweir 1231cdf0e10cSrcweir for ( my $i = 0; $i <= $#{$sequencetable}; $i++ ) 1232cdf0e10cSrcweir { 1233cdf0e10cSrcweir my $line = ${$sequencetable}[$i]; 1234cdf0e10cSrcweir 1235cdf0e10cSrcweir if ( $line =~ /^\s*(\w+)\t.*\t\s*(\d+)\s$/ ) 1236cdf0e10cSrcweir { 1237cdf0e10cSrcweir my $compareaction = $1; 1238cdf0e10cSrcweir $position = $2; 1239cdf0e10cSrcweir if ( $compareaction eq $action ) { last; } 1240cdf0e10cSrcweir } 1241cdf0e10cSrcweir } 1242cdf0e10cSrcweir 1243cdf0e10cSrcweir return $position; 1244cdf0e10cSrcweir} 1245cdf0e10cSrcweir 1246cdf0e10cSrcweir################################################################################################ 1247cdf0e10cSrcweir# Including the CustomAction for the configuration 1248cdf0e10cSrcweir# into the tables CustomAc.idt and InstallE.idt. 1249cdf0e10cSrcweir# 1250cdf0e10cSrcweir# CustomAc.idt: ExecutePkgchk 82 pkgchk.exe -s 1251cdf0e10cSrcweir# InstallE.idt: ExecutePkgchk Not REMOVE="ALL" 3175 1252cdf0e10cSrcweir# 1253cdf0e10cSrcweir# CustomAc.idt: ExecuteQuickstart 82 install_quickstart.exe 1254cdf0e10cSrcweir# InstallE.idt: ExecuteQuickstart &gm_o_Quickstart=3 3200 1255cdf0e10cSrcweir# 1256cdf0e10cSrcweir# CustomAc.idt: ExecuteInstallRegsvrex 82 regsvrex.exe shlxthdl.dll 1257cdf0e10cSrcweir# InstallE.idt: ExecuteInstallRegsvrex Not REMOVE="ALL" 3225 1258cdf0e10cSrcweir# 1259cdf0e10cSrcweir# CustomAc.idt: ExecuteUninstallRegsvrex 82 regsvrex.exe /u shlxthdl.dll 1260cdf0e10cSrcweir# InstallE.idt: ExecuteUninstallRegsvrex REMOVE="ALL" 690 1261cdf0e10cSrcweir# 1262cdf0e10cSrcweir# CustomAc.idt: Regmsdocmsidll1 1 reg4msdocmsidll Reg4MsDocEntry 1263cdf0e10cSrcweir# InstallU.idt: Regmsdocmsidll1 Not REMOVE="ALL" 610 1264cdf0e10cSrcweir# 1265cdf0e10cSrcweir# CustomAc.idt: Regmsdocmsidll2 1 reg4msdocmsidll Reg4MsDocEntry 1266cdf0e10cSrcweir# InstallE.idt: Regmsdocmsidll2 Not REMOVE="ALL" 3160 1267cdf0e10cSrcweir################################################################################################ 1268cdf0e10cSrcweir 1269cdf0e10cSrcweirsub set_custom_action 1270cdf0e10cSrcweir{ 1271cdf0e10cSrcweir my ($customactionidttable, $actionname, $actionflags, $exefilename, $actionparameter, $inbinarytable, $filesref, $customactionidttablename, $styles) = @_; 1272cdf0e10cSrcweir 1273cdf0e10cSrcweir my $included_customaction = 0; 1274cdf0e10cSrcweir my $infoline = ""; 1275cdf0e10cSrcweir my $customaction_exefilename = $exefilename; 1276cdf0e10cSrcweir my $uniquename = ""; 1277cdf0e10cSrcweir 1278cdf0e10cSrcweir # when the style NO_FILE is set, no searching for the file is needed, no filtering is done, we can add that custom action 1279cdf0e10cSrcweir if ( $styles =~ /\bNO_FILE\b/ ) 1280cdf0e10cSrcweir { 1281cdf0e10cSrcweir my $line = $actionname . "\t" . $actionflags . "\t" . $customaction_exefilename . "\t" . $actionparameter . "\n"; 1282cdf0e10cSrcweir push(@{$customactionidttable}, $line); 1283cdf0e10cSrcweir 1284cdf0e10cSrcweir $infoline = "Added $actionname CustomAction into table $customactionidttablename (NO_FILE has been set)\n"; 1285cdf0e10cSrcweir push(@installer::globals::logfileinfo, $infoline); 1286cdf0e10cSrcweir 1287cdf0e10cSrcweir $included_customaction = 1; 1288cdf0e10cSrcweir return $included_customaction; 1289cdf0e10cSrcweir } 1290cdf0e10cSrcweir 1291cdf0e10cSrcweir # is the $exefilename a library that is included into the binary table 1292cdf0e10cSrcweir 1293cdf0e10cSrcweir if ( $inbinarytable ) { $customaction_exefilename =~ s/\.//; } # this is the entry in the binary table ("abc.dll" -> "abcdll") 1294cdf0e10cSrcweir 1295cdf0e10cSrcweir # is the $exefilename included into the product? 1296cdf0e10cSrcweir 1297cdf0e10cSrcweir my $contains_file = 0; 1298cdf0e10cSrcweir 1299cdf0e10cSrcweir # All files are located in $filesref and in @installer::globals::binarytableonlyfiles. 1300cdf0e10cSrcweir # Both must be added together 1301cdf0e10cSrcweir my $localfilesref = installer::converter::combine_arrays_from_references(\@installer::globals::binarytableonlyfiles, $filesref); 1302cdf0e10cSrcweir 1303cdf0e10cSrcweir for ( my $i = 0; $i <= $#{$localfilesref}; $i++ ) 1304cdf0e10cSrcweir { 1305cdf0e10cSrcweir my $onefile = ${$localfilesref}[$i]; 1306cdf0e10cSrcweir my $filename = ""; 1307cdf0e10cSrcweir if ( exists($onefile->{'Name'}) ) 1308cdf0e10cSrcweir { 1309cdf0e10cSrcweir $filename = $onefile->{'Name'}; 1310cdf0e10cSrcweir 1311cdf0e10cSrcweir if ( $filename eq $exefilename ) 1312cdf0e10cSrcweir { 1313cdf0e10cSrcweir $contains_file = 1; 1314cdf0e10cSrcweir $uniquename = ${$localfilesref}[$i]->{'uniquename'}; 1315cdf0e10cSrcweir last; 1316cdf0e10cSrcweir } 1317cdf0e10cSrcweir } 1318cdf0e10cSrcweir else 1319cdf0e10cSrcweir { 1320cdf0e10cSrcweir installer::exiter::exit_program("ERROR: Did not find \"Name\" for file \"$onefile->{'uniquename'}\" ($onefile->{'gid'})!", "set_custom_action"); 1321cdf0e10cSrcweir } 1322cdf0e10cSrcweir } 1323cdf0e10cSrcweir 1324cdf0e10cSrcweir if ( $contains_file ) 1325cdf0e10cSrcweir { 1326cdf0e10cSrcweir # Now the CustomAction can be included into the CustomAc.idt 1327cdf0e10cSrcweir 1328cdf0e10cSrcweir if ( ! $inbinarytable ) { $customaction_exefilename = $uniquename; } # the unique file name has to be added to the custom action table 1329cdf0e10cSrcweir 1330cdf0e10cSrcweir my $line = $actionname . "\t" . $actionflags . "\t" . $customaction_exefilename . "\t" . $actionparameter . "\n"; 1331cdf0e10cSrcweir push(@{$customactionidttable}, $line); 1332cdf0e10cSrcweir 1333cdf0e10cSrcweir $included_customaction = 1; 1334cdf0e10cSrcweir } 1335cdf0e10cSrcweir 1336cdf0e10cSrcweir if ( $included_customaction ) { $infoline = "Added $actionname CustomAction into table $customactionidttablename\n"; } 1337cdf0e10cSrcweir else { $infoline = "Did not add $actionname CustomAction into table $customactionidttablename\n"; } 1338cdf0e10cSrcweir push(@installer::globals::logfileinfo, $infoline); 1339cdf0e10cSrcweir 1340cdf0e10cSrcweir return $included_customaction; 1341cdf0e10cSrcweir} 1342cdf0e10cSrcweir 1343cdf0e10cSrcweir#################################################################### 1344cdf0e10cSrcweir# Adding a Custom Action to InstallExecuteTable or InstallUITable 1345cdf0e10cSrcweir#################################################################### 1346cdf0e10cSrcweir 1347cdf0e10cSrcweirsub add_custom_action_to_install_table 1348cdf0e10cSrcweir{ 1349cdf0e10cSrcweir my ($installtable, $exefilename, $actionname, $actioncondition, $position, $filesref, $installtablename, $styles) = @_; 1350cdf0e10cSrcweir 1351cdf0e10cSrcweir my $included_customaction = 0; 1352cdf0e10cSrcweir my $feature = ""; 1353cdf0e10cSrcweir my $infoline = ""; 1354cdf0e10cSrcweir 1355cdf0e10cSrcweir # when the style NO_FILE is set, no searching for the file is needed, no filtering is done, we can add that custom action 1356cdf0e10cSrcweir if ( $styles =~ /\bNO_FILE\b/ ) 1357cdf0e10cSrcweir { 1358cdf0e10cSrcweir # then the InstallE.idt.idt or InstallU.idt.idt 1359cdf0e10cSrcweir $actioncondition =~ s/FEATURETEMPLATE/$feature/g; # only execute Custom Action, if feature of the file is installed 1360cdf0e10cSrcweir 1361cdf0e10cSrcweir my $actionposition = 0; 1362cdf0e10cSrcweir 1363cdf0e10cSrcweir if ( $position eq "end" ) { $actionposition = get_last_position_in_sequencetable($installtable) + 25; } 1364cdf0e10cSrcweir elsif ( $position =~ /^\s*behind_/ ) { $actionposition = get_position_in_sequencetable($position, $installtable) + 2; } 1365cdf0e10cSrcweir else { $actionposition = get_position_in_sequencetable($position, $installtable) - 2; } 1366cdf0e10cSrcweir 1367cdf0e10cSrcweir my $line = $actionname . "\t" . $actioncondition . "\t" . $actionposition . "\n"; 1368cdf0e10cSrcweir push(@{$installtable}, $line); 1369cdf0e10cSrcweir 1370cdf0e10cSrcweir $infoline = "Added $actionname CustomAction into table $installtablename (NO_FILE has been set)\n"; 1371cdf0e10cSrcweir push(@installer::globals::logfileinfo, $infoline); 1372cdf0e10cSrcweir return; 1373cdf0e10cSrcweir } 1374cdf0e10cSrcweir 1375cdf0e10cSrcweir my $contains_file = 0; 1376cdf0e10cSrcweir 1377cdf0e10cSrcweir # All files are located in $filesref and in @installer::globals::binarytableonlyfiles. 1378cdf0e10cSrcweir # Both must be added together 1379cdf0e10cSrcweir my $localfilesref = installer::converter::combine_arrays_from_references(\@installer::globals::binarytableonlyfiles, $filesref); 1380cdf0e10cSrcweir 1381cdf0e10cSrcweir for ( my $i = 0; $i <= $#{$localfilesref}; $i++ ) 1382cdf0e10cSrcweir { 1383cdf0e10cSrcweir my $filename = ${$localfilesref}[$i]->{'Name'}; 1384cdf0e10cSrcweir 1385cdf0e10cSrcweir if ( $filename eq $exefilename ) 1386cdf0e10cSrcweir { 1387cdf0e10cSrcweir $contains_file = 1; 1388cdf0e10cSrcweir 1389cdf0e10cSrcweir # Determining the feature of the file 1390cdf0e10cSrcweir 1391cdf0e10cSrcweir if ( ${$localfilesref}[$i] ) { $feature = ${$localfilesref}[$i]->{'modules'}; } 1392cdf0e10cSrcweir 1393cdf0e10cSrcweir # If modules contains a list of modules, only taking the first one. 1394cdf0e10cSrcweir if ( $feature =~ /^\s*(.*?)\,/ ) { $feature = $1; } 1395cdf0e10cSrcweir # Attention: Maximum feature length is 38! 1396cdf0e10cSrcweir shorten_feature_gid(\$feature); 1397cdf0e10cSrcweir 1398cdf0e10cSrcweir last; 1399cdf0e10cSrcweir } 1400cdf0e10cSrcweir } 1401cdf0e10cSrcweir 1402cdf0e10cSrcweir if ( $contains_file ) 1403cdf0e10cSrcweir { 1404cdf0e10cSrcweir # then the InstallE.idt.idt or InstallU.idt.idt 1405cdf0e10cSrcweir 1406cdf0e10cSrcweir $actioncondition =~ s/FEATURETEMPLATE/$feature/g; # only execute Custom Action, if feature of the file is installed 1407cdf0e10cSrcweir 1408cdf0e10cSrcweir# my $actionposition = 0; 1409cdf0e10cSrcweir# if ( $position eq "end" ) { $actionposition = get_last_position_in_sequencetable($installtable) + 25; } 1410cdf0e10cSrcweir# elsif ( $position =~ /^\s*behind_/ ) { $actionposition = get_position_in_sequencetable($position, $installtable) + 2; } 1411cdf0e10cSrcweir# else { $actionposition = get_position_in_sequencetable($position, $installtable) - 2; } 1412cdf0e10cSrcweir# my $line = $actionname . "\t" . $actioncondition . "\t" . $actionposition . "\n"; 1413cdf0e10cSrcweir 1414cdf0e10cSrcweir my $positiontemplate = ""; 1415cdf0e10cSrcweir if ( $position =~ /^\s*\d+\s*$/ ) { $positiontemplate = $position; } # setting the position directly, number defined in scp2 1416cdf0e10cSrcweir else { $positiontemplate = "POSITIONTEMPLATE_" . $position; } 1417cdf0e10cSrcweir 1418cdf0e10cSrcweir my $line = $actionname . "\t" . $actioncondition . "\t" . $positiontemplate . "\n"; 1419cdf0e10cSrcweir push(@{$installtable}, $line); 1420cdf0e10cSrcweir 1421cdf0e10cSrcweir $included_customaction = 1; 1422cdf0e10cSrcweir } 1423cdf0e10cSrcweir 1424cdf0e10cSrcweir if ( $included_customaction ) { $infoline = "Added $actionname CustomAction into table $installtablename\n"; } 1425cdf0e10cSrcweir else { $infoline = "Did not add $actionname CustomAction into table $installtablename\n"; } 1426cdf0e10cSrcweir push(@installer::globals::logfileinfo, $infoline); 1427cdf0e10cSrcweir 1428cdf0e10cSrcweir} 1429cdf0e10cSrcweir 1430cdf0e10cSrcweir################################################################## 1431cdf0e10cSrcweir# A line in the table ControlEvent connects a Control 1432cdf0e10cSrcweir# with a Custom Action 1433cdf0e10cSrcweir################################################################# 1434cdf0e10cSrcweir 1435cdf0e10cSrcweirsub connect_custom_action_to_control 1436cdf0e10cSrcweir{ 1437cdf0e10cSrcweir my ( $table, $tablename, $dialog, $control, $event, $argument, $condition, $ordering) = @_; 1438cdf0e10cSrcweir 1439cdf0e10cSrcweir my $line = $dialog . "\t" . $control. "\t" . $event. "\t" . $argument. "\t" . $condition. "\t" . $ordering . "\n"; 1440cdf0e10cSrcweir 1441cdf0e10cSrcweir push(@{$table}, $line); 1442cdf0e10cSrcweir 1443cdf0e10cSrcweir $line =~ s/\s*$//g; 1444cdf0e10cSrcweir 1445cdf0e10cSrcweir $infoline = "Added line \"$line\" into table $tablename\n"; 1446cdf0e10cSrcweir push(@installer::globals::logfileinfo, $infoline); 1447cdf0e10cSrcweir} 1448cdf0e10cSrcweir 1449cdf0e10cSrcweir################################################################## 1450cdf0e10cSrcweir# A line in the table ControlCondition connects a Control state 1451cdf0e10cSrcweir# with a condition 1452cdf0e10cSrcweir################################################################## 1453cdf0e10cSrcweir 1454cdf0e10cSrcweirsub connect_condition_to_control 1455cdf0e10cSrcweir{ 1456cdf0e10cSrcweir my ( $table, $tablename, $dialog, $control, $event, $condition) = @_; 1457cdf0e10cSrcweir 1458cdf0e10cSrcweir my $line = $dialog . "\t" . $control. "\t" . $event. "\t" . $condition. "\n"; 1459cdf0e10cSrcweir 1460cdf0e10cSrcweir push(@{$table}, $line); 1461cdf0e10cSrcweir 1462cdf0e10cSrcweir $line =~ s/\s*$//g; 1463cdf0e10cSrcweir 1464cdf0e10cSrcweir $infoline = "Added line \"$line\" into table $tablename\n"; 1465cdf0e10cSrcweir push(@installer::globals::logfileinfo, $infoline); 1466cdf0e10cSrcweir} 1467cdf0e10cSrcweir 1468cdf0e10cSrcweir################################################################## 1469cdf0e10cSrcweir# Searching for a sequencenumber in InstallUISequence table 1470cdf0e10cSrcweir# "ExecuteAction" must be the last action 1471cdf0e10cSrcweir################################################################## 1472cdf0e10cSrcweir 1473cdf0e10cSrcweirsub get_free_number_in_uisequence_table 1474cdf0e10cSrcweir{ 1475cdf0e10cSrcweir my ( $installuitable ) = @_; 1476cdf0e10cSrcweir 1477cdf0e10cSrcweir # determining the sequence of "ExecuteAction" 1478cdf0e10cSrcweir 1479cdf0e10cSrcweir my $executeactionnumber = 0; 1480cdf0e10cSrcweir 1481cdf0e10cSrcweir for ( my $i = 0; $i <= $#{$installuitable}; $i++ ) 1482cdf0e10cSrcweir { 1483cdf0e10cSrcweir if ( ${$installuitable}[$i] =~ /^\s*(\w+)\t\w*\t(\d+)\s*$/ ) 1484cdf0e10cSrcweir { 1485cdf0e10cSrcweir my $actionname = $1; 1486cdf0e10cSrcweir my $actionnumber = $2; 1487cdf0e10cSrcweir 1488cdf0e10cSrcweir if ( $actionname eq "ExecuteAction" ) 1489cdf0e10cSrcweir { 1490cdf0e10cSrcweir $executeactionnumber = $actionnumber; 1491cdf0e10cSrcweir last; 1492cdf0e10cSrcweir } 1493cdf0e10cSrcweir } 1494cdf0e10cSrcweir } 1495cdf0e10cSrcweir 1496cdf0e10cSrcweir if ( $executeactionnumber == 0 ) { installer::exiter::exit_program("ERROR: Did not find \"ExecuteAction\" in InstallUISequence table!", "get_free_number_in_uisequence_table"); } 1497cdf0e10cSrcweir 1498cdf0e10cSrcweir # determining the sequence of the action before "ExecuteAction" 1499cdf0e10cSrcweir 1500cdf0e10cSrcweir my $lastactionnumber = 0; 1501cdf0e10cSrcweir 1502cdf0e10cSrcweir for ( my $i = 0; $i <= $#{$installuitable}; $i++ ) 1503cdf0e10cSrcweir { 1504cdf0e10cSrcweir if ( ${$installuitable}[$i] =~ /^\s*\w+\t\w*\t(\d+)\s*$/ ) 1505cdf0e10cSrcweir { 1506cdf0e10cSrcweir my $actionnumber = $1; 1507cdf0e10cSrcweir 1508cdf0e10cSrcweir if (( $actionnumber > $lastactionnumber ) && ( $actionnumber != $executeactionnumber )) 1509cdf0e10cSrcweir { 1510cdf0e10cSrcweir $lastactionnumber = $actionnumber; 1511cdf0e10cSrcweir } 1512cdf0e10cSrcweir } 1513cdf0e10cSrcweir } 1514cdf0e10cSrcweir 1515cdf0e10cSrcweir # the new number can now be calculated 1516cdf0e10cSrcweir 1517cdf0e10cSrcweir my $newnumber = 0; 1518cdf0e10cSrcweir 1519cdf0e10cSrcweir if ((( $lastactionnumber + $executeactionnumber ) % 2 ) == 0 ) { $newnumber = ( $lastactionnumber + $executeactionnumber ) / 2; } 1520cdf0e10cSrcweir else { $newnumber = ( $lastactionnumber + $executeactionnumber -1 ) / 2; } 1521cdf0e10cSrcweir 1522cdf0e10cSrcweir return $newnumber; 1523cdf0e10cSrcweir} 1524cdf0e10cSrcweir 1525cdf0e10cSrcweir################################################################## 1526cdf0e10cSrcweir# Searching for a specified string in the feature table 1527cdf0e10cSrcweir################################################################## 1528cdf0e10cSrcweir 1529cdf0e10cSrcweirsub get_feature_name 1530cdf0e10cSrcweir{ 1531cdf0e10cSrcweir my ( $string, $featuretable ) = @_; 1532cdf0e10cSrcweir 1533cdf0e10cSrcweir my $featurename = ""; 1534cdf0e10cSrcweir 1535cdf0e10cSrcweir for ( my $i = 0; $i <= $#{$featuretable}; $i++ ) 1536cdf0e10cSrcweir { 1537cdf0e10cSrcweir if ( ${$featuretable}[$i] =~ /^\s*(\w+$string)\t/ ) 1538cdf0e10cSrcweir { 1539cdf0e10cSrcweir $featurename = $1; 1540cdf0e10cSrcweir last; 1541cdf0e10cSrcweir } 1542cdf0e10cSrcweir } 1543cdf0e10cSrcweir 1544cdf0e10cSrcweir return $featurename; 1545cdf0e10cSrcweir} 1546cdf0e10cSrcweir 1547cdf0e10cSrcweir###################################################################### 1548cdf0e10cSrcweir# Returning the toplevel directory name of one specific file 1549cdf0e10cSrcweir###################################################################### 1550cdf0e10cSrcweir 1551cdf0e10cSrcweirsub get_directory_name_from_file 1552cdf0e10cSrcweir{ 1553cdf0e10cSrcweir my ($onefile) = @_; 1554cdf0e10cSrcweir 1555cdf0e10cSrcweir my $destination = $onefile->{'destination'}; 1556cdf0e10cSrcweir my $name = $onefile->{'Name'}; 1557cdf0e10cSrcweir 1558cdf0e10cSrcweir $destination =~ s/\Q$name\E\s*$//; 1559cdf0e10cSrcweir $destination =~ s/\Q$installer::globals::separator\E\s*$//; 1560cdf0e10cSrcweir 1561cdf0e10cSrcweir my $path = ""; 1562cdf0e10cSrcweir 1563cdf0e10cSrcweir if ( $destination =~ /\Q$installer::globals::separator\E/ ) 1564cdf0e10cSrcweir { 1565cdf0e10cSrcweir if ( $destination =~ /^\s*(\S.*\S\Q$installer::globals::separator\E)(\S.+\S?)/ ) 1566cdf0e10cSrcweir { 1567cdf0e10cSrcweir $path = $2; 1568cdf0e10cSrcweir } 1569cdf0e10cSrcweir } 1570cdf0e10cSrcweir else 1571cdf0e10cSrcweir { 1572cdf0e10cSrcweir $path = $destination; 1573cdf0e10cSrcweir } 1574cdf0e10cSrcweir 1575cdf0e10cSrcweir return $path; 1576cdf0e10cSrcweir} 1577cdf0e10cSrcweir 1578cdf0e10cSrcweir############################################################# 1579cdf0e10cSrcweir# Including the new subdir into the directory table 1580cdf0e10cSrcweir############################################################# 1581cdf0e10cSrcweir 1582cdf0e10cSrcweirsub include_subdirname_into_directory_table 1583cdf0e10cSrcweir{ 1584cdf0e10cSrcweir my ($dirname, $directorytable, $directorytablename, $onefile) = @_; 1585cdf0e10cSrcweir 1586cdf0e10cSrcweir my $subdir = ""; 1587cdf0e10cSrcweir if ( $onefile->{'Subdir'} ) { $subdir = $onefile->{'Subdir'}; } 1588cdf0e10cSrcweir if ( $subdir eq "" ) { installer::exiter::exit_program("ERROR: No \"Subdir\" defined for $onefile->{'Name'}", "include_subdirname_into_directory_table"); } 1589cdf0e10cSrcweir 1590cdf0e10cSrcweir # program INSTALLLOCATION program -> subjava INSTALLLOCATION program:java 1591cdf0e10cSrcweir 1592cdf0e10cSrcweir my $uniquename = ""; 1593cdf0e10cSrcweir my $parent = ""; 1594cdf0e10cSrcweir my $name = ""; 1595cdf0e10cSrcweir 1596cdf0e10cSrcweir my $includedline = 0; 1597cdf0e10cSrcweir 1598cdf0e10cSrcweir my $newdir = ""; 1599cdf0e10cSrcweir 1600cdf0e10cSrcweir for ( my $i = 0; $i <= $#{$directorytable}; $i++ ) 1601cdf0e10cSrcweir { 1602cdf0e10cSrcweir 1603cdf0e10cSrcweir if ( ${$directorytable}[$i] =~ /^\s*(.*?)\t(.*?)\t(.*?)\s*$/ ) 1604cdf0e10cSrcweir { 1605cdf0e10cSrcweir $uniquename = $1; 1606cdf0e10cSrcweir $parent = $2; 1607cdf0e10cSrcweir $name = $3; 1608cdf0e10cSrcweir 1609cdf0e10cSrcweir if ( $dirname eq $name ) 1610cdf0e10cSrcweir { 1611cdf0e10cSrcweir my $newuniquename = "sub" . $subdir; 1612cdf0e10cSrcweir $newdir = $newuniquename; 1613cdf0e10cSrcweir # my $newparent = $parent; 1614cdf0e10cSrcweir my $newparent = "INSTALLLOCATION"; 1615cdf0e10cSrcweir my $newname = $name . "\:" . $subdir; 1616cdf0e10cSrcweir my $newline = 1617cdf0e10cSrcweir $line = "$newuniquename\t$newparent\t$newname\n"; 1618cdf0e10cSrcweir push(@{$directorytable}, $line); 1619cdf0e10cSrcweir installer::remover::remove_leading_and_ending_whitespaces(\$line); 1620cdf0e10cSrcweir $infoline = "Added $line into directory table $directorytablename\n"; 1621cdf0e10cSrcweir push(@installer::globals::logfileinfo, $infoline); 1622cdf0e10cSrcweir 1623cdf0e10cSrcweir $includedline = 1; 1624cdf0e10cSrcweir last; 1625cdf0e10cSrcweir } 1626cdf0e10cSrcweir } 1627cdf0e10cSrcweir } 1628cdf0e10cSrcweir 1629cdf0e10cSrcweir if ( ! $includedline ) { installer::exiter::exit_program("ERROR: Could not include new subdirectory into directory table for file $onefile->{'Name'}!", "include_subdirname_into_directory_table"); } 1630cdf0e10cSrcweir 1631cdf0e10cSrcweir return $newdir; 1632cdf0e10cSrcweir} 1633cdf0e10cSrcweir 1634cdf0e10cSrcweir################################################################## 1635cdf0e10cSrcweir# Including the new sub directory into the component table 1636cdf0e10cSrcweir################################################################## 1637cdf0e10cSrcweir 1638cdf0e10cSrcweirsub include_subdir_into_componenttable 1639cdf0e10cSrcweir{ 1640cdf0e10cSrcweir my ($subdir, $onefile, $componenttable) = @_; 1641cdf0e10cSrcweir 1642cdf0e10cSrcweir my $componentname = $onefile->{'componentname'}; 1643cdf0e10cSrcweir 1644cdf0e10cSrcweir my $changeddirectory = 0; 1645cdf0e10cSrcweir 1646cdf0e10cSrcweir for ( my $i = 0; $i <= $#{$componenttable}; $i++ ) 1647cdf0e10cSrcweir { 1648cdf0e10cSrcweir if ( ${$componenttable}[$i] =~ /^\s*(.*?)\t(.*?)\t(.*?)\t(.*?)\t(.*?)\t(.*?)\s*$/ ) 1649cdf0e10cSrcweir { 1650cdf0e10cSrcweir my $localcomponentname = $1; 1651cdf0e10cSrcweir my $directory = $3; 1652cdf0e10cSrcweir 1653cdf0e10cSrcweir if ( $componentname eq $localcomponentname ) 1654cdf0e10cSrcweir { 1655cdf0e10cSrcweir my $oldvalue = ${$componenttable}[$i]; 1656cdf0e10cSrcweir ${$componenttable}[$i] =~ s/\b\Q$directory\E\b/$subdir/; 1657cdf0e10cSrcweir my $newvalue = ${$componenttable}[$i]; 1658cdf0e10cSrcweir 1659cdf0e10cSrcweir installer::remover::remove_leading_and_ending_whitespaces(\$oldvalue); 1660cdf0e10cSrcweir installer::remover::remove_leading_and_ending_whitespaces(\$newvalue); 1661cdf0e10cSrcweir $infoline = "Change in Component table: From \"$oldvalue\" to \"$newvalue\"\n"; 1662cdf0e10cSrcweir push(@installer::globals::logfileinfo, $infoline); 1663cdf0e10cSrcweir 1664cdf0e10cSrcweir $changeddirectory = 1; 1665cdf0e10cSrcweir last; 1666cdf0e10cSrcweir } 1667cdf0e10cSrcweir } 1668cdf0e10cSrcweir } 1669cdf0e10cSrcweir 1670cdf0e10cSrcweir if ( ! $changeddirectory ) { installer::exiter::exit_program("ERROR: Could not change directory for component: $onefile->{'Name'}!", "include_subdir_into_componenttable"); } 1671cdf0e10cSrcweir 1672cdf0e10cSrcweir} 1673cdf0e10cSrcweir 1674cdf0e10cSrcweir################################################################################################ 1675cdf0e10cSrcweir# Including the content for the child installations 1676cdf0e10cSrcweir# into the tables: 1677cdf0e10cSrcweir# CustomAc.idt, InstallU.idt, Feature.idt 1678cdf0e10cSrcweir################################################################################################ 1679cdf0e10cSrcweir 1680cdf0e10cSrcweirsub add_childprojects 1681cdf0e10cSrcweir{ 1682cdf0e10cSrcweir my ($languageidtdir, $filesref, $allvariables) = @_; 1683cdf0e10cSrcweir 1684cdf0e10cSrcweir my $customactiontablename = $languageidtdir . $installer::globals::separator . "CustomAc.idt"; 1685cdf0e10cSrcweir my $customactiontable = installer::files::read_file($customactiontablename); 1686cdf0e10cSrcweir my $installuitablename = $languageidtdir . $installer::globals::separator . "InstallU.idt"; 1687cdf0e10cSrcweir my $installuitable = installer::files::read_file($installuitablename); 1688cdf0e10cSrcweir my $featuretablename = $languageidtdir . $installer::globals::separator . "Feature.idt"; 1689cdf0e10cSrcweir my $featuretable = installer::files::read_file($featuretablename); 1690cdf0e10cSrcweir my $directorytablename = $languageidtdir . $installer::globals::separator . "Director.idt"; 1691cdf0e10cSrcweir my $directorytable = installer::files::read_file($directorytablename); 1692cdf0e10cSrcweir my $componenttablename = $languageidtdir . $installer::globals::separator . "Componen.idt"; 1693cdf0e10cSrcweir my $componenttable = installer::files::read_file($componenttablename); 1694cdf0e10cSrcweir 1695cdf0e10cSrcweir my $infoline = ""; 1696cdf0e10cSrcweir my $line = ""; 1697cdf0e10cSrcweir 1698cdf0e10cSrcweir $installer::globals::javafile = installer::worker::return_first_item_with_special_flag($filesref ,"JAVAFILE"); 1699cdf0e10cSrcweir $installer::globals::urefile = installer::worker::return_first_item_with_special_flag($filesref ,"UREFILE"); 1700cdf0e10cSrcweir 1701cdf0e10cSrcweir if (( $installer::globals::javafile eq "" ) && ( $allvariables->{'JAVAPRODUCT'} )) { installer::exiter::exit_program("ERROR: No JAVAFILE found in files collector!", "add_childprojects"); } 1702cdf0e10cSrcweir if (( $installer::globals::urefile eq "" ) && ( $allvariables->{'UREPRODUCT'} )) { installer::exiter::exit_program("ERROR: No UREFILE found in files collector!", "add_childprojects"); } 1703cdf0e10cSrcweir 1704cdf0e10cSrcweir # Content for Directory table 1705cdf0e10cSrcweir # SystemFolder TARGETDIR . 1706cdf0e10cSrcweir 1707cdf0e10cSrcweir my $contains_systemfolder = 0; 1708cdf0e10cSrcweir 1709cdf0e10cSrcweir for ( my $i = 0; $i <= $#{$directorytable}; $i++ ) 1710cdf0e10cSrcweir { 1711cdf0e10cSrcweir if ( ${$directorytable}[$i] =~ /^\s*SystemFolder\t/ ) 1712cdf0e10cSrcweir { 1713cdf0e10cSrcweir $contains_systemfolder = 1; 1714cdf0e10cSrcweir last; 1715cdf0e10cSrcweir } 1716cdf0e10cSrcweir } 1717cdf0e10cSrcweir 1718cdf0e10cSrcweir if ( ! $contains_systemfolder ) 1719cdf0e10cSrcweir { 1720cdf0e10cSrcweir $line = "SystemFolder\tTARGETDIR\t\.\n"; 1721cdf0e10cSrcweir push(@{$directorytable}, $line); 1722cdf0e10cSrcweir installer::remover::remove_leading_and_ending_whitespaces(\$line); 1723cdf0e10cSrcweir $infoline = "Added $line into table $directorytablename\n"; 1724cdf0e10cSrcweir } 1725cdf0e10cSrcweir else 1726cdf0e10cSrcweir { 1727cdf0e10cSrcweir $infoline = "SystemFolder already exists in table $directorytablename\n"; 1728cdf0e10cSrcweir } 1729cdf0e10cSrcweir 1730cdf0e10cSrcweir push(@installer::globals::logfileinfo, $infoline); 1731cdf0e10cSrcweir 1732cdf0e10cSrcweir # Additional content for the directory table 1733cdf0e10cSrcweir # subjava INSTALLLOCATION program:java 1734cdf0e10cSrcweir # subure INSTALLLOCATION program:ure 1735cdf0e10cSrcweir 1736cdf0e10cSrcweir my $dirname = ""; 1737cdf0e10cSrcweir my $subjavadir = ""; 1738cdf0e10cSrcweir my $suburedir = ""; 1739cdf0e10cSrcweir 1740cdf0e10cSrcweir if ( $allvariables->{'JAVAPRODUCT'} ) 1741cdf0e10cSrcweir { 1742cdf0e10cSrcweir $dirname = get_directory_name_from_file($installer::globals::javafile); 1743cdf0e10cSrcweir $subjavadir = include_subdirname_into_directory_table($dirname, $directorytable, $directorytablename, $installer::globals::javafile); 1744cdf0e10cSrcweir } 1745cdf0e10cSrcweir 1746cdf0e10cSrcweir if ( $allvariables->{'UREPRODUCT'} ) 1747cdf0e10cSrcweir { 1748cdf0e10cSrcweir $dirname = get_directory_name_from_file($installer::globals::urefile); 1749cdf0e10cSrcweir $suburedir = include_subdirname_into_directory_table($dirname, $directorytable, $directorytablename, $installer::globals::urefile); 1750cdf0e10cSrcweir } 1751cdf0e10cSrcweir 1752cdf0e10cSrcweir # Content for the Component table 1753cdf0e10cSrcweir # The Java and Ada components have new directories 1754cdf0e10cSrcweir 1755cdf0e10cSrcweir if ( $allvariables->{'JAVAPRODUCT'} ) { include_subdir_into_componenttable($subjavadir, $installer::globals::javafile, $componenttable); } 1756cdf0e10cSrcweir if ( $allvariables->{'UREPRODUCT'} ) { include_subdir_into_componenttable($suburedir, $installer::globals::urefile, $componenttable); } 1757cdf0e10cSrcweir 1758cdf0e10cSrcweir # Content for CustomAction table 1759cdf0e10cSrcweir 1760cdf0e10cSrcweir if ( $allvariables->{'JAVAPRODUCT'} ) 1761cdf0e10cSrcweir { 1762cdf0e10cSrcweir $line = "InstallJava\t98\tSystemFolder\t[SourceDir]$installer::globals::javafile->{'Subdir'}\\$installer::globals::javafile->{'Name'} \/qb REBOOT=Suppress SPONSORS=0 DISABLEAD=1\n"; 1763cdf0e10cSrcweir push(@{$customactiontable} ,$line); 1764cdf0e10cSrcweir installer::remover::remove_leading_and_ending_whitespaces(\$line); 1765cdf0e10cSrcweir $infoline = "Added $line into table $customactiontablename\n"; 1766cdf0e10cSrcweir push(@installer::globals::logfileinfo, $infoline); 1767cdf0e10cSrcweir } 1768cdf0e10cSrcweir 1769cdf0e10cSrcweir if ( $allvariables->{'UREPRODUCT'} ) 1770cdf0e10cSrcweir { 1771cdf0e10cSrcweir $line = "InstallUre\t98\tSystemFolder\t$installer::globals::urefile->{'Subdir'}\\$installer::globals::urefile->{'Name'} /S\n"; 1772cdf0e10cSrcweir push(@{$customactiontable} ,$line); 1773cdf0e10cSrcweir installer::remover::remove_leading_and_ending_whitespaces(\$line); 1774cdf0e10cSrcweir $infoline = "Added $line into table $customactiontablename\n"; 1775cdf0e10cSrcweir push(@installer::globals::logfileinfo, $infoline); 1776cdf0e10cSrcweir } 1777cdf0e10cSrcweir 1778cdf0e10cSrcweir if ( $allvariables->{'JAVAPRODUCT'} ) 1779cdf0e10cSrcweir { 1780cdf0e10cSrcweir $line = "MaintenanceJava\t82\t$installer::globals::javafile->{'uniquename'}\t\/qb REBOOT=Suppress SPONSORS=0 DISABLEAD=1\n"; 1781cdf0e10cSrcweir push(@{$customactiontable} ,$line); 1782cdf0e10cSrcweir installer::remover::remove_leading_and_ending_whitespaces(\$line); 1783cdf0e10cSrcweir $infoline = "Added $line into table $customactiontablename\n"; 1784cdf0e10cSrcweir push(@installer::globals::logfileinfo, $infoline); 1785cdf0e10cSrcweir } 1786cdf0e10cSrcweir 1787cdf0e10cSrcweir if ( $allvariables->{'UREPRODUCT'} ) 1788cdf0e10cSrcweir { 1789cdf0e10cSrcweir $line = "MaintenanceUre\t82\t$installer::globals::urefile->{'uniquename'}\t\/S\n"; 1790cdf0e10cSrcweir push(@{$customactiontable} ,$line); 1791cdf0e10cSrcweir installer::remover::remove_leading_and_ending_whitespaces(\$line); 1792cdf0e10cSrcweir $infoline = "Added $line into table $customactiontablename\n"; 1793cdf0e10cSrcweir push(@installer::globals::logfileinfo, $infoline); 1794cdf0e10cSrcweir } 1795cdf0e10cSrcweir 1796cdf0e10cSrcweir # Content for InstallUISequence table 1797cdf0e10cSrcweir # InstallAdabas &gm_o_Adabas=3 825 1798cdf0e10cSrcweir # InstallJava &gm_o_Java=3 827 1799cdf0e10cSrcweir 1800cdf0e10cSrcweir my $number = ""; 1801cdf0e10cSrcweir my $featurename = ""; 1802cdf0e10cSrcweir 1803cdf0e10cSrcweir if ( $allvariables->{'ADAPRODUCT'} ) 1804cdf0e10cSrcweir { 1805cdf0e10cSrcweir $number = get_free_number_in_uisequence_table($installuitable); 1806cdf0e10cSrcweir $featurename = get_feature_name("_Adabas", $featuretable); 1807cdf0e10cSrcweir $line = "InstallAdabas\t\&$featurename\=3 And Not Installed And Not PATCH\t$number\n"; 1808cdf0e10cSrcweir push(@{$installuitable} ,$line); 1809cdf0e10cSrcweir installer::remover::remove_leading_and_ending_whitespaces(\$line); 1810cdf0e10cSrcweir $infoline = "Added $line into table $installuitablename\n"; 1811cdf0e10cSrcweir push(@installer::globals::logfileinfo, $infoline); 1812cdf0e10cSrcweir } 1813cdf0e10cSrcweir 1814cdf0e10cSrcweir if ( $allvariables->{'JAVAPRODUCT'} ) 1815cdf0e10cSrcweir { 1816cdf0e10cSrcweir $number = get_free_number_in_uisequence_table($installuitable) + 2; 1817cdf0e10cSrcweir $featurename = get_feature_name("_Java", $featuretable); 1818cdf0e10cSrcweir if ( $featurename ) { $line = "InstallJava\t\&$featurename\=3 And Not Installed And JAVAPATH\=\"\" And Not PATCH\t$number\n"; } 1819cdf0e10cSrcweir else { $line = "InstallJava\tNot Installed And JAVAPATH\=\"\" And Not PATCH\t$number\n"; } # feature belongs to root 1820cdf0e10cSrcweir push(@{$installuitable} ,$line); 1821cdf0e10cSrcweir installer::remover::remove_leading_and_ending_whitespaces(\$line); 1822cdf0e10cSrcweir $infoline = "Added $line into table $installuitablename\n"; 1823cdf0e10cSrcweir push(@installer::globals::logfileinfo, $infoline); 1824cdf0e10cSrcweir } 1825cdf0e10cSrcweir 1826cdf0e10cSrcweir if ( $allvariables->{'ADAPRODUCT'} ) 1827cdf0e10cSrcweir { 1828cdf0e10cSrcweir $number = get_free_number_in_uisequence_table($installuitable) + 4; 1829cdf0e10cSrcweir $featurename = get_feature_name("_Adabas", $featuretable); 1830cdf0e10cSrcweir $line = "MaintenanceAdabas\t\&$featurename\=3 And Installed And Not PATCH\t$number\n"; 1831cdf0e10cSrcweir push(@{$installuitable} ,$line); 1832cdf0e10cSrcweir installer::remover::remove_leading_and_ending_whitespaces(\$line); 1833cdf0e10cSrcweir $infoline = "Added $line into table $installuitablename\n"; 1834cdf0e10cSrcweir push(@installer::globals::logfileinfo, $infoline); 1835cdf0e10cSrcweir } 1836cdf0e10cSrcweir 1837cdf0e10cSrcweir if ( $allvariables->{'JAVAPRODUCT'} ) 1838cdf0e10cSrcweir { 1839cdf0e10cSrcweir $number = get_free_number_in_uisequence_table($installuitable) + 6; 1840cdf0e10cSrcweir $featurename = get_feature_name("_Java", $featuretable); 1841cdf0e10cSrcweir if ( $featurename ) { $line = "MaintenanceJava\t\&$featurename\=3 And Installed And JAVAPATH\=\"\" And Not PATCH\t$number\n"; } 1842cdf0e10cSrcweir else { $line = "MaintenanceJava\tInstalled And JAVAPATH\=\"\" And Not PATCH\t$number\n"; } # feature belongs to root 1843cdf0e10cSrcweir push(@{$installuitable} ,$line); 1844cdf0e10cSrcweir installer::remover::remove_leading_and_ending_whitespaces(\$line); 1845cdf0e10cSrcweir $infoline = "Added $line into table $installuitablename\n"; 1846cdf0e10cSrcweir push(@installer::globals::logfileinfo, $infoline); 1847cdf0e10cSrcweir } 1848cdf0e10cSrcweir 1849cdf0e10cSrcweir if ( $allvariables->{'UREPRODUCT'} ) 1850cdf0e10cSrcweir { 1851cdf0e10cSrcweir $number = get_free_number_in_uisequence_table($installuitable) + 8; 1852cdf0e10cSrcweir $featurename = get_feature_name("_Ure", $featuretable); 1853cdf0e10cSrcweir if ( $featurename ) { $line = "InstallUre\t\&$featurename\=3 And Not Installed\t$number\n"; } 1854cdf0e10cSrcweir else { $line = "InstallUre\tNot Installed\t$number\n"; } # feature belongs to root 1855cdf0e10cSrcweir push(@{$installuitable} ,$line); 1856cdf0e10cSrcweir installer::remover::remove_leading_and_ending_whitespaces(\$line); 1857cdf0e10cSrcweir $infoline = "Added $line into table $installuitablename\n"; 1858cdf0e10cSrcweir push(@installer::globals::logfileinfo, $infoline); 1859cdf0e10cSrcweir } 1860cdf0e10cSrcweir 1861cdf0e10cSrcweir if ( $allvariables->{'UREPRODUCT'} ) 1862cdf0e10cSrcweir { 1863cdf0e10cSrcweir $number = get_free_number_in_uisequence_table($installuitable) + 10; 1864cdf0e10cSrcweir $featurename = get_feature_name("_Ure", $featuretable); 1865cdf0e10cSrcweir if ( $featurename ) { $line = "MaintenanceUre\t\&$featurename\=3 And Installed\t$number\n"; } 1866cdf0e10cSrcweir else { $line = "MaintenanceUre\tInstalled\t$number\n"; } # feature belongs to root 1867cdf0e10cSrcweir push(@{$installuitable} ,$line); 1868cdf0e10cSrcweir installer::remover::remove_leading_and_ending_whitespaces(\$line); 1869cdf0e10cSrcweir $infoline = "Added $line into table $installuitablename\n"; 1870cdf0e10cSrcweir push(@installer::globals::logfileinfo, $infoline); 1871cdf0e10cSrcweir } 1872cdf0e10cSrcweir 1873cdf0e10cSrcweir # Content for Feature table, better from scp (translation) 1874cdf0e10cSrcweir # gm_o_java gm_optional Java 1.4.2 Description 2 200 1875cdf0e10cSrcweir 1876cdf0e10cSrcweir installer::files::save_file($customactiontablename, $customactiontable); 1877cdf0e10cSrcweir installer::files::save_file($installuitablename, $installuitable); 1878cdf0e10cSrcweir installer::files::save_file($featuretablename, $featuretable); 1879cdf0e10cSrcweir installer::files::save_file($directorytablename, $directorytable); 1880cdf0e10cSrcweir installer::files::save_file($componenttablename, $componenttable); 1881cdf0e10cSrcweir} 1882cdf0e10cSrcweir 1883cdf0e10cSrcweir################################################################## 1884cdf0e10cSrcweir# Setting the encoding in all idt files. Replacing the 1885cdf0e10cSrcweir# variable WINDOWSENCODINGTEMPLATE 1886cdf0e10cSrcweir################################################################## 1887cdf0e10cSrcweir 1888cdf0e10cSrcweirsub setencoding 1889cdf0e10cSrcweir{ 1890cdf0e10cSrcweir my ( $languageidtdir, $onelanguage ) = @_; 1891cdf0e10cSrcweir 1892cdf0e10cSrcweir my $encoding = installer::windows::language::get_windows_encoding($onelanguage); 1893cdf0e10cSrcweir 1894cdf0e10cSrcweir # collecting all idt files in the directory $languageidtdir and substituting the string 1895cdf0e10cSrcweir 1896cdf0e10cSrcweir my $idtfiles = installer::systemactions::find_file_with_file_extension("idt", $languageidtdir); 1897cdf0e10cSrcweir 1898cdf0e10cSrcweir for ( my $i = 0; $i <= $#{$idtfiles}; $i++ ) 1899cdf0e10cSrcweir { 1900cdf0e10cSrcweir my $onefilename = $languageidtdir . $installer::globals::separator . ${$idtfiles}[$i]; 1901cdf0e10cSrcweir my $onefile = installer::files::read_file($onefilename); 1902cdf0e10cSrcweir 1903cdf0e10cSrcweir for ( my $j = 0; $j <= $#{$onefile}; $j++ ) 1904cdf0e10cSrcweir { 1905cdf0e10cSrcweir ${$onefile}[$j] =~ s/WINDOWSENCODINGTEMPLATE/$encoding/g; 1906cdf0e10cSrcweir } 1907cdf0e10cSrcweir 1908cdf0e10cSrcweir installer::files::save_file($onefilename, $onefile); 1909cdf0e10cSrcweir } 1910cdf0e10cSrcweir} 1911cdf0e10cSrcweir 1912cdf0e10cSrcweir################################################################## 1913cdf0e10cSrcweir# Setting the condition, that at least one module is selected. 1914cdf0e10cSrcweir# All modules with flag SHOW_MULTILINGUAL_ONLY were already 1915cdf0e10cSrcweir# collected. In table ControlE.idt, the string 1916cdf0e10cSrcweir# LANGUAGECONDITIONINSTALL needs to be replaced. 1917cdf0e10cSrcweir# Also for APPLICATIONCONDITIONINSTALL for the applications 1918cdf0e10cSrcweir# with flag APPLICATIONMODULE. 1919cdf0e10cSrcweir################################################################## 1920cdf0e10cSrcweir 1921cdf0e10cSrcweirsub set_multilanguageonly_condition 1922cdf0e10cSrcweir{ 1923cdf0e10cSrcweir my ( $languageidtdir ) = @_; 1924cdf0e10cSrcweir 1925cdf0e10cSrcweir my $onefilename = $languageidtdir . $installer::globals::separator . "ControlE.idt"; 1926cdf0e10cSrcweir my $onefile = installer::files::read_file($onefilename); 1927cdf0e10cSrcweir 1928cdf0e10cSrcweir # Language modules 1929cdf0e10cSrcweir 1930cdf0e10cSrcweir my $condition = ""; 1931cdf0e10cSrcweir 1932cdf0e10cSrcweir foreach my $module ( sort keys %installer::globals::multilingual_only_modules ) 1933cdf0e10cSrcweir { 1934cdf0e10cSrcweir $condition = $condition . " &$module=3 Or"; 1935cdf0e10cSrcweir } 1936cdf0e10cSrcweir 1937cdf0e10cSrcweir $condition =~ s/^\s*//; 1938cdf0e10cSrcweir $condition =~ s/\s*Or\s*$//; # removing the ending "Or" 1939cdf0e10cSrcweir 1940cdf0e10cSrcweir if ( $condition eq "" ) { $condition = "1"; } 1941cdf0e10cSrcweir 1942cdf0e10cSrcweir for ( my $j = 0; $j <= $#{$onefile}; $j++ ) 1943cdf0e10cSrcweir { 1944cdf0e10cSrcweir ${$onefile}[$j] =~ s/LANGUAGECONDITIONINSTALL/$condition/; 1945cdf0e10cSrcweir } 1946cdf0e10cSrcweir 1947cdf0e10cSrcweir # Application modules 1948cdf0e10cSrcweir 1949cdf0e10cSrcweir $condition = ""; 1950cdf0e10cSrcweir 1951cdf0e10cSrcweir foreach my $module ( sort keys %installer::globals::application_modules ) 1952cdf0e10cSrcweir { 1953cdf0e10cSrcweir $condition = $condition . " &$module=3 Or"; 1954cdf0e10cSrcweir } 1955cdf0e10cSrcweir 1956cdf0e10cSrcweir $condition =~ s/^\s*//; 1957cdf0e10cSrcweir $condition =~ s/\s*Or\s*$//; # removing the ending "Or" 1958cdf0e10cSrcweir 1959cdf0e10cSrcweir if ( $condition eq "" ) { $condition = "1"; } 1960cdf0e10cSrcweir 1961cdf0e10cSrcweir for ( my $j = 0; $j <= $#{$onefile}; $j++ ) 1962cdf0e10cSrcweir { 1963cdf0e10cSrcweir ${$onefile}[$j] =~ s/APPLICATIONCONDITIONINSTALL/$condition/; 1964cdf0e10cSrcweir } 1965cdf0e10cSrcweir 1966cdf0e10cSrcweir installer::files::save_file($onefilename, $onefile); 1967cdf0e10cSrcweir} 1968cdf0e10cSrcweir 1969cdf0e10cSrcweir############################################# 1970cdf0e10cSrcweir# Putting array values into hash 1971cdf0e10cSrcweir############################################# 1972cdf0e10cSrcweir 1973cdf0e10cSrcweirsub fill_assignment_hash 1974cdf0e10cSrcweir{ 1975cdf0e10cSrcweir my ($gid, $name, $key, $assignmenthashref, $parameter, $tablename, $assignmentarray) = @_; 1976cdf0e10cSrcweir 1977cdf0e10cSrcweir my $max = $parameter - 1; 1978cdf0e10cSrcweir 1979cdf0e10cSrcweir if ( $max != $#{$assignmentarray} ) 1980cdf0e10cSrcweir { 1981cdf0e10cSrcweir my $definedparameter = $#{$assignmentarray} + 1; 1982cdf0e10cSrcweir installer::exiter::exit_program("ERROR: gid: $gid, key: $key ! Wrong parameter in scp. For table $tablename $parameter parameter are required ! You defined: $definedparameter", "fill_assignment_hash"); 1983cdf0e10cSrcweir } 1984cdf0e10cSrcweir 1985cdf0e10cSrcweir for ( my $i = 0; $i <= $#{$assignmentarray}; $i++ ) 1986cdf0e10cSrcweir { 1987cdf0e10cSrcweir my $counter = $i + 1; 1988cdf0e10cSrcweir my $key = "parameter". $counter; 1989cdf0e10cSrcweir 1990cdf0e10cSrcweir my $localvalue = ${$assignmentarray}[$i]; 1991cdf0e10cSrcweir installer::remover::remove_leading_and_ending_quotationmarks(\$localvalue); 1992cdf0e10cSrcweir $localvalue =~ s/\\\"/\"/g; 1993cdf0e10cSrcweir $localvalue =~ s/\\\!/\!/g; 1994cdf0e10cSrcweir $localvalue =~ s/\\\&/\&/g; 1995cdf0e10cSrcweir $localvalue =~ s/\\\</\</g; 1996cdf0e10cSrcweir $localvalue =~ s/\\\>/\>/g; 1997cdf0e10cSrcweir $assignmenthashref->{$key} = $localvalue; 1998cdf0e10cSrcweir } 1999cdf0e10cSrcweir} 2000cdf0e10cSrcweir 2001cdf0e10cSrcweir########################################################################## 2002cdf0e10cSrcweir# Checking the assignment of a Windows CustomAction and putting it 2003cdf0e10cSrcweir# into a hash 2004cdf0e10cSrcweir########################################################################## 2005cdf0e10cSrcweir 2006cdf0e10cSrcweirsub create_customaction_assignment_hash 2007cdf0e10cSrcweir{ 2008cdf0e10cSrcweir my ($gid, $name, $key, $assignmentarray) = @_; 2009cdf0e10cSrcweir 2010cdf0e10cSrcweir my %assignment = (); 2011cdf0e10cSrcweir my $assignmenthashref = \%assignment; 2012cdf0e10cSrcweir 2013cdf0e10cSrcweir my $tablename = ${$assignmentarray}[0]; 2014cdf0e10cSrcweir installer::remover::remove_leading_and_ending_quotationmarks(\$tablename); 2015cdf0e10cSrcweir 2016cdf0e10cSrcweir my $tablename_defined = 0; 2017cdf0e10cSrcweir my $parameter = 0; 2018cdf0e10cSrcweir 2019cdf0e10cSrcweir if ( $tablename eq "InstallUISequence" ) 2020cdf0e10cSrcweir { 2021cdf0e10cSrcweir $tablename_defined = 1; 2022cdf0e10cSrcweir $parameter = 3; 2023cdf0e10cSrcweir fill_assignment_hash($gid, $name, $key, $assignmenthashref, $parameter, $tablename, $assignmentarray); 2024cdf0e10cSrcweir } 2025cdf0e10cSrcweir 2026cdf0e10cSrcweir if ( $tablename eq "InstallExecuteSequence" ) 2027cdf0e10cSrcweir { 2028cdf0e10cSrcweir $tablename_defined = 1; 2029cdf0e10cSrcweir $parameter = 3; 2030cdf0e10cSrcweir fill_assignment_hash($gid, $name, $key, $assignmenthashref, $parameter, $tablename, $assignmentarray); 2031cdf0e10cSrcweir } 2032cdf0e10cSrcweir 2033cdf0e10cSrcweir if ( $tablename eq "AdminExecuteSequence" ) 2034cdf0e10cSrcweir { 2035cdf0e10cSrcweir $tablename_defined = 1; 2036cdf0e10cSrcweir $parameter = 3; 2037cdf0e10cSrcweir fill_assignment_hash($gid, $name, $key, $assignmenthashref, $parameter, $tablename, $assignmentarray); 2038cdf0e10cSrcweir } 2039cdf0e10cSrcweir 2040cdf0e10cSrcweir if ( $tablename eq "ControlEvent" ) 2041cdf0e10cSrcweir { 2042cdf0e10cSrcweir $tablename_defined = 1; 2043cdf0e10cSrcweir $parameter = 7; 2044cdf0e10cSrcweir fill_assignment_hash($gid, $name, $key, $assignmenthashref, $parameter, $tablename, $assignmentarray); 2045cdf0e10cSrcweir } 2046cdf0e10cSrcweir 2047cdf0e10cSrcweir if ( $tablename eq "ControlCondition" ) 2048cdf0e10cSrcweir { 2049cdf0e10cSrcweir $tablename_defined = 1; 2050cdf0e10cSrcweir $parameter = 5; 2051cdf0e10cSrcweir fill_assignment_hash($gid, $name, $key, $assignmenthashref, $parameter, $tablename, $assignmentarray); 2052cdf0e10cSrcweir } 2053cdf0e10cSrcweir 2054cdf0e10cSrcweir if ( ! $tablename_defined ) 2055cdf0e10cSrcweir { 2056cdf0e10cSrcweir installer::exiter::exit_program("ERROR: gid: $gid, key: $key ! Unknown Windows CustomAction table: $tablename ! Currently supported: InstallUISequence, InstallExecuteSequence, ControlEvent, ControlCondition", "create_customaction_assignment_hash"); 2057cdf0e10cSrcweir } 2058cdf0e10cSrcweir 2059cdf0e10cSrcweir return $assignmenthashref; 2060cdf0e10cSrcweir} 2061cdf0e10cSrcweir 2062cdf0e10cSrcweir########################################################################## 2063cdf0e10cSrcweir# Finding the position of a specified CustomAction. 2064cdf0e10cSrcweir# If the CustomAction is not found, the return value is "-1". 2065cdf0e10cSrcweir# If the CustomAction position is not defined yet, 2066cdf0e10cSrcweir# the return value is also "-1". 2067cdf0e10cSrcweir########################################################################## 2068cdf0e10cSrcweir 2069cdf0e10cSrcweirsub get_customaction_position 2070cdf0e10cSrcweir{ 2071cdf0e10cSrcweir my ($action, $sequencetable) = @_; 2072cdf0e10cSrcweir 2073cdf0e10cSrcweir my $position = -1; 2074cdf0e10cSrcweir 2075cdf0e10cSrcweir for ( my $i = 0; $i <= $#{$sequencetable}; $i++ ) 2076cdf0e10cSrcweir { 2077cdf0e10cSrcweir my $line = ${$sequencetable}[$i]; 2078cdf0e10cSrcweir 2079cdf0e10cSrcweir if ( $line =~ /^\s*([\w\.]+)\t.*\t\s*(\d+)\s$/ ) # matching only, if position is a number! 2080cdf0e10cSrcweir { 2081cdf0e10cSrcweir my $compareaction = $1; 2082cdf0e10cSrcweir my $localposition = $2; 2083cdf0e10cSrcweir 2084cdf0e10cSrcweir if ( $compareaction eq $action ) 2085cdf0e10cSrcweir { 2086cdf0e10cSrcweir $position = $localposition; 2087cdf0e10cSrcweir last; 2088cdf0e10cSrcweir } 2089cdf0e10cSrcweir } 2090cdf0e10cSrcweir } 2091cdf0e10cSrcweir 2092cdf0e10cSrcweir return $position; 2093cdf0e10cSrcweir} 2094cdf0e10cSrcweir 2095cdf0e10cSrcweir########################################################################## 2096cdf0e10cSrcweir# Setting the position of CustomActions in sequence tables. 2097cdf0e10cSrcweir# Replacing all occurences of "POSITIONTEMPLATE_" 2098cdf0e10cSrcweir########################################################################## 2099cdf0e10cSrcweir 2100cdf0e10cSrcweirsub set_positions_in_table 2101cdf0e10cSrcweir{ 2102cdf0e10cSrcweir my ( $sequencetable, $tablename ) = @_; 2103cdf0e10cSrcweir 2104cdf0e10cSrcweir my $infoline = "\nSetting positions in table \"$tablename\".\n"; 2105cdf0e10cSrcweir push(@installer::globals::logfileinfo, $infoline); 2106cdf0e10cSrcweir 2107cdf0e10cSrcweir # Step 1: Resolving all occurences of "POSITIONTEMPLATE_end" 2108cdf0e10cSrcweir 2109cdf0e10cSrcweir my $lastposition = get_last_position_in_sequencetable($sequencetable); 2110cdf0e10cSrcweir 2111cdf0e10cSrcweir for ( my $i = 0; $i <= $#{$sequencetable}; $i++ ) 2112cdf0e10cSrcweir { 2113cdf0e10cSrcweir if ( ${$sequencetable}[$i] =~ /^\s*([\w\.]+)\t.*\t\s*POSITIONTEMPLATE_end\s*$/ ) 2114cdf0e10cSrcweir { 2115cdf0e10cSrcweir my $customaction = $1; 2116cdf0e10cSrcweir $lastposition = $lastposition + 25; 2117cdf0e10cSrcweir ${$sequencetable}[$i] =~ s/POSITIONTEMPLATE_end/$lastposition/; 2118cdf0e10cSrcweir $infoline = "Setting position \"$lastposition\" for custom action \"$customaction\".\n"; 2119cdf0e10cSrcweir push(@installer::globals::logfileinfo, $infoline); 2120cdf0e10cSrcweir } 2121cdf0e10cSrcweir } 2122cdf0e10cSrcweir 2123cdf0e10cSrcweir # Step 2: Resolving all occurences of "POSITIONTEMPLATE_abc" or "POSITIONTEMPLATE_behind_abc" 2124cdf0e10cSrcweir # where abc is the name of the reference Custom Action. 2125cdf0e10cSrcweir # This has to be done, until there is no more occurence of POSITIONTEMPLATE (success) 2126cdf0e10cSrcweir # or there is no replacement in one circle (failure). 2127cdf0e10cSrcweir 2128cdf0e10cSrcweir my $template_exists = 0; 2129cdf0e10cSrcweir my $template_replaced = 0; 2130cdf0e10cSrcweir my $counter = 0; 2131cdf0e10cSrcweir 2132cdf0e10cSrcweir do 2133cdf0e10cSrcweir { 2134cdf0e10cSrcweir $template_exists = 0; 2135cdf0e10cSrcweir $template_replaced = 0; 2136cdf0e10cSrcweir $counter++; 2137cdf0e10cSrcweir 2138cdf0e10cSrcweir for ( my $i = 0; $i <= $#{$sequencetable}; $i++ ) 2139cdf0e10cSrcweir { 2140cdf0e10cSrcweir if ( ${$sequencetable}[$i] =~ /^\s*([\w\.]+)\t.*\t\s*(POSITIONTEMPLATE_.*?)\s*$/ ) 2141cdf0e10cSrcweir { 2142cdf0e10cSrcweir my $onename = $1; 2143cdf0e10cSrcweir my $templatename = $2; 2144cdf0e10cSrcweir my $positionname = $templatename; 2145cdf0e10cSrcweir my $customaction = $templatename; 2146cdf0e10cSrcweir $customaction =~ s/POSITIONTEMPLATE_//; 2147cdf0e10cSrcweir $template_exists = 1; 2148cdf0e10cSrcweir 2149cdf0e10cSrcweir # Trying to find the correct number. 2150cdf0e10cSrcweir # This can fail, if the custom action has no number 2151cdf0e10cSrcweir 2152cdf0e10cSrcweir my $setbehind = 0; 2153cdf0e10cSrcweir if ( $customaction =~ /^\s*behind_(.*?)\s*$/ ) 2154cdf0e10cSrcweir { 2155cdf0e10cSrcweir $customaction = $1; 2156cdf0e10cSrcweir $setbehind = 1; 2157cdf0e10cSrcweir } 2158cdf0e10cSrcweir 2159cdf0e10cSrcweir my $position = get_customaction_position($customaction, $sequencetable); 2160cdf0e10cSrcweir 2161cdf0e10cSrcweir if ( $position >= 0 ) # Found CustomAction and is has a position. Otherwise return value is "-1". 2162cdf0e10cSrcweir { 2163cdf0e10cSrcweir my $newposition = 0; 2164cdf0e10cSrcweir if ( $setbehind ) { $newposition = $position + 2; } 2165cdf0e10cSrcweir else { $newposition = $position - 2; } 2166cdf0e10cSrcweir ${$sequencetable}[$i] =~ s/$templatename/$newposition/; 2167cdf0e10cSrcweir $template_replaced = 1; 2168cdf0e10cSrcweir $infoline = "Setting position \"$newposition\" for custom action \"$onename\" (scp: \"$positionname\" at position $position).\n"; 2169cdf0e10cSrcweir push(@installer::globals::logfileinfo, $infoline); 2170cdf0e10cSrcweir } 2171cdf0e10cSrcweir else 2172cdf0e10cSrcweir { 2173cdf0e10cSrcweir $infoline = "Could not assign position for custom action \"$onename\" yet (scp: \"$positionname\").\n"; 2174cdf0e10cSrcweir push(@installer::globals::logfileinfo, $infoline); 2175cdf0e10cSrcweir } 2176cdf0e10cSrcweir } 2177cdf0e10cSrcweir } 2178cdf0e10cSrcweir } while (( $template_exists ) && ( $template_replaced )); 2179cdf0e10cSrcweir 2180cdf0e10cSrcweir # An error occured, because templates still exist, but could not be replaced. 2181cdf0e10cSrcweir # Reason: 2182cdf0e10cSrcweir # 1. Wrong name of CustomAction in scp2 (typo?) 2183cdf0e10cSrcweir # 2. Circular dependencies of CustomActions (A after B and B after A) 2184cdf0e10cSrcweir 2185cdf0e10cSrcweir # Problem: It is allowed, that a CustomAction is defined in scp2 in a library that is 2186cdf0e10cSrcweir # part of product ABC, but this CustomAction is not used in this product 2187cdf0e10cSrcweir # and the reference CustomAction is not part of this product. 2188cdf0e10cSrcweir # Therefore this cannot be an error, but only produce a warning. The assigned number 2189cdf0e10cSrcweir # must be the last sequence number. 2190cdf0e10cSrcweir 2191cdf0e10cSrcweir if (( $template_exists ) && ( ! $template_replaced )) 2192cdf0e10cSrcweir { 2193cdf0e10cSrcweir # Giving a precise error message, collecting all unresolved templates 2194cdf0e10cSrcweir # my $templatestring = ""; 2195cdf0e10cSrcweir 2196cdf0e10cSrcweir for ( my $i = 0; $i <= $#{$sequencetable}; $i++ ) 2197cdf0e10cSrcweir { 2198cdf0e10cSrcweir if ( ${$sequencetable}[$i] =~ /^\s*([\w\.]+)\t.*\t\s*(POSITIONTEMPLATE_.*?)\s*$/ ) 2199cdf0e10cSrcweir { 2200cdf0e10cSrcweir my $customactionname = $1; 2201cdf0e10cSrcweir my $fulltemplate = $2; 2202cdf0e10cSrcweir my $template = $fulltemplate; 2203cdf0e10cSrcweir $template =~ s/POSITIONTEMPLATE_//; 2204cdf0e10cSrcweir # my $newstring = $customactionname . " (" . $template . ")"; 2205cdf0e10cSrcweir # $templatestring = $templatestring . $newstring . ", "; 2206cdf0e10cSrcweir # Setting at the end! 2207cdf0e10cSrcweir $lastposition = $lastposition + 25; 2208cdf0e10cSrcweir ${$sequencetable}[$i] =~ s/$fulltemplate/$lastposition/; 2209cdf0e10cSrcweir $infoline = "WARNING: Setting position \"$lastposition\" for custom action \"$customactionname\". Could not find CustomAction \"$template\".\n"; 2210cdf0e10cSrcweir push(@installer::globals::logfileinfo, $infoline); 2211cdf0e10cSrcweir } 2212cdf0e10cSrcweir } 2213cdf0e10cSrcweir # $templatestring =~ s/,\s*$//; 2214cdf0e10cSrcweir 2215cdf0e10cSrcweir # $infoline = "Error: Saving table \"$tablename\"\n"; 2216cdf0e10cSrcweir # push(@installer::globals::logfileinfo, $infoline); 2217cdf0e10cSrcweir # print $infoline; 2218cdf0e10cSrcweir # installer::files::save_file($tablename, $sequencetable); 2219cdf0e10cSrcweir # installer::exiter::exit_program("ERROR: Unresolved positions in CustomActions in scp2: $templatestring", "set_positions_in_table"); 2220cdf0e10cSrcweir } 2221cdf0e10cSrcweir} 2222cdf0e10cSrcweir 2223cdf0e10cSrcweir########################################################################## 2224cdf0e10cSrcweir# Setting the Windows custom actions into different tables 2225cdf0e10cSrcweir# CustomAc.idt, InstallE.idt, InstallU.idt, ControlE.idt, ControlC.idt 2226cdf0e10cSrcweir########################################################################## 2227cdf0e10cSrcweir 2228cdf0e10cSrcweirsub addcustomactions 2229cdf0e10cSrcweir{ 2230cdf0e10cSrcweir my ($languageidtdir, $customactions, $filesarray) = @_; 2231cdf0e10cSrcweir 2232cdf0e10cSrcweir installer::logger::include_timestamp_into_logfile("\nPerformance Info: addcustomactions start\n"); 2233cdf0e10cSrcweir 2234cdf0e10cSrcweir my $customactionidttablename = $languageidtdir . $installer::globals::separator . "CustomAc.idt"; 2235cdf0e10cSrcweir my $customactionidttable = installer::files::read_file($customactionidttablename); 2236cdf0e10cSrcweir my $installexecutetablename = $languageidtdir . $installer::globals::separator . "InstallE.idt"; 2237cdf0e10cSrcweir my $installexecutetable = installer::files::read_file($installexecutetablename); 2238cdf0e10cSrcweir my $adminexecutetablename = $languageidtdir . $installer::globals::separator . "AdminExe.idt"; 2239cdf0e10cSrcweir my $adminexecutetable = installer::files::read_file($adminexecutetablename); 2240cdf0e10cSrcweir my $installuitablename = $languageidtdir . $installer::globals::separator . "InstallU.idt"; 2241cdf0e10cSrcweir my $installuitable = installer::files::read_file($installuitablename); 2242cdf0e10cSrcweir my $controleventtablename = $languageidtdir . $installer::globals::separator . "ControlE.idt"; 2243cdf0e10cSrcweir my $controleventtable = installer::files::read_file($controleventtablename); 2244cdf0e10cSrcweir my $controlconditiontablename = $languageidtdir . $installer::globals::separator . "ControlC.idt"; 2245cdf0e10cSrcweir my $controlconditiontable = installer::files::read_file($controlconditiontablename); 2246cdf0e10cSrcweir 2247cdf0e10cSrcweir # Iterating over all Windows custom actions 2248cdf0e10cSrcweir 2249cdf0e10cSrcweir for ( my $i = 0; $i <= $#{$customactions}; $i++ ) 2250cdf0e10cSrcweir { 2251cdf0e10cSrcweir my $customaction = ${$customactions}[$i]; 2252cdf0e10cSrcweir my $name = $customaction->{'Name'}; 2253cdf0e10cSrcweir my $typ = $customaction->{'Typ'}; 2254cdf0e10cSrcweir my $source = $customaction->{'Source'}; 2255cdf0e10cSrcweir my $target = $customaction->{'Target'}; 2256cdf0e10cSrcweir my $inbinarytable = $customaction->{'Inbinarytable'}; 2257cdf0e10cSrcweir my $gid = $customaction->{'gid'}; 2258cdf0e10cSrcweir 2259cdf0e10cSrcweir my $styles = ""; 2260cdf0e10cSrcweir if ( $customaction->{'Styles'} ) { $styles = $customaction->{'Styles'}; } 2261cdf0e10cSrcweir 2262cdf0e10cSrcweir my $added_customaction = set_custom_action($customactionidttable, $name, $typ, $source, $target, $inbinarytable, $filesarray, $customactionidttablename, $styles); 2263cdf0e10cSrcweir 2264cdf0e10cSrcweir if ( $added_customaction ) 2265cdf0e10cSrcweir { 2266cdf0e10cSrcweir # If the CustomAction was added into the CustomAc.idt, it can be connected to the installation. 2267cdf0e10cSrcweir # There are currently two different ways for doing this: 2268cdf0e10cSrcweir # 1. Using "add_custom_action_to_install_table", which adds the CustomAction to the install sequences, 2269cdf0e10cSrcweir # which are saved in InstallE.idt and InstallU.idt 2270cdf0e10cSrcweir # 2. Using "connect_custom_action_to_control" and "connect_custom_action_to_control". The first method 2271cdf0e10cSrcweir # connects a CustomAction to a control in ControlE.idt. The second method sets a condition for a control, 2272cdf0e10cSrcweir # which might be influenced by the CustomAction. This happens in ControlC.idt. 2273cdf0e10cSrcweir 2274cdf0e10cSrcweir # Any Windows CustomAction can have a lot of different assignments. 2275cdf0e10cSrcweir 2276cdf0e10cSrcweir for ( my $j = 1; $j <= 50; $j++ ) 2277cdf0e10cSrcweir { 2278cdf0e10cSrcweir my $key = "Assignment" . $j; 2279cdf0e10cSrcweir my $value = ""; 2280cdf0e10cSrcweir if ( $customaction->{$key} ) 2281cdf0e10cSrcweir { 2282cdf0e10cSrcweir $value = $customaction->{$key}; 2283cdf0e10cSrcweir 2284cdf0e10cSrcweir # in a patch the Assignment can be overwritten by a PatchAssignment 2285cdf0e10cSrcweir if ( $installer::globals::patch ) 2286cdf0e10cSrcweir { 2287cdf0e10cSrcweir $patchkey = "PatchAssignment" . $j; 2288cdf0e10cSrcweir if ( $customaction->{$patchkey} ) 2289cdf0e10cSrcweir { 2290cdf0e10cSrcweir $value = $customaction->{$patchkey}; 2291cdf0e10cSrcweir $key = $patchkey; 2292cdf0e10cSrcweir } 2293cdf0e10cSrcweir } 2294cdf0e10cSrcweir 2295cdf0e10cSrcweir } 2296cdf0e10cSrcweir else { last; } 2297cdf0e10cSrcweir 2298cdf0e10cSrcweir # $value is now a comma separated list 2299cdf0e10cSrcweir if ( $value =~ /^\s*\(\s*(.*)\s*\);?\s*$/ ) { $value = $1; } 2300cdf0e10cSrcweir my $assignmentarray = installer::converter::convert_stringlist_into_array(\$value, ","); 2301cdf0e10cSrcweir my $assignment = create_customaction_assignment_hash($gid, $name, $key, $assignmentarray); 2302cdf0e10cSrcweir 2303cdf0e10cSrcweir if ( $assignment->{'parameter1'} eq "InstallExecuteSequence" ) 2304cdf0e10cSrcweir { 2305cdf0e10cSrcweir add_custom_action_to_install_table($installexecutetable, $source, $name, $assignment->{'parameter2'}, $assignment->{'parameter3'}, $filesarray, $installexecutetablename, $styles); 2306cdf0e10cSrcweir } 2307cdf0e10cSrcweir elsif ( $assignment->{'parameter1'} eq "AdminExecuteSequence" ) 2308cdf0e10cSrcweir { 2309cdf0e10cSrcweir add_custom_action_to_install_table($adminexecutetable, $source, $name, $assignment->{'parameter2'}, $assignment->{'parameter3'}, $filesarray, $adminexecutetablename, $styles); 2310cdf0e10cSrcweir } 2311cdf0e10cSrcweir elsif ( $assignment->{'parameter1'} eq "InstallUISequence" ) 2312cdf0e10cSrcweir { 2313cdf0e10cSrcweir add_custom_action_to_install_table($installuitable, $source, $name, $assignment->{'parameter2'}, $assignment->{'parameter3'}, $filesarray, $installuitablename, $styles); 2314cdf0e10cSrcweir } 2315cdf0e10cSrcweir elsif ( $assignment->{'parameter1'} eq "ControlEvent" ) 2316cdf0e10cSrcweir { 2317cdf0e10cSrcweir connect_custom_action_to_control($controleventtable, $controleventtablename, $assignment->{'parameter2'}, $assignment->{'parameter3'}, $assignment->{'parameter4'}, $assignment->{'parameter5'}, $assignment->{'parameter6'}, $assignment->{'parameter7'}); 2318cdf0e10cSrcweir } 2319cdf0e10cSrcweir elsif ( $assignment->{'parameter1'} eq "ControlCondition" ) 2320cdf0e10cSrcweir { 2321cdf0e10cSrcweir connect_condition_to_control($controlconditiontable, $controlconditiontablename, $assignment->{'parameter2'}, $assignment->{'parameter3'}, $assignment->{'parameter4'}, $assignment->{'parameter5'}); 2322cdf0e10cSrcweir } 2323cdf0e10cSrcweir else 2324cdf0e10cSrcweir { 2325cdf0e10cSrcweir installer::exiter::exit_program("ERROR: gid: $gid, key: $key ! Unknown Windows CustomAction table: $assignmenthashref->{'parameter1'} ! Currently supported: InstallUISequence, InstallESequence, ControlEvent, ControlCondition", "addcustomactions"); 2326cdf0e10cSrcweir } 2327cdf0e10cSrcweir } 2328cdf0e10cSrcweir } 2329cdf0e10cSrcweir } 2330cdf0e10cSrcweir 2331cdf0e10cSrcweir # Setting the positions in the tables 2332cdf0e10cSrcweir 2333cdf0e10cSrcweir set_positions_in_table($installexecutetable, $installexecutetablename); 2334cdf0e10cSrcweir set_positions_in_table($installuitable, $installuitablename); 2335cdf0e10cSrcweir set_positions_in_table($adminexecutetable, $adminexecutetablename); 2336cdf0e10cSrcweir 2337cdf0e10cSrcweir # Saving the files 2338cdf0e10cSrcweir 2339cdf0e10cSrcweir installer::files::save_file($customactionidttablename, $customactionidttable); 2340cdf0e10cSrcweir installer::files::save_file($installexecutetablename, $installexecutetable); 2341cdf0e10cSrcweir installer::files::save_file($adminexecutetablename, $adminexecutetable); 2342cdf0e10cSrcweir installer::files::save_file($installuitablename, $installuitable); 2343cdf0e10cSrcweir installer::files::save_file($controleventtablename, $controleventtable); 2344cdf0e10cSrcweir installer::files::save_file($controlconditiontablename, $controlconditiontable); 2345cdf0e10cSrcweir 2346cdf0e10cSrcweir my $infoline = "Updated idt file: $customactionidttablename\n"; 2347cdf0e10cSrcweir push(@installer::globals::logfileinfo, $infoline); 2348cdf0e10cSrcweir $infoline = "Updated idt file: $installexecutetablename\n"; 2349cdf0e10cSrcweir push(@installer::globals::logfileinfo, $infoline); 2350cdf0e10cSrcweir $infoline = "Updated idt file: $adminexecutetablename\n"; 2351cdf0e10cSrcweir push(@installer::globals::logfileinfo, $infoline); 2352cdf0e10cSrcweir $infoline = "Updated idt file: $installuitablename\n"; 2353cdf0e10cSrcweir push(@installer::globals::logfileinfo, $infoline); 2354cdf0e10cSrcweir $infoline = "Updated idt file: $controleventtablename\n"; 2355cdf0e10cSrcweir push(@installer::globals::logfileinfo, $infoline); 2356cdf0e10cSrcweir $infoline = "Updated idt file: $controlconditiontablename\n"; 2357cdf0e10cSrcweir push(@installer::globals::logfileinfo, $infoline); 2358cdf0e10cSrcweir 2359cdf0e10cSrcweir installer::logger::include_timestamp_into_logfile("\nPerformance Info: addcustomactions end\n"); 2360cdf0e10cSrcweir} 2361cdf0e10cSrcweir 2362cdf0e10cSrcweir########################################################################## 2363cdf0e10cSrcweir# Setting bidi attributes in idt tables 2364cdf0e10cSrcweir########################################################################## 2365cdf0e10cSrcweir 2366cdf0e10cSrcweirsub setbidiattributes 2367cdf0e10cSrcweir{ 2368cdf0e10cSrcweir my ($languageidtdir, $onelanguage) = @_; 2369cdf0e10cSrcweir 2370cdf0e10cSrcweir # Editing the files Dialog.idt and Control.idt 2371cdf0e10cSrcweir 2372cdf0e10cSrcweir my $dialogfilename = $languageidtdir . $installer::globals::separator . "Dialog.idt"; 2373cdf0e10cSrcweir my $controlfilename = $languageidtdir . $installer::globals::separator . "Control.idt"; 2374cdf0e10cSrcweir 2375cdf0e10cSrcweir my $dialogfile = installer::files::read_file($dialogfilename); 2376cdf0e10cSrcweir my $controlfile = installer::files::read_file($controlfilename); 2377cdf0e10cSrcweir 2378cdf0e10cSrcweir # Searching attributes in Dialog.idt and adding "896". 2379cdf0e10cSrcweir # Attributes are in column 6 (from 10). 2380cdf0e10cSrcweir 2381cdf0e10cSrcweir my $bidiattribute = 896; 2382cdf0e10cSrcweir for ( my $i = 0; $i <= $#{$dialogfile}; $i++ ) 2383cdf0e10cSrcweir { 2384cdf0e10cSrcweir if ( $i < 3 ) { next; } 2385cdf0e10cSrcweir if ( ${$dialogfile}[$i] =~ /^\s*(.*?)\t(.*?)\t(.*?)\t(.*?)\t(.*?)\t(.*?)\t(.*?)\t(.*?)\s*$/ ) 2386cdf0e10cSrcweir { 2387cdf0e10cSrcweir my $one = $1; 2388cdf0e10cSrcweir my $two = $2; 2389cdf0e10cSrcweir my $three = $3; 2390cdf0e10cSrcweir my $four = $4; 2391cdf0e10cSrcweir my $five = $5; 2392cdf0e10cSrcweir my $attribute = $6; 2393cdf0e10cSrcweir my $seven = $7; 2394cdf0e10cSrcweir my $eight = $8; 2395cdf0e10cSrcweir $attribute = $attribute + $bidiattribute; 2396cdf0e10cSrcweir ${$dialogfile}[$i] = "$one\t$two\t$three\t$four\t$five\t$attribute\t$seven\t$eight\n"; 2397cdf0e10cSrcweir } 2398cdf0e10cSrcweir } 2399cdf0e10cSrcweir 2400cdf0e10cSrcweir # Searching attributes in Control.idt and adding "224". 2401cdf0e10cSrcweir # Attributes are in column 8 (from 12). 2402cdf0e10cSrcweir 2403cdf0e10cSrcweir $bidiattribute = 224; 2404cdf0e10cSrcweir for ( my $i = 0; $i <= $#{$controlfile}; $i++ ) 2405cdf0e10cSrcweir { 2406cdf0e10cSrcweir if ( $i < 3 ) { next; } 2407cdf0e10cSrcweir if ( ${$controlfile}[$i] =~ /^\s*(.*?)\t(.*?)\t(.*?)\t(.*?)\t(.*?)\t(.*?)\t(.*?)\t(.*?)\t(.*?)\t(.*?)\t(.*?)\t(.*?)\s*$/ ) 2408cdf0e10cSrcweir { 2409cdf0e10cSrcweir my $one = $1; 2410cdf0e10cSrcweir my $two = $2; 2411cdf0e10cSrcweir my $three = $3; 2412cdf0e10cSrcweir my $four = $4; 2413cdf0e10cSrcweir my $five = $5; 2414cdf0e10cSrcweir my $six = $6; 2415cdf0e10cSrcweir my $seven = $7; 2416cdf0e10cSrcweir my $attribute = $8; 2417cdf0e10cSrcweir my $nine = $9; 2418cdf0e10cSrcweir my $ten = $10; 2419cdf0e10cSrcweir my $eleven = $11; 2420cdf0e10cSrcweir my $twelve = $12; 2421cdf0e10cSrcweir $attribute = $attribute + $bidiattribute; 2422cdf0e10cSrcweir ${$controlfile}[$i] = "$one\t$two\t$three\t$four\t$five\t$six\t$seven\t$attribute\t$nine\t$ten\t$eleven\t$twelve\n"; 2423cdf0e10cSrcweir } 2424cdf0e10cSrcweir } 2425cdf0e10cSrcweir 2426cdf0e10cSrcweir # Saving the file 2427cdf0e10cSrcweir 2428cdf0e10cSrcweir installer::files::save_file($dialogfilename, $dialogfile); 2429cdf0e10cSrcweir $infoline = "Set bidi support in idt file \"$dialogfilename\" for language $onelanguage\n"; 2430cdf0e10cSrcweir push(@installer::globals::logfileinfo, $infoline); 2431cdf0e10cSrcweir 2432cdf0e10cSrcweir installer::files::save_file($controlfilename, $controlfile); 2433cdf0e10cSrcweir $infoline = "Set bidi support in idt file \"$controlfilename\" for language $onelanguage\n"; 2434cdf0e10cSrcweir push(@installer::globals::logfileinfo, $infoline); 2435cdf0e10cSrcweir} 2436cdf0e10cSrcweir 2437cdf0e10cSrcweir1; 2438