mirror of
https://github.com/pi-hole/pi-hole.git
synced 2024-12-23 21:30:17 +00:00
add flag to skip download of lists
This commit is contained in:
parent
25343da6b7
commit
59ba6f8aec
1 changed files with 14 additions and 4 deletions
18
gravity.sh
18
gravity.sh
|
@ -54,6 +54,8 @@ supernova=${basename}.1.supernova.txt
|
|||
eventHorizon=${basename}.2.eventHorizon.txt
|
||||
accretionDisc=${basename}.3.accretionDisc.txt
|
||||
|
||||
skipDownload=false
|
||||
|
||||
# Warn users still using pihole.conf that it no longer has any effect (I imagine about 2 people use it)
|
||||
if [[ -r ${piholeDir}/pihole.conf ]];then
|
||||
echo "::: pihole.conf file no longer supported. Over-rides in this file are ignored."
|
||||
|
@ -162,7 +164,7 @@ gravity_spinup() {
|
|||
|
||||
agent="Mozilla/10.0"
|
||||
|
||||
echo -n "::: Getting $domain list..."
|
||||
|
||||
|
||||
# Use a case statement to download lists that need special cURL commands
|
||||
# to complete properly and reset the user agent when required
|
||||
|
@ -179,7 +181,12 @@ gravity_spinup() {
|
|||
# Default is a simple request
|
||||
*) cmd_ext=""
|
||||
esac
|
||||
gravity_transport "$url" "$cmd_ext" "$agent"
|
||||
if [[ "${skipDownload}" == false ]]; then
|
||||
echo -n "::: Getting $domain list..."
|
||||
gravity_transport "$url" "$cmd_ext" "$agent"
|
||||
else
|
||||
echo "::: Using cached $domain list"
|
||||
fi
|
||||
done
|
||||
}
|
||||
|
||||
|
@ -317,7 +324,7 @@ gravity_reload() {
|
|||
# Reload hosts file
|
||||
echo ":::"
|
||||
echo -n "::: Refresh lists in dnsmasq..."
|
||||
|
||||
|
||||
#ensure /etc/dnsmasq.d/01-pihole.conf is pointing at the correct list!
|
||||
#First escape forward slashes in the path:
|
||||
adList=${adList//\//\\\/}
|
||||
|
@ -345,15 +352,18 @@ gravity_reload() {
|
|||
}
|
||||
|
||||
|
||||
|
||||
|
||||
for var in "$@"
|
||||
do
|
||||
case "$var" in
|
||||
"-f" | "--force" ) forceGrav=true;;
|
||||
"-h" | "--help" ) helpFunc;;
|
||||
"-sd" | "--skip-download" ) skipDownload=true;;
|
||||
esac
|
||||
done
|
||||
|
||||
if [[ ${forceGrav} == true ]]; then
|
||||
if [[ "${forceGrav}" == true ]]; then
|
||||
echo -n "::: Deleting exising list cache..."
|
||||
rm /etc/pihole/list.*
|
||||
echo " done!"
|
||||
|
|
Loading…
Reference in a new issue