forked from cited/JRI-Publisher
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathuninstall_java.cgi
45 lines (30 loc) · 943 Bytes
/
uninstall_java.cgi
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
#!/usr/bin/perl
use File::Path 'rmtree';
require './tomcat-lib.pl';
require './java-lib.pl';
require '../webmin/webmin-lib.pl'; #For OS Fetection
&ReadParse();
&error_setup($text{'delete_err'});
my $jdk_name = $in{'inst_jdk'};
$jdk_name || &error($text{'delete_enone'});
my $jdk_dir = get_jdk_dir_by_name($jdk_name);
my $def_jdk = is_default_jdk($jdk_dir);
if(($def_jdk == 1) and ($in{'rm_def_jdk'} == 0)){
&ui_print_header(undef, $text{'delete_title'}, "");
print "Uninstall stopped, since $jdk_dir is default JDK.<br>";
}else{
if($jdk_name =~ /.*openjdk.*/){
&redirect("/software/search.cgi?search=$jdk_name");
return;
}
&ui_print_header(undef, $text{'delete_title'}, "");
print "Removing $jdk_dir...<br>";
if($def_jdk == 1){
unset_default_java($jdk_dir);
}
if( -d $jdk_dir){
rmtree($jdk_dir);
}
print "<hr>Uninstall of <tt>$jdk_name</tt> is successful<br>";
}
&ui_print_footer("", $text{'index_return'});