From ad1f210528009c5655499ae6b75a47d43964423b Mon Sep 17 00:00:00 2001 From: Adam Warner Date: Fri, 2 Mar 2018 20:47:01 +0000 Subject: [PATCH] As we no longer add source lists to the whitelist by default, gravity falls over on new installs. Signed-off-by: Adam Warner --- gravity.sh | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/gravity.sh b/gravity.sh index cfc7566e..395ea548 100755 --- a/gravity.sh +++ b/gravity.sh @@ -505,8 +505,13 @@ gravity_ParseBlacklistDomains() { # Empty $accretionDisc if it already exists, otherwise, create it : > "${piholeDir}/${accretionDisc}" - - gravity_ParseDomainsIntoHosts "${piholeDir}/${whitelistMatter}" "${piholeDir}/${accretionDisc}" + + if [[ -f "${piholeDir}/${whitelistMatter}" ]]; then + gravity_ParseDomainsIntoHosts "${piholeDir}/${whitelistMatter}" "${piholeDir}/${accretionDisc}" + else + # There was no whitelist file, so use preEventHorizon instead of whitelistMatter. + gravity_ParseDomainsIntoHosts "${piholeDir}/${preEventHorizon}" "${piholeDir}/${accretionDisc}" + fi # Move the file over as /etc/pihole/gravity.list so dnsmasq can use it output=$( { mv "${piholeDir}/${accretionDisc}" "${adList}"; } 2>&1 )