install_pkgs() (
PACKAGES="lighttpd-1.4.18_1 php5-5.2.4_1"
export PACKAGESITE="ftp://127.0.0.1/"
# add an alias to /etc/hosts in our world dir to fix pkg_add stupidity
cp -pf "${NANO_WORLDDIR}/etc/hosts" "${NANO_WORLDDIR}/etc/hosts.orig" && \
echo "127.0.0.1 All" >> "${NANO_WORLDDIR}/etc/hosts"
# perform the installation by chrooting and going at it
for package in $PACKAGES
do pkg_add -C "${NANO_WORLDDIR}" -r "${package}"
done
# restore the original /etc/hosts
mv -f "${NANO_WORLDDIR}/etc/hosts.orig" "${NANO_WORLDDIR}/etc/hosts"
)