mirror of
https://github.com/pi-hole/pi-hole.git
synced 2024-12-25 06:10:20 +00:00
add if traps to check for existence of whitelist.txt / blacklist.txt
This commit is contained in:
parent
4839953328
commit
4c853defb2
1 changed files with 20 additions and 12 deletions
32
gravity.sh
32
gravity.sh
|
@ -187,12 +187,16 @@ gravity_Schwarzchild() {
|
||||||
|
|
||||||
gravity_Blacklist() {
|
gravity_Blacklist() {
|
||||||
# Append blacklist entries if they exist
|
# Append blacklist entries if they exist
|
||||||
numBlacklisted=$(wc -l < "${blacklistFile}")
|
if [[ -f "${blacklistFile}" ]]; then
|
||||||
plural=; [[ "$numBlacklisted" != "1" ]] && plural=s
|
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
|
||||||
|
|
||||||
echo -n "::: BlackListing $numBlacklisted domain${plural}..."
|
|
||||||
cat ${blacklistFile} >> ${piholeDir}/${eventHorizon}
|
|
||||||
echo " done!"
|
|
||||||
}
|
}
|
||||||
|
|
||||||
gravity_Whitelist() {
|
gravity_Whitelist() {
|
||||||
|
@ -209,15 +213,19 @@ gravity_Whitelist() {
|
||||||
done
|
done
|
||||||
echo " done!"
|
echo " done!"
|
||||||
|
|
||||||
# Ensure adlist domains are in whitelist.txt
|
# Ensure adlist domains are in whitelist.txt
|
||||||
${whitelistScript} -nr -q "${urls[@]}" > /dev/null
|
${whitelistScript} -nr -q "${urls[@]}" > /dev/null
|
||||||
|
|
||||||
# Remove anything in whitelist.txt from the Event Horizon
|
if [[ -f "${whitelistFile}" ]]; then
|
||||||
numWhitelisted=$(wc -l < "${whitelistFile}")
|
# Remove anything in whitelist.txt from the Event Horizon
|
||||||
plural=; [[ "$numWhitelisted" != "1" ]] && plural=s
|
numWhitelisted=$(wc -l < "${whitelistFile}")
|
||||||
echo -n "::: Whitelisting $numWhitelisted domain${plural}..."
|
plural=; [[ "$numWhitelisted" != "1" ]] && plural=s
|
||||||
grep -F -x -v -f ${whitelistFile} ${piholeDir}/${preEventHorizon} > ${piholeDir}/${eventHorizon}
|
echo -n "::: Whitelisting $numWhitelisted domain${plural}..."
|
||||||
echo " done!"
|
grep -F -x -v -f ${whitelistFile} ${piholeDir}/${preEventHorizon} > ${piholeDir}/${eventHorizon}
|
||||||
|
echo " done!"
|
||||||
|
else
|
||||||
|
echo "::: Nothing to whitelist!"
|
||||||
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
gravity_unique() {
|
gravity_unique() {
|
||||||
|
|
Loading…
Reference in a new issue