replace wget with curl to utilize proxy settings

This commit is contained in:
root 2020-02-14 21:21:15 +08:00
parent f3bcc3aaea
commit 3957f286d8

View File

@ -1,5 +1,5 @@
#!/bin/bash #!/bin/bash
# requires: wget # requires: curl -s -S --fail
set -e set -e
set -o pipefail set -o pipefail
@ -33,7 +33,7 @@ function must_download() {
dst=$2 dst=$2
while true; do while true; do
echo "downloading: $dst" echo "downloading: $dst"
wget "$src" -O "$dst" &>/dev/null curl -s -S --fail -L "$src" -o "$dst"
tar -tzf "$dst" >/dev/null || rm "$dst" && break tar -tzf "$dst" >/dev/null || rm "$dst" && break
done done
return 0 return 0
@ -49,14 +49,14 @@ function hackage_mirror() {
echo "Downloading index..." echo "Downloading index..."
rm index.tar.gz || true rm index.tar.gz || true
wget "${base_url}/01-index.tar.gz" -O index.tar.gz &> /dev/null curl -s -S --fail -L "${base_url}/01-index.tar.gz" -o index.tar.gz
# https://hackage.haskell.org/api#security # https://hackage.haskell.org/api#security
echo "Dowloading security features..." echo "Dowloading security features..."
jsons=("timestamp.json" "snapshot.json" "root.json" "mirrors.json") jsons=("timestamp.json" "snapshot.json" "root.json" "mirrors.json")
for name in "${jsons[@]}" for name in "${jsons[@]}"
do do
wget "${base_url}/${name}" -O "${name}" curl -s -S --fail -L "${base_url}/${name}" -o "${name}"
done done
echo "building local package list" echo "building local package list"