From 570bdbeb49c6d3084dc351aaded26a35cb45977f Mon Sep 17 00:00:00 2001 From: Antoine Jacoutot Date: Thu, 14 Aug 2014 15:55:31 +0200 Subject: [PATCH] Tell users to check their proxy... settings when ftp fails. --- openup | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) diff --git a/openup b/openup index 2e17324..721616f 100755 --- a/openup +++ b/openup @@ -102,7 +102,12 @@ _PID="/var/run/${0##*/}.pid" export PKG_PATH=${PKG_PATH_UPDATE_LTS}:${PKG_PATH_UPDATE}:${PKG_PATH_MAIN} -trap "rm -rf ${_TMPDIR} ${_PID}" 1 2 3 13 15 +trap "bye_bye" 1 2 3 13 15 + +bye_bye() { + rm -rf ${_TMPDIR} ${_PID} + exit 1 +} pr_bigarrow() { if [ -z "${checkmode}" ]; then @@ -118,7 +123,7 @@ pr_smallarrow() { cmd.exe() { if [ -z "${dryrun}" ]; then - eval "${@}" || exit 1 + eval "${@}" || bye_bye fi } @@ -167,11 +172,16 @@ check_openupd() { _CMD="ftp -Vo - ${OPENUP_URL} | awk -F '=' '/^_OPENUP_VERSION/ { print \$2 }'" pr_smallarrow "${_CMD}" _N=$(cmd.exe ${_CMD}) + if [ -z "${_N}" ]; then + pr_error "Cannot retrieve ${OPENUP_URL}" + pr_error "Please verify your Internet connection, proxy settings and firewall." + bye_bye + fi if [ "${_OPENUP_VERSION}" -lt "${_N}" ]; then pr_error "New openup release (version ${_N}) available; please update with:" pr_error "ftp -Vo $(readlink -f $0) ${OPENUP_URL}" - exit 1 + bye_bye fi } @@ -241,7 +251,7 @@ update_pkg() { check_vuxml() { local _BP_MATCH _OUTDATED _PAT _PKG_MATCH _b _e _p - ftp -Vo ${_TMPVUXML} ${VUXML_URL} >/dev/null || exit 1 + ftp -Vo ${_TMPVUXML} ${VUXML_URL} >/dev/null || bye_bye perl -pi -e 's,\$ARCH,'"${_ARCH}"',g' ${_TMPVUXML} _BP_MATCH="$(grep binpatch ${_TMPVUXML} | sed -e 's,,,g;s,,,g;s,\$ARCH,'"${_ARCH}"',g' | sort -u)"