init-plex-chown/run: use TMPDIR instead of hardcoded /run/plex-temp

Changes init-plex-chown/run to use TMPDIR instead of hardcoded /run/plex-temp

Plex uses TMPDIR to store transcodes of music to WAV format for music
analysis (and maybe other things).

LS.io container sets TMPDIR=/run/plex-temp.  With read-only root this
means the /run tmpfs needs to have enough memory to store music analysis
transcodes.

LS.io container hardcoded /run/plex-temp in init so TMPDIR could not be
flexibly changed -- changed to use TMPDIR and clean on restart in case
of unclean shutdown.

Plex container is marked as supporting read-only root.
This commit is contained in:
Evan Champion 2026-03-15 12:45:15 +08:00
parent 2186587d37
commit 094d2071e2
2 changed files with 8 additions and 2 deletions

View file

@ -1,7 +1,11 @@
#!/usr/bin/with-contenv bash
# shellcheck shell=bash
mkdir -p /run/plex-temp
# remove plex temporary directory after unclean stop
if [[ -d "${TMPDIR}" ]]; then
rm -rf "${TMPDIR}"
fi
mkdir -p ${TMPDIR}
# create folders
if [[ ! -d "${PLEX_MEDIA_SERVER_APPLICATION_SUPPORT_DIR}" ]]; then
@ -40,7 +44,7 @@ if [[ -z ${LSIO_NON_ROOT_USER} ]]; then
# permissions (non-recursive) on config root and folders
lsiown abc:abc \
/run/plex-temp \
"${TMPDIR}" \
/config \
/config/*
fi