NetBSD Wiki/pkgsrc/
how to save your packages
You can easily save all of your currently installed NetBSD packages for use on other machines by using pkg_tarup. Here's what to do.
- Install pkg_tarup from pkgsrc. ie.. cd /usr/pkgsrc/pkgtools/pkg_tarup ; make install (as root)
 - Now you can now use pkg_tarup to create a tarball package from any currently installed package. Just do pkg_tarup [packagename]
 
Here is an example of how powerful this technique can be. With only a few lines of shell code we can put all the installed packages into a directory:
cd /var/tmp
mkdir packages
cd packages
for PKGNAME in `pkg_info -e "*" | sort`; do
    echo "Packaging $PKGNAME"
    pkg_tarup -d "." "$PKGNAME" || echo "WARNING: Packaging $PKGNAME failed." 1>&2
done
