install packages with pkg_add(1) into another file system

Matthias Apitz guru at
Tue Oct 8 11:12:49 UTC 2013


I have prepared a boot-able USB-key (to be exactly a disk image of it)
the usual way:

# dd if=/dev/zero of=da0  bs=8m count=1868
# mdconfig -a -t vnode -f da0

# fdisk -I md0
# fdisk -B md0
# bsdlabel -w md0s1 auto
# bsdlabel -B md0s1
# bsdlabel -e md0s1  # edit the disk label and change partition "a" from "unused" to "4.2BSD"

# newfs /dev/md0s1a
# mount /dev/md0s1a /mnt

# cd /usr/src

now we can install world an kernel:

# make installworld  DESTDIR=/mnt
# make distrib-dirs  DESTDIR=/mnt
# make distribution  DESTDIR=/mnt

I have compiled ~800 ports (Xorg and KDE4) and after this I've created
packages of all the installed ports with pkg_create(1); the resulting
xxxx.tgz files are all as well copied to the image into /mnt/PKGDIR.

So far so good. Now I want install the packages as well into the image
in /mnt. What would be the best method for this? Run pkg_add with the
flag --chroot chrootdir, or use chroot(8) directly? Or any other idea?

Thanks in advance

All this is with 10-CURRENT (base and ports).


Matthias Apitz               |  /"\ ASCII Ribbon Campaign:
E-mail: guru at     |  \ / - No HTML/RTF in E-mail
WWW: |   X  - No proprietary attachments
phone: +49-170-4527211       |  / \ - Respect for open standards

More information about the freebsd-questions mailing list