better local bounce handling
authorIan Kelling <ian@iankelling.org>
Mon, 29 Jul 2019 00:36:19 +0000 (20:36 -0400)
committerIan Kelling <ian@iankelling.org>
Mon, 29 Jul 2019 01:18:14 +0000 (21:18 -0400)
brc
mail-setup

diff --git a/brc b/brc
index e1aa677c23ab4c4fe32a64ae7dd30c659d864e7d..df4b90811132aeb5240b18ce2573b13c850c51b2 100644 (file)
--- a/brc
+++ b/brc
@@ -122,7 +122,7 @@ if [[ $- == *i* ]]; then
 
     if [[ $KONSOLE_PROFILE_NAME ]]; then
       TERM=xterm-256color
-      fi
+    fi
 
     # todo: not sure this works in sakura
     #stty werase undef
@@ -1118,14 +1118,14 @@ ifn() {
 }
 
 
-  o() {
-    if type gvfs-open &> /dev/null ; then
-      gvfs-open "$@"
-    else
-      xdg-open "$@"
-    fi
-    # another alternative is run-mailcap
-  }
+o() {
+  if type gvfs-open &> /dev/null ; then
+    gvfs-open "$@"
+  else
+    xdg-open "$@"
+  fi
+  # another alternative is run-mailcap
+}
 
 ipdrop() {
   s iptables -A INPUT -s $1 -j DROP
@@ -2192,8 +2192,11 @@ if [[ $- == *i* ]]; then
     if [[ -e /nocow/btrfs-stale ]] && ((`command ls -AUq /nocow/btrfs-stale|wc -l`)); then
       ps_char="! $ps_char"
     fi
+    if test -e /Maildir/new/*; then
+      ps_char='!BOUNCE! '"$ps_char"
+    fi
     if [[ -e /nocow/mailtest-failure ]]; then
-      ps_char="@#$@#$ $ps_char"
+      ps_char='@#$@#$ '"$ps_char"
     fi
     source /a/bin/bash_unpublished/source-state
     if [[ ! $SSH_CLIENT && $MAIL_HOST != $HOSTNAME ]]; then
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.