Skip to content

Commit

Permalink
Save the IMAP mailbox list in the backup
Browse files Browse the repository at this point in the history
The mailbox list is needed to quickly find an IMAP folder path inside
a given backup snapshot. Maildir path-encoding format can be obtained
with the "doveadm mailbox path" command.
  • Loading branch information
DavidePrincipi committed Oct 31, 2024
1 parent 9956bb7 commit b7b2de9
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 0 deletions.
1 change: 1 addition & 0 deletions imageroot/bin/module-cleanup-state
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,5 @@

echo "Cleaning up Mail state:"
rm -vf pcdb-dump.sql
rm -vf maildir-dump.lst
rm -vf *.is-enabled
5 changes: 5 additions & 0 deletions imageroot/bin/module-dump-state
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,11 @@

echo "Dumping Mail state to disk:"
podman exec postfix sqlite3 /srv/pcdb.sqlite .dump > pcdb-dump.sql
echo "Saving Maildir IMAP folder index:"
podman exec -i dovecot ash -s >maildir-dump.lst <<'EOF'
doveadm -f tab mailbox list -A | tail -n +2 | grep -v -E $'\t''(Shared|Public)(/|$)'
EOF
echo "Saving service status:"
for unit in clamav.service freshclam.timer; do
systemctl --user is-enabled "${unit}" > "${unit}".is-enabled || : # ignore exit code
done
1 change: 1 addition & 0 deletions imageroot/etc/state-include.conf
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
# Restic --files-from: https://restic.readthedocs.io/en/stable/040_backup.html#including-files
#
state/pcdb-dump.sql
state/maildir-dump.lst
state/dovecot.env
state/rspamd.env
state/*.is-enabled
Expand Down

0 comments on commit b7b2de9

Please sign in to comment.