2022-12-07 10:47:40 -03:00
|
|
|
#!/command/with-contenv bash
|
|
|
|
|
# shellcheck shell=bash
|
|
|
|
|
# Prepare the logs folder for s6-log
|
|
|
|
|
|
|
|
|
|
set -o errexit -o nounset -o pipefail
|
|
|
|
|
|
2024-06-01 10:29:46 -05:00
|
|
|
dirs=(/dev/shm/logs/frigate /dev/shm/logs/go2rtc /dev/shm/logs/nginx /dev/shm/logs/certsync)
|
2022-12-07 10:47:40 -03:00
|
|
|
|
|
|
|
|
mkdir -p "${dirs[@]}"
|
2026-08-23 15:40:32 -05:00
|
|
|
|
|
|
|
|
# logutil-service drops s6-log to nobody, so the dirs must stay nobody-owned
|
|
|
|
|
# in root mode. Under docker --user we are already the (only) target user,
|
|
|
|
|
# chown would fail, and the plain s6-log fallback in the *-log services
|
|
|
|
|
# writes as us (the mkdir above is sufficient, /dev/shm is 1777).
|
|
|
|
|
if [[ "$(id -u)" -eq 0 ]]; then
|
|
|
|
|
chown nobody:nogroup "${dirs[@]}"
|
|
|
|
|
fi
|
2022-12-07 10:47:40 -03:00
|
|
|
chmod 02755 "${dirs[@]}"
|