#!/bin/sh -e cmds="$(dirname "$(realpath -- "$0")")" . "$cmds/env.rc" 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:-curl} --fail \ --tcp-fastopen \ --user-agent "$FEEDER_USER_AGENT" \ --compressed \ --location --max-redirs 2 \ --dump-header hdr \ --output out \ --remote-time \ --etag-save etag \ --max-time $FEEDER_CURL_MAX_TIME \ $etag_compare \ $time_cond \ $silent \ "$url" >&2 if [ -s out ] ; then $ZSTD < out > feed.zst touch -r out feed.zst truncate -s 0 out touch -r feed.zst out fi $SHA512 < feed.zst > download.hash