smeserver-postfix/createlinks

202 lines
7.2 KiB
Plaintext
Raw Normal View History

2024-09-25 04:51:20 +02:00
#!/usr/bin/perl -w
use esmith::Build::CreateLinks qw(:all);
use esmith::Build::Backup qw(:all);
my $event;
# email-conf - console-save, bootstrap-console-save, domain-create, domain-delete,
# ip-change, email-update, host-create, host-delete, host-modify, post-upgrade
# rcpthosts template was in smeserver qpsmtpd, and not used if qpsmtpd in use anymore
foreach (qw(
main.cf
master.cf
transport
virtual
))
{
templates2events("/var/qmail/control/$_", qw(
console-save
bootstrap-console-save
domain-create
domain-delete
ip-change
email-update
host-create
host-delete
host-modify
post-upgrade
smeserver-postfix-update
));
}
#--------------------------------------------------
# actions for console-save event:
# write config files and create startup link
#--------------------------------------------------
$event = "console-save";
# If qmail-send is running, it will receive the SIGHUP and ignore the
# start command. If it is not running then the signal will be ignored
# and qmail-send will read its new configuration files anyway.
safe_symlink("sighup", "root/etc/e-smith/events/$event/services2adjust/postfix");
#--------------------------------------------------
# actions for bootstrap-console-save event:
# write config files and create startup link
#--------------------------------------------------
$event = "bootstrap-console-save";
# TODO alternative ? event_link("pseudonym-cleanup", $event, "03");
# TODO alternative ? event_link("qmail-update-group", $event, "20");
# TODO alternative ? event_link("qmail-update-user", $event, "55");
# TODO alternative ? templates2events("/var/qmail/users/assign", $event);
# TODO alternative ? safe_symlink("/var/qmail/bin/qmail-newu", "root/etc/e-smith/events/$event/S55email-assign");
#--------------------------------------------------
# actions for domain-create event:
# rewrite config files and restart server
#--------------------------------------------------
$event = "domain-create";
safe_symlink("sighup", "root/etc/e-smith/events/$event/services2adjust/postfix");
#--------------------------------------------------
# actions for domain-delete event:
# rewrite config files and restart server
#--------------------------------------------------
$event = "domain-delete";
safe_symlink("sighup", "root/etc/e-smith/events/$event/services2adjust/postfix");
#--------------------------------------------------
# actions for email-update event:
# email parameters have been changed in the e-smith
# manager; update system security, rewrite email config
# files, configure other system files (crontab is the
# important one), and restart server
#--------------------------------------------------
$event = "email-update";
# TODO alternative ? event_link("qmail-update-user", $event, "03");
# TODO alternative ? event_link("pseudonym-cleanup", $event, "30");
safe_symlink("sighup", "root/etc/e-smith/events/$event/services2adjust/postfix");
safe_symlink("adjust", "root/etc/e-smith/events/$event/services2adjust/masq");
safe_symlink("restart", "root/etc/e-smith/events/$event/services2adjust/smtp-auth-proxy");
#--------------------------------------------------
# actions for group-create event:
#--------------------------------------------------
$event = "group-create";
# TODO alternative ? event_link("pseudonym-cleanup", $event, "03");
# TODO alternative ? event_link("qmail-update-group", $event, "20");
# TODO alternative ? templates2events("/var/qmail/users/assign", $event);
# TODO alternative ? safe_symlink("/var/qmail/bin/qmail-newu", "root/etc/e-smith/events/$event/S55email-assign");
safe_symlink("sighup", "root/etc/e-smith/events/$event/services2adjust/postfix");
#--------------------------------------------------
# actions for group-delete event:
#--------------------------------------------------
$event = "group-delete";
# TODO alternative ? event_link("pseudonym-cleanup", $event, "03");
# TODO alternative ? event_link("qmail-delete-group", $event, "20");
# TODO alternative ? templates2events("/var/qmail/users/assign", $event);
# TODO alternative ? safe_symlink("/var/qmail/bin/qmail-newu", "root/etc/e-smith/events/$event/S55email-assign");
safe_symlink("sighup", "root/etc/e-smith/events/$event/services2adjust/postfix");
#--------------------------------------------------
# actions for group-modify event:
#--------------------------------------------------
$event = "group-modify";
# TODO alternative ? event_link("pseudonym-cleanup", $event, "03");
# TODO alternative ? event_link("qmail-update-group", $event, "20");
# TODO alternative ? templates2events("/var/qmail/users/assign", $event);
# TODO alternative ? safe_symlink("/var/qmail/bin/qmail-newu", "root/etc/e-smith/events/$event/S55email-assign");
safe_symlink("sighup", "root/etc/e-smith/events/$event/services2adjust/postfix");
#--------------------------------------------------
# actions for user-create event:
#--------------------------------------------------
$event = "user-create";
# TODO alternative ? event_link("qmail-update-user", $event, "20");
# TODO alternative ? event_link("qmail-update-group", $event, "20");
#--------------------------------------------------
# actions for user-modify event
#--------------------------------------------------
$event = "user-modify";
# TODO alternative ? event_link("qmail-update-user", $event, "20");
# TODO alternative ? event_link("qmail-update-group", $event, "20");
#--------------------------------------------------
# actions for user-modify-admin event
#--------------------------------------------------
$event = "user-modify-admin";
# TODO alternative ? event_link("qmail-update-user", $event, "20");
#--------------------------------------------------
# actions for user-delete event
#--------------------------------------------------
$event = "user-delete";
# TODO alternative ? event_link("qmail-update-group", $event, "25");
#--------------------------------------------------
# actions for ip-up event:
#--------------------------------------------------
$event = "ip-up";
# TODO alternative ? event_link("qmail-ipup", $event, "20");
#--------------------------------------------------
# actions for ip-change event:
#--------------------------------------------------
$event = "ip-change";
safe_symlink("sighup", "root/etc/e-smith/events/$event/services2adjust/postfix");
2024-09-25 04:51:20 +02:00
# our event specific for updating with yum without reboot
$event = 'smeserver-postfix-update';
#add here the path to your templates needed to expand
#see the /etc/systemd/system-preset/49-koozali.preset should be present for systemd integration on all you yum update event
# Maybe need ths in here as well:
# /etc/dar/DailyBackup.dcf - if backup requested
foreach my $file (qw(
/etc/systemd/system-preset/49-koozali.preset
))
{
templates2events( $file, $event );
};
#action needed in case we have a systemd unit
event_link('systemd-default', $event, '10');
event_link('systemd-reload', $event, '50');
safe_symlink("restart", "root/etc/e-smith/events/$event/services2adjust/postfix");
2024-09-25 04:51:20 +02:00
#services we might need to restart
#event_services($event, 'xxxx' => 'restart', 'yyyy' => 'restart');
#Backup files
2024-09-25 04:51:20 +02:00
# backup_includes("smeserver-postfix", qw(
# files(s) to be backed up
#));