better local bounce handling
[distro-setup] / mail-setup
index db75252b4f2eaae59b3754e4760929b4ee12a292..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,14 +819,13 @@ EOF
 fi
 
 # local mail that bounces to alerts goes to /Maildir
-mkdir -p /Maildir{cur,tmp,new}
-chgrp Debian-exim /Maildir{cur,tmp,new}
-chmod 775 /Maildir{cur,tmp,new}
-if id -g 1000 &>/dev/null; then
-  usermod -a -G Debian-exim 1000
-fi
-if [[ -e /m/md ]]; then
-  ln -s /Maildir /m/md/bounces
+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
 
 # put spool dir in directory that spans multiple distros.