if [[ $HOSTNAME == $MAIL_HOST ]]; then
+ # mail.iankelling.org so local imap clients can connect with tls and
+ # when they happen to not be local.
+ sed -ri -f - /etc/hosts <<'EOF'
+/^127\.0\.1\.1.* mail\.iankelling\.org\b/q
+/^127\.0\.1\.1 /s/ *$/ mail.iankelling.org/
+EOF
+ /a/exe/cedit mail /etc/dnsmasq-servers.conf <<'EOF' || [[ $? == 1 ]]
+server=/mail.iankelling.org/127.0.1.1
+EOF
+ systemctl reload dnsmasq
+
debconf-set-selections <<EOF
# Mail Server configuration
# -------------------------
systemctl restart dovecot
else # $HOSTNAME != $MAIL_HOST
+ # remove mail. 2 lines to properly remove whitespace
+ sed -ri -f - /etc/hosts <<'EOF'
+s#^(127\.0\.1\.1 .*) +mail\.iankelling\.org$#\1#
+s#^(127\.0\.1\.1 .*)mail\.iankelling\.org +(.*)#\1\2#
+EOF
+
+ echo | /a/exe/cedit mail /etc/dnsmasq-servers.conf || [[ $? == 1 ]]
+ systemctl reload dnsmasq
+
systemctl disable offlineimapsync.timer &>/dev/null ||:
systemctl stop offlineimapsync.timer &>/dev/null ||:
systemctl disable mailclean.timer &>/dev/null ||:
dir=/nocow/exim4
sdir=/var/spool/exim4
# we only do this if our system has $dir
-if [[ -e /nocow && $(readlink -f $sdir) != $dir ]]; then
- systemctl stop exim4
- if [[ ! -e $dir && -d $sdir ]]; then
- mv $sdir $dir
+
+# this used to do a symlink, but, in the boot logs, /nocow would get mounted succesfully,
+# about 2 seconds later, exim starts, and immediately puts into paniclog:
+# honVi-0000u3-82 Failed to create directory "/var/spool/exim4/input": No such file or directory
+# so, im trying a bind mount to get rid of that.
+if [[ -e /nocow ]]; then
+ if ! grep -Fx "/nocow/exim4 /var/spool/exim4 none bind 0 0" /etc/fstab; then
+ echo "/nocow/exim4 /var/spool/exim4 none bind 0 0" >> /etc/fstab
+ fi
+ if ! mountpoint -q $sdir; then
+ systemctl stop exim4
+ if [[ -L $sdir ]]; then
+ rm $sdir
+ fi
+ if [[ ! -e $dir && -d $sdir ]]; then
+ mv $sdir $dir
+ fi
+ if [[ ! -d $sdir ]]; then
+ mkdir $sdir
+ chmod 000 $sdir # only want it to be used when its mounted
+ fi
+ mount $sdir
fi
- /a/exe/lnf -T $dir $sdir
fi
systemctl restart exim4