mirror of
https://github.com/pi-hole/pi-hole
synced 2024-12-22 14:58:08 +00:00
Add "pihole -g -b" to *only* update black.list (saves a bunch of time when adding/changing only blacklisted files - won'tdownload lal lists, but only processes the blacklist and restars dnsmasq)
This commit is contained in:
parent
0283a1ab74
commit
0a9c234127
47
gravity.sh
47
gravity.sh
@ -317,9 +317,8 @@ gravity_doHostFormat() {
|
|||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
gravity_hostFormat() {
|
gravity_hostFormatLocal() {
|
||||||
# Format domain list as "192.168.x.x domain.com"
|
# Format domain list as "192.168.x.x domain.com"
|
||||||
echo -n "::: Formatting domains into a HOSTS file..."
|
|
||||||
|
|
||||||
if [[ -f /etc/hostname ]]; then
|
if [[ -f /etc/hostname ]]; then
|
||||||
hostname=$(</etc/hostname)
|
hostname=$(</etc/hostname)
|
||||||
@ -333,19 +332,24 @@ gravity_hostFormat() {
|
|||||||
# Copy the file over as /etc/pihole/local.list so dnsmasq can use it
|
# Copy the file over as /etc/pihole/local.list so dnsmasq can use it
|
||||||
gravity_doHostFormat "${localList}.tmp" "${localList}"
|
gravity_doHostFormat "${localList}.tmp" "${localList}"
|
||||||
rm "${localList}.tmp"
|
rm "${localList}.tmp"
|
||||||
|
}
|
||||||
|
|
||||||
|
gravity_hostFormatGravity() {
|
||||||
|
# Format domain list as "192.168.x.x domain.com"
|
||||||
echo "" > "${piholeDir}/${accretionDisc}"
|
echo "" > "${piholeDir}/${accretionDisc}"
|
||||||
gravity_doHostFormat "${piholeDir}/${eventHorizon}" "${piholeDir}/${accretionDisc}"
|
gravity_doHostFormat "${piholeDir}/${eventHorizon}" "${piholeDir}/${accretionDisc}"
|
||||||
# Copy the file over as /etc/pihole/gravity.list so dnsmasq can use it
|
# Copy the file over as /etc/pihole/gravity.list so dnsmasq can use it
|
||||||
cp "${piholeDir}/${accretionDisc}" "${adList}"
|
cp "${piholeDir}/${accretionDisc}" "${adList}"
|
||||||
rm "${piholeDir}/${accretionDisc}"
|
rm "${piholeDir}/${accretionDisc}"
|
||||||
|
}
|
||||||
|
|
||||||
|
gravity_hostFormatBlack() {
|
||||||
|
# Format domain list as "192.168.x.x domain.com"
|
||||||
echo -e "" > "${blackList}.tmp"
|
echo -e "" > "${blackList}.tmp"
|
||||||
gravity_doHostFormat "${blackList}.tmp" "${blackList}"
|
gravity_doHostFormat "${blackList}.tmp" "${blackList}"
|
||||||
# Copy the file over as /etc/pihole/black.list so dnsmasq can use it
|
# Copy the file over as /etc/pihole/black.list so dnsmasq can use it
|
||||||
cp "${blackList}.tmp" "${blackList}"
|
cp "${blackList}.tmp" "${blackList}"
|
||||||
rm "${blackList}.tmp"
|
rm "${blackList}.tmp"
|
||||||
echo " done!"
|
|
||||||
}
|
}
|
||||||
|
|
||||||
# blackbody - remove any remnant files from script processes
|
# blackbody - remove any remnant files from script processes
|
||||||
@ -386,11 +390,6 @@ gravity_advanced() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
gravity_reload() {
|
gravity_reload() {
|
||||||
#Clear no longer needed files...
|
|
||||||
echo ":::"
|
|
||||||
echo -n "::: Cleaning up un-needed files..."
|
|
||||||
rm ${piholeDir}/pihole.*.txt
|
|
||||||
echo " done!"
|
|
||||||
|
|
||||||
# Reload hosts file
|
# Reload hosts file
|
||||||
echo ":::"
|
echo ":::"
|
||||||
@ -411,6 +410,7 @@ for var in "$@"; do
|
|||||||
"-f" | "--force" ) forceGrav=true;;
|
"-f" | "--force" ) forceGrav=true;;
|
||||||
"-h" | "--help" ) helpFunc;;
|
"-h" | "--help" ) helpFunc;;
|
||||||
"-sd" | "--skip-download" ) skipDownload=true;;
|
"-sd" | "--skip-download" ) skipDownload=true;;
|
||||||
|
"-b" | "--blacklist-only" ) blackListOnly=true;;
|
||||||
esac
|
esac
|
||||||
done
|
done
|
||||||
|
|
||||||
@ -420,22 +420,39 @@ if [[ "${forceGrav}" == true ]]; then
|
|||||||
echo " done!"
|
echo " done!"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
gravity_collapse
|
if [[ ! "${blackListOnly}" == true ]]; then
|
||||||
gravity_spinup
|
gravity_collapse
|
||||||
if [[ "${skipDownload}" == false ]]; then
|
gravity_spinup
|
||||||
|
if [[ "${skipDownload}" == false ]]; then
|
||||||
gravity_Schwarzchild
|
gravity_Schwarzchild
|
||||||
gravity_advanced
|
gravity_advanced
|
||||||
else
|
else
|
||||||
echo "::: Using cached Event Horizon list..."
|
echo "::: Using cached Event Horizon list..."
|
||||||
numberOf=$(wc -l < ${piholeDir}/${preEventHorizon})
|
numberOf=$(wc -l < ${piholeDir}/${preEventHorizon})
|
||||||
echo "::: $numberOf unique domains trapped in the event horizon."
|
echo "::: $numberOf unique domains trapped in the event horizon."
|
||||||
|
fi
|
||||||
|
gravity_Whitelist
|
||||||
fi
|
fi
|
||||||
gravity_Whitelist
|
|
||||||
gravity_Blacklist
|
gravity_Blacklist
|
||||||
gravity_Wildcard
|
gravity_Wildcard
|
||||||
|
|
||||||
gravity_hostFormat
|
echo -n "::: Formatting domains into a HOSTS file..."
|
||||||
|
if [[ ! "${blackListOnly}" == true ]]; then
|
||||||
|
gravity_hostFormatLocal
|
||||||
|
gravity_hostFormatGravity
|
||||||
|
fi
|
||||||
|
gravity_hostFormatBlack
|
||||||
|
echo " done!"
|
||||||
|
|
||||||
gravity_blackbody
|
gravity_blackbody
|
||||||
|
|
||||||
|
if [[ ! "${blackListOnly}" == true ]]; then
|
||||||
|
#Clear no longer needed files...
|
||||||
|
echo ":::"
|
||||||
|
echo -n "::: Cleaning up un-needed files..."
|
||||||
|
rm ${piholeDir}/pihole.*.txt
|
||||||
|
echo " done!"
|
||||||
|
fi
|
||||||
|
|
||||||
gravity_reload
|
gravity_reload
|
||||||
"${PIHOLE_COMMAND}" status
|
"${PIHOLE_COMMAND}" status
|
||||||
|
Loading…
Reference in New Issue
Block a user