From 406098e55a61c8cf72ba06e3de682cb938a401e1 Mon Sep 17 00:00:00 2001 From: WaLLy3K Date: Mon, 24 Jul 2017 21:26:39 +1000 Subject: [PATCH] Speed up refresh time * Add "--blacklist-only" to only run essential gravity functions * Pass "--wildcard" option to `gravity.sh` to ensure dnsmasq is restarted Signed-off-by: WaLLy3K --- advanced/Scripts/list.sh | 21 +++++++++++++-------- 1 file changed, 13 insertions(+), 8 deletions(-) diff --git a/advanced/Scripts/list.sh b/advanced/Scripts/list.sh index 86589083..8b6a6e5b 100755 --- a/advanced/Scripts/list.sh +++ b/advanced/Scripts/list.sh @@ -138,7 +138,7 @@ AddDomain() { if [[ "${verbose}" == true ]]; then echo -e " ${INFO} Adding $1 to wildcard blacklist..." fi - reload=true + reload="restart" echo "address=/$1/${IPV4_ADDRESS}" >> "${wildcardlist}" if [[ "${#IPV6_ADDRESS}" > 0 ]]; then echo "address=/$1/${IPV6_ADDRESS}" >> "${wildcardlist}" @@ -183,7 +183,7 @@ RemoveDomain() { echo -e " ${INFO} Removing $1 from $listname..." # /I flag: search case-insensitive sed -i "/address=\/${domain}/Id" "${list}" - reload=true + reload="restart" else if [[ "${verbose}" == true ]]; then echo -e " ${INFO} ${1} does not exist in ${listname}, no need to remove!" @@ -192,12 +192,16 @@ RemoveDomain() { fi } +# Update Gravity Reload() { - # Reload hosts file echo "" - echo -e " ${INFO} Updating gravity..." - echo "" - pihole -g -sd + + # Ensure that "restart" is used for Wildcard updates + if [[ "${1}" == "restart" ]]; then + local type="--wildcard" + fi + + pihole -g --skip-download --blacklist-only "${type:-}" } Displaylist() { @@ -243,6 +247,7 @@ fi PoplistFile -if ${reload}; then - Reload +if [[ "${reload}" != false ]]; then + # Ensure that "restart" is used for Wildcard updates + Reload "${reload}" fi