mirror of
https://github.com/pi-hole/pi-hole.git
synced 2024-11-15 02:42:58 +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
16
gravity.sh
16
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
|
||||
}
|
||||
|
||||
|
@ -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