fix: Properly implement fix

This commit is contained in:
Brennan Kinney 2024-05-16 12:57:13 +12:00 committed by GitHub
parent d71db46a39
commit dad2abdb72
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 7 additions and 4 deletions

View File

@ -31,6 +31,10 @@ function _setup_getmail() {
EOF
chmod -R 600 "${GETMAILRC}"
fi
# Both the debug command and cron job (that runs getmail) for getmail
# expect this location to exist. As does the `/var/mail-state` startup script.
mkdir -p /var/lib/getmail
else
_log 'debug' 'Getmail is disabled'
fi

View File

@ -70,14 +70,13 @@ function _setup_save_states() {
rm -rf "${SERVICEDIR}"
elif [[ -d ${SERVICEDIR} ]]; then
_log 'trace' "Moving contents of ${SERVICEDIR} to ${DEST}"
# 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}"
# An empty volume was mounted, or new content dir now exists from enabling a feature ENV:
mv "${SERVICEDIR}" "${DEST}"
# Apply SELinux security context to match the state directory, so access
# is not restricted to the current running container:
chcon -R --reference="${STATEDIR}" "${DEST}" 2>/dev/null || true
else
_log 'error' "${SERVICEDIR} should exist but is missing"
fi
# Symlink the original path in the container ($SERVICEDIR) to be