Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added configurable session folder #172

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
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.md
Original file line number Diff line number Diff line change
Expand Up @@ -128,6 +128,7 @@ Image: crazymax/rtorrent-rutorrent:latest
* `RT_LOG_LEVEL`: rTorrent log level (default `info`)
* `RT_LOG_EXECUTE`: Log executed commands to `/data/rtorrent/log/execute.log` (default `false`)
* `RT_LOG_XMLRPC`: Log XMLRPC queries to `/data/rtorrent/log/xmlrpc.log` (default `false`)
* `RT_SESSION_FOLDER`: rTorrent session folder - saved to /data/ (`cfg.session`, default `.session`)
* `RT_DHT_PORT`: DHT UDP port (`dht.port.set`, default `6881`)
* `RT_INC_PORT`: Incoming connections (`network.port_range.set`, default `50000`)

Expand Down
8 changes: 5 additions & 3 deletions rootfs/etc/cont-init.d/03-config.sh
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ RU_OVERWRITE_UPLOADED_TORRENTS=${RU_OVERWRITE_UPLOADED_TORRENTS:-false}
RU_FORBID_USER_SETTINGS=${RU_FORBID_USER_SETTINGS:-false}
RU_LOCALE=${RU_LOCALE:-UTF8}

RT_SESSION_FOLDER=${RT_SESSION_FOLDER:-.session}
RT_DHT_PORT=${RT_DHT_PORT:-6881}
RT_INC_PORT=${RT_INC_PORT:-50000}
XMLRPC_PORT=${XMLRPC_PORT:-8000}
Expand Down Expand Up @@ -136,7 +137,7 @@ EOL
echo "Initializing files and folders..."
mkdir -p /data/geoip \
/data/rtorrent/log \
/data/rtorrent/.session \
/data/rtorrent/$RT_SESSION_FOLDER \
/data/rtorrent/watch \
/data/rutorrent/conf/users \
/data/rutorrent/plugins \
Expand All @@ -151,7 +152,7 @@ touch /passwd/rpc.htpasswd \
/passwd/webdav.htpasswd \
/data/rtorrent/log/rtorrent.log \
"${RU_LOG_FILE}"
rm -f /data/rtorrent/.session/rtorrent.lock
rm -f /data/rtorrent/$RT_SESSION_FOLDER/rtorrent.lock

# Check htpasswd files
if [ ! -s "/passwd/rpc.htpasswd" ]; then
Expand All @@ -173,6 +174,7 @@ fi
# rTorrent local config
echo "Checking rTorrent local configuration..."
sed -e "s!@RT_LOG_LEVEL@!$RT_LOG_LEVEL!g" \
-e "s!@RT_SESSION_FOLDER@!$RT_SESSION_FOLDER!g" \
-e "s!@RT_DHT_PORT@!$RT_DHT_PORT!g" \
-e "s!@RT_INC_PORT@!$RT_INC_PORT!g" \
-e "s!@XMLRPC_SIZE_LIMIT@!$XMLRPC_SIZE_LIMIT!g" \
Expand Down Expand Up @@ -374,7 +376,7 @@ chown rtorrent. \
chown -R rtorrent. \
/data/geoip \
/data/rtorrent/log \
/data/rtorrent/.session \
/data/rtorrent/"${RT_SESSION_FOLDER}" \
/data/rtorrent/watch \
/data/rutorrent/conf \
/data/rutorrent/plugins \
Expand Down
2 changes: 1 addition & 1 deletion rootfs/tpls/etc/rtorrent/.rtlocal.rc
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ method.insert = cfg.download, private|const|string, (cat,"/downloads/")
method.insert = cfg.download_complete, private|const|string, (cat,(cfg.download),"complete/")
method.insert = cfg.download_temp, private|const|string, (cat,(cfg.download),"temp/")
method.insert = cfg.logs, private|const|string, (cat,(cfg.basedir),"log/")
method.insert = cfg.session, private|const|string, (cat,(cfg.basedir),".session/")
method.insert = cfg.session, private|const|string, (cat,(cfg.basedir),"@RT_SESSION_FOLDER@/")
method.insert = cfg.watch, private|const|string, (cat,(cfg.basedir),"watch/")
method.insert = cfg.rundir, private|const|string, (cat,"/var/run/rtorrent/")

Expand Down