.\" $NetBSD: mksandbox.8,v 1.3 2012/08/26 22:13:18 wiz Exp $ .\" .\" Copyright (c) 2012 Thomas Klausner .\" All rights reserved. .\" .\" Redistribution and use in source and binary forms, with or without .\" modification, are permitted provided that the following conditions .\" are met: .\" 1. Redistributions of source code must retain the above copyright .\" notice, this list of conditions and the following disclaimer. .\" 2. Redistributions in binary form must reproduce the above copyright .\" notice, this list of conditions and the following disclaimer in the .\" documentation and/or other materials provided with the distribution. .\" .\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR .\" IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES .\" OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. .\" IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, .\" INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT .\" NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, .\" DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY .\" THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT .\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF .\" THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. .\" .Dd August 26, 2012 .Dt MKSANDBOX 8 .Os .Sh NAME .Nm mksandbox .Nd set up a sandbox .Sh SYNOPSIS .Nm .Op Fl Fl pkgsrc Ns = Ns Ar dir .Op Fl Fl src Ns = Ns Ar srcdir .Op Fl Fl verbose .Op Fl Fl without-x .Op Fl Fl xsrc Ns = Ns Ar xsrcdir .Ar sandbox-dir .Sh DESCRIPTION .Nm 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 .Ar sandbox-dir . .Pp The supported options are: .Bl -tag -width "Xpkgsrc=dirXXX" .It Fl Fl pkgsrc Ns = Ns Ar dir Look for the pkgsrc files in .Ar dir instead of the default .Pa /usr/pkgsrc . .It Fl Fl src Ns = Ns Ar srcdir Look for the .Nx src files in .Ar dir instead of the default .Pa /usr/src (only needed for some packages that compile kernel modules). .It Fl Fl verbose More verbose output. .It Fl Fl without-x Do not include X files in the sandbox. .It Fl Fl xsrc Ns = Ns Ar xsrcdir Look for the .Nx xsrc files in .Ar dir instead of the default .Pa /usr/src (only needed for some packages). .El .Sh USAGE After .Nm has finished successfully, .Ar sandbox-dir will contain a file .Pa sandbox which can be used to set up and tear down the sandbox, as well as execute commands inside. The .Pa sandbox script supports the following commands: .Bl -tag -width XanythingXelseXXX .It Ic mount Set up the sandbox. .It Ic umount Tear down the sandbox. .It (no argument) Start .Xr ksh 1 inside the sandbox. Can only be called after .Ic mount . .It anything-else Try running .Pa anything-else inside the sandbox. Fails if the argument is not an executable. Can only be called after .Ic mount . .El .Sh EXAMPLES The most common usage is running mksandbox once, e.g. .Dl mksandbox /home/user/sandboxdir and then reusing this sandbox. Once the sandbox exists, the most common usage is: .Bd -literal -offset indent 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 .Ed .Sh AUTHORS .An Alistair G. Crooks .Aq agc@NetBSD.org