From 4eae00b707f860317b1099ed31831749551e109f Mon Sep 17 00:00:00 2001 From: Stephan Raue Date: Sat, 5 May 2012 16:37:13 +0200 Subject: [PATCH] scripts/get: add mirror support Signed-off-by: Stephan Raue --- scripts/get | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/scripts/get b/scripts/get index 784e1fbb57..e1639ab056 100755 --- a/scripts/get +++ b/scripts/get @@ -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 !!"