-if [[ $postmaster != root ]]; then
- sed -i --follow-symlinks -f - /etc/aliases <<EOF
-\$a root: $postmaster
-/^root:/d
-EOF
- newaliases
-fi
-
-# local mail that bounces to alerts goes to /Maildir
-mkdir -p /Maildir{cur,tmp,new}
-chgrp Debian-exim /Maildir{cur,tmp,new}
-chmod 775 /Maildir{cur,tmp,new}
-if id -g 1000 &>/dev/null; then
- usermod -a -G Debian-exim 1000
-fi
-if [[ -e /m/md ]]; then
- ln -s /Maildir /m/md/bounces
-fi
+# local mail that bounces goes to /Maildir or /root/Maildir
+dirs=(/m/md/bounces/{cur,tmp,new})
+mkdir -p ${dirs[@]}
+chown -R $u:Debian-exim /m/md/bounces
+chmod 775 ${dirs[@]}
+usermod -a -G Debian-exim $u
+for d in /Maildir /root/Maildir; do
+ if [[ ! -L $d ]]; then
+ rm -rf $d
+ fi
+ ln -sf -T /m/md/bounces $d
+done