proot.1 6.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288
  1. .\" $OpenBSD: proot.1,v 1.17 2017/04/30 18:49:14 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: April 30 2017 $
  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
  31. can fill up a chroot directory for ports building usage.
  32. It will perform a set of
  33. .Cm actions
  34. that should fill up a destination
  35. .Ar chroot
  36. directory from the base system (or an optional
  37. .Ar srcroot ) .
  38. .Pp
  39. As far as possible,
  40. .Nm
  41. will create hardlinks instead of copying files, so that cloning an existing
  42. chroot will often only consume i-nodes.
  43. .Pp
  44. Some attributes can take multiple values.
  45. As a shorthand, several values can be specified in a row without having
  46. to repeat the
  47. .Ar attribute
  48. name, for instance:
  49. .Pp
  50. .Dl proot -B /build actions=unpopulate_light check_symlinks
  51. .Pp
  52. A
  53. .Ar configfile
  54. mostly contains one
  55. .Ar attribute Ns = Ns Ar value
  56. assignment per line, with comments starting with a
  57. .Sq #
  58. character.
  59. .Pp
  60. Possible
  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
  66. Verify the state of mount points in the system, specifically whether
  67. the chroot area is not nodev.
  68. .It Cm unpopulate
  69. Remove everything from the chroot apart from selected data.
  70. See
  71. .Sx Preserved areas and unpopulate
  72. for details.
  73. .It Cm snapshot
  74. Copy things from a snapshot,
  75. to be retrieved from an url or from the local filesystem.
  76. .It Cm locate
  77. Copy things from the base system, perusing the system
  78. .Xr locate 1
  79. databases.
  80. .Bf Sy
  81. Note that this might erase data, in case it doesn't match the base system
  82. and is in the way.
  83. .Ef
  84. .It Cm resolv
  85. Copy the system
  86. .Xr resolv.conf 5
  87. and
  88. .Xr hosts 5
  89. files.
  90. .It Cm copy_ports
  91. Copy the ports tree.
  92. .It Cm copy_sys
  93. Copy system include files (deprecated).
  94. .It Cm unpopulate_light
  95. Remove everything from the chroot apart from selected data.
  96. See
  97. .Sx Preserved areas and unpopulate
  98. for details.
  99. .It Cm ldconfig
  100. Rerun
  101. .Xr ldconfig 8 .
  102. .It Cm devs
  103. Regenerate devices using
  104. .Xr MAKEDEV 8
  105. and
  106. .Xr dev_mkdb 8 .
  107. .It Cm checkout_ports
  108. Check out a ports tree from cvs using a provided
  109. .Cm portscvs
  110. location.
  111. .It Cm ports_subdirs
  112. Create ports infrastructure subdirs, according to users required for
  113. .Xr dpb 1 .
  114. If
  115. .Cm chown_all
  116. is set to 1,
  117. .Xr chown 2
  118. any content within to the appropriate users.
  119. .It Cm stragglers
  120. Double-check filled up chroot for files we don't know about.
  121. .It Cm write_mk
  122. If some directory values are different from the default,
  123. write a skeleton
  124. .Xr mk.conf 5
  125. file.
  126. .It Cm check_symlinks
  127. Report absolute symlinks that exist under the
  128. .Ar chroot ,
  129. white-listing known base system links.
  130. .El
  131. .Pp
  132. By default,
  133. .Nm
  134. will run
  135. .Cm check_mount , unpopulate_light , devs , ldconfig , ports_subdirs ,
  136. .Cm resolv , write_mk .
  137. If
  138. .Cm unpopulate
  139. is used,
  140. .Cm unpopulate_light
  141. won't be run.
  142. It will also run
  143. .Cm snapshot
  144. if a snapshot location is provided,
  145. or
  146. .Cm locate
  147. otherwise.
  148. .Pp
  149. Add actions with
  150. .Cm actions Ns = Ns Ar value ,
  151. remove them with
  152. .Cm actions Ns =- Ns Ar value .
  153. .Pp
  154. Other attributes are:
  155. .Pp
  156. .Bl -tag -width mkconf_lines -offset indent -compact
  157. .It Cm chroot
  158. same as
  159. .Fl B Ar chroot
  160. .It Cm srcroot
  161. same as
  162. .Fl S Ar srcroot
  163. .It Cm PORT_USER
  164. Who the ports tree should belong to
  165. .It Cm BUILD_USER
  166. Who to build as (defaults to _pbuild)
  167. .It Cm FETCH_USER
  168. Who to fetch as (defaults to _pfetch)
  169. .It Cm LOG_USER
  170. Who 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
  178. same as in
  179. .Xr bsd.port.mk 5
  180. .Pp
  181. .It Cm chown_all
  182. set to 1 to have the action
  183. .Cm ports_subdirs
  184. change owners of every content.
  185. .It Cm extra
  186. extra file to copy into the
  187. .Ar chroot .
  188. .It Cm mkconf_lines
  189. Add lines to the generated
  190. .Pa /etc/mk.conf .
  191. .It Cm mkconf_tail
  192. Add file to the generated
  193. .Pa /etc/mk.conf .
  194. .It Cm preserve
  195. Supplemental directory to preserve during
  196. .Cm unpopulate .
  197. .It Cm sets
  198. Add 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
  201. Location of snapshot for the
  202. .Cm snapshot
  203. action.
  204. .It Cm portscvs
  205. Where to get a ports snapshot for the
  206. .Cm checkout_ports
  207. action.
  208. .El
  209. .Ss Preserved areas and unpopulate
  210. The following entries won't be erased during a
  211. .Cm locate
  212. or
  213. .Cm unpopulate*
  214. action:
  215. .Pp
  216. .Bl -dash -compact -offset indent
  217. .It
  218. Items explicitly marked with the
  219. .Cm preserve
  220. attribute.
  221. .It
  222. A
  223. .Cm snapshot
  224. directory containing the base sets.
  225. .It
  226. All the ports specific sub directories if they are defined,
  227. namely
  228. .Cm DISTDIR , WRKOBJDIR, LOGDIR, PACKAGE_REPOSITORY , PLIST_REPOSITY , LOCKDIR .
  229. .It
  230. The
  231. .Cm PORTSDIR
  232. itself, unless
  233. .Cm copy_ports
  234. is used.
  235. .It
  236. Any mountpoint.
  237. .It
  238. Data explicitly copied through other actions, e.g.,
  239. .Cm extra
  240. files, key files...
  241. .El
  242. .Sh EXAMPLES
  243. The following
  244. .Ar configfile
  245. sets things up for an initial build on a
  246. .Xr dpb 1
  247. cluster.
  248. .Bd -literal -offset index
  249. chroot=/build
  250. PORT_USER=espie
  251. extra=/home/espie/startup
  252. WRKOBJDIR=/tmp/pobj
  253. LOCKDIR=/tmp/locks
  254. PLIST_REPOSITORY=/data/plist
  255. DISTDIR=/data/distfiles
  256. PACKAGE_REPOSITORY=/data/packages
  257. actions=unpopulate_light
  258. copy_ports
  259. .Ed
  260. .Pp
  261. It assumes
  262. .Pa /build/data
  263. is a separate partition that won't be cleaned up by
  264. .Cm unpopulate_light ,
  265. and that can be mounted on slaves.
  266. Note also that
  267. .Pa /tmp
  268. should be a fast local directory on every machine of the cluster.
  269. .Pp
  270. .Pa /home/espie/startup
  271. is a startup script for
  272. .Xr dpb 1 .
  273. .Pp
  274. Initial invocation on the master could be
  275. .Pp
  276. .D1 Nm Fl c Ar configfile Cm chown_all Ns =1
  277. .Pp
  278. to ensure correct permissions for existing data under various
  279. ports directories.
  280. .Pp
  281. Slaves should not need the extra arguments, as the directories will
  282. already have correct owners.
  283. .Sh SEE ALSO
  284. .Xr dpb 1 ,
  285. .Xr chroot 8
  286. .Sh AUTHOR
  287. Marc Espie