From fbe979a304253a313589de13798c4f5e6f0cfe2f Mon Sep 17 00:00:00 2001 From: Eric Nemchik Date: Tue, 28 Apr 2020 09:20:16 -0500 Subject: [PATCH] Use transmission-remote to update blocklist --- root/app/blocklist-update.sh | 23 +++++++---------------- 1 file changed, 7 insertions(+), 16 deletions(-) diff --git a/root/app/blocklist-update.sh b/root/app/blocklist-update.sh index e7dac6d..5c11dc4 100755 --- a/root/app/blocklist-update.sh +++ b/root/app/blocklist-update.sh @@ -1,20 +1,11 @@ #!/usr/bin/with-contenv bash -BLOCKLIST_ENABLED=`jq -r '.["blocklist-enabled"]' /config/settings.json` -BLOCKLIST_URL=`jq -r '.["blocklist-url"]' /config/settings.json | sed 's/\&/\&/g'` +BLOCKLIST_ENABLED=$(jq -r '.["blocklist-enabled"]' /config/settings.json) -if [ $BLOCKLIST_ENABLED == true ]; then - mkdir -p /tmp/blocklists - rm -rf /tmp/blocklists/* - cd /tmp/blocklists - wget -q -O blocklist.gz "$BLOCKLIST_URL" - if [ $? == 0 ]; then - gunzip *.gz - if [ $? == 0 ]; then - chmod go+r * - rm -rf /config/blocklists/* - cp /tmp/blocklists/* /config/blocklists - s6-svc -t /var/run/s6/services/transmission - fi - fi +if [ "$BLOCKLIST_ENABLED" == true ]; then + if [ -n "$USER" ] && [ -n "$PASS" ]; then + /usr/bin/transmission-remote -n "$USER":"$PASS" --blocklist-update + else + /usr/bin/transmission-remote --blocklist-update + fi fi