svn commit: r255991 - in stable/9/usr.sbin/bsdconfig: examples share/media
Devin Teske
dteske at FreeBSD.org
Wed Oct 2 16:32:09 UTC 2013
Author: dteske
Date: Wed Oct 2 16:32:07 2013
New Revision: 255991
URL: http://svnweb.freebsd.org/changeset/base/255991
Log:
MFC revisions 255908, 255925, and 255925:
SVN r255908:
Fix a bug in HTTP checking/fetching. Add Main Site to HTTP menu. Add new
example script browse_packages_http.sh and move existing example script
browse_packages.sh -> browse_packages_ftp.sh
SVN r255925:
Remove the is (Iceland) mirror per mail from the admins.
SVN r255925:
Remove ftp5.se.f.o, as per request to -hubs@
Added:
stable/9/usr.sbin/bsdconfig/examples/browse_packages_ftp.sh
- copied unchanged from r255818, head/usr.sbin/bsdconfig/examples/browse_packages_ftp.sh
stable/9/usr.sbin/bsdconfig/examples/browse_packages_http.sh
- copied unchanged from r255818, head/usr.sbin/bsdconfig/examples/browse_packages_http.sh
Deleted:
stable/9/usr.sbin/bsdconfig/examples/browse_packages.sh
Modified:
stable/9/usr.sbin/bsdconfig/examples/Makefile
stable/9/usr.sbin/bsdconfig/share/media/ftp.subr
stable/9/usr.sbin/bsdconfig/share/media/http.subr
Directory Properties:
stable/9/usr.sbin/bsdconfig/ (props changed)
Modified: stable/9/usr.sbin/bsdconfig/examples/Makefile
==============================================================================
--- stable/9/usr.sbin/bsdconfig/examples/Makefile Wed Oct 2 15:00:04 2013 (r255990)
+++ stable/9/usr.sbin/bsdconfig/examples/Makefile Wed Oct 2 16:32:07 2013 (r255991)
@@ -3,7 +3,7 @@
NO_OBJ=
FILESDIR= ${SHAREDIR}/examples/bsdconfig
-FILES= browse_packages.sh bsdconfigrc
+FILES= browse_packages_ftp.sh browse_packages_http.sh bsdconfigrc
beforeinstall:
mkdir -p ${DESTDIR}${FILESDIR}
Copied: stable/9/usr.sbin/bsdconfig/examples/browse_packages_ftp.sh (from r255818, head/usr.sbin/bsdconfig/examples/browse_packages_ftp.sh)
==============================================================================
--- /dev/null 00:00:00 1970 (empty, because file is newly added)
+++ stable/9/usr.sbin/bsdconfig/examples/browse_packages_ftp.sh Wed Oct 2 16:32:07 2013 (r255991, copy of r255818, head/usr.sbin/bsdconfig/examples/browse_packages_ftp.sh)
@@ -0,0 +1,25 @@
+#!/bin/sh
+# $FreeBSD$
+#
+# This sample downloads the package INDEX file from FTP to /tmp (if it doesn't
+# already exist) and then displays the package configuration/management screen
+# using the local INDEX file (results in faster browsing of packages from-start
+# since the INDEX can be loaded from local media).
+#
+# NOTE: Packages cannot be installed unless staged to /tmp/packages/All
+#
+. /usr/share/bsdconfig/script.subr
+nonInteractive=1
+TMPDIR=/tmp
+if [ ! -e "$TMPDIR/packages/INDEX" ]; then
+ [ -d "$TMPDIR/packages" ] || mkdir -p "$TMPDIR/packages" || exit 1
+ _ftpPath=ftp://ftp.freebsd.org
+ # For older releases, use ftp://ftp-archive.freebsd.org
+ mediaSetFTP
+ mediaOpen
+ f_show_info "Downloading packages/INDEX from\n %s" "$_ftpPath"
+ f_device_get media packages/INDEX > $TMPDIR/packages/INDEX
+fi
+_directoryPath=$TMPDIR
+mediaSetDirectory
+configPackages
Copied: stable/9/usr.sbin/bsdconfig/examples/browse_packages_http.sh (from r255818, head/usr.sbin/bsdconfig/examples/browse_packages_http.sh)
==============================================================================
--- /dev/null 00:00:00 1970 (empty, because file is newly added)
+++ stable/9/usr.sbin/bsdconfig/examples/browse_packages_http.sh Wed Oct 2 16:32:07 2013 (r255991, copy of r255818, head/usr.sbin/bsdconfig/examples/browse_packages_http.sh)
@@ -0,0 +1,25 @@
+#!/bin/sh
+# $FreeBSD$
+#
+# This sample downloads the package INDEX file from HTTP to /tmp (if it doesn't
+# already exist) and then displays the package configuration/management screen
+# using the local INDEX file (results in faster browsing of packages from-start
+# since the INDEX can be loaded from local media).
+#
+# NOTE: Packages cannot be installed unless staged to /tmp/packages/All
+#
+. /usr/share/bsdconfig/script.subr
+nonInteractive=1
+TMPDIR=/tmp
+if [ ! -e "$TMPDIR/packages/INDEX" ]; then
+ [ -d "$TMPDIR/packages" ] || mkdir -p "$TMPDIR/packages" || exit 1
+ _httpPath=http://ftp.freebsd.org
+ # For older releases, use http://ftp-archive.freebsd.org
+ mediaSetHTTP
+ mediaOpen
+ f_show_info "Downloading packages/INDEX from\n %s" "$_httpPath"
+ f_device_get media packages/INDEX > $TMPDIR/packages/INDEX
+fi
+_directoryPath=$TMPDIR
+mediaSetDirectory
+configPackages
Modified: stable/9/usr.sbin/bsdconfig/share/media/ftp.subr
==============================================================================
--- stable/9/usr.sbin/bsdconfig/share/media/ftp.subr Wed Oct 2 15:00:04 2013 (r255990)
+++ stable/9/usr.sbin/bsdconfig/share/media/ftp.subr Wed Oct 2 16:32:07 2013 (r255991)
@@ -125,7 +125,6 @@ f_dialog_menu_media_ftp()
' $msg_germany #8' 'ftp8.de.freebsd.org'
'$msg_greece' 'ftp.gr.freebsd.org'
' $msg_greece #2' 'ftp2.gr.freebsd.org'
- '$msg_iceland' 'ftp.is.freebsd.org'
'$msg_ireland' 'ftp3.ie.freebsd.org'
'$msg_israel' 'ftp.il.freebsd.org'
'$msg_italy' 'ftp.it.freebsd.org'
@@ -165,7 +164,6 @@ f_dialog_menu_media_ftp()
' $msg_sweden #2' 'ftp2.se.freebsd.org'
' $msg_sweden #3' 'ftp3.se.freebsd.org'
' $msg_sweden #4' 'ftp4.se.freebsd.org'
- ' $msg_sweden #5' 'ftp5.se.freebsd.org'
' $msg_sweden #6' 'ftp6.se.freebsd.org'
'$msg_switzerland' 'ftp.ch.freebsd.org'
'$msg_taiwan' 'ftp.tw.freebsd.org'
Modified: stable/9/usr.sbin/bsdconfig/share/media/http.subr
==============================================================================
--- stable/9/usr.sbin/bsdconfig/share/media/http.subr Wed Oct 2 15:00:04 2013 (r255990)
+++ stable/9/usr.sbin/bsdconfig/share/media/http.subr Wed Oct 2 16:32:07 2013 (r255991)
@@ -77,7 +77,8 @@ f_dialog_menu_media_http()
f_dialog_title_restore
local prompt="$msg_please_select_the_site_closest_to_you_or_other"
local menu_list="
- 'URL' '$msg_specify_some_other_http_site'
+ '$msg_main_site' 'ftp.freebsd.org'
+ 'URL' '$msg_specify_some_other_http_site'
" # END-QUOTE
local hline="$msg_select_a_site_thats_close"
@@ -390,8 +391,12 @@ f_http_check_access()
f_show_info "$msg_checking_access_to" "$http_path"
local rx
+ case "$http_path" in
+ http://*|/*) : valid request ;;
+ *) http_path="/$http_path" # full URI requests only
+ esac
if ! rx=$(
- printf "GET /%s/ HTTP/1.0\r\n\r\n" "${http_path%/}" |
+ printf "GET %s/ HTTP/1.0\r\n\r\n" "${http_path%/}" |
nc -n "$host" "$http_port"
); then
f_show_msg "$msg_couldnt_connect_to_server http://%s:%s/" \
@@ -581,8 +586,12 @@ f_media_get_http()
local http_path
f_getvar $VAR_HTTP_PATH%/ http_path
- local url="/$http_path/$file" rx
+ case "$http_path" in
+ http://*|/*) : valid request ;;
+ *) http_path="/$http_path" # full URI requests only
+ esac
+ local url="$http_path/$file" rx
f_dprintf "sending http request for: %s" "$url"
printf "GET %s HTTP/1.0\r\n\r\n" "$url" | nc -n "$host" "$http_port" |
(
More information about the svn-src-stable-9
mailing list