56.6. Pre- and Post-Install Scripts

Webmin versions 0.990 and above allow modules to contain Perl scripts that will be run after a module is installed and before it is uninstalled. If your module contains a file called postinstall.pl, the Perl function module_install in this file will be called after the install of your module is complete. Because it is executed in the module's directory, it can make use of the common functions library, in the following way:

require 'yourmodule-lib.pl';

sub module_install
{
system("cp $module_root_directory/somefile $config_directory/somefile")
        if (!-r "$config_directory/somefile");
}

The function will be called when a module is installed from the Webmin Configuration or Cluster Webmin Servers modules. It is not called, however, if the install-module.pl script is used or when the module in RPM format is installed.

If your module contains a file called uninstall.pl, the Perl function module_uninstall in that file will also be called just before the module is deleted. This can happen when it is deleted, using the Webmin Users or Cluster Webmin Servers modules, or when all of Webmin is uninstalled. The module_uninstall function should clean up any configuration that will no longer work when the module is uninstalled, such as Cron jobs that reference scripts in the module.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
18.116.87.196