From 317a0a78adabb7aaff7c1a438dbdecce4cc3fe6f Mon Sep 17 00:00:00 2001 From: Patrick Kishino Date: Sat, 16 Oct 2021 12:34:12 +0900 Subject: [PATCH] Mount point changed to /config (#1974) This changes the default mountpoint for transmission-home to /config --- Dockerfile | 2 +- docs/config-options.md | 4 ++-- docs/faq.md | 4 ++-- transmission/userSetup.sh | 27 +++++++++++++++++++++------ 4 files changed, 26 insertions(+), 11 deletions(-) diff --git a/Dockerfile b/Dockerfile index 37ed6693a..25d726df8 100644 --- a/Dockerfile +++ b/Dockerfile @@ -47,7 +47,7 @@ ENV OPENVPN_USERNAME=**None** \ OPENVPN_PASSWORD=**None** \ OPENVPN_PROVIDER=**None** \ GLOBAL_APPLY_PERMISSIONS=true \ - TRANSMISSION_HOME=/data/transmission-home \ + TRANSMISSION_HOME=/config/transmission-home \ TRANSMISSION_RPC_PORT=9091 \ TRANSMISSION_DOWNLOAD_DIR=/data/completed \ TRANSMISSION_INCOMPLETE_DIR=/data/incomplete \ diff --git a/docs/config-options.md b/docs/config-options.md index 738131910..6c0ee5bf4 100755 --- a/docs/config-options.md +++ b/docs/config-options.md @@ -87,8 +87,8 @@ In previous versions of this container the settings were not persistent but was This had the benefit of being very explicit and reproducable but you had to provide Transmission config as environment variables if you wanted them to stay that way between container restarts. This felt cumbersome to many. -As of version 3.0 this is no longer true. Settings are now persisted in the `/data/transmission-home` folder in the container and as -long as you mount `/data` you should be able to configure Transmission using the UI as you normally would. +As of version 3.0 this is no longer true. Settings are now persisted in the `/config/transmission-home` folder in the container and as +long as you mount `/config` you should be able to configure Transmission using the UI as you normally would. You may still override Transmission options by setting environment variables if that's your thing. The variables are named after the transmission config they target but are prefixed with `TRANSMISSION_`, capitalized, and `-` is converted to `_`. diff --git a/docs/faq.md b/docs/faq.md index ad7b2865e..68c0b9195 100755 --- a/docs/faq.md +++ b/docs/faq.md @@ -19,8 +19,8 @@ ## How do I enable authentication in the web ui You can do this either by setting the appropriate fields in `settings.json` which is -found in TRANSMISSION_HOME which defaults to `/data/transmission-home` so it will be available -on your host where you mount the `/data` volume. Remember that Transmission overwrites the config +found in TRANSMISSION_HOME which defaults to `/config/transmission-home` so it will be available +on your host where you mount the `/config` volume. Remember that Transmission overwrites the config when it shuts down, so do this when the container is not running. Or you can set it using the convenience environment variables. They will then override the settings diff --git a/transmission/userSetup.sh b/transmission/userSetup.sh index ab4113d24..607c88c40 100644 --- a/transmission/userSetup.sh +++ b/transmission/userSetup.sh @@ -17,6 +17,23 @@ if [ -n "$PUID" ] && [ ! "$(id -u root)" -eq "$PUID" ]; then chown ${RUN_AS}:${RUN_AS} /dev/stdout fi + if [[ "${TRANSMISSION_HOME%/*}" != "/config" ]]; then + echo "WARNING: TRANSMISSION_HOME mountpoint is not on default /config, this is not recommended." + fi + + #If migration is enabled, attempt to move transmission-home + if [[ "$TRANSMISSION_HOME_MIGRATE" = true ]]; then + TRANSMISSION_HOME_SUBNAME=${TRANSMISSION_HOME##*/} + echo "Attempting to migrate old TRANSMISSION_HOME from /data/$TRANSMISSION_HOME_SUBNAME to /config/$TRANSMISSION_HOME_SUBNAME " + if [ -d "/data/$TRANSMISSION_HOME_SUBNAME" ] && [ ! -d "/config/$TRANSMISSION_HOME_SUBNAME" ]; then + mv "/data/$TRANSMISSION_HOME_SUBNAME" "/config/$TRANSMISSION_HOME_SUBNAME" + TRANSMISSION_HOME="/config/$TRANSMISSION_HOME_SUBNAME" + TRANSMISSION_HOME_MIGRATE=false + else + echo "Could not migrate, please check for existing folder in /config or missing folder in /data" + fi + fi + # Make sure directories exist before chown and chmod mkdir -p /config \ "${TRANSMISSION_HOME}" \ @@ -24,15 +41,13 @@ if [ -n "$PUID" ] && [ ! "$(id -u root)" -eq "$PUID" ]; then "${TRANSMISSION_INCOMPLETE_DIR}" \ "${TRANSMISSION_WATCH_DIR}" - echo "Enforcing ownership on transmission config directories" + echo "Enforcing ownership on transmission config directory" chown -R ${RUN_AS}:${RUN_AS} \ - /config \ - "${TRANSMISSION_HOME}" + /config - echo "Applying permissions to transmission config directories" + echo "Applying permissions to transmission config directory" chmod -R go=rX,u=rwX \ - /config \ - "${TRANSMISSION_HOME}" + /config if [ "$GLOBAL_APPLY_PERMISSIONS" = true ] ; then echo "Setting owner for transmission paths to ${PUID}:${PGID}"