From cb30231facbfa15a5e5c2f54f555beb28fb4056f Mon Sep 17 00:00:00 2001 From: Henric Andersson Date: Thu, 10 Nov 2016 17:19:10 -0800 Subject: [PATCH] Check if wget fails due to unsupported options --show-progress will not stop plexupdate.sh but it will tell you it didn't like it very much. You need wget 1.16+ for that to work. Fixes #123 --- plexupdate.sh | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/plexupdate.sh b/plexupdate.sh index be9cf0a..7a69840 100755 --- a/plexupdate.sh +++ b/plexupdate.sh @@ -766,6 +766,13 @@ if [ "${SKIP_DOWNLOAD}" = "no" ]; then infoLogNoNewline "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 + errorLog "!! Your wget is too old to support --show-progress" + infoLogNoNewline "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 + ERROR=$(cat ${FILE_WGETLOG}) if [ ${CODE} -ne 0 ]; then errorLog "!! Download failed with code ${CODE}, \"${ERROR}\""