various fixes and mail improvements
[distro-setup] / mail-setup
index b8440fbfc7fc3684678f851273128102a238cfe4..058fb4f52d4d56e4894212a2a1d804d4b36f4a05 100755 (executable)
@@ -322,7 +322,7 @@ debconf-set-selections <<EOF
 exim4-config exim4/use_split_config boolean true
 EOF
 
-source /a/bin/bash_unpublished/source-semi-priv
+source /a/bin/bash_unpublished/source-state
 mkdir -p /etc/exim4/conf.d/{main,transport,auth,router}
 
 cat >/etc/exim4/rcpt_local_acl <<'EOF'
@@ -419,7 +419,7 @@ trap 'echo "$0:$LINENO:error: \"$BASH_COMMAND\" returned $?" >&2' ERR
 
 [[ $EUID == 0 ]] || exec sudo "$BASH_SOURCE" "$@"
 
-f=/a/bin/bash_unpublished/source-semi-priv
+f=/a/bin/bash_unpublished/source-state
 if [[ -e $f ]]; then
     source $f
 fi
@@ -543,8 +543,7 @@ exim4-config exim4/mailname string mail.iankelling.org
 # Other destinations for which mail is accepted:
 # iank.bid is for testing
 # mail.iankelling.org is for machines i own
-exim4-config exim4/dc_other_hostnames string *.iankelling.org;iankelling.org;*iank.bid;iank.bid;*zroe.org;zroe.org;*.b8.nz;b8.nz
-
+exim4-config exim4/dc_other_hostnames string *.iankelling.org;iankelling.org;*iank.bid;iank.bid;*zroe.org;zroe.org;*.b8.nz;b8.nz;*.fsf.org;fsf.org
 
 
 
@@ -973,6 +972,17 @@ fi
 systemctl restart exim4
 systemctl enable exim4
 
+
+if [[ $HOSTNAME == $MAIL_HOST ]]; then
+  cat >/etc/cron.d/mailtest <<'EOF'
+*/10 * * * *   iank echo body_test | mail -s "primary_test $(date +%s) $(date +%Y-%m-%dT%H:%M:%S%z)" iank@posteo.de
+2/10 * * * *   root /usr/local/bin/mailtest-check
+EOF
+  cp /a/bin/distro-setup/filesystem/usr/local/bin/mailtest-check /usr/local/bin
+else
+  rm -f /etc/cron.d/mailtest
+fi
+
 # MAIL_HOST also does radicale, and easier to start and stop it here
 # for when MAIL_HOST changes, so radicale gets the synced files and
 # does not stop us from remounting /o.