base=ftp://ftp.freebsd.org/pub/FreeBSD/releases/amd64/8.1-BETA1/base
fetch -qo- ${base}/CHECKSUM.MD5 | sed -e 's/^MD5 (//g; s/) = [0-9a-f]\{32\}$//g; /^base\.inf$/d; /^base\.mtree$/d; /^install.sh$/d' | sort | while read chunk
do
  url=${base}/${chunk}
  echo "${url}" >&2
  fetch -o- ${url} > %SRCPAK/${chunk}
done
fetch -o- ${base}/base.mtree > %SRCPAK/base.mtree

base=ftp://ftp.freebsd.org/pub/FreeBSD/releases/amd64/8.1-BETA1/kernels
fetch -qo- ${base}/CHECKSUM.MD5 | sed -e 's/^MD5 (//g; s/) = [0-9a-f]\{32\}$//g; /^generic\.inf$/d; /^generic\.mtree$/d; /^install.sh$/d' | sort | while read chunk
do
  url=${base}/${chunk}
  echo "${url}" >&2
  fetch -o- ${url} > %SRCPAK/${chunk}
done
fetch -o- ${base}/generic.mtree > %SRCPAK/generic.mtree
getdist() {
  # getdist 8.1-RELEASE i386 base manpages kernels
  dist="${1}"
  arch="${2}"
  while [ "${3}" ]
  do
    pack="${3}"
    url="ftp://ftp.freebsd.org/pub/FreeBSD/releases/${arch}/${dist}/${pack}"
    dst="$(pwd)/${dist}/${arch}/${pack}"
    mkdir -p "${dst}"
    curl "${url}" | awk '{print $9}' | sed -e 's#^#${url}#' | ( cd "${dst}"; xargs fetch )
    shift
  done
}