OSDN Git Service

Added option -g to portsreinstall-chroot.
[portsreinstall/current.git] / man / portsreinstall-chroot.8
1 .\" ==================================================================================
2 .\" portsreinstall\-chroot(8) manual page
3 .\" Copyright (C) 2018 Mamoru Sakaue, MwGhennndo, All Rights Reserved.
4 .\" ==================================================================================
5 .TH PORTSREINSTALL\-CHROOT 8 "13 September 2018" "FreeBSD" "FreeBSD System Manager's Manual"
6 .SH NAME
7 portsreinstall\-chroot \- Support utility for \fBportsreinstall\fR(8) to build packages in a virtual environment
8 .SH SYNOPSIS
9 .B portsreinstall\-chroot
10 [
11 .I
12 OPTIONS
13 ] [
14 .B
15 \-\-
16 ] [
17 .I
18 command
19 ]
20 .SH DESCRIPTION
21  This utility assists to update packages by creating and using \fBchroot\fR(8) environment for building. The ch\fBchroot\fR(8)root environment is first created by forking the host environment, and the user is asked to complete update of packages at the \fBchroot\fR(8) environment.
22 .SH RESTRICTION
23 When this utility is executed inside a \fBchroot\fR(8) or \fBjail\fR(8) virtual environment as the target, the execution MAY be terminated at the process of mounting and unmounting file systems.
24 In this case, the user should follow a message which addresses to execute \fBportsreinstall\-chroot\-mount\fR(8) at the grand host environment.
25 Note that this utility involves mounting and unmounting operations of unionfs whose implementation is still in a challenging level, and the user MAY find that the detection of the mounting/unmounting privilege is fluctuated, namely, sometimes available and sometimes not.
26 If you want to forcibly invalidate the privilege of such operations inside \fBchroot\fR(8) or \fBjail\fR(8) environments, set \fB\-d\fR option.
27 .PP
28 \fI$basedir\fR/usr/local/share/portsreinstall/bin/portsreinstall\-chroot\-mount
29 .PP
30 for mounting, and
31 .PP
32 \fI$basedir\fR/usr/local/share/portsreinstall/bin/portsreinstall\-chroot\-mount unmount
33 .PP
34 for unmounting, where \fI$basedir\fR denotes the base directory of the target environment.
35 Here, the exit code of the termination is 2  for mounting and 3 for unmounting.
36 After the mounting or unmounting at the grand host environment, rerun this utility (\fBportsreinstall\-chroot\fR(8)) at the target environment.
37 .PP
38 If the installation path of \fBportsreinstall\fR(8) in the target environment is configured by non-default PREFIX, environment variable SYSTEMBASE must be defined for telling the base directory of the target environment as
39 .PP
40 .PD 0
41 env SYSTEMBASE=\fI$basedir\fR \\
42 .RS
43 .PD 0
44 \fI$basedir\fR\fI$PREFIX\fR/share/portsreinstall/bin/portsreinstall\-chroot\-mount
45 .RE
46 .PD 0
47 for mounting, and
48 .PP
49 .PD 0
50 env SYSTEMBASE=\fI$basedir\fR \\
51 .RS
52 .PD 0
53 \fI$basedir\fR\fI$PREFIX\fR/share/portsreinstall/bin/portsreinstall\-chroot\-mount unmount
54 .RE
55 .PD 0
56 for unmounting.
57 .SH ROBUSTNESS AGAINST TERMINATION AND RESTART
58 Execution of the commands except \fBclean\fR and \fBoptions\fR commands can be terminated at any points and restarted from there with the same options saved in the temporary database (independent among utilities). The saved options can be changed by the ways depending on the assigned groups of the options. The options and execution progress are reset to the default by \fBclean\fR command.
59 .SH SHELL IN THE BUILDER CHROOT ENVIRONMENT
60 The same login shell of the current user (which will be the superuser) is invoked as the login shell in the builder \fBchroot\fR(8) environment.
61 For \fBsh\fR(1) and its families, environment variable \fIPS1\fR is modified for distinction from the host environment.
62 For \fBtcsh\fR(1) and its families, the configuration file (\fB/root/.cshrc\fR) is modified to add a line for redefining \fBprompt\fR variable for the distinction.
63 The original configuration file is backed up as \fB/root/.cshrc.bak\-portsreinstall\-chroot\fR.
64 .SH ARGUMENTS
65 One of the following \fIcommands\fR can be given for optional operations or confirmation.
66 .TP
67 \fBdo\fR
68 (Default) Execute the whole process from creation of a builder \fBchroot\fR(8) environment to package update of the host system, where the flow corresponds to \fBmount\fR, \fBenter\fR, \fBportsreinstall packupgrade create\fR at the builder chroot, \fBportsreinstall packupgrade crop\fR at the builder chroot, \fBsync\fR, then \fBportsreinstall\-upgrade\fR at the host, in order.
69 .TP
70 \fBauto\fR [\fIoptions\fR] [\fIarguments\fR]
71 Automatically execute \fBportsreinstall\fR(8) in the builder \fBchroot\fR(8) environment instead of the \fBenter\fR stage in the conventional \fBdo\fR process.
72 If given, \fIoptions\fR and \fIarguments\fR are passed to \fBportsreinstall\fR(8).
73 In case of the lost of the lower layer image of unionfs by its bug, the file system will be automatically recovered by re-mounting.
74 .TP
75 \fBenter\fR
76 Just (create, if not yet, and) enter the builder \fBchroot\fR(8) environment.
77 If once the upgrade of the host environment was completed, this command enables to reuse the same builder \fBchroot\fR(8) environment for the next upgrade with modified configuration or updated ports tree.
78 .TP
79 \fBmount\fR
80 Just (create, if not yet, and) mount file systems for the builder \fBchroot\fR(8) environment.
81 .TP
82 \fBunmount\fR
83 Just unmount file systems for the builder \fBchroot\fR(8) environment.
84 .TP
85 \fBsync\fR
86 Synchronize the files affecting package installation (packages, distfiles, port options, ports/packages management tools configurations) of the host environment to the builder.
87 .TP
88 \fBdestroy\fR
89 Destroy the builder \fBchroot\fR(8) environment.
90 The difference from \fBclean\fR command is that the saved options are preserved.
91 .TP
92 \fBclean\fR
93 .PD 0
94 .TP
95 \fBclean [normal]\fR
96 Destroy the builder \fBchroot\fR(8) environment and clean up the temporary database.
97 .TP
98 \fBclean force\fR
99 Attempt to destroy the builder \fBchroot\fR(8) environment and clean up the temporary database without checking the lock and privilege.
100 .TP
101 \fBoptions\fR
102 Show saved option settings and expected effects of option-resetting options \fB\-M\fR.
103 With \fB\-a\fR option, the first, second and third columns denote the option-resetting options, reset options and remaining options, respectively.
104 .TP
105 .RE
106 .SH OPTIONS
107 If duplicated or conflicting ones are set, the last ones are effective.
108 The end of options can be explicitly specified by \fB\-\-\fR.
109 Short options can be given in compact forms, for example, \fB\-V \-a\fR to be \fB\-Va\fR.
110 .PD
111 .TP
112 \fB*NOTE*\fR
113 Option settings are loaded from the saved configuration (independent of \fBportsreinstall\fR(8)) unless explicitly reset by \fB\-M\fR option.
114 The saved options can be checked by \fBportsreinstall-upgrade options\fR command.
115 .PD
116 .SS Group 1: Just show messages and exit without operation
117 .IP \fB\-H\fR
118 .PD 0
119 .TP
120 \fB\-\-long\-help\fR
121 Show a long help whose content is the same as the manual page.
122 .PD
123 .IP \fB\-h\fR
124 .PD 0
125 .TP
126 \fB\-\-help\fR
127 .PD 0
128 .TP
129 \fB\-\-short\-help\fR
130 Show a short help.
131 .PD
132 .IP \fB\-V\fR
133 .PD 0
134 .TP
135 \fB\-\-show\-version\fR
136 Show the current version.
137 .PD
138 .SS Group 2: Effective anytime
139 .IP \fB\-a\fR
140 .PD 0
141 .TP
142 \fB\-\-batch\-mode\fR
143 Suppress messages so as to be friendly for batch operations.
144 Comments are suppressed as much as possible.
145 It is noted that log output in build/installation processes are not suppressed.
146 .PD
147 .IP \fB\-E\fR\ \fIdelimiter(s)\fR
148 .PD 0
149 .TP
150 \fB\-\-extra\-dirs\-delim\fR=\fIdelimiter(s)\fR
151 Sets a (set of) custom delimiter character(s) for \fB\-e\fR option.
152 The default is comma (",").
153 If a string longer than one-character length is set, the all characters are recognized as delimiters.
154 .PD
155 .IP \fB\-S\fR
156 .PD 0
157 .TP
158 \fB\-\-no\-opening\-message\fR
159 Suppress the credit, opening and terminating messages.
160 Option \fB\-a\fR takes higher priority over this option.
161 .PD
162 .SS Group 3: Saved and not renewable until cleaning
163 .IP \fB\-b\fR \fIbasedir\fR
164 .PD 0
165 .TP
166 \fB\-\-basedir\fR=\fIbasedir\fR
167 Specifies the base directory of the \fBchroot\fR(8) environment.
168 The default is "/home/.portsreinstall\-chroot".
169 .PD
170 .IP \fB\-c\fR
171 .PD 0
172 .TP
173 \fB\-\-suppress\-cleaning\-obsolete\-database\fR
174 Suppress cleaning the temporary database even if its obsolete.
175 This option suppresses the default behavior that the temporary database is automatically cleaned up if it is older than the ports tree or portsreinstall itself is to be upgraded.
176 Use of this option may cause unexpected results and basically unrecommended.
177 .PD
178 .IP \fB\-d\fR
179 .PD 0
180 .TP
181 \fB\-\-invalidate\-mount\-privilege\fR
182 Forcibly invalidate the privilege of the current environment for mounting/unmounting file systems.
183 This option can be meaningful when this utility is executed inside a \fBchroot\fR(8) or \fBjail\fR(8) virtual environment.
184 .PD
185 .IP \fB\-e\fR \fIdir1\fR[\fB,\fIdir2\fR[\fB,\fR...]]
186 .PD 0
187 .TP
188 \fB\-\-extra\-dirs\fR=\fIdir1\fR[\fB,\fIdir2\fR[\fB,\fR...]]
189 Sets extra directories to mount for the chroot environment.
190 By default (without this option), /bin, /compat, /etc, /lib, /libexec, /rootm /sbin, /sys, /usr and /var (or their entities if they themselves are symbolic links) as well as file systems overlaying their descendant directories are mounted by read-only nullfs from the host and overlaid by unionfs while /dev, /proc and /tmp are mounted with independent proper file systems.
191 This option should be set if any of the above directories contain symbolic links referring to outside of the default directories, or if any package build/installation is customized to refer to outside of them.
192 The delimiter is comma (",") by default and changeable by \fB\-E\fR option.
193 .PD
194 .IP \fB\-f\fR
195 .PD 0
196 .TP
197 \fB\-\-fullcourse\fR
198 Carry out the \fBdo\fR process as the "full course" automatic mode where update of the ports tree and package repository are done first at the target host environment and thhen operation in the builder \fBchroot\fR(8) environment is started by cleaning of the temporary database and execution of \fBportsreinstall\fR(8) initiated with option \fB\-CGSjqx\fR (\fB\-CGSYajqx\fR if \fB\-a\fR option is set).
199 Resuming \fBdo\fR command automatically executes \fBportsreinstall\fR(8) in the builder \fBchroot\fR(8) environment.
200 With \fB\-a\fR option, the all detected leaf and obsolete packages will be deleted.
201 .PD
202 .IP \fB\-g\fR
203 .PD 0
204 .TP
205 \fB\-\-upgraded\-system\fR
206 Adjust the all operations to be suitable as post-processes after system upgrade.
207 Concretely, the full course mode is adjusted to reinstall the all ports by removing \fB\-q\fR option of \fBportsreinstall\fR(8).
208 .PD
209 .IP \fB\-P\fR
210 .PD 0
211 .TP
212 \fB\-\-load\-pkgtoolsconf\-as\-override\fR
213 Import settings from \fBpkgtools.conf\fR(5) as the secondary.
214 This option is effective only when \fBportupgrade\fR(1) is installed.
215 For duplicated configurations, values in portsreinstall.conf are applied first and then those in \fBpkgtools.conf\fR(5) are.
216 This option overrides preceding \fB\-p\fR option. 
217 .PD
218 .IP \fB\-p\fR
219 .PD 0
220 .TP
221 \fB\-\-load\-pkgtoolsconf\-as\-default\fR
222 Import settings from \fBpkgtools.conf\fR(5) as the primary (default).
223 This option is effective only when \fBportupgrade\fR(1) is installed.
224 For duplicated configurations, values in \fBpkgtools.conf\fR(5) are applied first and then those in portsreinstall.conf are.
225 This option overrides preceding \fB\-P\fR option. 
226 .PD
227 .IP \fB\-Q\fR
228 .PD 0
229 .TP
230 \fB\-\-ignore\-pkgtoolsconf\fR
231 Ignore \fBpkgtools.conf\fR(5) even if it exists.
232 .PD
233 .IP \fB\-s\fR
234 .PD 0
235 .TP
236 \fB\-\-share\-port\-pkgs\-dirs\fR
237 Share the ports tree (PORTSDIR=/usr/ports by default), portsnap work directory (WORKDIR=/var/db/portsnap in \fBportsnap.conf\fR(5) by default) and package cache (PKG_CACHEDIR=/var/cache/pkg in \fBpkg.conf\fR(5) by default) with the host by nullfs.
238 .PD
239 .SH DETAILS
240 .SS Overview
241 This utility is a supporting tool of \fBportsreinstall\fR(8) to build packages in a \fBchroot\fR(8) environment "forked" from the host environment which is the final target of upgrading.
242 On-the-fly smart entire upgrade of all installed ports and robustness against termination/restart is pursued by this utility.
243 .PP
244 The forked environment is created by \fBnullfs\fR(5) and \fBmount_unionfs\fR(8) onto the host environment.
245 Fetched/deleted distfiles and created/fetched/deleted packages are synchronized at the host to the forked environment.
246 The ports options and other configurations of ports management (\fB/etc/make.conf\fR, \fB/usr/local/etc/portsreinstall.conf\fR, \fB/usr/local/etc/pkgtools.conf\fR, \fB/usr/local/etc/pkg.conf\fR and the temporary database of \fBportsreinstall\fR(8) in usual environments) are also synchronized as well.
247 .PP
248 The execution of \fBdo\fR command proceeds in the following step (while use of \fBauto\fR command can be more practical):
249 .TP
250 1.
251 This utility will create and mount the \fBchroot\fR(8) builder environment.
252 .PD
253 .TP
254 2.
255 This utility will enter the builder environment, and the user will be prompted in a shell to complete the upgrade of packages by \fBportsreinstall\fR(8).
256 .PD
257 .TP
258 3.
259 The user will exit from the builder environment when the upgrade is complete.
260 .PD
261 .TP
262 4.
263 This utility will create packages and an archive of dispatch script for upgrade.
264 .PD
265 .TP
266 5.
267 This utility will synchronize the host environment to the builder about distfiles, package files, ports options and other configurations of ports management.
268 .PD
269 .TP
270 6.
271 The utility will upgrade the ports in host environment using the created packages and dispatched script set.
272 .PD
273 .SS Example
274 The conventional flow of using this utility will be as follows:
275 .PP
276 1. In the host (target) environment, execute this utility by the full course mode.
277 .RS
278 root@[host]#
279 .B portsreinstall\-chroot -f
280 .RE
281 2. After successful build of the temporary database, \fBportsreinstall\fR(8) may show select dialogues for leaf and obsolete ports/packages.
282 Note that the choice made here can be changed afterward without any fatal risk as long as the current builder \fBchroot\fR(8) environment is preserved even after the upgrade of the host environment.
283 .PP
284 3. \fBportsreinstall\fR(8) will continue to build, (re)install and deinstall processes, which take very long and impose a high load.
285 You may want to interrupt the execution to cool down or shutdown your machine for your work or travel.
286 In this case, press Ctrl+C at any point so that \fBportsreinstall\fR(8) will stop by preserving its progress marker information in the temporary database and this utility will unmount the builder \fBchroot\fR(8) environment.
287 Some network troubles in fetching distfiles or packages may be resolved by terminating the process once.
288 (Even damages due to critical accidents of kernel panics, overheating and sudden shutdown may be recovered without problem just like this intentional termination.)
289 .RS
290 .B Ctrl+C
291 .RE
292 4. At any convenient time, restart the processes.
293 Note that no option should be speified here.
294 .RS
295 root@[host]#
296 .B portsreinstall\-chroot auto
297 .RE
298 5. The process may stop with some failures which cannot be resolved automatically.
299 It may be mismatches of port option configurations of dependencies, unrecognized conflict or essential conflict between needed packages.
300 In this case, you will need to enter the builder \fBchroot\fR(8) environment for the manual troubleshooting.
301 .RS
302 root@[host]#
303 .B portsreinstall\-chroot enter
304 .RE
305 6. Then the you will be prompted in the builder \fBchroot\fR(8) environment.
306 .RS
307 root@[chroot]#
308 .RE
309 7. Troubleshooting may be done by modifying the configuration files or struggling with \fBfreeze\fR/\fBtaboo\fR/\fBescape\fR/\fBok\fR/\fBneed\fR/\fBnoneed\fR/\fBreselect\fR/\fBreconf\fR commands of \fBportsreinstall\fR(8) referring to information obtained by \fBshow\fR command of \fBportsreinstall\fR(8).
310 After such possible patchwork, exit from the builder \fBchroot\fR(8) environment.
311 .RS
312 root@[chroot]#
313 .B exit
314 .RE
315 8. Retry to continue the processes by executing
316 .RS
317 root@[host]#
318 .B portsreinstall\-chroot auto
319 .RE
320 or, when the configuration files were modified,
321 .RS
322 root@[host]#
323 .B portsreinstall\-chroot auto -L redo
324 .RE
325 9. When the all necessary upgrade is completed inside the builder \fBchroot\fR(8) environment, you will be asked whether to reflect the upgrade to the host environment.
326 If you select Yes here, package archiving in the builder \fBchroot\fR(8) environment, synchronization of package files, distfiles, port option database and configuration files for \fBportsreinstall\fR(8), and the update of the packages at the host environment will be automatically carried out.
327 Here, again, Ctrl+C interruption and unintentional termination will be recovered by simple re-exeution of this utility.
328 .SH "ENVIRONMENT VARIABLES"
329 .TP
330 .B SYSTEMBASE
331 (Used only when the target environment is a virtual environment implemented by \fBchroot\fR(8) or \fBjail\fR(8))
332 The base directory of the target environment at its grand host environment.
333 This variable is referred by \fBportsreinstall\-chroot\-mount\fR(8), which is to be executed in the grand host environment of the target environment.
334 The default is the two-levels higher directory of PREFIX applied for installation of \fBportsreinstall\fR(8) in the target environment.
335 .PP
336 See also the corresponding section of \fBportsreinstall\fR(8).
337 The variables are conveyed to the forked environment from the target host.
338 .SH HISTORY
339 This utility first appeared as a part of \fBportsreinstall\fR(8) version 4.0.0 released on June 29, 2018.
340 .SH "SEE ALSO"
341 \fBchroot\fR(8)
342 \fBportsreinstall\fR(8),
343 \fBportsreinstall\-chroot\-mount\fR(8),
344 \fBportsreinstall\-upgrade\fR(8).
345 .SH COPYRIGHT
346 This software is distributed under the 2-Clause BSD License.
347 .PP
348 (C)\ 2018\ Mamoru\ Sakaue,\ MwGhennndo,\ All\ Rights\ Reserved.
349 .PP
350 Email:\ sakaue.mamoru@samurai.mwghennn.net
351 .PP
352 Homepage:\ http://www.mwghennndo.com/software/portsreinstall/