better local bounce handling
[distro-setup] / mail-setup
index 31841b9ef71f6293a95e0784411fbbef44eebd48..65c9d8b70a80d7b437833cdf4fed4b877ad84c93 100755 (executable)
@@ -684,7 +684,10 @@ EOF
   cat >>/etc/exim4/update-exim4.conf.conf <<EOF
 dc_eximconfig_configtype='satellite'
 dc_smarthost='$smarthost'
-# i dunno if this would ever get used.
+# The manpage incorrectly states this will do header rewriting, but
+# that only happens if we have dc_hide_mailname is set.
+dc_readhost='iankelling.org'
+# Only used in case of bounces.
 dc_localdelivery='maildir_home'
 EOF
 
@@ -816,15 +819,14 @@ EOF
 fi
 
 # local mail that bounces to alerts goes to /Maildir
-mkdir -p /m/md/INBOX
-chmod 770 /m/md/INBOX
-if id -g 1000 &>/dev/null; then
-  chgrp 1000 /m/md/INBOX
-  usermod -a -G 1000 Debian-exim
-else
-  chgrp Debian-exim /m/md/INBOX
+dirs=(/Maildir/{cur,tmp,new})
+mkdir -p ${dirs[@]}
+chown -R $u:Debian-exim /Maildir
+chmod 775 ${dirs[@]}
+usermod -a -G Debian-exim $u
+if [[ -d /m/md ]]; then
+  sudo -u $u ln -sf -T /Maildir /m/md/bounces
 fi
-ln -s /m/md/INBOX /Maildir
 
 # put spool dir in directory that spans multiple distros.
 # based on http://www.postfix.org/qmgr.8.html and my notes in gnus