Add check if server is installed

This commit is contained in:
Jamie Cameron
2013-03-23 10:44:05 -07:00
parent fbecfd07f9
commit 090249afe6
4 changed files with 41 additions and 0 deletions

View File

@@ -5,6 +5,22 @@ BEGIN { push(@INC, ".."); };
use WebminCore;
&init_config();
# check_exports()
# Returns an error message if the NFS exports package is missing
sub check_exports
{
if ($gconfig{'os_type'} eq 'freebsd') {
foreach my $c ("mountd", "nfsd", "portmap") {
&has_command($c) || return &text('check_ecmd', $c);
}
return undef;
}
else {
# Don't know
return undef;
}
}
# list_exports()
# Returns the current exports list
sub list_exports

View File

@@ -5,6 +5,14 @@
require './bsdexports-lib.pl';
&ui_print_header(undef, $text{'index_title'}, "", undef, 1, 1);
# Check if installed
my $err = &check_exports();
if ($err) {
print "<b>",&text('index_echeck', $err),"</b><p>\n";
&ui_print_footer("/", $text{'index'});
return;
}
@exp = &list_exports();
if (@exp) {
print &ui_form_start("delete_exports.cgi", "post");

14
bsdexports/install_check.pl Executable file
View File

@@ -0,0 +1,14 @@
# install_check.pl
do 'bsdexports-lib.pl';
# is_installed(mode)
# For mode 1, returns 2 if the server is installed and configured for use by
# Webmin, 1 if installed but not configured, or 0 otherwise.
# For mode 0, returns 1 if installed, 0 if not
sub is_installed
{
return 0 if (&check_exports());
return $_[0] ? 2 : 1;
}

View File

@@ -8,6 +8,9 @@ index_delete=Delete Selected Exports
index_apply=Apply Changes
index_applydesc=Click this button to apply the current file exports configuration. This will make all the directories listed above available with the options specified.
index_return=exports list
index_echeck=The NFS server cannot be used on this system : $1
check_ecmd=NFS server command $1 is not installed
delete_err=Failed to delete exports
delete_enone=None selected