mirror of
https://github.com/pi-hole/pi-hole
synced 2024-11-18 14:18:15 +00:00
9a2862de62
It's pretty slow because /etc/hosts is so large, but it works. You can add any number of domains as arguments and it will search for and remove each one. Maybe someone smarter knows how to make it faster...
13 lines
458 B
Bash
Executable File
13 lines
458 B
Bash
Executable File
#!/bin/bash
|
|
# For each argument passed to this script
|
|
for var in "$@"
|
|
do
|
|
echo "Whitelisting $var..."
|
|
# Use sed to search for the domain in /etc/hosts and remove it using an in-place edit
|
|
sed -i "/$var/d" /etc/hosts
|
|
# Also add the domain to the whitelist.txt in /etc/pihole
|
|
echo "$var" >> /etc/pihole/whitelist.txt
|
|
done
|
|
echo "** $# domain(s) whitelisted."
|
|
# Force dnsmasq to reload /etc/hosts
|
|
kill -HUP $(pidof dnsmasq) |