Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions readme-vars.yml
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,7 @@ init_diagram: |
"transmission:latest" <- Base Images
# changelog
changelogs:
- {date: "04.04.26:", desc: "Read download, incomplete, and watch directory paths from settings.json instead of hardcoding them in init script."}
- {date: "29.11.24:", desc: "Fix PEERPORT setting."}
- {date: "07.10.23:", desc: "Install unrar from [linuxserver repo](https://github.com/linuxserver/docker-unrar)."}
- {date: "10.08.23:", desc: "Bump unrar to 6.2.10."}
Expand Down
34 changes: 20 additions & 14 deletions root/etc/s6-overlay/s6-rc.d/init-transmission-config/run
Original file line number Diff line number Diff line change
Expand Up @@ -47,23 +47,29 @@ if [[ -z ${LSIO_NON_ROOT_USER} ]]; then
lsiown -R abc:abc \
/config

if grep -qe ' /downloads ' /proc/mounts; then
if [[ "$(stat -c '%U' /downloads)" != "abc" ]]; then
lsiown abc:abc /downloads
fi
if [[ -f /config/settings.json ]]; then
DOWNLOAD_DIR=$(jq -r '.["download-dir"] // "/downloads"' /config/settings.json)
INCOMPLETE_DIR=$(jq -r '.["incomplete-dir"] // "/downloads/incomplete"' /config/settings.json)
INCOMPLETE_ENABLED=$(jq -r '.["incomplete-dir-enabled"] // false' /config/settings.json)
WATCH_DIR=$(jq -r '.["watch-dir"] // "/watch"' /config/settings.json)
WATCH_ENABLED=$(jq -r '.["watch-dir-enabled"] // false' /config/settings.json)
else
DOWNLOAD_DIR="/downloads"
INCOMPLETE_DIR="/downloads/incomplete"
INCOMPLETE_ENABLED="true"
WATCH_DIR="/watch"
WATCH_ENABLED="true"
fi

if [[ "$(stat -c '%U' /downloads/complete)" != "abc" ]]; then
lsiown abc:abc /downloads/complete
fi
if [[ -d "${DOWNLOAD_DIR}" ]] && [[ "$(stat -c '%U' "${DOWNLOAD_DIR}")" != "abc" ]]; then
lsiown abc:abc "${DOWNLOAD_DIR}"
fi

if [[ "$(stat -c '%U' /downloads/incomplete)" != "abc" ]]; then
lsiown abc:abc /downloads/incomplete
fi
if [[ "${INCOMPLETE_ENABLED}" == "true" ]] && [[ -d "${INCOMPLETE_DIR}" ]] && [[ "$(stat -c '%U' "${INCOMPLETE_DIR}")" != "abc" ]]; then
lsiown abc:abc "${INCOMPLETE_DIR}"
fi

if grep -qe ' /watch ' /proc/mounts; then
if [[ "$(stat -c '%U' /watch)" != "abc" ]]; then
lsiown abc:abc /watch
fi
if [[ "${WATCH_ENABLED}" == "true" ]] && [[ -d "${WATCH_DIR}" ]] && [[ "$(stat -c '%U' "${WATCH_DIR}")" != "abc" ]]; then
lsiown abc:abc "${WATCH_DIR}"
fi
fi