Getting started with pkgwrap

Setting up pkgwrap to build ports as an unprivileged user

To initialize pkgwrap, you will need access to the packages from the core collection plus opt/fakeroot. You can mount a CRUX release ISO, loop mount a CRUX release ISO image, or use packages stored locally.

Setup pkgwrap directories for your user:

$ pkgwrap-init -p /path/to/packages

By default, pkgwrap-init installs configuration files and the build container to $HOME/.pkgwrap. This destination directory can be changed by using the -b option:

$ pkgwrap-init -b /another/dir -p /path/to/core/packages

After pkgwrap-init successfully completes, you will need to edit the newly installed configuration files to your needs:

If the packages installed into the fresh build container are out of date, this command will bring them up to date, based on your ports collection at /usr/ports::

$ pkgwrap-update

Without options, pkgwrap-update will update an installation in the default location ($HOME/.pkgwrap). Use the -b option, just like pkgwrap-init, to alter the location:

$pkgwrap-update -b /path/to/your/installation

If you initialize pkgwrap to a different directory than the default, invocations of pkgwrap will need to have the PKGWRAP_HOME environment varialble set. It can be exported or set on the command line:

$ PKGWRAP_HOME=/path/to/your/installation pkgwrap -d

Setting up pkgwrap as a makecommand for prt-get

This portion is based on

Add the pkgmk user:

# useradd -r -U -m pkgmk

Add entries into the subuid (subordinate uid) and subgid (subordinate gid) files:

# cat >> /etc/subuid << EOF

# cat >> /etc/subuid << EOF

Mount a CRUX iso image or cdrom:

# mount -o loop /path/to/crux_iso /mnt


# mount /dev/sr0 /mnt

Initialize pkgwrap build environment for user pkgmk:

# cd /home/pkgmk && sudo -H -u pkgmk -g pkgmk pkgwrap-init -p /mnt

Update the container (optional):

# cd /home/pkgmk && sudo -H -u pkgmk -g pkgmk pkgwrap-update

Unmount the iso image or cdrom:

# umount /mnt

Edit /etc/pkgmk.conf to add pkgmk user’s source, package. and work directories :

# sed -i -e 's,\(^#[[:space:]]*\|\)\(PKGMK_SOURCE_DIR\"\).*,\2/home/pkgmk/src",' \
    -e 's,\(^#[[:space:]]*\|\)\(PKGMK_PACKAGE_DIR\"\).*,\2/home/pkgmk/pkg",' \
    -e 's,\(^#[[:space:]]*\|\)\(PKGMK_WORK_DIR\"\).*,\2/home/pkgmk/work/$name",' \

Comment out current prt-get ‘makecommand’ in prt-get.conf:

# sed -i -e '/^makecommand/s//#&/' /etc/prt-get.conf

Add new makecommand to prt-get.conf:

# cat >> /etc/prt-get.conf << EOF
makecommand sudo -H -u pkgmk -g -pkgmk pkgwrap