scripts/get: add mirror support

Signed-off-by: Stephan Raue <stephan@openelec.tv>
This commit is contained in:
Stephan Raue 2012-05-05 16:37:13 +02:00
parent 75e8a3b157
commit 4eae00b707

View File

@ -35,7 +35,15 @@ if [ -n "$PKG_URL" ]; then
URLS="$URLS `echo $PKG_URL | sed s%GEEXBOX_SRCS%$GEEXBOX_SRCS%`"
for i in $URLS; do
PACKAGE="$SOURCES/$1/`basename $i`"
OPENELEC_MIRROR="http://sources.openelec.tv/mirror"
SOURCE_NAME="`basename $i`"
PACKAGE="$SOURCES/$1/$SOURCE_NAME"
PACKAGE_MIRROR="$OPENELEC_MIRROR/$PKG_NAME/$SOURCE_NAME"
[ "$VERBOSE" != "yes" ] && WGET_OPT=-q
WGET_CMD="wget --passive-ftp --no-check-certificate -c $WGET_OPT -P $SOURCES/$1"
NBWGET="1"
STAMP="$PACKAGE.url"
MD5SUM="$PACKAGE.md5"
@ -53,10 +61,7 @@ if [ -n "$PKG_URL" ]; then
printf "%${INDENT}c GET $1\n" >&$SILENT_OUT
export INDENT=$((${INDENT:-1}+$INDENT_SIZE))
[ "$VERBOSE" != "yes" ] && WGET_OPT=-q
NBWGET="1"
until [ -f "$STAMP" ] || wget --passive-ftp --no-check-certificate -c $WGET_OPT -P $SOURCES/$1 $i; do
until [ -f "$STAMP" ] || $WGET_CMD $i || $WGET_CMD $PACKAGE_MIRROR; do
NBWGET=$(($NBWGET+1))
if [ "$NBWGET" -gt "10" ]; then
echo -e "\nCant't get $1 sources : $i\n Try later !!"