mirror of
https://github.com/pi-hole/pi-hole.git
synced 2024-12-25 14:20:18 +00:00
Better output if file has not been downloaded because it has not been changed
This commit is contained in:
parent
efaee2b68b
commit
cd0c3f9418
1 changed files with 17 additions and 13 deletions
12
gravity.sh
12
gravity.sh
|
@ -105,9 +105,13 @@ gravity_collapse() {
|
||||||
gravity_patternCheck() {
|
gravity_patternCheck() {
|
||||||
patternBuffer=$1
|
patternBuffer=$1
|
||||||
success=$2
|
success=$2
|
||||||
# check if the patternbuffer is a non-zero length file
|
error=$3
|
||||||
if [ $success = true ]; then
|
if [ $success = true ]; then
|
||||||
if [[ -s "${patternBuffer}" ]]; then
|
# check if download was successful but list has not been modified
|
||||||
|
if [ "${error}" == "304" ]; then
|
||||||
|
echo "::: No changes detected, transport skipped!"
|
||||||
|
# check if the patternbuffer is a non-zero length file
|
||||||
|
elif [[ -s "${patternBuffer}" ]]; then
|
||||||
# Some of the blocklists are copyright, they need to be downloaded
|
# Some of the blocklists are copyright, they need to be downloaded
|
||||||
# and stored as is. They can be processed for content after they
|
# and stored as is. They can be processed for content after they
|
||||||
# have been saved.
|
# have been saved.
|
||||||
|
@ -149,7 +153,7 @@ gravity_transport() {
|
||||||
echo -n "::: Status: "
|
echo -n "::: Status: "
|
||||||
case "$err" in
|
case "$err" in
|
||||||
"200" ) echo "Success (OK)"; success=true;;
|
"200" ) echo "Success (OK)"; success=true;;
|
||||||
"304" ) echo "Not modified"; success=false;;
|
"304" ) echo "Not modified"; success=true;;
|
||||||
"403" ) echo "Forbidden"; success=false;;
|
"403" ) echo "Forbidden"; success=false;;
|
||||||
"404" ) echo "Not found"; success=false;;
|
"404" ) echo "Not found"; success=false;;
|
||||||
"408" ) echo "Time-out"; success=false;;
|
"408" ) echo "Time-out"; success=false;;
|
||||||
|
@ -161,7 +165,7 @@ gravity_transport() {
|
||||||
esac
|
esac
|
||||||
|
|
||||||
# Process result
|
# Process result
|
||||||
gravity_patternCheck "${patternBuffer}" ${success}
|
gravity_patternCheck "${patternBuffer}" ${success} "${err}"
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue