MKSANDBOX(8)

NAME
mksandbox - set up a sandbox

SYNOPSIS
mksandbox [- -mounthost=host] [- -rodirs=dir,...] [- -rwdirs=dir,...] [- -pkgsrc=dir] [- -src=srcdir] [- -xsrc=xsrcdir] [- -without-x] [- -without-pkgsrc] [- -without-src] [- -without-xsrc] [- -verbose] sandbox-dir

DESCRIPTION
mksandbox is a small shell script to set up a sandbox (usually for a pkgsrc bulk build), using null mounts. The sandbox is set up for the target directory sandbox-dir.

The following options are available:

- -mounthost=host
    Use host as the mount host.

- -rodirs=dir,...
    Mount additional directories read-only.

- -rwdirs=dir,...
    Mount additional directories read-write.

- -pkgsrc=dir
    Look for the pkgsrc files in dir instead of the default /usr/pkgsrc.

- -src=srcdir
    Look for the NetBSD src files in srcdir instead of the default /usr/src (only needed for some packages that compile kernel modules).

- -xsrc=xsrcdir
    Look for the NetBSD xsrc files in xsrcdir instead of the default /usr/xsrc (only needed for some packages).

- -without-pkgsrc
    Do not mount pkgsrc directories in the sandbox.

- -without-src
    Do not mount src directory in the sandbox.

- -without-xsrc
    Do not mount xsrc directory in the sandbox.

- -without-x
    Do not include X files in the sandbox.

- -verbose
    More verbose output.

USAGE
After mksandbox has finished successfully, sandbox-dir will contain a file sandbox which can be used to set up and tear down the sandbox, as well as execute commands inside. The sandbox script supports the following commands:

chroot
    Start ksh(1) inside the sandbox and load /etc/shrc.

mount
    Set up the sandbox.

umount
    Tear down the sandbox.

(no argument)
    Start ksh(1) inside the sandbox without loading /etc/shrc. Can only be called after mount.

command
    Try running command inside the sandbox. Fails if the argument is not an executable. Can only be called after mount.

EXAMPLES
The most common usage is running mksandbox once, e.g.,
    mksandbox /home/user/sandboxdir
and then reusing this sandbox. Once the sandbox exists, the most common usage is:

    cd /home/user/sandboxdir
    ./sandbox mount
    ./sandbox
    (do something inside, like a bulk build or building one package by hand)
    (CTRL-D or logout, to leave the shell inside the sandbox)
    ./sandbox umount

AUTHORS
Alistair G. Crooks <agc@NetBSD.org>