1cda7fc92SDevin Teske#!/bin/sh 2cda7fc92SDevin Teske# 3*95d45410SDevin Teske# This sample downloads the package digests.txz and packagesite.txz files from 4*95d45410SDevin Teske# HTTP to /tmp (if they don't already exist) and then displays the package 5*95d45410SDevin Teske# configuration/management screen using the local files (resulting in faster 6*95d45410SDevin Teske# browsing of packages from-start since digests.txz/packagesite.txz can be 7*95d45410SDevin Teske# loaded from local media). 8cda7fc92SDevin Teske# 9*95d45410SDevin Teske# NOTE: Packages cannot be installed unless staged to 10*95d45410SDevin Teske# /tmp/packages/$PKG_ABI/All 11cda7fc92SDevin Teske# 12*95d45410SDevin Teske[ "$_SCRIPT_SUBR" ] || . /usr/share/bsdconfig/script.subr || exit 1 13cda7fc92SDevin TeskenonInteractive=1 14*95d45410SDevin Teskef_musthavepkg_init # Make sure we have a usable pkg(8) with $PKG_ABI 15cda7fc92SDevin TeskeTMPDIR=/tmp 16*95d45410SDevin TeskePKGDIR=$TMPDIR/packages/$PKG_ABI 17*95d45410SDevin Teske[ -d "$PKGDIR" ] || mkdir -p "$PKGDIR" || exit 1 18*95d45410SDevin Teskefor file in digests.txz packagesite.txz; do 19*95d45410SDevin Teske [ -s "$PKGDIR/$file" ] && continue 20*95d45410SDevin Teske if [ ! "$HTTP_INITIALIZED" ]; then 21*95d45410SDevin Teske _httpPath=http://pkg.freebsd.org 22cda7fc92SDevin Teske mediaSetHTTP 23cda7fc92SDevin Teske mediaOpen 24cda7fc92SDevin Teske fi 25*95d45410SDevin Teske f_show_info "Downloading %s from\n %s" "$file" "$_httpPath" 26*95d45410SDevin Teske f_device_get device_media "/$PKG_ABI/latest/$file" > $PKGDIR/$file || 27*95d45410SDevin Teske exit 1 28*95d45410SDevin Teskedone 29cda7fc92SDevin Teske_directoryPath=$TMPDIR 30cda7fc92SDevin TeskemediaSetDirectory 31cda7fc92SDevin TeskeconfigPackages 32