mirror of
https://github.com/pi-hole/pi-hole
synced 2024-11-18 06:08:21 +00:00
add if traps to check for existence of whitelist.txt / blacklist.txt
This commit is contained in:
parent
4839953328
commit
4c853defb2
10
gravity.sh
10
gravity.sh
@ -187,12 +187,16 @@ gravity_Schwarzchild() {
|
||||
|
||||
gravity_Blacklist() {
|
||||
# Append blacklist entries if they exist
|
||||
if [[ -f "${blacklistFile}" ]]; then
|
||||
numBlacklisted=$(wc -l < "${blacklistFile}")
|
||||
plural=; [[ "$numBlacklisted" != "1" ]] && plural=s
|
||||
|
||||
echo -n "::: BlackListing $numBlacklisted domain${plural}..."
|
||||
cat ${blacklistFile} >> ${piholeDir}/${eventHorizon}
|
||||
echo " done!"
|
||||
else
|
||||
echo "::: Nothing to blacklist!"
|
||||
fi
|
||||
|
||||
}
|
||||
|
||||
gravity_Whitelist() {
|
||||
@ -212,12 +216,16 @@ gravity_Whitelist() {
|
||||
# Ensure adlist domains are in whitelist.txt
|
||||
${whitelistScript} -nr -q "${urls[@]}" > /dev/null
|
||||
|
||||
if [[ -f "${whitelistFile}" ]]; then
|
||||
# Remove anything in whitelist.txt from the Event Horizon
|
||||
numWhitelisted=$(wc -l < "${whitelistFile}")
|
||||
plural=; [[ "$numWhitelisted" != "1" ]] && plural=s
|
||||
echo -n "::: Whitelisting $numWhitelisted domain${plural}..."
|
||||
grep -F -x -v -f ${whitelistFile} ${piholeDir}/${preEventHorizon} > ${piholeDir}/${eventHorizon}
|
||||
echo " done!"
|
||||
else
|
||||
echo "::: Nothing to whitelist!"
|
||||
fi
|
||||
}
|
||||
|
||||
gravity_unique() {
|
||||
|
Loading…
Reference in New Issue
Block a user