summaryrefslogtreecommitdiff
path: root/ezjail-admin
diff options
context:
space:
mode:
authorerdgeist <erdgeist@erdgeist.org>2006-05-17 20:22:04 +0000
committererdgeist <erdgeist@erdgeist.org>2006-05-17 20:22:04 +0000
commitbb7bf169676e646b1e0f00da2157752ac37b64c9 (patch)
tree3bd1dc293655cd7a7004ab27c043a78c37acaa34 /ezjail-admin
parentfdd73c5b88789b51401b9eb3996792842c82e1b3 (diff)
Query ftp server for the versions he knows off.
Diffstat (limited to 'ezjail-admin')
-rwxr-xr-xezjail-admin29
1 files changed, 26 insertions, 3 deletions
diff --git a/ezjail-admin b/ezjail-admin
index 8141989..9d8b2a6 100755
--- a/ezjail-admin
+++ b/ezjail-admin
@@ -151,6 +151,25 @@ ezjail_updateports () {
151 [ $? = 0 ] || exerr "Updating ports failed." 151 [ $? = 0 ] || exerr "Updating ports failed."
152} 152}
153 153
154# Try to fetch the list of releases the server provides
155ezjail_queryftpserver () {
156 unset _ret
157 TIFS=${IFS}; IFS=
158 for ezjail_path in pub/FreeBSD/releases pub/FreeBSD/snapshot pub/FreeBSD releases snapshots NO; do
159 if [ ${ezjail_path} = "NO" ]; then
160 echo "Warning: I am having problems querying the ftp server you specified (${ezjail_ftphost})."
161 _ret=1; break
162 fi
163 ezjail_ftpresponse=`echo ls | ftp ${ezjail_ftphost}:${ezjail_path}/${ezjail_installarch}/ 2> /dev/null`
164 if [ $? -eq 0 ]; then
165 echo -e "The ftp server you specified (${ezjail_ftphost}) seems to provide the following builds:\n${ezjail_ftpresponse}\n."
166 _ret=0; break
167 fi
168 done
169 IFS=${TIFS}
170 return _ret
171}
172
154############################# 173#############################
155# End of function definitions 174# End of function definitions
156# 175#
@@ -505,11 +524,12 @@ install)
505 [ "${ezjail_dir%%[!/]*}" ] || ezjail_reldir=${PWD} 524 [ "${ezjail_dir%%[!/]*}" ] || ezjail_reldir=${PWD}
506 525
507 # ftp servers normally wont provide non-RELEASE-builds 526 # ftp servers normally wont provide non-RELEASE-builds
508 if [ -z "${ezjail_release}" ]; then 527 if [ -z "${ezjail_release}" -a "${ezjail_dir}" = "${ezjail_ftphost}" ]; then
509 ezjail_release=`uname -r` 528 ezjail_release=`uname -r`
510 case ${ezjail_release} in *-STABLE) ezjail_release="${ezjail_release%-STABLE}-RELEASE";; esac 529 case ${ezjail_release} in *-STABLE) ezjail_release="${ezjail_release%-STABLE}-RELEASE";; esac
511 if [ "${ezjail_release%-RELEASE}" = "${ezjail_release}" -a "${ezjail_dir}" = "${ezjail_ftphost}" ]; then 530 if [ "${ezjail_release%-RELEASE}" = "${ezjail_release}" ]; then
512 echo "Your system is ${ezjail_release}. Normally FTP-servers don't provide non-RELEASE-builds." 531 echo "Your system is ${ezjail_release}. Normally FTP-servers don't provide non-RELEASE-builds."
532 ezjail_queryftpserver || echo "... I'll continue anyway."
513 echo -n "Release [ ${ezjail_release} ]: " 533 echo -n "Release [ ${ezjail_release} ]: "
514 read ezjail_releasetmp 534 read ezjail_releasetmp
515 [ "${ezjail_releasetmp}" ] && ezjail_release=${ezjail_releasetmp} 535 [ "${ezjail_releasetmp}" ] && ezjail_release=${ezjail_releasetmp}
@@ -533,7 +553,10 @@ install)
533 553
534 # Try all paths as stolen from sysinstall, break on success. 554 # Try all paths as stolen from sysinstall, break on success.
535 for ezjail_path in pub/FreeBSD/releases pub/FreeBSD/snapshot pub/FreeBSD releases snapshots NO; do 555 for ezjail_path in pub/FreeBSD/releases pub/FreeBSD/snapshot pub/FreeBSD releases snapshots NO; do
536 [ "${ezjail_path}" = "NO" ] && exerr "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." 556 if [ "${ezjail_path}" = "NO" ]; then
557 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
558 ezjail_queryftpserver; exit 1
559 fi
537 ftp "${ezjail_ftphost}:${ezjail_path}/${ezjail_installarch}/${ezjail_release}/${pkg}/*" && break 560 ftp "${ezjail_ftphost}:${ezjail_path}/${ezjail_installarch}/${ezjail_release}/${pkg}/*" && break
538 done 561 done
539 562