From a1b5353ea285708d998ec6855fb4b1c5aeb0792e Mon Sep 17 00:00:00 2001 From: Paul Hendryx Date: Wed, 2 Nov 2016 09:38:19 -0400 Subject: [PATCH 1/4] fixed update script --- root/defaults/blocklist-update.sh | 21 +++++++++++++++------ 1 file changed, 15 insertions(+), 6 deletions(-) diff --git a/root/defaults/blocklist-update.sh b/root/defaults/blocklist-update.sh index e3263df..a36c283 100644 --- a/root/defaults/blocklist-update.sh +++ b/root/defaults/blocklist-update.sh @@ -1,10 +1,19 @@ #!/usr/bin/with-contenv bash +BLOCKLIST_ENABLED=`jq -r '.["blocklist-enabled"]' settings.json` BLOCKLIST_URL=`jq -r '.["blocklist-url"]' settings.json` -rm /config/blocklists/* -cd /config/blocklists -wget -q $BLOCKLIST_URL -gunzip *.gz -chmod go+r * -s6-svc -h /var/run/s6/services/transmission +if [ $BLOCKLIST_URL == true ]; then + mkdir -p /tmp/blocklist + cd /tmp/blocklist + wget -q $BLOCKLIST_URL + if [ $? == 0 ]; then + gunzip *.gz + if [ $? == 0 ]; then + chmod go+r * + rm /config/blocklists/* + cp /tmp/blocklists/* /config/blocklists + s6-svc -h /var/run/s6/services/transmission + fi + fi +fi From 72c8df500ed9bb5ff92322a86327041d865b9ca9 Mon Sep 17 00:00:00 2001 From: Paul Hendryx Date: Wed, 2 Nov 2016 09:39:55 -0400 Subject: [PATCH 2/4] working script from container --- root/defaults/blocklist-update.sh | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/root/defaults/blocklist-update.sh b/root/defaults/blocklist-update.sh index a36c283..09ee255 100644 --- a/root/defaults/blocklist-update.sh +++ b/root/defaults/blocklist-update.sh @@ -3,15 +3,16 @@ BLOCKLIST_ENABLED=`jq -r '.["blocklist-enabled"]' settings.json` BLOCKLIST_URL=`jq -r '.["blocklist-url"]' settings.json` -if [ $BLOCKLIST_URL == true ]; then - mkdir -p /tmp/blocklist - cd /tmp/blocklist +if [ $BLOCKLIST_ENABLED == true ]; then + mkdir -p /tmp/blocklists + rm -rf /tmp/blocklists/* + cd /tmp/blocklists wget -q $BLOCKLIST_URL if [ $? == 0 ]; then gunzip *.gz if [ $? == 0 ]; then chmod go+r * - rm /config/blocklists/* + rm -rf /config/blocklists/* cp /tmp/blocklists/* /config/blocklists s6-svc -h /var/run/s6/services/transmission fi From 6bad2d716e976a5dde8d5ddcd5d573837e7fb336 Mon Sep 17 00:00:00 2001 From: Paul Hendryx Date: Wed, 2 Nov 2016 10:04:54 -0400 Subject: [PATCH 3/4] replace & with &, static filename output for wget --- root/defaults/blocklist-update.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/root/defaults/blocklist-update.sh b/root/defaults/blocklist-update.sh index 09ee255..399a956 100644 --- a/root/defaults/blocklist-update.sh +++ b/root/defaults/blocklist-update.sh @@ -1,13 +1,13 @@ #!/usr/bin/with-contenv bash BLOCKLIST_ENABLED=`jq -r '.["blocklist-enabled"]' settings.json` -BLOCKLIST_URL=`jq -r '.["blocklist-url"]' settings.json` +BLOCKLIST_URL=`jq -r '.["blocklist-url"]' settings.json | sed 's/\&/\&/g'` if [ $BLOCKLIST_ENABLED == true ]; then mkdir -p /tmp/blocklists rm -rf /tmp/blocklists/* cd /tmp/blocklists - wget -q $BLOCKLIST_URL + wget -q -O blocklist.gz "$BLOCKLIST_URL" if [ $? == 0 ]; then gunzip *.gz if [ $? == 0 ]; then From f7490f4fd72ce703ade91612814b427a3613e45c Mon Sep 17 00:00:00 2001 From: Paul Hendryx Date: Thu, 3 Nov 2016 07:12:13 -0400 Subject: [PATCH 4/4] full path to settings.json --- root/defaults/blocklist-update.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/root/defaults/blocklist-update.sh b/root/defaults/blocklist-update.sh index 399a956..c76c868 100644 --- a/root/defaults/blocklist-update.sh +++ b/root/defaults/blocklist-update.sh @@ -1,7 +1,7 @@ #!/usr/bin/with-contenv bash -BLOCKLIST_ENABLED=`jq -r '.["blocklist-enabled"]' settings.json` -BLOCKLIST_URL=`jq -r '.["blocklist-url"]' settings.json | sed 's/\&/\&/g'` +BLOCKLIST_ENABLED=`jq -r '.["blocklist-enabled"]' /config/settings.json` +BLOCKLIST_URL=`jq -r '.["blocklist-url"]' /config/settings.json | sed 's/\&/\&/g'` if [ $BLOCKLIST_ENABLED == true ]; then mkdir -p /tmp/blocklists