- # if we already have it installed, need to reconfigure, without being prompted
- if ! dpkg -s exim4-config &>/dev/null; then
- s dpkg-reconfigure -u -pcritical exim4-config
- fi
- # light version does not have sasl auth support.
- pi exim4-daemon-heavy spamassassin
-
- ##### begin spamassassin config
- ser enable spamassassin
- # per readme.debian
- s sed -i '/^\s*CRON\s*=/d' /etc/default/spamassassin
- s tee -a /etc/default/spamassassin <<<CRON=1
- # just noticed this in the config file, seems like a good idea.
- s sed -i '/^\s*NICE\s*=/d' /etc/default/spamassassin
- s tee -a /etc/default/spamassassin <<<'NICE="--nicelevel 15"'
-
- s dd of=/etc/systemd/system/spamddnsfix.service <<'EOF'
+ fi # end $HOSTNAME != $MAIL_HOST
+
+ # if we already have it installed, need to reconfigure, without being prompted
+ if dpkg -s exim4-config &>/dev/null; then
+ # gotta remove this, otherwise the set-selections are completely
+ # ignored. It woulda been nice if this was documented somewhere!
+ rm -f /etc/exim4/update-exim4.conf.conf
+ while fuser /var/lib/dpkg/lock &>/dev/null; do sleep 1; done
+ dpkg-reconfigure -u -fnoninteractive exim4-config
+ fi
+
+ # i have the spool directory be common to distro multi-boot, so
+ # we need the uid to be the same. 608 cuz it's kind of in the middle
+ # of the free system uids.
+ IFS=:; read _ _ uid _ < <(getent passwd Debian-exim ); unset IFS
+ IFS=:; read _ _ gid _ < <(getent group Debian-exim ); unset IFS
+ if [[ ! $uid ]]; then
+ # from /var/lib/dpkg/info/exim4-base.postinst, plus uid and gid options
+ adduser --uid 608 --gid 608 --system --group --quiet --home /var/spool/exim4 \
+ --no-create-home --disabled-login --force-badname Debian-exim
+ elif [[ $uid != 608 ]]; then
+ systemctl stop exim4 ||:
+ usermod -u 608 Debian-exim
+ groupmod -g 608 Debian-exim
+ usermod -g 608 Debian-exim
+ find / /nocow -xdev -uid $uid -exec chown -h 608 {} +
+ find / /nocow -xdev -gid $gid -exec chgrp -h 608 {} +
+ fi
+
+ # light version of exim does not have sasl auth support.
+ pi exim4-daemon-heavy spamassassin
+
+
+
+
+ ##### begin spamassassin config
+ systemctl enable spamassassin
+ # per readme.debian
+ sed -i '/^\s*CRON\s*=/d' /etc/default/spamassassin
+ e CRON=1 >>/etc/default/spamassassin
+ # just noticed this in the config file, seems like a good idea.
+ sed -i '/^\s*NICE\s*=/d' /etc/default/spamassassin
+ e 'NICE="--nicelevel 15"' >>/etc/default/spamassassin
+ systemctl start spamassassin
+ systemctl reload spamassassin
+
+ cat >/etc/systemd/system/spamddnsfix.service <<'EOF'