Fix disk space monitoring on MacOS, expand supported OS for modules
authorJamie Cameron <jcameron@webmin.com>
Wed, 19 Dec 2007 20:05:24 +0000 (20:05 +0000)
committerJamie Cameron <jcameron@webmin.com>
Wed, 19 Dec 2007 20:05:24 +0000 (20:05 +0000)
fastrpc.cgi
mount/module.info
rpc.cgi
status/space-monitor.pl
status/status-lib.pl
web-lib-funcs.pl

index 517cf40..d6b5b21 100755 (executable)
@@ -93,7 +93,8 @@ while(1) {
                print STDERR "fastrpc: check $arg->{'module'}\n" if ($gconfig{'rpcdebug'});
                $rawrv = &serialise_variable(
                        { 'status' => 1,
-                         'rv' => &foreign_check($arg->{'module'}) } );
+                         'rv' => &foreign_check($arg->{'module'}, undef, undef,
+                                                $arg->{'api'}) } );
                }
        elsif ($arg->{'action'} eq 'config') {
                # Get the config for some module
index b3b34ac..11d417c 100644 (file)
@@ -10,6 +10,7 @@ desc_pt=Sistema de Ficheiros de Disco e Rede
 category=system
 desc_tr=Disk ve Að Dosya Sistemi
 os_support=slackware-linux redhat-linux mandrake-linux solaris debian-linux suse-linux united-linux freebsd hpux unixware open-linux turbo-linux corel-linux openbsd cobalt-linux lfs-linux msc-linux generic-linux gentoo-linux irix netbsd trustix-linux sol-linux coherent-linux openmamba-linux
+api_os_support=macos
 desc=Disk and Network Filesystems
 desc_es=Sistemas de Archivo de Disco y Red
 desc_sv=Filsystem för diskar och nätverk
diff --git a/rpc.cgi b/rpc.cgi
index 4c67dda..f117f09 100755 (executable)
--- a/rpc.cgi
+++ b/rpc.cgi
@@ -116,7 +116,8 @@ elsif ($arg->{'action'} eq 'check') {
        # Check if some module is supported
        print &serialise_variable(
                { 'status' => 1,
-                 'rv' => &foreign_check($arg->{'module'}) } );
+                 'rv' => &foreign_check($arg->{'module'}, undef, undef,
+                                        $arg->{'api'}) } );
        }
 elsif ($arg->{'action'} eq 'config') {
        # Get the config for some module
index c13c49f..c9896f8 100644 (file)
@@ -3,7 +3,7 @@
 
 sub get_space_status
 {
-return { 'up' => -1 } if (!&foreign_check("mount"));
+return { 'up' => -1 } if (!&foreign_check("mount", 1));
 &foreign_require("mount", "mount-lib.pl");
 local $m;
 foreach $f (&mount::list_mounted()) {
index fed14ca..f3e6b9a 100644 (file)
@@ -219,7 +219,7 @@ return if ($_[0]->{'id'});  # only check for new services
 if ($_[0]->{'remote'}) {
        # Check on the remote server
        foreach $m (@_[1..$#_]) {
-               &remote_foreign_check($_[0]->{'remote'}, $m) ||
+               &remote_foreign_check($_[0]->{'remote'}, $m, 1) ||
                        &error(&text('depends_remote', "<tt>$m</tt>",
                                     "<tt>$_[0]->{'remote'}</tt>"));
                }
@@ -229,7 +229,7 @@ else {
        foreach $m (@_[1..$#_]) {
                local %minfo = &get_module_info($m);
                %minfo || &error(&text('depends_mod', "<tt>$m</tt>"));
-               &check_os_support(\%minfo) ||
+               &check_os_support(\%minfo, undef, undef, 1) ||
                        &error(&text('depends_os', "<tt>$minfo{'desc'}</tt>"));
                }
        $_[0]->{'depends'} = join(" ", @_[1..$#_]);
index ded2093..646ec0f 100755 (executable)
@@ -1347,12 +1347,16 @@ else {
        }
 }
 
-# check_os_support(&minfo, [os-type, os-version])
+# check_os_support(&minfo, [os-type, os-version], [api-only])
 # Returns 1 if some module is supported on the current operating system, or the
 # OS supplies as parameters.
 sub check_os_support
 {
 local $oss = $_[0]->{'os_support'};
+if ($_[3] && $oss && $_[0]->{'api_os_support'}) {
+       # May provide usable API
+       $oss .= " ".$_[0]->{'api_os_support'};
+       }
 if ($_[0]->{'nozone'} && &running_in_zone()) {
        # Not supported in a Solaris Zone
        return 0;
@@ -2073,14 +2077,15 @@ elsif (!$_[1] && $gconfig{'db_sizeuser'}) {
 return "<input type=button onClick='ifield = form.$_[0]; chooser = window.open(\"$gconfig{'webprefix'}/group_chooser.cgi?multi=$_[1]&group=\"+escape(ifield.value), \"chooser\", \"toolbar=no,menubar=no,scrollbars=yes,resizable=yes,width=$w,height=$h\"); chooser.ifield = ifield; window.ifield = ifield' value=\"...\">\n";
 }
 
-# foreign_check(module)
+# foreign_check(module, [api-only])
 # Checks if some other module exists and is supported on this OS
 sub foreign_check
 {
+local ($mod, $api) = @_;
 local %minfo;
-local $mdir = &module_root_directory($_[0]);
+local $mdir = &module_root_directory($mod);
 &read_file_cached("$mdir/module.info", \%minfo) || return 0;
-return &check_os_support(\%minfo);
+return &check_os_support(\%minfo, undef, undef, $api);
 }
 
 # foreign_exists(module)
@@ -3594,7 +3599,6 @@ while(1) {
                last;
                }
        }
-close(OUT);
 if (kill('TERM', $pid) && time() - $start >= $_[1]) {
        $timed_out = 1;
        }
@@ -3926,12 +3930,13 @@ return &remote_rpc_call($_[0], { 'action' => 'call',
                                 'args' => [ @_[3 .. $#_] ] } );
 }
 
-# remote_foreign_check(server, module)
+# remote_foreign_check(server, module, [api-only])
 # Checks if some module is installed and supported on a remote server
 sub remote_foreign_check
 {
 return &remote_rpc_call($_[0], { 'action' => 'check',
-                                'module' => $_[1] });
+                                'module' => $_[1],
+                                'api' => $_[2] });
 }
 
 # remote_foreign_config(server, module)