#!/bin/sh -e PROXY="--proxy http://localhost:8080/" cd "$1" read url < url [ -s etag ] && etag_compare="--etag-compare etag" || : [ -r out ] && time_cond="--time-cond out" || : [ -z "$FEEDER_CURL_VERBOSE" ] && silent="--silent" || silent="--verbose" curl --fail \ --user-agent "go.stargrave.org-feeder/0.1.0" \ --compressed \ --location --max-redirs 2 \ --dump-header hdr \ --output out \ --remote-time \ --etag-save etag \ $PROXY \ $etag_compare \ $time_cond \ $silent \ "$url" >&2 if [ -s out ] ; then zstdmt -19 < out > feed.zst touch -r out feed.zst truncate -s 0 out touch -r feed.zst out fi sha512 < feed.zst > download.hash