Skip to content

Commit f420227

Browse files
committed
Fix #61
1 parent 5089d29 commit f420227

File tree

2 files changed

+44
-11
lines changed

2 files changed

+44
-11
lines changed

CHANGELOG.md

+2
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,8 @@
99
[./run-seedbox.sh] line 320: ./env/traefik.env: No such file or directory
1010
```
1111
This bug was introduced in ``v2.2.1`` release and I'm sorry for it. It should work as expected now.
12+
* [**Flood**] Fix #61
13+
The feature of Deluge Daemon auth autoconfig was broken since v2.2.0. It should work now and also handle filesystem with different permissions between config directory and media directory.
1214

1315
# v2.2.1 (The little Flame 🔥)
1416

run-seedbox.sh

+42-11
Original file line numberDiff line numberDiff line change
@@ -204,17 +204,6 @@ if is_service_enabled flood; then
204204
else
205205
export DELUGE_HOST="deluge"
206206
fi
207-
208-
# Specific instructions for Flood
209-
# User for Deluge daemon RPC has to be created in deluge auth config file
210-
if [[ ! -z ${FLOOD_PASSWORD} && ${FLOOD_AUTOCREATE_USER_IN_DELUGE_DAEMON} == true ]]; then
211-
if ! grep -q "flood" $HOST_CONFIG_PATH/deluge/auth; then
212-
echo "flood:${FLOOD_PASSWORD}:10" >> $HOST_CONFIG_PATH/deluge/auth
213-
else
214-
echo "[$0] No need to add user/password for flood as it has already been created."
215-
echo "[$0] Consider setting FLOOD_AUTOCREATE_USER_IN_DELUGE_DAEMON variable to false in .env file."
216-
fi
217-
fi
218207
fi
219208

220209
# Check that if calibre-web is enabled, calibre should also be enabled
@@ -253,6 +242,7 @@ echo "[$0] ***** Generating configuration... *****"
253242

254243
# Cleanup files before start, in case there was a change we start from scratch at every script execution
255244
rm -f services/generated/*-vpn.yaml
245+
rm -f services/generated/*-envfile.yaml
256246

257247
ALL_SERVICES="-f docker-compose.yaml"
258248

@@ -307,6 +297,47 @@ for json in $(yq eval -o json config.yaml | jq -c ".services[]"); do
307297
fi
308298
fi
309299

300+
# If we are on flood service AND autoconfig for flood password is set to true:
301+
# Check that .env.custom exists and variable defined
302+
# Do the deluge autoconfig - we already checked that deluge is enabled at this point
303+
if [[ ${name} == "flood" && ${FLOOD_AUTOCREATE_USER_IN_DELUGE_DAEMON} == true ]]; then
304+
# Specific instructions for Flood
305+
if [[ ! -f env/${name}.env ]]; then
306+
echo "ERROR. You set variable \"FLOOD_AUTOCREATE_USER_IN_DELUGE_DAEMON\" to true but you did not specify key \"FLOOD_FLOOD_PASSWORD\" in your .env.custom."
307+
exit 1
308+
fi
309+
set -a
310+
source env/${name}.env
311+
set +a
312+
# User for Deluge daemon RPC has to be created in deluge auth config file
313+
if [[ ! -z ${FLOOD_PASSWORD} ]]; then
314+
DELUGE_CONFIG_FILE="$HOST_CONFIG_PATH/deluge/auth"
315+
if [[ -r $DELUGE_CONFIG_FILE && -w $DELUGE_CONFIG_FILE ]]; then
316+
if ! grep -q "flood" ${DELUGE_CONFIG_FILE}; then
317+
echo "flood:${FLOOD_PASSWORD}:10" >> ${DELUGE_CONFIG_FILE}
318+
else
319+
echo "[$0] No need to add user/password for flood as it has already been created."
320+
echo "[$0] Consider setting FLOOD_AUTOCREATE_USER_IN_DELUGE_DAEMON variable to false in .env file."
321+
fi
322+
else
323+
echo "[$0] It seems you do not have permission to read or write to ${DELUGE_CONFIG_FILE} ."
324+
echo "[$0] Prompting for sudo password..."
325+
sudo bash <<EOF
326+
if ! grep -q "flood" ${DELUGE_CONFIG_FILE}; then
327+
echo "flood:${FLOOD_PASSWORD}:10" >> ${DELUGE_CONFIG_FILE}
328+
else
329+
echo "[$0] No need to add user/password for flood as it has already been created."
330+
echo "[$0] Consider setting FLOOD_AUTOCREATE_USER_IN_DELUGE_DAEMON variable to false in .env file."
331+
fi
332+
EOF
333+
fi
334+
else
335+
echo "ERROR. \"FLOOD_FLOOD_PASSWORD\" variable seems not defined but flood service still has variables defined. Please add the missing variable."
336+
exit 1
337+
fi
338+
fi
339+
340+
310341
###### For services which have "command" field with environment variables ######
311342
var_in_cmd_detected="0"
312343
if [[ $(yq ".services.${name}.command[]" services/${file} | { grep "\\$.*\}" || true; } | wc -l) -gt 0 ]]; then

0 commit comments

Comments
 (0)