summaryrefslogtreecommitdiff
path: root/pkgtools/mksandbox/files/mksandbox.8
blob: 32d53a2b6a0e409f48c10345f11bd5aaeeb79f4b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
.\" $NetBSD: mksandbox.8,v 1.6 2018/04/12 02:11:24 simonb Exp $
.\"
.\" Copyright (c) 2012 Thomas Klausner <wiz@NetBSD.org>
.\" 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 May 29, 2013
.Dt MKSANDBOX 8
.Os
.Sh NAME
.Nm mksandbox
.Nd set up a sandbox
.Sh SYNOPSIS
.Nm
.Op Fl Fl mounthost Ns = Ns Ar host
.Op Fl Fl rodirs Ns = Ns Ar dir,...
.Op Fl Fl rwdirs Ns = Ns Ar dir,...
.Op Fl Fl pkgsrc Ns = Ns Ar dir
.Op Fl Fl src Ns = Ns Ar srcdir
.Op Fl Fl xsrc Ns = Ns Ar xsrcdir
.Op Fl Fl without-x
.Op Fl Fl without-pkgsrc
.Op Fl Fl without-src
.Op Fl Fl without-xsrc
.Op Fl Fl verbose
.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 following options are available:
.Bl -tag -width "Xmounthost=hostXXX"
.It Fl Fl mounthost Ns = Ns Ar host
Use
.Ar host
as the mount host.
.It Fl Fl rodirs Ns = Ns Ar dir,...
Mount additional directories read-only.
.It Fl Fl rwdirs Ns = Ns Ar dir,...
Mount additional directories read-write.
.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 srcdir
instead of the default
.Pa /usr/src
(only needed for some packages that compile kernel modules).
.It Fl Fl xsrc Ns = Ns Ar xsrcdir
Look for the
.Nx
xsrc files in
.Ar xsrcdir
instead of the default
.Pa /usr/xsrc
(only needed for some packages).
.It Fl Fl without-pkgsrc
Do not mount pkgsrc directories in the sandbox.
.It Fl Fl without-src
Do not mount src directory in the sandbox.
.It Fl Fl without-xsrc
Do not mount xsrc directory in the sandbox.
.It Fl Fl without-x
Do not include X files in the sandbox.
.It Fl Fl verbose
More verbose output.
.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 XXnoXargumentXXXX
.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 Ic command
Try running
.Pa command
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