mirror of
https://github.com/pi-hole/pi-hole
synced 2024-12-22 14:58:08 +00:00
if whitelist.txt doesn't exist, create it
This commit is contained in:
parent
3b9f7031d5
commit
a2cddda590
@ -1,5 +1,9 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
|
if [[ ! -f /etc/pihole/whitelist.txt ]];then
|
||||||
|
touch /etc/pihole/whitelist.txt
|
||||||
|
fi
|
||||||
|
|
||||||
if [ $# = 0 ]; then
|
if [ $# = 0 ]; then
|
||||||
echo "Immediately whitelists one or more domains."
|
echo "Immediately whitelists one or more domains."
|
||||||
echo "Usage: whitelist.sh domain1 [domain2 ...]"
|
echo "Usage: whitelist.sh domain1 [domain2 ...]"
|
||||||
@ -29,7 +33,7 @@ done
|
|||||||
# Now report on and remove matched domains
|
# Now report on and remove matched domains
|
||||||
if [ "$combopattern" != "" ]; then
|
if [ "$combopattern" != "" ]; then
|
||||||
echo "Modifying hosts file..."
|
echo "Modifying hosts file..."
|
||||||
|
|
||||||
# Construct pattern to match entry in hosts file.
|
# Construct pattern to match entry in hosts file.
|
||||||
# This consists of one or more IP addresses followed by the domain name.
|
# 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")$"}')
|
pattern=$(echo $combopattern | awk -F '[# \t]' '{printf "%s", "^(([0-9]+\.){3}[0-9]+ +)+("$1")$"}')
|
||||||
|
Loading…
Reference in New Issue
Block a user