config: warn that changing localRoot will not work currently
[hcoop/domtool2.git] / scripts / domtool-publish
index fdc9da8..cd5e196 100755 (executable)
@@ -1,5 +1,18 @@
 #!/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/
@@ -12,32 +25,78 @@ case $1 in
                /usr/bin/rsync -r --delete /var/domtool/vhosts/ /etc/apache2/vhosts/
                /etc/init.d/apache2 start
        ;;
+       apache1.3)
+               /usr/bin/rsync -r --delete /var/domtool/vhosts/ /etc/apache/vhosts/
+               /etc/init.d/apache reload
+       ;;
+       apache1.3-down)
+               /etc/init.d/apache stop
+       ;;
+       apache1.3-undown)
+               /usr/bin/rsync -r --delete /var/domtool/vhosts/ /etc/apache/vhosts/
+               /etc/init.d/apache start
+       ;;
        bind)
                /usr/bin/rsync -r --delete /var/domtool/zones/ /etc/bind/zones/
+               /bin/chown -R bind /etc/bind/zones
                /bin/cp /var/domtool/named.conf.local /etc/bind/
-               /etc/init.d/bind9 reload
+               /bin/chown root:bind /etc/bind/named.conf.local
+               /bin/chmod 644 /etc/bind/named.conf.local
+               /etc/init.d/bind9 restart
        ;;
        exim)
-               /bin/cp /var/domtool/aliases /etc/
-               /bin/cp /var/domtool/aliases.default /etc/
-               /bin/cp /var/domtool/local_domains.cfg /etc/exim4/
-               /etc/init.d/exim4 reload
+               /bin/cp /var/domtool/aliases /etc/aliases.hosted
+               /bin/cp /var/domtool/aliases.default /etc/aliases.wildcard
+               redo_exim
        ;;
        mailman)
-               /bin/cp /var/domtool/mailman.map /etc/mailman
+                /bin/echo "HCOOP_VHOSTS = {" >/etc/mailman/vhosts_cfg.py
+               /bin/cat /var/domtool/mailman.map >>/etc/mailman/vhosts_cfg.py
+                /bin/echo "}" >>/etc/mailman/vhosts_cfg.py
                /etc/init.d/mailman reload
+               redo_exim
        ;;
        courier)
+               VMAILDB=`domtool-config -path vmaildb`
+               if [ -z "$VMAILDB" ]; then
+                   echo "domtool-config not found, not syncing courier vmail userdb"
+                   exit 1
+               fi
+               /usr/bin/rsync -r --delete ${VMAILDB}/ /etc/courier/userdb
+               /usr/sbin/makeuserdb
+               /bin/chown -R domtool:nogroup /etc/courier/userdb
                /bin/cat /etc/courier/userdb/* >/etc/courier/exim
                /bin/chmod o-r /etc/courier/exim
                /usr/sbin/exim_dbmbuild /etc/courier/exim /etc/courier/exim.dat
                /bin/chgrp mail /etc/courier/exim.dat
                /bin/chmod o-r /etc/courier/exim.dat
        ;;
+        spamassassin)
+               SHAREDROOT=`domtool-config -path shared-root`
+               /usr/bin/rsync -r --delete ${SHAREDROOT}/email/spamassassin/addrs/ /etc/spamassassin/addrs
+       ;;
        smtplog)
                /bin/grep $2 /var/log/exim4/mainlog
        ;;
+        apache-fixperms)
+                /bin/chown -R domtool:nogroup /var/log/apache2/user
+        ;;
+        apache1.3-fixperms)
+                /bin/chown -R domtool:nogroup /var/log/apache/user
+        ;;
+        users)
+                /bin/cp /var/domtool/waklog.conf /etc/apache2/
+               /etc/init.d/apache2 reload
+        ;;
+        firewall)
+              # Ideally this would check if the config worked first
+              # (ferm failing just uses the previous config at
+              # least). Does it need to chown/chmod the generated
+              # rules?
+              /bin/cp /var/domtool/firewall/*.conf /etc/ferm/
+              /etc/init.d/ferm reload
+       ;;
        *)
-               echo "Usage: domtool-publish [apache|bind|exim|mailman]"
+               echo "Usage: domtool-publish [apache|bind|courier|exim|mailman|smtplog STRING|users|firewall]"
        ;;
 esac