easyapache calls if they exist and are executable.
Their output is sent to the screen and the log, and has a "before" and "after" alert to visually separate it from the rest of the output.
Unless otherwise noted, the exit value is ignored.
Hook scripts:
The following scripts use "before" or "after" in their names, instead of "pre" or "post," to help indicate they relate to specific parts instead of the entire script:
/scripts/preeasyapache— Use this at the very beginning of a build. If it does not exit cleanly, will halt the build (i.e.,exit(1);). Potential uses: to lockeasyapacheto keep it from building; to alert users Apache is currently being updated./scripts/posteasyapache— Use this at the very end of a successful build. Potential uses: to verify some customization is still working properly and alert someone if it is not; to alert users when the Apache update is complete.
Use
/scripts/before_apache_make/scripts/after_apache_make_install
Hint: This is where you should use the apxs tool to include other Apache modules.
/scripts/before_httpd_restart_tests/scripts/after_httpd_restart_tests
--skip-hooks to build without running any hooks (or the WHM equivalent found in EasyApache's Help section).
/scripts/preeasyapache to prevent EasyApache from building if a particular condition is not met.
Using /scripts/preeasyapache, you could prevent EasyApache from building with the following Perl script:
#!/usr/bin/perl
my $file = '/etc/disable_easyapache_builds';
if (-e $file) {
print "The admin has disabled me via $file\n";
exit 1;
}
0 means that Apache will not be built.
0 means that PHP will not be built.
#!/usr/bin/perl
my ($ea_version, $ea_revision, $apache, $php_csv, @hook_args) = @ARGV;
if ($ea_revision ne int($ea_revision)) {
print "using a branch of some sort\n";
}
my @phps = split(/,/, $php_csv);
if( !$apache ) {
if ( $apache == 0) {
print "We are not building apache this run\n";
}
elsif ($apache eq '') {
print "I must be /scripts/preeasyapache\n";
}
}
ea3_params_yaml. This variable contains a YAML data structure of parameters that are sent to EasyApache.
You should use --hook-args to pass custom data to hook scripts. This will avoid conflicts with any flags used by the Cpanel::Easy framework.
#!/usr/bin/perl
use YAML::Syck;
my $hr = YAMl::Syck::Load( $ENV{'ea3_params_yaml'} );
if ( exists $hr->{'hook-args'} && grep( /no notify/, @{ $hr->{'hook-args'} }) ) {
print "Skipping user notification\n";
}
else {
print "Notifying users...\n";
notify_users($msg);
}
Copyright © cPanel 2000–2011.