xref: /openbsd/share/man/man1/proot.1 (revision 73471bf0)
1.\"	$OpenBSD: proot.1,v 1.9 2021/10/04 13:42:53 espie Exp $
2.\"
3.\" Copyright (c) 2016 Marc Espie <espie@openbsd.org>
4.\"
5.\" Permission to use, copy, modify, and distribute this software for any
6.\" purpose with or without fee is hereby granted, provided that the above
7.\" copyright notice and this permission notice appear in all copies.
8.\"
9.\" THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
10.\" WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
11.\" MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
12.\" ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
13.\" WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
14.\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
15.\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
16.\"
17.Dd $Mdocdate: October 4 2021 $
18.Dt PROOT 1
19.Os
20.Sh NAME
21.Nm proot
22.Nd ports chroot builder
23.Sh SYNOPSIS
24.Nm proot
25.Op Fl B Ar chroot
26.Op Fl c Ar configfile
27.Op Fl S Ar srcroot
28.Op Ar attribute Ns = Ns Ar value ...
29.Sh DESCRIPTION
30.Nm
31can fill up a chroot directory for ports building usage.
32It will perform a set of
33.Cm actions
34that should fill up a destination
35.Ar chroot
36directory from the base system (or an optional
37.Ar srcroot ) .
38.Pp
39As far as possible,
40.Nm
41will create hardlinks instead of copying files, so that cloning an existing
42chroot will often only consume i-nodes.
43.Pp
44Some attributes can take multiple values.
45As a shorthand, several values can be specified in a row without having
46to repeat the
47.Ar attribute
48name, for instance:
49.Pp
50.Dl proot -B /build actions=unpopulate_light check_symlinks
51.Pp
52A
53.Ar configfile
54mostly contains one
55.Ar attribute Ns = Ns Ar value
56assignment per line, with comments starting with a
57.Sq #
58character.
59.Pp
60Possible
61.Cm actions
62(in the order of execution) are as follows:
63.Pp
64.Bl -tag -width unpopulate_light -compact -offset indent
65.It Cm check_mount
66Verify the state of mount points in the system, specifically whether
67the chroot area is not nodev.
68.It Cm unpopulate
69Remove everything from the chroot apart from selected data.
70See
71.Sx Preserved areas and unpopulate
72for details.
73.It Cm snapshot
74Copy things from a snapshot,
75to be retrieved from a URL or from the local filesystem.
76.It Cm trusted_snapshot
77Like
78.Cm snapshot ,
79but without signature checking.
80Use with caution, usually with snapshots you've built yourself.
81.It Cm locate
82Copy things from the base system, perusing the system
83.Xr locate 1
84databases.
85.Bf Sy
86Note that this might erase data, in case it doesn't match the base system
87and is in the way.
88.Ef
89.It Cm resolv
90Copy the system
91.Xr resolv.conf 5
92and
93.Xr hosts 5
94files.
95.It Cm copy_ports
96Copy the ports tree.
97.It Cm copy_sys
98Copy system include files (deprecated).
99.It Cm unpopulate_light
100Remove everything from the chroot apart from selected data.
101See
102.Sx Preserved areas and unpopulate
103for details.
104.It Cm ldconfig
105Rerun
106.Xr ldconfig 8 .
107.It Cm devs
108Regenerate devices using
109.Xr MAKEDEV 8
110and
111.Xr dev_mkdb 8 .
112.It Cm checkout_ports
113Check out a ports tree from cvs using a provided
114.Cm portscvs
115location.
116.It Cm ports_subdirs
117Create ports infrastructure subdirs, according to users required for
118.Xr dpb 1 .
119If
120.Cm chown_all
121is set to 1,
122.Xr chown 2
123any content within to the appropriate users.
124.It Cm stragglers
125Double-check filled up chroot for files we don't know about.
126.It Cm write_mk
127If some values are different from the default,
128write a skeleton
129.Xr mk.conf 5
130file.
131.It Cm check_symlinks
132Report absolute symlinks that exist under the
133.Ar chroot ,
134white-listing known base system links.
135.El
136.Pp
137By default,
138.Nm
139will run
140.Cm check_mount , unpopulate_light , devs , ldconfig , ports_subdirs ,
141.Cm resolv , write_mk .
142If
143.Cm unpopulate
144is used,
145.Cm unpopulate_light
146won't be run.
147It will also run
148.Cm snapshot
149if a snapshot location is provided,
150or
151.Cm locate
152otherwise.
153.Pp
154Add actions with
155.Cm actions Ns = Ns Ar value ,
156remove them with
157.Cm actions Ns =- Ns Ar value .
158.Pp
159Other attributes are:
160.Pp
161.Bl -tag -width mkconf_lines -offset indent -compact
162.It Cm chroot
163same as
164.Fl B Ar chroot
165.It Cm srcroot
166same as
167.Fl S Ar srcroot
168.It Cm PORT_USER
169Who the ports tree should belong to
170.It Cm BUILD_USER
171Who to build as (defaults to _pbuild)
172.It Cm FETCH_USER
173Who to fetch as (defaults to _pfetch)
174.It Cm LOG_USER
175Who to write log as (defaults to
176.Cm BUILD_USER )
177.It Cm PORTSDIR
178.It Cm DISTDIR
179.It Cm PACKAGE_REPOSITORY
180.It Cm PLIST_REPOSITORY
181.It Cm LOGDIR
182.It Cm LOCKDIR
183.It Cm WRKOBJDIR
184same as in
185.Xr bsd.port.mk 5
186.Pp
187.It Cm chown_all
188set to 1 to have the action
189.Cm ports_subdirs
190change owners of every content.
191.It Cm extra
192extra file to copy into the
193.Ar chroot .
194.It Cm mkconf_lines
195Add lines to the generated
196.Pa /etc/mk.conf .
197.It Cm mkconf_tail
198Add file to the generated
199.Pa /etc/mk.conf .
200.It Cm preserve
201Supplemental directory to preserve during
202.Cm unpopulate .
203.It Cm sets
204Add or remove sets compared to the default list required to build ports
205(defaults to all sets).
206.It Cm snapshot
207Location of snapshot for the
208.Cm snapshot
209action.
210.It Cm portscvs
211Where to get a ports snapshot for the
212.Cm checkout_ports
213action.
214.El
215.Ss Preserved areas and unpopulate
216The following entries won't be erased during a
217.Cm locate
218or
219.Cm unpopulate*
220action:
221.Pp
222.Bl -dash -compact -offset indent
223.It
224Items explicitly marked with the
225.Cm preserve
226attribute.
227.It
228A
229.Cm snapshot
230directory containing the base sets.
231.It
232All the ports specific sub directories if they are defined,
233namely
234.Cm DISTDIR , WRKOBJDIR , LOGDIR , PACKAGE_REPOSITORY , PLIST_REPOSITORY ,
235.Cm LOCKDIR .
236.It
237The
238.Cm PORTSDIR
239itself, unless
240.Cm copy_ports
241is used.
242.It
243Any mount point.
244.It
245Data explicitly copied through other actions, e.g.,
246.Cm extra
247files, key files...
248.El
249.Sh EXAMPLES
250The following
251.Ar configfile
252sets things up for an initial build on a
253.Xr dpb 1
254cluster.
255.Bd -literal -offset index
256chroot=/build
257PORT_USER=espie
258extra=/home/espie/startup
259WRKOBJDIR=/tmp/pobj
260LOCKDIR=/tmp/locks
261PLIST_REPOSITORY=/data/plist
262DISTDIR=/data/distfiles
263PACKAGE_REPOSITORY=/data/packages
264actions=unpopulate_light
265	copy_ports
266.Ed
267.Pp
268It assumes
269.Pa /build/data
270is a separate partition that won't be cleaned up by
271.Cm unpopulate_light ,
272and that can be mounted on slaves.
273Note also that
274.Pa /tmp
275should be a fast local directory on every machine of the cluster.
276.Pp
277.Pa /home/espie/startup
278is a startup script for
279.Xr dpb 1 .
280.Pp
281Initial invocation on the master could be
282.Pp
283.D1 Nm Fl c Ar configfile Cm chown_all Ns =1
284.Pp
285to ensure correct permissions for existing data under various
286ports directories.
287.Pp
288Slaves should not need the extra arguments, as the directories will
289already have correct owners.
290.Sh SEE ALSO
291.Xr dpb 1 ,
292.Xr chroot 8
293.Sh AUTHORS
294.An Marc Espie Aq Mt espie@openbsd.org
295