1#************************************************************** 2# 3# Licensed to the Apache Software Foundation (ASF) under one 4# or more contributor license agreements. See the NOTICE file 5# distributed with this work for additional information 6# regarding copyright ownership. The ASF licenses this file 7# to you under the Apache License, Version 2.0 (the 8# "License"); you may not use this file except in compliance 9# with the License. You may obtain a copy of the License at 10# 11# http://www.apache.org/licenses/LICENSE-2.0 12# 13# Unless required by applicable law or agreed to in writing, 14# software distributed under the License is distributed on an 15# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 16# KIND, either express or implied. See the License for the 17# specific language governing permissions and limitations 18# under the License. 19# 20#************************************************************** 21 22 23 24package installer::windows::java; 25 26use installer::exiter; 27use installer::files; 28use installer::globals; 29use installer::windows::idtglobal; 30 31#################################################################################### 32# Writing content into RegLocat.idt and AppSearc.idt to find Java on system 33#################################################################################### 34 35sub update_java_tables 36{ 37 my ($basedir, $allvariables) = @_; 38 39 my $reglocatfile = ""; 40 my $appsearchfile = ""; 41 42 my $reglocatfilename = $basedir . $installer::globals::separator . "RegLocat.idt"; 43 my $appsearchfilename = $basedir . $installer::globals::separator . "AppSearc.idt"; 44 my $signaturefilename = $basedir . $installer::globals::separator . "Signatur.idt"; 45 46 if ( -f $reglocatfilename ) 47 { 48 $reglocatfile = installer::files::read_file($reglocatfilename); 49 } 50 else 51 { 52 my @reglocattable = (); 53 $reglocatfile = \@reglocattable; 54 installer::windows::idtglobal::write_idt_header($reglocatfile, "reglocat"); 55 } 56 57 if ( -f $appsearchfilename ) 58 { 59 $appsearchfile = installer::files::read_file($appsearchfilename); 60 } 61 else 62 { 63 my @appsearchtable = (); 64 $appsearchfile = \@appsearchtable; 65 installer::windows::idtglobal::write_idt_header($appsearchfile, "appsearch"); 66 } 67 68 if ( -f $signaturefilename ) 69 { 70 $signaturefile = installer::files::read_file($signaturefilename); 71 } 72 else 73 { 74 my @signaturetable = (); 75 $signaturefile = \@signaturetable; 76 installer::windows::idtglobal::write_idt_header($signaturefile, "signatur"); 77 } 78 79 # Writing content into this tables 80 # Java version is saved in scp project 81 # $installer::globals::javafile was defined in installer::windows::idtglobal::add_childprojects 82 83 if ( ! $installer::globals::javafile->{'Javaversion'} ) { installer::exiter::exit_program("ERROR: \"Javaversion\" has to be defined in $installer::globals::javafile->{'gid'} in scp project!", "update_java_tables"); } 84 85 my $javastring = $installer::globals::javafile->{'Javaversion'}; 86 87 my $signature = "JavaReg"; 88 my $rootvalue = "2"; 89 my $key = "Software\\JavaSoft\\Java Runtime Environment\\" . $javastring; 90 my $name = "JavaHome"; 91 my $type = 2; 92 my $property = "JAVAPATH"; 93 94 my $oneline = $signature . "\t" . $rootvalue . "\t" . $key . "\t" . $name . "\t" . $type . "\n"; 95 push(@{$reglocatfile}, $oneline); 96 97 $oneline = $property . "\t" . $signature . "\n"; 98 push(@{$appsearchfile}, $oneline); 99 100 # Saving the files 101 102 installer::files::save_file($reglocatfilename ,$reglocatfile); 103 my $infoline = "Updated idt file for Java: $reglocatfilename\n"; 104 push(@installer::globals::logfileinfo, $infoline); 105 106 installer::files::save_file($appsearchfilename ,$appsearchfile); 107 $infoline = "Updated idt file for Java: $appsearchfilename\n"; 108 push(@installer::globals::logfileinfo, $infoline); 109 110 installer::files::save_file($signaturefilename ,$signaturefile); 111 $infoline = "Updated idt file: $signaturefilename\n"; 112 push(@installer::globals::logfileinfo, $infoline); 113 114} 115 1161; 117