From 170c0905e4d5230833a1854b896299c743c3059e Mon Sep 17 00:00:00 2001 From: Amir Zarrinkafsh Date: Sun, 17 Aug 2025 06:05:58 +1000 Subject: [PATCH] fix: ability to use default cache in scripts (#274) --- .editorconfig | 3 ++- scripts/create-adguardhome.sh | 3 +-- scripts/create-dnsmasq.sh | 3 +-- scripts/create-rpz.sh | 4 +--- scripts/create-squid.sh | 4 +--- scripts/create-unbound.sh | 3 +-- 6 files changed, 7 insertions(+), 13 deletions(-) diff --git a/.editorconfig b/.editorconfig index e028911..94a6750 100644 --- a/.editorconfig +++ b/.editorconfig @@ -11,4 +11,5 @@ insert_final_newline = true indent_size = 0 [*.sh] -indent_style = tab \ No newline at end of file +indent_style = tab + diff --git a/scripts/create-adguardhome.sh b/scripts/create-adguardhome.sh index c7048f2..006fdcc 100755 --- a/scripts/create-adguardhome.sh +++ b/scripts/create-adguardhome.sh @@ -13,7 +13,6 @@ if ! command -v jq >/dev/null; then exit 1 fi -cachenamedefault="disabled" combinedoutput=$(jq -r ".combined_output" config.json) while read -r line; do @@ -34,7 +33,7 @@ while read -r entry; do key=$(jq -r ".cache_domains[$entry].name" ${path}) cachename="cachename${key}" if [ -z "${!cachename}" ]; then - cachename=${cachenamedefault} + cachename="cachenamedefault" fi if [[ ${cachename} == "disabled" ]]; then continue diff --git a/scripts/create-dnsmasq.sh b/scripts/create-dnsmasq.sh index 2f453b3..61b991f 100755 --- a/scripts/create-dnsmasq.sh +++ b/scripts/create-dnsmasq.sh @@ -13,7 +13,6 @@ if ! command -v jq >/dev/null; then exit 1 fi -cachenamedefault="disabled" combinedoutput=$(jq -r ".combined_output" config.json) while read -r line; do @@ -34,7 +33,7 @@ while read -r entry; do key=$(jq -r ".cache_domains[${entry}].name" ${path}) cachename="cachename${key}" if [ -z "${!cachename}" ]; then - cachename=${cachenamedefault} + cachename="cachenamedefault" fi if [[ ${cachename} == "disabled" ]]; then continue diff --git a/scripts/create-rpz.sh b/scripts/create-rpz.sh index cb52318..ec1ed71 100755 --- a/scripts/create-rpz.sh +++ b/scripts/create-rpz.sh @@ -14,8 +14,6 @@ if ! command -v jq >/dev/null; then exit 1 fi -cachenamedefault="disabled" - while read -r line; do ip=$(jq ".ips[\"${line}\"]" config.json) declare "cacheip${line}"="${ip}" @@ -50,7 +48,7 @@ while read -r entry; do key=$(jq -r ".cache_domains[${entry}].name" ${path}) cachename="cachename${key}" if [ -z "${!cachename}" ]; then - cachename=${cachenamedefault} + cachename="cachenamedefault" fi if [[ ${cachename} == "disabled" ]]; then continue diff --git a/scripts/create-squid.sh b/scripts/create-squid.sh index 95ad5f7..1af4427 100755 --- a/scripts/create-squid.sh +++ b/scripts/create-squid.sh @@ -14,8 +14,6 @@ if ! command -v jq >/dev/null; then exit 1 fi -cachenamedefault="disabled" - while read -r line; do name=$(jq -r ".cache_domains[\"${line}\"]" config.json) declare "cachename${line}"="${name}" @@ -28,7 +26,7 @@ while read -r entry; do key=$(jq -r ".cache_domains[$entry].name" ${path}) cachename="cachename${key}" if [ -z "${!cachename}" ]; then - cachename=${cachenamedefault} + cachename="cachenamedefault" fi if [[ ${cachename} == "disabled" ]]; then continue diff --git a/scripts/create-unbound.sh b/scripts/create-unbound.sh index d60629a..7ba76e5 100755 --- a/scripts/create-unbound.sh +++ b/scripts/create-unbound.sh @@ -13,7 +13,6 @@ if ! command -v jq >/dev/null; then exit 1 fi -cachenamedefault="disabled" combinedoutput=$(jq -r ".combined_output" config.json) while read -r line; do @@ -34,7 +33,7 @@ while read -r entry; do key=$(jq -r ".cache_domains[${entry}].name" ${path}) cachename="cachename${key}" if [ -z "${!cachename}" ]; then - cachename=${cachenamedefault} + cachename="cachenamedefault" fi if [[ ${cachename} == "disabled" ]]; then continue