]> Sergey Matveev's repositories - feeder.git/blobdiff - cmd/download.sh
Various refactoring and parametrizing
[feeder.git] / cmd / download.sh
index a70c6d7039dd0ae1ceeeb450c75b48dd00289f0c..2b642f6b02b09a239d28367f8ba8fa1eb9412c75 100755 (executable)
@@ -1,28 +1,28 @@
 #!/bin/sh -e
 
-PROXY="--proxy http://localhost:8080/"
+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 --fail \
-    --user-agent "go.stargrave.org-feeder/0.1.0" \
+${CURL:-curl} --fail \
+    --user-agent "$FEEDER_USER_AGENT" \
     --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
+    $ZSTD < out > feed.zst
     touch -r out feed.zst
     truncate -s 0 out
     touch -r feed.zst out
 fi
-sha512 < feed.zst > download.hash
+$SHA512 < feed.zst > download.hash