various fixes
[distro-setup] / mail-setup
index 33ad75a0b3af2719e63ecd3328f77070c0227605..09c33d773e758917d5b0f5600bc02c9e301a67ac 100755 (executable)
@@ -622,7 +622,7 @@ EOF
         # sieve option, we wouldn\'t need this, but I\'d rather not modify a
         # default config if not needed. This won\'t work as a symlink in /a/c
         # unfortunately.
-        sudo -u $postmaster /a/exe/lnf -T sieve/main.sieve ~$postmaster/.dovecot.sieve
+        sudo -u $postmaster /a/exe/lnf -T sieve/main.sieve $(eval echo ~$postmaster)/.dovecot.sieve
 
         sed -ri -f - /etc/dovecot/conf.d/10-mail.conf <<'EOF'
 1i mail_location = maildir:/m/md:LAYOUT=fs:INBOX=/m/md/INBOX
@@ -817,6 +817,18 @@ fi
 systemctl restart $type
 systemctl enable $type
 
+# 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.
+if dpkg -s radicale &>/dev/null; then
+    if [[ $HOSTNAME == $MAIL_HOST ]]; then
+        systemctl restart radicale
+        systemctl enable radicale
+    else
+        systemctl stop radicale
+        systemctl disable radicale
+    fi
+fi
 
 # if I wanted the from address to be renamed and sent to a different address,
 # echo "sdx@localhost development@localhost" | sudo dd of=/etc/postfix/recipient_canonical