From 88f07cdc88095ab91e9df43811ae362cf9479638 Mon Sep 17 00:00:00 2001 From: Evgenii Pashkin Date: Sun, 26 Apr 2020 09:46:05 +0300 Subject: [PATCH] Add autodetect security updates and retry on server internal error --- gir-dl.sh | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/gir-dl.sh b/gir-dl.sh index 639c4ab..be8baee 100755 --- a/gir-dl.sh +++ b/gir-dl.sh @@ -3,16 +3,18 @@ set -e -u -o pipefail MIRRORS="$1" echo $MIRRORS +WGETPARAMS="--tries=10 --retry-on-http-error=500 --waitretry=1 --show-progress" +EXTRA_MIRROR=security.ubuntu.com/ubuntu/pool if [ $# -lt 2 ]; then MIRROR="mirrors.kernel.org" else MIRROR="$2" fi -wget -q --show-progress -O tmp.html "$MIRRORS" -URL=`cat tmp.html | grep -oP "http://$MIRROR/[^\"]+"` +wget $WGETPARAMS -O tmp.html "$MIRRORS" +URL=`cat tmp.html | grep -oP "http://($MIRROR|$EXTRA_MIRROR)/[^\"]+"` rm tmp.html echo $URL -wget -q --show-progress -O tmp.deb "$URL" +wget $WGETPARAMS -O tmp.deb "$URL" ar x tmp.deb data.tar.xz rm tmp.deb tar xf data.tar.xz --strip-components 4 ./usr/share/gir-1.0