From 144989e9c3b76dd67f241d64d89dba6dab34d418 Mon Sep 17 00:00:00 2001 From: Alex Malinovich Date: Sun, 20 Nov 2016 19:32:37 -0800 Subject: [PATCH] Better error handling for wget show-progress --- plexupdate.sh | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/plexupdate.sh b/plexupdate.sh index f6309e9..d58196a 100755 --- a/plexupdate.sh +++ b/plexupdate.sh @@ -322,7 +322,11 @@ if [ "${SAVECONFIG}" = "yes" ]; then fi if [ "${SHOWPROGRESS}" = "yes" ]; then - WGETOPTIONS="--show-progress" + if ! wget --show-progress -V &>/dev/null; then + warn "Your wget is too old to support --show-progress, ignoring" + else + WGETOPTIONS="--show-progress" + fi fi if [ "${IGNOREAUTOUPDATE}" = "yes" ]; then @@ -613,12 +617,6 @@ if [ "${SKIP_DOWNLOAD}" = "no" ]; then info "Downloading release \"${FILENAME}\"" wget ${WGETOPTIONS} -o "${FILE_WGETLOG}" --load-cookies "${FILE_KAKA}" --save-cookies "${FILE_KAKA}" --keep-session-cookies "${DOWNLOAD}" -O "${DOWNLOADDIR}/${FILENAME}" 2>&1 CODE=$? - if [ ${CODE} -eq 2 ]; then - error "Your wget is too old to support --show-progress" - info "Trying to download release \"${FILENAME}\" again" - wget -o "${FILE_WGETLOG}" --load-cookies "${FILE_KAKA}" --save-cookies "${FILE_KAKA}" --keep-session-cookies "${DOWNLOAD}" -O "${DOWNLOADDIR}/${FILENAME}" 2>&1 - CODE=$? - fi if [ ${CODE} -ne 0 ]; then error "Download failed with code ${CODE}:"