19780544fSAndrew Rist#************************************************************** 29780544fSAndrew Rist# 39780544fSAndrew Rist# Licensed to the Apache Software Foundation (ASF) under one 49780544fSAndrew Rist# or more contributor license agreements. See the NOTICE file 59780544fSAndrew Rist# distributed with this work for additional information 69780544fSAndrew Rist# regarding copyright ownership. The ASF licenses this file 79780544fSAndrew Rist# to you under the Apache License, Version 2.0 (the 89780544fSAndrew Rist# "License"); you may not use this file except in compliance 99780544fSAndrew Rist# with the License. You may obtain a copy of the License at 109780544fSAndrew Rist# 119780544fSAndrew Rist# http://www.apache.org/licenses/LICENSE-2.0 129780544fSAndrew Rist# 139780544fSAndrew Rist# Unless required by applicable law or agreed to in writing, 149780544fSAndrew Rist# software distributed under the License is distributed on an 159780544fSAndrew Rist# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 169780544fSAndrew Rist# KIND, either express or implied. See the License for the 179780544fSAndrew Rist# specific language governing permissions and limitations 189780544fSAndrew Rist# under the License. 199780544fSAndrew Rist# 209780544fSAndrew Rist#************************************************************** 219780544fSAndrew Rist 229780544fSAndrew Rist 23cdf0e10cSrcweir 24cdf0e10cSrcweirpackage installer::windows::java; 25cdf0e10cSrcweir 26cdf0e10cSrcweiruse installer::exiter; 27cdf0e10cSrcweiruse installer::files; 28cdf0e10cSrcweiruse installer::globals; 29cdf0e10cSrcweiruse installer::windows::idtglobal; 30cdf0e10cSrcweir 31cdf0e10cSrcweir#################################################################################### 32cdf0e10cSrcweir# Writing content into RegLocat.idt and AppSearc.idt to find Java on system 33cdf0e10cSrcweir#################################################################################### 34cdf0e10cSrcweir 35cdf0e10cSrcweirsub update_java_tables 36cdf0e10cSrcweir{ 37cdf0e10cSrcweir my ($basedir, $allvariables) = @_; 38cdf0e10cSrcweir 39cdf0e10cSrcweir my $reglocatfile = ""; 40cdf0e10cSrcweir my $appsearchfile = ""; 41cdf0e10cSrcweir 42cdf0e10cSrcweir my $reglocatfilename = $basedir . $installer::globals::separator . "RegLocat.idt"; 43cdf0e10cSrcweir my $appsearchfilename = $basedir . $installer::globals::separator . "AppSearc.idt"; 44cdf0e10cSrcweir my $signaturefilename = $basedir . $installer::globals::separator . "Signatur.idt"; 45cdf0e10cSrcweir 46cdf0e10cSrcweir if ( -f $reglocatfilename ) 47cdf0e10cSrcweir { 48cdf0e10cSrcweir $reglocatfile = installer::files::read_file($reglocatfilename); 49cdf0e10cSrcweir } 50cdf0e10cSrcweir else 51cdf0e10cSrcweir { 52cdf0e10cSrcweir my @reglocattable = (); 53cdf0e10cSrcweir $reglocatfile = \@reglocattable; 54cdf0e10cSrcweir installer::windows::idtglobal::write_idt_header($reglocatfile, "reglocat"); 55cdf0e10cSrcweir } 56cdf0e10cSrcweir 57cdf0e10cSrcweir if ( -f $appsearchfilename ) 58cdf0e10cSrcweir { 59cdf0e10cSrcweir $appsearchfile = installer::files::read_file($appsearchfilename); 60cdf0e10cSrcweir } 61cdf0e10cSrcweir else 62cdf0e10cSrcweir { 63cdf0e10cSrcweir my @appsearchtable = (); 64cdf0e10cSrcweir $appsearchfile = \@appsearchtable; 65cdf0e10cSrcweir installer::windows::idtglobal::write_idt_header($appsearchfile, "appsearch"); 66cdf0e10cSrcweir } 67cdf0e10cSrcweir 68cdf0e10cSrcweir if ( -f $signaturefilename ) 69cdf0e10cSrcweir { 70cdf0e10cSrcweir $signaturefile = installer::files::read_file($signaturefilename); 71cdf0e10cSrcweir } 72cdf0e10cSrcweir else 73cdf0e10cSrcweir { 74cdf0e10cSrcweir my @signaturetable = (); 75cdf0e10cSrcweir $signaturefile = \@signaturetable; 76cdf0e10cSrcweir installer::windows::idtglobal::write_idt_header($signaturefile, "signatur"); 77cdf0e10cSrcweir } 78cdf0e10cSrcweir 79cdf0e10cSrcweir # Writing content into this tables 80cdf0e10cSrcweir # Java version is saved in scp project 81cdf0e10cSrcweir # $installer::globals::javafile was defined in installer::windows::idtglobal::add_childprojects 82cdf0e10cSrcweir 83cdf0e10cSrcweir 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"); } 84cdf0e10cSrcweir 85cdf0e10cSrcweir my $javastring = $installer::globals::javafile->{'Javaversion'}; 86cdf0e10cSrcweir 87cdf0e10cSrcweir my $signature = "JavaReg"; 88cdf0e10cSrcweir my $rootvalue = "2"; 89cdf0e10cSrcweir my $key = "Software\\JavaSoft\\Java Runtime Environment\\" . $javastring; 90cdf0e10cSrcweir my $name = "JavaHome"; 91cdf0e10cSrcweir my $type = 2; 92cdf0e10cSrcweir my $property = "JAVAPATH"; 93cdf0e10cSrcweir 94cdf0e10cSrcweir my $oneline = $signature . "\t" . $rootvalue . "\t" . $key . "\t" . $name . "\t" . $type . "\n"; 95cdf0e10cSrcweir push(@{$reglocatfile}, $oneline); 96cdf0e10cSrcweir 97cdf0e10cSrcweir $oneline = $property . "\t" . $signature . "\n"; 98cdf0e10cSrcweir push(@{$appsearchfile}, $oneline); 99cdf0e10cSrcweir 100cdf0e10cSrcweir # Saving the files 101cdf0e10cSrcweir 102cdf0e10cSrcweir installer::files::save_file($reglocatfilename ,$reglocatfile); 103cdf0e10cSrcweir my $infoline = "Updated idt file for Java: $reglocatfilename\n"; 104*b274bc22SAndre Fischer $installer::logger::Lang->print($infoline); 105cdf0e10cSrcweir 106cdf0e10cSrcweir installer::files::save_file($appsearchfilename ,$appsearchfile); 107cdf0e10cSrcweir $infoline = "Updated idt file for Java: $appsearchfilename\n"; 108*b274bc22SAndre Fischer $installer::logger::Lang->print($infoline); 109cdf0e10cSrcweir 110cdf0e10cSrcweir installer::files::save_file($signaturefilename ,$signaturefile); 111cdf0e10cSrcweir $infoline = "Updated idt file: $signaturefilename\n"; 112*b274bc22SAndre Fischer $installer::logger::Lang->print($infoline); 113cdf0e10cSrcweir 114cdf0e10cSrcweir} 115cdf0e10cSrcweir 116cdf0e10cSrcweir1; 117