Better output if file has not been downloaded because it has not been changed

This commit is contained in:
DL6ER 2016-12-17 23:46:28 +01:00
parent efaee2b68b
commit cd0c3f9418

View file

@ -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}"
} }