1
0
mirror of https://github.com/pi-hole/pi-hole synced 2024-12-23 07:18:07 +00:00

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 <wally3k@pi-hole.net>
This commit is contained in:
WaLLy3K 2017-07-24 21:26:39 +10:00 committed by GitHub
parent a2825be819
commit 406098e55a

View File

@ -138,7 +138,7 @@ AddDomain() {
if [[ "${verbose}" == true ]]; then if [[ "${verbose}" == true ]]; then
echo -e " ${INFO} Adding $1 to wildcard blacklist..." echo -e " ${INFO} Adding $1 to wildcard blacklist..."
fi fi
reload=true reload="restart"
echo "address=/$1/${IPV4_ADDRESS}" >> "${wildcardlist}" echo "address=/$1/${IPV4_ADDRESS}" >> "${wildcardlist}"
if [[ "${#IPV6_ADDRESS}" > 0 ]]; then if [[ "${#IPV6_ADDRESS}" > 0 ]]; then
echo "address=/$1/${IPV6_ADDRESS}" >> "${wildcardlist}" echo "address=/$1/${IPV6_ADDRESS}" >> "${wildcardlist}"
@ -183,7 +183,7 @@ RemoveDomain() {
echo -e " ${INFO} Removing $1 from $listname..." echo -e " ${INFO} Removing $1 from $listname..."
# /I flag: search case-insensitive # /I flag: search case-insensitive
sed -i "/address=\/${domain}/Id" "${list}" sed -i "/address=\/${domain}/Id" "${list}"
reload=true reload="restart"
else else
if [[ "${verbose}" == true ]]; then if [[ "${verbose}" == true ]]; then
echo -e " ${INFO} ${1} does not exist in ${listname}, no need to remove!" echo -e " ${INFO} ${1} does not exist in ${listname}, no need to remove!"
@ -192,12 +192,16 @@ RemoveDomain() {
fi fi
} }
# Update Gravity
Reload() { Reload() {
# Reload hosts file
echo "" echo ""
echo -e " ${INFO} Updating gravity..."
echo "" # Ensure that "restart" is used for Wildcard updates
pihole -g -sd if [[ "${1}" == "restart" ]]; then
local type="--wildcard"
fi
pihole -g --skip-download --blacklist-only "${type:-}"
} }
Displaylist() { Displaylist() {
@ -243,6 +247,7 @@ fi
PoplistFile PoplistFile
if ${reload}; then if [[ "${reload}" != false ]]; then
Reload # Ensure that "restart" is used for Wildcard updates
Reload "${reload}"
fi fi