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
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
|
.\" $OpenBSD: proot.1,v 1.7 2019/12/19 09:38:03 bentley Exp $
.\"
.\" Copyright (c) 2016 Marc Espie <espie@openbsd.org>
.\"
.\" Permission to use, copy, modify, and distribute this software for any
.\" purpose with or without fee is hereby granted, provided that the above
.\" copyright notice and this permission notice appear in all copies.
.\"
.\" THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
.\" WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
.\" MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
.\" ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
.\" WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
.\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
.\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
.\"
.Dd $Mdocdate: December 19 2019 $
.Dt PROOT 1
.Os
.Sh NAME
.Nm proot
.Nd ports chroot builder
.Sh SYNOPSIS
.Nm proot
.Op Fl B Ar chroot
.Op Fl c Ar configfile
.Op Fl S Ar srcroot
.Op Ar attribute Ns = Ns Ar value ...
.Sh DESCRIPTION
.Nm
can fill up a chroot directory for ports building usage.
It will perform a set of
.Cm actions
that should fill up a destination
.Ar chroot
directory from the base system (or an optional
.Ar srcroot ) .
.Pp
As far as possible,
.Nm
will create hardlinks instead of copying files, so that cloning an existing
chroot will often only consume i-nodes.
.Pp
Some attributes can take multiple values.
As a shorthand, several values can be specified in a row without having
to repeat the
.Ar attribute
name, for instance:
.Pp
.Dl proot -B /build actions=unpopulate_light check_symlinks
.Pp
A
.Ar configfile
mostly contains one
.Ar attribute Ns = Ns Ar value
assignment per line, with comments starting with a
.Sq #
character.
.Pp
Possible
.Cm actions
(in the order of execution) are as follows:
.Pp
.Bl -tag -width unpopulate_light -compact -offset indent
.It Cm check_mount
Verify the state of mount points in the system, specifically whether
the chroot area is not nodev.
.It Cm unpopulate
Remove everything from the chroot apart from selected data.
See
.Sx Preserved areas and unpopulate
for details.
.It Cm snapshot
Copy things from a snapshot,
to be retrieved from a URL or from the local filesystem.
.It Cm locate
Copy things from the base system, perusing the system
.Xr locate 1
databases.
.Bf Sy
Note that this might erase data, in case it doesn't match the base system
and is in the way.
.Ef
.It Cm resolv
Copy the system
.Xr resolv.conf 5
and
.Xr hosts 5
files.
.It Cm copy_ports
Copy the ports tree.
.It Cm copy_sys
Copy system include files (deprecated).
.It Cm unpopulate_light
Remove everything from the chroot apart from selected data.
See
.Sx Preserved areas and unpopulate
for details.
.It Cm ldconfig
Rerun
.Xr ldconfig 8 .
.It Cm devs
Regenerate devices using
.Xr MAKEDEV 8
and
.Xr dev_mkdb 8 .
.It Cm checkout_ports
Check out a ports tree from cvs using a provided
.Cm portscvs
location.
.It Cm ports_subdirs
Create ports infrastructure subdirs, according to users required for
.Xr dpb 1 .
If
.Cm chown_all
is set to 1,
.Xr chown 2
any content within to the appropriate users.
.It Cm stragglers
Double-check filled up chroot for files we don't know about.
.It Cm write_mk
If some values are different from the default,
write a skeleton
.Xr mk.conf 5
file.
.It Cm check_symlinks
Report absolute symlinks that exist under the
.Ar chroot ,
white-listing known base system links.
.El
.Pp
By default,
.Nm
will run
.Cm check_mount , unpopulate_light , devs , ldconfig , ports_subdirs ,
.Cm resolv , write_mk .
If
.Cm unpopulate
is used,
.Cm unpopulate_light
won't be run.
It will also run
.Cm snapshot
if a snapshot location is provided,
or
.Cm locate
otherwise.
.Pp
Add actions with
.Cm actions Ns = Ns Ar value ,
remove them with
.Cm actions Ns =- Ns Ar value .
.Pp
Other attributes are:
.Pp
.Bl -tag -width mkconf_lines -offset indent -compact
.It Cm chroot
same as
.Fl B Ar chroot
.It Cm srcroot
same as
.Fl S Ar srcroot
.It Cm PORT_USER
Who the ports tree should belong to
.It Cm BUILD_USER
Who to build as (defaults to _pbuild)
.It Cm FETCH_USER
Who to fetch as (defaults to _pfetch)
.It Cm LOG_USER
Who to write log as (defaults to
.Cm BUILD_USER )
.It Cm PORTSDIR
.It Cm DISTDIR
.It Cm PACKAGE_REPOSITORY
.It Cm PLIST_REPOSITORY
.It Cm LOCKDIR
.It Cm WRKOBJDIR
same as in
.Xr bsd.port.mk 5
.Pp
.It Cm chown_all
set to 1 to have the action
.Cm ports_subdirs
change owners of every content.
.It Cm extra
extra file to copy into the
.Ar chroot .
.It Cm mkconf_lines
Add lines to the generated
.Pa /etc/mk.conf .
.It Cm mkconf_tail
Add file to the generated
.Pa /etc/mk.conf .
.It Cm preserve
Supplemental directory to preserve during
.Cm unpopulate .
.It Cm sets
Add or remove sets compared to the default list required to build ports
(defaults to base comp etc xbase xfont xshare xetc).
.It Cm snapshot
Location of snapshot for the
.Cm snapshot
action.
.It Cm portscvs
Where to get a ports snapshot for the
.Cm checkout_ports
action.
.El
.Ss Preserved areas and unpopulate
The following entries won't be erased during a
.Cm locate
or
.Cm unpopulate*
action:
.Pp
.Bl -dash -compact -offset indent
.It
Items explicitly marked with the
.Cm preserve
attribute.
.It
A
.Cm snapshot
directory containing the base sets.
.It
All the ports specific sub directories if they are defined,
namely
.Cm DISTDIR , WRKOBJDIR , LOGDIR , PACKAGE_REPOSITORY , PLIST_REPOSITORY ,
.Cm LOCKDIR .
.It
The
.Cm PORTSDIR
itself, unless
.Cm copy_ports
is used.
.It
Any mount point.
.It
Data explicitly copied through other actions, e.g.,
.Cm extra
files, key files...
.El
.Sh EXAMPLES
The following
.Ar configfile
sets things up for an initial build on a
.Xr dpb 1
cluster.
.Bd -literal -offset index
chroot=/build
PORT_USER=espie
extra=/home/espie/startup
WRKOBJDIR=/tmp/pobj
LOCKDIR=/tmp/locks
PLIST_REPOSITORY=/data/plist
DISTDIR=/data/distfiles
PACKAGE_REPOSITORY=/data/packages
actions=unpopulate_light
copy_ports
.Ed
.Pp
It assumes
.Pa /build/data
is a separate partition that won't be cleaned up by
.Cm unpopulate_light ,
and that can be mounted on slaves.
Note also that
.Pa /tmp
should be a fast local directory on every machine of the cluster.
.Pp
.Pa /home/espie/startup
is a startup script for
.Xr dpb 1 .
.Pp
Initial invocation on the master could be
.Pp
.D1 Nm Fl c Ar configfile Cm chown_all Ns =1
.Pp
to ensure correct permissions for existing data under various
ports directories.
.Pp
Slaves should not need the extra arguments, as the directories will
already have correct owners.
.Sh SEE ALSO
.Xr dpb 1 ,
.Xr chroot 8
.Sh AUTHORS
.An Marc Espie Aq Mt espie@openbsd.org
|