diff --git a/.local/bin/rget b/.local/bin/rget index 42d39c26..202096d1 100755 --- a/.local/bin/rget +++ b/.local/bin/rget @@ -62,10 +62,18 @@ rsync*) fi esac +get_wget () { + wget --reject 'index.html*' $OPT_SINGLE --continue --content-disposition --compression=gzip --no-proxy "$1" --directory-prefix="$OUTPUT" +} + mkdir -p "$OUTPUT" if $OPT_HTTP; then - wget --reject 'index.html*' $OPT_SINGLE --continue --content-disposition --compression=gzip --no-proxy "$ADDRESS" --directory-prefix="$OUTPUT" + get_wget "$ADDRESS" else # We ignore timestamp by removing "-t" from "-a". See man page. rsync -ivzzP -rlpgoD --size-only $ADDRESS/files "$OUTPUT" + if [ $? = 5 ]; then + echo "Looks like HTTP, retrying with wget..." + get_wget $(echo "$ADDRESS" | sed s/^rsync/http/) + fi fi