freebsd-dev/usr.sbin/bsdconfig/examples/browse_packages_http.sh
Devin Teske 9ecd54f24f Implement GEOM based media device classification. You'll notice a few
different things from this commit:
+ More devices. Devices that were previously ignored are now present.
+ Faster device scanning. "There is no try, only Do" -- f_device_try()
  is no longer the basis of device scanning as GEOM provides [nearly]
  all devices (doesn't provide network devices).
+ More information available as non-root. Usually you have to be root
  to do things like taste filesystems, and that limits the amount of
  information available to non-root users; with GEOM, we see all even
  running unprivileged as the brunt of information (except for so-
  called ``dangerously dedicated'' file systems) is represented by the
  `kern.geom.confxml' sysctl(8) MIB.
NB: Only really useful for external scripts that use the API and run as
    non-root; where this code is used in bsdconfig(8) and bsdinstall(8)
    you are running as root so can detect even ``dangerously dedicated''
    file systems that are not present in GEOM; e.g., no PART class for
    a DOS filesystem written directly to disk without partition table).
+ No more use of legacy tools such as diskinfo(8) to get disk capacity
  or fdisk(8) to see partitions.

MFC after:	1 week
2014-04-23 22:04:04 +00:00

26 lines
873 B
Bash
Executable File

#!/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 device_media packages/INDEX > $TMPDIR/packages/INDEX
fi
_directoryPath=$TMPDIR
mediaSetDirectory
configPackages