From a2cddda590ad983dc7ae8915646130559eb1e947 Mon Sep 17 00:00:00 2001 From: Jacob Salmela Date: Fri, 27 Nov 2015 18:29:44 -0600 Subject: [PATCH] if whitelist.txt doesn't exist, create it --- advanced/Scripts/whitelist.sh | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/advanced/Scripts/whitelist.sh b/advanced/Scripts/whitelist.sh index d610d0a..97385c9 100755 --- a/advanced/Scripts/whitelist.sh +++ b/advanced/Scripts/whitelist.sh @@ -1,5 +1,9 @@ #!/bin/bash +if [[ ! -f /etc/pihole/whitelist.txt ]];then + touch /etc/pihole/whitelist.txt +fi + if [ $# = 0 ]; then echo "Immediately whitelists one or more domains." echo "Usage: whitelist.sh domain1 [domain2 ...]" @@ -29,7 +33,7 @@ done # Now report on and remove matched domains if [ "$combopattern" != "" ]; then echo "Modifying hosts file..." - + # Construct pattern to match entry in hosts file. # This consists of one or more IP addresses followed by the domain name. pattern=$(echo $combopattern | awk -F '[# \t]' '{printf "%s", "^(([0-9]+\.){3}[0-9]+ +)+("$1")$"}')