Installed Checks

In Webmin version 1.110 and above, module writers can call the function foreign_installed to check if the server or service managed by some other module is installed on the system. If you are writing a module that manages some server, you can add a file to your module's directory that provides this information to callers.

This is done by creating a script called install_check.pl that contains the single Perl function is_installed. This function takes a mode parameter with the same meaning as the parameter passed to foreign_installed, and must interpret it in the same way. Because most modules don't require an extra level of configuration before use, your function can just return 0 if the server is not installed, or mode + 1 if it is.

This example code shows how a is_installed function might be written :

do 'foo-lib.pl';

sub is_installed
{
local $mode = $_[0];
if (!-r $config{'foo_config_file'}) {
        return 0;
        }
else {
        return $mode + 1;
        }
}