fix: `/var/mail-state` should ensure service dir exists before symlinking

The Getmail service doesn't have a directory in `/var/lib/` by default, yet `mail-state` is configured to symlink it, and the service in DMS is configured to expect `/var/lib/getmail` exists.

Handled in `mail-state` logic to ensure it doesn't silently fail.
This commit is contained in:
Brennan Kinney 2024-05-16 12:34:45 +12:00 committed by GitHub
parent 5bd8df68eb
commit d71db46a39
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 4 additions and 1 deletions

View File

@ -70,7 +70,10 @@ function _setup_save_states() {
rm -rf "${SERVICEDIR}"
elif [[ -d ${SERVICEDIR} ]]; then
_log 'trace' "Moving contents of ${SERVICEDIR} to ${DEST}"
# Empty volume was mounted, or new content from enabling a feature ENV:
# An empty volume was mounted, or new content exists from enabling a feature ENV:
# Ensure the original directory exists before mv, otherwise with nothing to move
# the symlink created afterwards is invalid.
mkdir -p "${SERVICEDIR}"
mv "${SERVICEDIR}" "${DEST}"
# Apply SELinux security context to match the state directory, so access
# is not restricted to the current running container: