browse_packages_http.sh revision 268999
1284345Ssjg#!/bin/sh 2284345Ssjg# $FreeBSD: head/usr.sbin/bsdconfig/examples/browse_packages_http.sh 268999 2014-07-22 23:10:12Z dteske $ 3284345Ssjg# 4284345Ssjg# This sample downloads the package digests.txz and packagesite.txz files from 5284345Ssjg# HTTP to /tmp (if they don't already exist) and then displays the package 6284345Ssjg# configuration/management screen using the local files (resulting in faster 7284345Ssjg# browsing of packages from-start since digests.txz/packagesite.txz can be 8284345Ssjg# loaded from local media). 9284345Ssjg# 10296550Sbdrewery# NOTE: Packages cannot be installed unless staged to 11284345Ssjg# /tmp/packages/$PKG_ABI/All 12284345Ssjg# 13284345Ssjg[ "$_SCRIPT_SUBR" ] || . /usr/share/bsdconfig/script.subr || exit 1 14284345SsjgnonInteractive=1 15284345Ssjgf_musthavepkg_init # Make sure we have a usable pkg(8) with $PKG_ABI 16284345SsjgTMPDIR=/tmp 17284345SsjgPKGDIR=$TMPDIR/packages/$PKG_ABI 18[ -d "$PKGDIR" ] || mkdir -p "$PKGDIR" || exit 1 19for file in digests.txz packagesite.txz; do 20 [ -s "$PKGDIR/$file" ] && continue 21 if [ ! "$HTTP_INITIALIZED" ]; then 22 _httpPath=http://pkg.freebsd.org 23 mediaSetHTTP 24 mediaOpen 25 fi 26 f_show_info "Downloading %s from\n %s" "$file" "$_httpPath" 27 f_device_get device_media "/$PKG_ABI/latest/$file" > $PKGDIR/$file || 28 exit 1 29done 30_directoryPath=$TMPDIR 31mediaSetDirectory 32configPackages 33