diff --git a/mail/migration3_cleanup.sh b/mail/migration3_cleanup.sh new file mode 100644 index 0000000..8a27c89 --- /dev/null +++ b/mail/migration3_cleanup.sh @@ -0,0 +1,16 @@ +#!/usr/bin/env bash + +# After running Migration 3 (https://nixos-mailserver.readthedocs.io/en/latest/migrations.html#dovecot-mail-directory-migration) +# For some reason dovecot was putting items into /var/vmail/ldap/$USERNAME@skynet.ie instead of /var/vmail/skynet.ie/$USERNAME +# Whats more it was expecting to see items there so email clients were erroring out (seeing empty inboxes). +# This could be due to the extra commits we have on top of the main nixos mailserver +# This might be the case since migration 2 mentions teh /var/vmail/ldap folder as not being desired + +for f in *; do + if [ -d "$f" ]; then + echo "$f" + mkdir -p "/var/vmail/ldap/$f@skynet.ie/" + # hardlink "copy", can delete the original folder afterwards + cp -rlp /var/vmail/skynet.ie/$f/* "/var/vmail/ldap/$f@skynet.ie" + fi +done