From 24e91c5d8b649e8b9c4cb1e63378c937e54d58c2 Mon Sep 17 00:00:00 2001 From: erdgeist Date: Wed, 17 May 2006 20:42:13 +0000 Subject: Provide more clues as how to continue if fetching dir list from server fails --- ezjail-admin | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/ezjail-admin b/ezjail-admin index 9d8b2a6..01369bb 100755 --- a/ezjail-admin +++ b/ezjail-admin @@ -154,20 +154,22 @@ ezjail_updateports () { # Try to fetch the list of releases the server provides ezjail_queryftpserver () { unset _ret + echo -n "Querying your ftp-server... " TIFS=${IFS}; IFS= for ezjail_path in pub/FreeBSD/releases pub/FreeBSD/snapshot pub/FreeBSD releases snapshots NO; do if [ ${ezjail_path} = "NO" ]; then echo "Warning: I am having problems querying the ftp server you specified (${ezjail_ftphost})." _ret=1; break fi - ezjail_ftpresponse=`echo ls | ftp ${ezjail_ftphost}:${ezjail_path}/${ezjail_installarch}/ 2> /dev/null` + ezjail_ftpresponse=`echo ls | ftp ${ezjail_ftphost}:${ezjail_path}/${ezjail_installarch}/ 2> /dev/null` 2> /dev/null if [ $? -eq 0 ]; then - echo -e "The ftp server you specified (${ezjail_ftphost}) seems to provide the following builds:\n${ezjail_ftpresponse}\n." - _ret=0; break + echo -e "The ftp server you specified (${ezjail_ftphost}) seems to provide the following builds:\n${ezjail_ftpresponse}" + _ret=0; break 2 fi done IFS=${TIFS} - return _ret + ezjail_ftpserverqueried="YES" + return ${_ret} } ############################# @@ -504,7 +506,7 @@ setup|update) ######################## ezjail-admin INSTALL ######################## install) # Clean variables, prevent polution - unset ezjail_release ezjail_ftphost ezjail_installmanpages ezjail_installports ezjail_installsources ezjail_dir ezjail_reldir + unset ezjail_release ezjail_ftphost ezjail_installmanpages ezjail_installports ezjail_installsources ezjail_dir ezjail_reldir ezjail_ftpserverqueried shift; while getopts :mpsh:r: arg; do case ${arg} in m) ezjail_installmanpages=" manpages";; @@ -554,8 +556,9 @@ install) # Try all paths as stolen from sysinstall, break on success. for ezjail_path in pub/FreeBSD/releases pub/FreeBSD/snapshot pub/FreeBSD releases snapshots NO; do if [ "${ezjail_path}" = "NO" ]; then - echo "Could not fetch ${pkg} from ${ezjail_ftphost}. Maybe your release (${ezjail_release}) is specified incorrectly or the host ${ezjail_ftphost} does not provide that release build. Use the -r option to specify an existing release or the -h option to specify an alternative ftp server." >&2 - ezjail_queryftpserver; exit 1 + echo -e "\nCould not fetch ${pkg} from ${ezjail_ftphost}.\nMaybe your release (${ezjail_release}) is specified incorrectly or the host ${ezjail_ftphost} does not provide that release build.\nUse the -r option to specify an existing release or the -h option to specify an alternative ftp server." >&2 + [ -z "${ezjail_ftpserverqueried}" ] && ezjail_queryftpserver + exit 1 fi ftp "${ezjail_ftphost}:${ezjail_path}/${ezjail_installarch}/${ezjail_release}/${pkg}/*" && break done -- cgit v1.2.3