From 4d9199235aa98165d8a46a57574aa019c8246f39 Mon Sep 17 00:00:00 2001 From: Evan Lloyd New-Schmidt Date: Fri, 18 Aug 2023 14:08:11 -0400 Subject: [PATCH] Use wget2 by default Signed-off-by: Evan Lloyd New-Schmidt --- download.sh | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/download.sh b/download.sh index de2b7e3..e22fb90 100755 --- a/download.sh +++ b/download.sh @@ -109,8 +109,17 @@ if [ ! -e "$DOWNLOAD_DIR" ]; then fi log "Downloading available dumps" -# shellcheck disable=SC2086 # URLS should be expanded on spaces. -wget --directory-prefix "$DOWNLOAD_DIR" --continue $URLS +if type wget2 > /dev/null; then + # NOTE: Wikipedia requests no more than 2 concurrent downloads. + # See https://dumps.wikimedia.org/ for more info. + + # shellcheck disable=SC2086 # URLS should be expanded on spaces. + wget2 --max-threads 2 --verbose --progress=bar --directory-prefix "$DOWNLOAD_DIR" --continue $URLS +else + log "WARN: wget2 is not available, falling back to sequential downloads" + # shellcheck disable=SC2086 # URLS should be expanded on spaces. + wget --directory-prefix "$DOWNLOAD_DIR" --continue $URLS +fi if [ $MISSING_DUMPS -gt 0 ]; then log "$MISSING_DUMPS dumps not available yet"