30 lines
994 B
Bash
Executable File
30 lines
994 B
Bash
Executable File
#!/bin/sh
|
|
# -*- mode: sh; fill-column: 75; tab-width: 8; coding: utf-8-unix -*-
|
|
ROLE=proxy
|
|
|
|
# filter - arguments are to wget - quoted?
|
|
if [ "$#" -eq 0 ] ; then
|
|
WARGS="-xc -P /i/net/Http --tries=1 --no-hsts"
|
|
export CURL_OPTS="-C - --retry 3 --remote-name --create-dirs"
|
|
else
|
|
WARGS="$@"
|
|
export CURL_OPTS="$@"
|
|
fi
|
|
grep ^http | \
|
|
sed -e 's@ftp://[^ ]*@@' \
|
|
-e 's@^https://distfiles.gentoo.org/distfiles/[^ ]* https://pypi.python.org/@https://pypi.python.org/@' \
|
|
-e 's/http:/https:/' \
|
|
-e 's@distfiles.gentoo.org/@mirror.leaseweb.com/gentoo/@g' | \
|
|
while read urls ; do
|
|
url=`echo $urls|sed -e 's@ .*@@'`
|
|
base=`basename "$url"`
|
|
[ -e /usr/portage/distfiles/$base ] && echo distfiles/$base && continue
|
|
for url in $urls ; do
|
|
# wget --restrict-file-names=windows --no-verbose $WARGS $url || continue
|
|
scurl.bash --directory-prefix /i/net/Http --force-directories \
|
|
-- $CURL_OPTS $url || continue
|
|
|
|
break
|
|
done
|
|
done
|