xref: /openbsd-src/share/man/man1/proot.1 (revision 46035553bfdd96e63c94e32da0210227ec2e3cf1)
1.\"	$OpenBSD: proot.1,v 1.7 2019/12/19 09:38:03 bentley 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: December 19 2019 $
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 locate
77Copy things from the base system, perusing the system
78.Xr locate 1
79databases.
80.Bf Sy
81Note that this might erase data, in case it doesn't match the base system
82and is in the way.
83.Ef
84.It Cm resolv
85Copy the system
86.Xr resolv.conf 5
87and
88.Xr hosts 5
89files.
90.It Cm copy_ports
91Copy the ports tree.
92.It Cm copy_sys
93Copy system include files (deprecated).
94.It Cm unpopulate_light
95Remove everything from the chroot apart from selected data.
96See
97.Sx Preserved areas and unpopulate
98for details.
99.It Cm ldconfig
100Rerun
101.Xr ldconfig 8 .
102.It Cm devs
103Regenerate devices using
104.Xr MAKEDEV 8
105and
106.Xr dev_mkdb 8 .
107.It Cm checkout_ports
108Check out a ports tree from cvs using a provided
109.Cm portscvs
110location.
111.It Cm ports_subdirs
112Create ports infrastructure subdirs, according to users required for
113.Xr dpb 1 .
114If
115.Cm chown_all
116is set to 1,
117.Xr chown 2
118any content within to the appropriate users.
119.It Cm stragglers
120Double-check filled up chroot for files we don't know about.
121.It Cm write_mk
122If some values are different from the default,
123write a skeleton
124.Xr mk.conf 5
125file.
126.It Cm check_symlinks
127Report absolute symlinks that exist under the
128.Ar chroot ,
129white-listing known base system links.
130.El
131.Pp
132By default,
133.Nm
134will run
135.Cm check_mount , unpopulate_light , devs , ldconfig , ports_subdirs ,
136.Cm resolv , write_mk .
137If
138.Cm unpopulate
139is used,
140.Cm unpopulate_light
141won't be run.
142It will also run
143.Cm snapshot
144if a snapshot location is provided,
145or
146.Cm locate
147otherwise.
148.Pp
149Add actions with
150.Cm actions Ns = Ns Ar value ,
151remove them with
152.Cm actions Ns =- Ns Ar value .
153.Pp
154Other attributes are:
155.Pp
156.Bl -tag -width mkconf_lines -offset indent -compact
157.It Cm chroot
158same as
159.Fl B Ar chroot
160.It Cm srcroot
161same as
162.Fl S Ar srcroot
163.It Cm PORT_USER
164Who the ports tree should belong to
165.It Cm BUILD_USER
166Who to build as (defaults to _pbuild)
167.It Cm FETCH_USER
168Who to fetch as (defaults to _pfetch)
169.It Cm LOG_USER
170Who to write log as (defaults to
171.Cm BUILD_USER )
172.It Cm PORTSDIR
173.It Cm DISTDIR
174.It Cm PACKAGE_REPOSITORY
175.It Cm PLIST_REPOSITORY
176.It Cm LOCKDIR
177.It Cm WRKOBJDIR
178same as in
179.Xr bsd.port.mk 5
180.Pp
181.It Cm chown_all
182set to 1 to have the action
183.Cm ports_subdirs
184change owners of every content.
185.It Cm extra
186extra file to copy into the
187.Ar chroot .
188.It Cm mkconf_lines
189Add lines to the generated
190.Pa /etc/mk.conf .
191.It Cm mkconf_tail
192Add file to the generated
193.Pa /etc/mk.conf .
194.It Cm preserve
195Supplemental directory to preserve during
196.Cm unpopulate .
197.It Cm sets
198Add or remove sets compared to the default list required to build ports
199(defaults to base comp etc xbase xfont xshare xetc).
200.It Cm snapshot
201Location of snapshot for the
202.Cm snapshot
203action.
204.It Cm portscvs
205Where to get a ports snapshot for the
206.Cm checkout_ports
207action.
208.El
209.Ss Preserved areas and unpopulate
210The following entries won't be erased during a
211.Cm locate
212or
213.Cm unpopulate*
214action:
215.Pp
216.Bl -dash -compact -offset indent
217.It
218Items explicitly marked with the
219.Cm preserve
220attribute.
221.It
222A
223.Cm snapshot
224directory containing the base sets.
225.It
226All the ports specific sub directories if they are defined,
227namely
228.Cm DISTDIR , WRKOBJDIR , LOGDIR , PACKAGE_REPOSITORY , PLIST_REPOSITORY ,
229.Cm LOCKDIR .
230.It
231The
232.Cm PORTSDIR
233itself, unless
234.Cm copy_ports
235is used.
236.It
237Any mount point.
238.It
239Data explicitly copied through other actions, e.g.,
240.Cm extra
241files, key files...
242.El
243.Sh EXAMPLES
244The following
245.Ar configfile
246sets things up for an initial build on a
247.Xr dpb 1
248cluster.
249.Bd -literal -offset index
250chroot=/build
251PORT_USER=espie
252extra=/home/espie/startup
253WRKOBJDIR=/tmp/pobj
254LOCKDIR=/tmp/locks
255PLIST_REPOSITORY=/data/plist
256DISTDIR=/data/distfiles
257PACKAGE_REPOSITORY=/data/packages
258actions=unpopulate_light
259	copy_ports
260.Ed
261.Pp
262It assumes
263.Pa /build/data
264is a separate partition that won't be cleaned up by
265.Cm unpopulate_light ,
266and that can be mounted on slaves.
267Note also that
268.Pa /tmp
269should be a fast local directory on every machine of the cluster.
270.Pp
271.Pa /home/espie/startup
272is a startup script for
273.Xr dpb 1 .
274.Pp
275Initial invocation on the master could be
276.Pp
277.D1 Nm Fl c Ar configfile Cm chown_all Ns =1
278.Pp
279to ensure correct permissions for existing data under various
280ports directories.
281.Pp
282Slaves should not need the extra arguments, as the directories will
283already have correct owners.
284.Sh SEE ALSO
285.Xr dpb 1 ,
286.Xr chroot 8
287.Sh AUTHORS
288.An Marc Espie Aq Mt espie@openbsd.org
289