pbulk in chroot on non-NetBSD platform

This documentation describes how to run pkgsrc/pkgtools/pbulk in chroot on non-NetBSD platform. This is based on Using pbulk to create a pkgsrc binary repository and pbulk-HOWTO.

Bootstrap pkgsrc on non-chrooted environment for getting bmake

For making sandbox, bmake is needed.

# ./bootstrap --varbase /usr/pkg/var --workdir /tmp/bs

Making sandbox using script

Make sure you have pkgsrc tree for bulk buld as /usr/pkgsrc. If you have pkgsrc tree at another place, you can use --pkgsrc=/some/where/pkgsrc option.

And I will setup sandbox under /home/bulk using mksandbox from the pkgtools/mksandbox package.

# mksandbox --without-x /home/bulk

If you get the following message, you can modify pkgsrc/pkgtools/files/mksandbox script.

Unknown Operating System ($opsys) - good luck

Entering to chroot

# chroot /home/bulk /bin/sh

Adding unprivileged user for build stage

# pw useradd bulk # for FreeBSD
# useradd -M bulk # for CentOS (Linux)

Creating some directories to store packages and logs.

# mkdir /scratch /bulklog /packages

# chown bulk /scratch
/scratch must be writable for bulk user.

Creating the environment for pbulk program

# ./bootstrap --prefix /usr/pkg_bulk --varbase /usr/pkg_bulk/var --workdir /tmp/bs

# rm -r /tmp/bs

# vi /usr/pkg_bulk/etc/mk.conf
Add the following lines.

WRKOBJDIR=/usr/tmp
PACKAGES=/scratch/pbulk_packages

# export PATH=/usr/pkg_bulk/bin:/usr/pkg_bulk/sbin:${PATH}

# cd /usr/pkgsrc/pkgtools/pbulk

# bmake install

# rm -r /usr/tmp/*

Configuring pbulk

# vi /usr/pkg_bulk/etc/pbulk.conf
Add the following lines to header.

ulimit -t 1800 # set the limit on CPU time (in seconds)
ulimit -v 2097152 # limits process address space

Modify the following lines.

base_url=http://www.NetBSD.org/~ryo_on/FreeBSD-i386-9.0-RC3
master_mode=no
bootstrapkit=/bootstrap.tar.gz
unprivileged_user=bulk
bulklog=/bulklog
packages=/packages
prefix=/usr/pkg
pkgsrc=/usr/pkgsrc
pkgdb=/usr/pkg/var/db/pkg
varbase=/usr/pkg/var
mail=:
rsync=:

Preparing bootstrap kit

# cd /usr/pkgsrc/bootstrap

# ./bootstrap --varbase /usr/pkg/var --workdir /tmp/bsi

# rm -r /tmp/bsi

# vi /usr/pkg/etc/mk.conf
Add the following lines.

WRKOBJDIR=/scratch
PKGSRCDIR=/usr/pkgsrc
DISTDIR=/usr/distfiles
PACKAGES=/packages
SKIP_LICENSE_CHECK=yes
ALLOW_VULNERABLE_PACKAGES=yes
PKG_DEVELOPER=yes
X11_TYPE=modular

# tar zvfc /bootstrap.tar.gz /usr/pkg

Running the bulk build

# /usr/pkg_bulk/bin/bulkbuild

Or to restart

# /usr/pkg_bulk/libexec/pbulk/build