+ # /etc/alias setup is debian specific, and
+ # exim config sets up an /etc/alias from root to the postmaster, which i
+ # config to ian, as long as there exists an entry for root, or there was
+ # no preexisting aliases file. based on the postinst file. postfix
+ # won\'t set up a root to $postmaster alias if it\'s already installed.
+ # Since postfix is not the greatest, just set it ourselves.
+ if [[ $postmaster != root ]]; then
+ sed -i --follow-symlinks -f - /etc/aliases <<EOF
+\$a root: $postmaster
+/^root:/d
+EOF
+ newaliases
+ fi
+
+ # put spool dir in directory that spans multiple distros.
+ # based on http://www.postfix.org/qmgr.8.html and my notes in gnus
+ #
+ # todo: I\'m suspicious of uids for Debian-exim being the same across
+ # distros. It would be good to test this.
+ dir=/nocow/$type
+ sdir=/var/spool/$type
+ # we only do this if our system has $dir
+ if [[ -e /nocow && $(readlink -f $sdir) != $dir ]]; then
+ systemctl stop $type
+ if [[ ! -e $dir && -d $sdir ]]; then
+ mv $sdir $dir
+ fi
+ /a/exe/lnf -T $dir $sdir
+ 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
+ if [[ -e /etc/logrotate.d/radicale.disabled ]]; then
+ mv /etc/logrotate.d/radicale{.disabled,}
+ fi
+ else
+ systemctl stop radicale
+ systemctl disable radicale
+ # weekly logrotate tries to restart radicale even if it's a disabled service in flidas.
+ if [[ -e /etc/logrotate.d/radicale ]]; then
+ mv /etc/logrotate.d/radicale{,.disabled}
+ fi
+ fi
+ fi
+ exit 0
+
+ # 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
+ # sudo postmap hash:/etc/postfix/recipient_canonical
+ # sudo service postfix reload