I use a simple script to set and export the PKG_PATH variable.
Code:
# Set PKG_PATH and PKG_CACHE
# $Id: PKGenv,v 1.2 2009/01/11 12:29:54 j65nko Exp $
# ------------------------------
# IMPORTANT use "." to source this script!!!
#
# . ./PKGenv
# ------------------------------
# The PKG_PATH variable needs to be set
# and exported in the current shell/xterm !
# 'sh ./PKGenv' will not work!
if [ "$(id -u)" -ne 0 ]; then
echo PKGenv : Remember you are not ROOT !!
fi
# ---- VERSION or RELEASE
VERSION=snapshots
VERSION=4.4
# --- Architecture
ARCH=amd64
ARCH=i386
# -- from man pkg_add (1)
# If the environment variable PKG_CACHE is set, every package retrieved
# from a distant location will also be copied here.
# -- make sure the PATH ends with a '/' !
PKG_CACHE=/home/packages/
export PKG_CACHE
mkdir -p ${PKG_CACHE}
# -- make sure the PATH ends with a '/' !
PKGDIR=pub/OpenBSD/${VERSION}/packages/${ARCH}/
# -- sites
export alberta=ftp://ftp.openbsd.org/${PKGDIR}
export stacken=ftp://ftp.stacken.kth.se/${PKGDIR}
export plig=ftp://ftp.plig.org/${PKGDIR}
export hostfuss=ftp://mirror.hostfuss.com/${PKGDIR}
export calyx=ftp://ftp.calyx.nl/${PKGDIR}
export nluug=ftp://ftp.nluug.nl/${PKGDIR}
export plato=scp://plato.utp.xnet/home/packages/
# -- for testing
#for site in alberta stacken plig hostfuss calyx nluug plato; do
# eval echo \$${site}
#done
# -- actual setting and export
#PKG_PATH=${PKG_CACHE}:${alberta}
PKG_PATH=${plig}
export PKG_PATH
echo ------------------------------------
# env TZ=Europe/Amsterdam date
# env TZ=UTC date
# env TZ=Canada/Mountain date
# env TZ=MST date
# echo ------------------------------------
dmesg | head -2
echo Current settings
echo ------------------------------------
env | grep PKG
echo ------------------------------------
You source it like this
Code:
$ . ./PKGenv
j65nko@hercules[~]. ./PKGenv
PKGenv : Remember you are not ROOT !!
------------------------------------
OpenBSD 4.2 (GENERIC) #1179: Tue Aug 28 10:37:50 MDT 2007
deraadt@amd64.openbsd.org:/usr/src/sys/arch/amd64/compile/GENERIC
Current settings
------------------------------------
PKG_CACHE=/home/packages/
PKG_PATH=ftp://ftp.plig.org/pub/OpenBSD/4.4/packages/i386/
------------------------------------
The script is attached for download. Just do a "mv PKGenv.txt PKGenv" to get rid of the ".txt" extension.