val aliases = "/var/domtool/aliases"
val aliasesDefault = "/var/domtool/aliases.default"
val handleDomains = "/var/domtool/local_domains.cfg"
+val relayDomains = "/var/domtool/relay_domains.cfg"
val reload = "/usr/bin/sudo /usr/local/sbin/domtool-publish exim"
val handleDomains : string
(* File to which to write a comma-separate list of domains to handle mail for *)
+val relayDomains : string
+(* File to which to write a comma-separate list of domains to relay mail for *)
+
val aliasTo : string list
(* Default nodes to which alias directives are applied *)
#!/bin/sh -e
+redo_exim() {
+ /bin/echo -n "domainlist local_domains = " >/etc/exim4/conf.d/main/10_domtool-domains
+ /bin/cat /var/domtool/local_domains.cfg >>/etc/exim4/conf.d/main/10_domtool-domains
+ /bin/echo "" >>/etc/exim4/conf.d/main/10_domtool-domains
+ /bin/echo -n "domainlist relay_to_domains = " >>/etc/exim4/conf.d/main/10_domtool-domains
+ /bin/cat /var/domtool/relay_domains.cfg >>/etc/exim4/conf.d/main/10_domtool-domains
+ /bin/echo "" >>/etc/exim4/conf.d/main/10_domtool-domains
+ /bin/echo -n "domainlist mm_domains = " >>/etc/exim4/conf.d/main/10_domtool-domains
+ /bin/cat /var/domtool/mailman_domains.cfg >>/etc/exim4/conf.d/main/10_domtool-domains
+ /bin/echo "" >>/etc/exim4/conf.d/main/10_domtool-domains
+ /etc/init.d/exim4 reload
+}
+
case $1 in
apache)
/usr/bin/rsync -r --delete /var/domtool/vhosts/ /etc/apache2/vhosts/
exim)
/bin/cp /var/domtool/aliases /etc/
/bin/cp /var/domtool/aliases.default /etc/
- /bin/echo -n "domainlist local_domains = " >/etc/exim4/conf.d/main/10_domtool-domains
- /bin/cat /var/domtool/local_domains.cfg >>/etc/exim4/conf.d/main/10_domtool-domains
- /bin/echo "" >>/etc/exim4/conf.d/main/10_domtool-domains
- /etc/init.d/exim4 reload
+ redo_exim
;;
mailman)
/bin/cp /var/domtool/mailman.map /etc/mailman
/etc/init.d/mailman reload
+ redo_exim
;;
courier)
/bin/cat /etc/courier/userdb/* >/etc/courier/exim
val aliasesChanged = ref false
val aliasesDefaultChanged = ref false
val hostsChanged = ref false
+val relayHostsChanged = ref false
val () = Slave.registerPreHandler
(fn () => (aliasesChanged := false;
aliasesDefaultChanged := true
else if #file spl = "mail" then
hostsChanged := true
+ else if #file spl = "mail.relay" then
+ relayHostsChanged := true
else
()
end)
Slave.enumerateTo (fn s => s = "mail") ":" Config.Exim.handleDomains
else
();
+ if !relayHostsChanged then
+ Slave.enumerateTo (fn s => s = "mail.relay") ":" Config.Exim.relayDomains
+ else
+ ();
if !aliasesChanged orelse !aliasesDefaultChanged
- orelse !hostsChanged then
+ orelse !hostsChanged orelse !relayHostsChanged then
Slave.shellF ([Config.Exim.reload],
fn cl => "Error reloading exim with " ^ cl)
else
name = "mail"})) nodes
end)
+val () = Env.actionV_none "relayMail"
+ (fn env =>
+ let
+ val nodes = Env.env (Env.list Env.string) (env, "MailNodes")
+ in
+ app (fn node => TextIO.closeOut
+ (Domain.domainFile {node = node,
+ name = "mail.relay"})) nodes
+ end)
+
end
if !mailmanChanged then
(Slave.concatTo (fn s => s = "mailman")
Config.Mailman.mapFile;
- Slave.shellF ([Config.Mailman.reload],
+ Slave.enumerateTo (fn s => s = "mailman") ":"
+ Config.Mailman.handleDomains;
+ Slave.shellF ([Config.Mailman.reload],
fn cl => "Error reloading Mailman with " ^ cl))
else
())