Building NanoBSD with ports and packages

Eugene Grosbein eugen at
Fri Apr 20 12:45:14 UTC 2007

On Fri, Apr 20, 2007 at 06:07:50AM -0400, Jordan Coleman wrote:

> Can anyone suggest a way to pre-install ports in a NanoBSD system at  
> build time?  Ideally, I'd like to be able to add a customize_cmd to  
> my NanoBSD configuration file so that the finished disk images can be  
> made to include anything in ports.
> Suggestions?

Just add to your nanobsd.conf:


Place packages to /path/to/Pkg subdirectory.

Here comes the script "localfiles":

#!/bin/sh -e

# save pointer to packages, there should be $src/Pkg directory
# with packages ready to install
src=$(dirname `realpath $0`)

# go to Nano world

# start from the beginning
dirs="usr/local tmp/Pkg var/db/pkg"
rm -rf $dirs
mkdir $dirs

trap "umount $pkgs" SIGHUP SIGINT SIGTERM
mount_nullfs -o ro "$pkgs" tmp/Pkg
chroot "$NANO_WORLDDIR" sh -c "cd /tmp/Pkg && pkg_add -vF *"
umount "$pkgs"
rmdir tmp/Pkg

More information about the freebsd-small mailing list