OSDN Git Service

13c6651cf00b0087840508912696acc8c94d6ed4
[portsreinstall/current.git] / man / portsreinstall.8
1 .\" ==================================================================================
2 .\" portsreinstall(8) manual page
3 .\" Copyright (C) 2010-2018 Mamoru Sakaue, MwGhennndo, All Rights Reserved.
4 .\" ==================================================================================
5 .TH PORTSREINSTALL 8 "22 September 2018" "FreeBSD" "FreeBSD System Manager's Manual"
6 .SH NAME
7 portsreinstall \- ports upgrading utility for massive forced reinstallation
8 .SH SYNOPSIS
9 .B portsreinstall
10 [
11 .I
12 OPTIONS
13 ] [
14 .B
15 \-\-
16 ] [
17 .I
18 command
19 ]
20 .SH DESCRIPTION
21 This utility is an alternative to \fBportupgrade\fR(1) and \fBportmaster\fR(8), and designed to be suitable for reinstallation/upgrade of all packages after major version upgrade of the system or very long absence of ports upgrade, or for entire correction of confusion among installed packages.
22 .SH ROBUSTNESS AGAINST TERMINATION AND RESTART
23 Execution of \fBdo\fR, \fBredo\fR and \fBpackupgrade\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. Some options can be reset only by \fBredo\fR command. The options are reset to the default by \fBclean\fR and \fBreset all\fR commands.
24 .SH FLAVOR SUPPORT
25 As of the release time of this software, the flavor support of the Ports Collection has many incomplete features.
26 Therefore, users should note that problems may arrise due to the specification changes related to flavors.
27 Currenly, coexistence with \fBportupgrade\fR(1) is suspended due to the lack of flavor support.
28 The same port configuration options of the same ports are shared among the all flavors because they are not distinguishable in the current implementation of the Ports Collection.
29 .SH GLOB PATTERNS
30 A \fIglob\fR is an extended regular expression or a shell\-type glob pattern matching either of a unique name, package names, or unflavored port origins possibly followed by flaver.
31 The format of a \fIglob\fR may be either:
32 .RS
33 .IP \fIunique_name_glob\fR
34 .IP \fIpackage_name_glob\fR
35 .IP \fIport_origin_glob\fR
36 .IP \fIport_origin_glob@flaver_glob\fR
37 .IP \fI:unique_name_regexp\fR
38 .IP \fI:package_name_regexp\fR
39 .IP \fI:port_origin_regexp\fR
40 .IP \fI:port_origin_regexp@flaver_regexp\fR
41 .RE
42 where each regular expression (*_regexp) and glob (_glob) pattern must not include any at sign (@).
43 Port origin patterns without at sign match all available flavors if deined.
44 As long as the specified port origin pattern represents ports wihout available flavor, the glob syntax is compatible with \fBportupgrade\fR(1) and its accompaniments such as \fBportsdb\fR(1), \fBpkg_glob\fR(1) and \fBports_glob\fR(1).
45 If a glob starts with a colon ":", the following string is parsed as an extended regular expression, and otherwise a shell\-type glob.
46 A shell\-type glob is evaluated by matching an asterisk "*" to an arbitrary string of an arbitrary length, a question mark "?" to an arbitrary single character, characters "..." enclosed in a bracket "[...]" to a single character as one of the characters and characters "..." in a bracket "[!...]" to a single character matching none of the characters.
47 Here, the evaluation of the bracket is actually done by passing it to an extended regular expression by simply converting the prefix "[!" to "[^".
48 A glob is recognized as a unique name (package name without the version part) if no slash "/" or any special character for an extended regular expression or a shell\-type glob is included in the pattern.
49 For example, all of "zip" "zip\-3.?", "zip\-*", "zip\-[0\-9]*" and ":^zip\-[[:digit:]]+\.*" can match "zip\-3.0"; "archivers/unzip*" can match both of "archivers/unzip" and "archivers/unzip\-iconv".
50 When the \fIglob\fR should match the all flavors of a port, a regular expression can be used such as ":devel/py-setuptools(|@.*)".
51 .SH ARGUMENTS
52 One of the following \fIcommands\fR can be given for optional operations or confirmation.
53 .TP
54 \fBdo\fR
55 .PD 0
56 .TP
57 \fBdo all\fR
58 (Default) Full execution.
59 .TP
60 \fBprepare\fR
61 .PD 0
62 .TP
63 \fBdo prepare\fR
64 Just build (or continue to build or rebuild) the temporary database and stop before the actual operations to the ports/packages.
65 .TP
66 \fBredo\fR
67 .PD 0
68 .TP
69 \fBredo all\fR
70 Execute again for failed ports and their dependents.
71 .TP
72 \fBredo prepare\fR
73 Just rebuild the temporary database and stop before the actual operations for the redo process.
74 In case of restarting a stopped \fBredo prepare\fR process, execute by \fBprepare\fR or \fBdo prepare\fR command instead of this command.
75 .TP
76 \fBclean\fR
77 .PD 0
78 .TP
79 \fBclean [normal]\fR
80 Clean up the temporary database.
81 .TP
82 \fBclean force\fR
83 Attempt to clean up the temporary database without checking the lock and privilege.
84 .TP
85 \fBreset\fR
86 .PD 0
87 .TP
88 \fBreset all\fR
89 Reset the temporary database by preserving the initial snapshot of installed packages.
90 This command can be used to restart reinstallation when the ports tree is updated after the previous run or to rescue the temporary database from destruction.
91 .TP
92 \fBreset keepopts\fR
93 Reset the temporary database by preserving the initial snapshot of installed packages, option settings and manually added \fBtaboo\fR/\fBneed\fR/\fBnoneed\fR ports.
94 This command can be used to restart reinstallation when the ports tree is updated after the previous run or to rescue the temporary database from destruction.
95 .TP
96 \fBreset keepstatus\fR
97 Reset the temporary database by preserving the progress status to reuse for unchanged successfully (re)installed ports.
98 The initial snapshot of installed packages, option settings and manually added \fBtaboo\fR/\fBneed\fR/\fBnoneed\fR ports are preserved in the same way as \fBreset keepopts\fR command.
99 This command can be used to more smartly restart reinstallation when the ports tree is updated after the previous run.
100 .TP
101 \fBok add\fR \fIglob1\fR [\fIglob2\fR ...]
102 Register manually resolved ports.
103 The port globs are separated from each other by comma or space.
104 .TP
105 \fBok del\fR \fIglob1\fR [\fIglob2\fR ...]
106 deregister manually resolved ports.
107 The port globs are separated from each other by comma or space.
108 .TP
109 \fBtaboo add\fR \fIglob1\fR [\fIglob2\fR ...]
110 Register taboo ports that must not be built or newly (re)installed.
111 The port globs are separated from each other by comma or space.
112 Registration to be "taboo" practically invalidates "necessary" registered by \fBnoneed add\fR command.
113 Ports specified in the HOLD section in the configuration file are protected from deinstallation.
114 This functionality is intended to avoid manually deinstalled conflict ports or ports whose build or installation operations can damage the system, e.g., by flooding the file systems or kernel panic.
115 This command is for temporal definitions and permanent definitions should be given as TABOO_* values in ${LOCALBASE}/etc/portsreinstall.conf instead.
116 .TP
117 \fBtaboo del\fR \fIglob1\fR [\fIglob2\fR ...]
118 Deregister taboo ports.
119 The port globs are separated from each other by comma or space.
120 .TP
121 \fBfreeze add\fR \fIglob1\fR [\fIglob2\fR ...]
122 Register ports to freeze that must not be built but the package installtion by any available version may be safe.
123 If the specified ports failed to (re)install by packages, build of their dependents are also suppressed.
124 The port globs are separated from each other by comma or space.
125 This functionality is intended to build of ports which can damage the system, e.g., by flooding the file systems or kernel panic, while their installed packages will not be harmful.
126 This command is for temporal definitions and permanent definitions should be given as FREEZE_* values in ${LOCALBASE}/etc/portsreinstall.conf instead.
127 .TP
128 \fBfreeze del\fR \fIglob1\fR [\fIglob2\fR ...]
129 Deregister ports to freeze.
130 The port globs are separated from each other by comma or space.
131 .TP
132 \fBneed add\fR \fIglob1\fR [\fIglob2\fR ...]
133 Register necessary ports that should be newly installed if not yet and kept installed even if being obsolete.
134 The port globs are separated from each other by comma or space.
135 Registration to be "necessary" takes priority over "unnecessary" registered by \fBnoneed add\fR command.
136 In other words, the registered ports are excluded from deinstallation candidates if they are obsolete, leaf or not-initially-installed ports, and otherwise have no effect on the actual operations.
137 .TP
138 \fBneed del\fR \fIglob1\fR [\fIglob2\fR ...]
139 Deregister necessary ports.
140 The port globs are separated from each other by comma or space.
141 The deregistered ports are added to leaf port candidates if they are not initially installed.
142 In this case, information on the deregistered ports remain until removal by \fBforget\fR command.
143 .TP
144 \fBnoneed add\fR \fIglob1\fR [\fIglob2\fR ...]
145 Register unnecessary ports that should be deinstalled unless required by other non\-leaf ports.
146 The port globs are separated from each other by comma or space.
147 In other words, the registered ports are added to leaf ports if they have no non\-leaf dependent, and otherwise have no effect on the actual operations.
148 Requirements of the registered ports are also recognized as leaves if all of their dependents are leaves.
149 Ports specified in the HOLD section in the configuration file are protected.
150 For example, just after installing new ports due to \fBneed add\fR command or \fB\-i\fR option as requirements of a specified target, registering only the target will let the all required ports be leaves as well as the target.
151 Actually deinstalled ports are selected via dialog together with the original leaf ports.
152 .TP
153 \fBnoneed del\fR \fIglob1\fR [\fIglob2\fR ...]
154 Deregister unnecessary ports.
155 The port globs are separated from each other by comma or space.
156 .TP
157 \fBreselect leaves\fR
158 Reselect leaf ports to delete.
159 This command is effective only after the temporary database is once built.
160 .TP
161 \fBreselect obsolete\fR
162 Reselect obsolete ports to delete.
163 This command is effective only after the temporary database is once built.
164 .TP
165 \fBsave\fR [\fIdir\fR]
166 Save the current temporary database as a .tar.gz archive.
167 The file name is created automatically by containing the current date time.
168 By default save directory is the current directory.
169 .TP
170 \fBload\fR \fIpath\fR
171 Load a temporary database archive.
172 Note that the currently temporary database is removed.
173 .TP
174 \fBrmconf\fR \fIglob\fR [\fIglob2\fR ...]
175 Reset port options for the specified ports to the default and reset affected parts in the temporary database.
176 .TP
177 \fBreconf\fR \fIglob\fR [\fIglob2\fR ...]
178 Reconfigure port options for the specified ports.
179 The specified ports are re-inspected even when the options are unchanged or undefined.
180 All affected ports are inspected again in the following runs by \fBdo\fR or \fBredo\fR command.
181 .TP
182 \fBforget\fR \fIglob\fR [\fIglob2\fR ...]
183 Try to let the temporary database forget about the specified ports as much as possible.
184 Concretely, the data on each of the specified ports and their requirements/dependents is unless initially installed or required by other preserved ports.
185 This command is mainly for removing information on ports which had been added due to \fB\-i\fR option or \fBneed add\fR command but have become unneeded again.
186 In advance to executing this command, deinstallation for the specified ports should be completed by \fBnoneed add\fR command followed by \fBredo\fR command.
187 It is noted that ports registered by \fBok\fR, \fBtaboo\fR, \fBfreeze\fR and \fBnoneed\fR commands are NOT deleted.
188 Internal tables used for \fBshow\fR command keep their information regardless of this command.
189 .TP
190 \fBpkgsanity\fR [\fIglob\fR ...]
191 Examine the sanity of installed packages, i.e., whether the installed files exist and match the checksum.
192 If arguments \fIglobs\fR are given, only the matching packages are examined.
193 For each insane package, the user is queried whether to reinstall it forcedly in the following do/redo runs.
194 The default choice is "yes" for packages which have any ELF binaries or include files changed or any type of files overwritten by other packages, and "no" for the others.
195 Insane packages already assigned to be reinstalled are skipped.
196 With \fB\-a\fR enabled, all insane packages are assigned to be the above mentioned default and the output is given in a form that the first to fourth columns denote the package name, flavored port origin, whether assigned to be reinstalled (yes or no), and file path with a notice, respectively.
197 It is noted that this sanity check can detect some configuration or cache files which are changed during normal use and need not to be recovered.
198 .TP
199 \fBescape\fR \fIglob\fR [\fIglob2\fR ...]
200 Back up and delete packages specified by \fIglobs\fR for a temporary escape mainly for resolving undeclared conflicts.
201 The escaped packages are registered as taboo as same as \fBtaboo add\fR \fIglob\fR [\fIglob2\fR ...].
202 .TP
203 \fBrestore\fR \fIglob\fR [\fIglob2\fR ...]
204 Restore packages specified by \fIglobs\fR escaped by \fBescape\fR command.
205 The escaped packages are deregistered from taboo as same as \fBtaboo del\fR \fIglob\fR [\fIglob2\fR ...].
206 .TP
207 \fBpackupgrade\fR \fBcreate\fR
208 Create packages of the all reinstalled or newly installed ports (at a "builder" environment) with a set of scripts for upgrading another system with the same initial configuration of installed packages ("target" environment).
209 One of typical examples of application can be such that the builder is a "forked" jail/chroot system constructed onto a host system by using nullfs and unionfs and the target is the host system (Refer to "Package build in a chroot system" Section).
210 Another typical example can be such that the builder is one node of a cluster system and the targets are the other nodes.
211 If the execution is terminated before completion, it can be restarted from the terminated point by re-running this command.
212 The created packages are saved at ${PACKAGES}/${PKGREPOSITORYSUBDIR}, which is usually /usr/ports/packages/All.
213 In order to crop the created set of scripts, \fBpackupgrade\fR \fBcrop\fR command must be executed.
214 .TP
215 \fBpackupgrade\fR \fBcrop\fR [\fIpath\fR]
216 Crop the created set of scripts as a tar.gz archive, where its path name is specified by \fIpath\fR argument (if \fIpath\fR is a directory, the file name is set to "portsreinstall-upgrade.tar.gz"; the default of \fIpath\fR is the current directory).
217 This command must be executed after completion of \fBpackupgrade\fR \fBcreate\fR command.
218 The obtained archive is to be conveyed to the target together with the created packages.
219 Then "portsreinstall-upgrade.sh" obtained by extracting the archive is to be run at the target.
220 .TP
221 \fBpackupgrade\fR \fBclean\fR
222 Reset the execution progress of \fBpackupgrade\fR \fBcreate\fR command and discard the internally saved created set of scripts.
223 This does not affect any already cropped sets of scripts or created packages.
224 This command is provided for cases that ports/packages are reinstalled or reconfigured during/after the execution of \fBpackupgrade\fR \fBcreate\fR command.
225 After execution of this command, \fBpackupgrade\fR \fBcreate\fR command will overwrite the packages by creating them again.
226 .TP
227 \fBmake\fR \fIglob\fR [\fItarget\fR ...] [\fIarguments\fR ...]
228 Execute \fBmake\fR(1) command for ports matching the glob pattern.
229 The taget and arguments are passed as they are with the arguments and environment variables customized for each port.
230 For flavored ports, the appropriate argument (FLAVOR variable) is automatically set.
231 The main purpose of this command is diagnosis and experimental build of unsuccessful ports.
232 The result of this command will not be recognized by the (re)installation processes of \fBdo\fR and \fBredo\fR commands.
233 The execution is carried out for each matching port in the alphanumeric order.
234 If any port failed to execute \fBmake\fR(1) command, its exit status is returned by terminating immediately (so the following ports in the queue are skipped). 
235 .TP
236 \fBglob\fR \fIglob\fR [\fIglob2\fR ...]
237 Evaluate port globs and show matched flavored origins both for installed and uninstalled packages.
238 The exit status is always 0.
239 .TP
240 \fBpkg\fR \fIglob\fR [\fIglob2\fR ...]
241 Evaluate port globs and show matched installed package names.
242 The returned exit status is 1 if no installed package matches any of the globs.
243 .TP
244 \fBoptions\fR
245 Show saved option settings and expected effects of option-resetting options \fB\-L\fR, \fB\-M\fR and \fB\-N\fR.
246 With \fB\-a\fR option, the first, second and third columns denote the option-resetting options, reset options and remaining options, respectively.
247 .TP
248 \fBshow\fR [\fIsubject\fR] [@[\fBrun\fR|\fBbuild\fR|\fBall\fR][,[\fBdirect\fR|\fBfull\fR]]] [\fIarguments\fR]
249 Show the list of ports to be reinstalled.
250 The applied scope of dependencies can be controlled by "show option" proceeded by "@"; \fBrun\fR, \fBbuild\fR and \fBall\fR employ the run\-time, build\-time or both-time ones, respectively; \fBdirect\fR and \fBfull\fR include only the direct or fully recursive ones, respectively.
251 Here, the \fBfull\fR build\-time requirements are defined as the \fBdirect\fR build\-time requirements and their \fBfull\fR run\-time requirements.
252 The \fBfull\fR build\-time dependents are also defined in accordance.
253 The default scope is determined by the saved option settings for \fB\-B\fR, \fB\-b\fR and \fB\-o\fR.
254 Some \fIsubject\fR's require \fIarguments\fR.
255 The following \fIsubject\fR's are available.
256 .RS 8
257 .TP
258 \fBtodo\fR
259 Ports to be reinstalled in the current do/redo process (default).
260 With \fB\-a\fR option, the first and second columns denote the flavored origin and initial/new/current package name, respectively.
261 .TP
262 \fBdone\fR
263 Ports which have been already reinstalled to be up-to-date with their all requirements.
264 With \fB\-a\fR option, the first and second columns denote the flavored origin and initial/new/current package name, respectively.
265 .TP
266 \fBresolved\fR
267 Manually reinstalled ports registered by \fBok\fR command.
268 With \fB\-a\fR option, the first and second columns denote the flavored origin and initial/new/current package name, respectively.
269 .TP
270 \fBfailure\fR
271 Failed ports.
272 With \fB\-a\fR option, the first, second and third columns denote the flavored origin, initial/new/current package name, failed make target and manually resolved status (yes or no), respectively.
273 .TP
274 \fBredo\fR
275 Ports to be reinstalled after success in any of their failed requirements.
276 With \fB\-a\fR option, the first and second columns denote the flavored origin and initial/new/current package name, respectively.
277 .TP
278 \fBinst_by_pkg\fR
279 Ports installed by the default packages because their configurations are default.
280 With \fB\-a\fR option, the first and second columns denote the flavored origin and initial/new/current package name, respectively.
281 .TP
282 \fBinst_built_default\fR
283 Ports locally built and installed with the default configurations including their all requirements.
284 With \fB\-a\fR option, the first and second columns denote the flavored origin and initial/new/current package name, respectively.
285 .TP
286 \fBinst_built_custom\fR
287 Ports locally built and installed with the non-default configurations or having any of their requirements non-default.
288 With \fB\-a\fR option, the first and second columns denote the flavored origin and initial/new/current package name, respectively.
289 .TP
290 \fBtaboo\fR
291 Taboo ports registered by \fBtaboo\fR command.
292 With \fB\-a\fR option, the first and second columns denote the flavored origin and initial/new/current package name, respectively.
293 .TP
294 \fBfreeze\fR
295 Taboo ports registered by \fBfreeze\fR command.
296 With \fB\-a\fR option, the first and second columns denote the flavored origin and initial/new/current package name, respectively.
297 .TP
298 \fBneed\fR
299 Necessary ports registered by \fBneed\fR command.
300 With \fB\-a\fR option, the first and second columns denote the flavored origin and initial/new/current package name, respectively.
301 .TP
302 \fBnoneed\fR
303 Unnecessary ports registered by \fBnoneed\fR command.
304 With \fB\-a\fR option, the first and second columns denote the flavored origin and initial/new/current package name, respectively.
305 .TP
306 \fBrestored\fR
307 Leaf, obsolete or unneeded ports which had been once deleted but are to be or have been restored.
308 With \fB\-a\fR option, the first and second columns denote the flavored origin and initial/new/current package name, respectively.
309 .TP
310 \fBdeleted\fR
311 Leaf, obsolete or unneeded ports are to be or have been deleted.
312 With \fB\-a\fR option, the first and second columns denote the flavored origin and initial/new/current package name, respectively.
313 .TP
314 \fBfossil\fR
315 Installed ports which have not been either upgraded or reinstalled since the initial state.
316 With \fB\-a\fR option, the first and second columns denote the flavored origin and package name, respectively.
317 .TP
318 \fBconflict\fR
319 Conflicting ports which are temporarily deleted.
320 With \fB\-a\fR option, the first, second and third columns denote the flavored origin, initial/new/current package name, and opponent ports concatenated by comma, respectively.
321 .TP
322 \fBmoved\fR
323 Moved or replaced ports.
324 With \fB\-a\fR option, the first, second, third and fourth columns denote the flavored initial origin, initial package name, flavored alternative origin and alternative package name, respectively.
325 .TP
326 \fBbuild_conflict_pkgs\fR \fIglob\fR [\fIglob2\fR...]
327 Installed packages which conflict with ports matching \fIglob\fRs in the build.
328 The package names are listed in a single column.
329 .TP
330 \fBinst_conflict_pkgs\fR \fIglob\fR [\fIglob2\fR...]
331 Installed packages which conflict with ports matching \fIglob\fRs in the installation.
332 The package names are listed in a single column.
333 .TP
334 \fBleaves\fR [\fBselected\fR | \fBunselected\fR]
335 All detected leaf ports.
336 Keywords \fBselected\fR and \fBunselected\fR are for filtering only selected (to be deleted) and unselected (to be preserved) ones, respectively.
337 With \fB\-a\fR option, the first, second and third columns denote the flavored origin, initial/new/current package name, and opponent ports concatenated by comma respectively.
338 .TP
339 \fBobsolete\fR [\fBselected\fR | \fBunselected\fR]
340 All detected obsolete ports.
341 Keywords \fBselected\fR and \fBunselected\fR are for filtering only selected (to be deleted) and unselected (to be preserved) ones, respectively.
342 With \fB\-a\fR option, the first, second and third columns denote the flavored origin, initial/new/current package name, and opponent ports concatenated by comma respectively.
343 .TP
344 \fBrequirements\fR \fIglob1\fR [\fIglob2\fR ...]
345 Ports required by matching ports/packages.
346 With \fB\-a\fR option, the first, second, third and fourth columns denote the flavored origin of the queried port, initial/new/current package name of the queried port, flavored origin of a requirement of the queried port and initial/new/current package name of the requirement, respectively.
347 .TP
348 \fBdependents\fR \fIglob1\fR [\fIglob2\fR ...]
349 Ports depending on matching ports/packages.
350 With \fB\-a\fR option, the first, second, third and fourth columns denote the flavored origin of the queried port, initial/new/current package name of the queried port, flavored origin of a dependent of the queried port and initial/new/current package name of the dependent, respectively.
351 .TP
352 \fBinitrequirements\fR \fIglob1\fR [\fIglob2\fR ...]
353 Ports initially required by matching initially installed ports/packages.
354 With \fB\-a\fR option, the first, second, third and fourth columns denote the flavored origin of the queried port, package name of the queried port, flavored origin of a requirement of the queried port and package name of the requirement, respectively.
355 .TP
356 \fBinitdependents\fR \fIglob1\fR [\fIglob2\fR ...]
357 Ports initially depending on matching initially installed ports/packages.
358 With \fB\-a\fR option, the first, second, third and fourth columns denote the flavored origin of the queried port, package name of the queried port, flavored origin of a dependent of the queried port and package name of the dependent, respectively.
359 .TP
360 \fBconflict_files\fR \fIglob1\fR [\fIglob2\fR ...]
361 Possible additional conflict files of matching ports/packages.
362 The first and second columns denote the possible conflict package and file path, respectively.
363 For officially registered conflict, nothing is outputted.
364 In other words, if something is outputted, the port Makefile can have some defect or the custom modification of the system can be confusing the port or the conflicting packages.
365 .TP
366 \fBstatus\fR \fIglob1\fR [\fIglob2\fR ...]
367 Current success/failure status in (re)installation of matching ports/packages.
368 Returned values are null, "todo", "done", "resolved", "failure", "redo", "inst_by_pkg", "inst_built_default", "inst_built_custom", "taboo", "freeze", "need", "noneed", "restored", "deleted", "fossil", or "conflict",  where null means that they are untouched in the current option configuration or temporary reset due to configuration changes. 
369 .TP
370         \fBerrormessage\fR \fIglob1\fR [\fIglob2\fR ...]
371 Error message in (re)installation of matching ports/packages.
372 Returned values are null for successful or skipped ports/packages. 
373 .RE
374 .SH OPTIONS
375 If duplicated or conflicting ones are set, the last ones are effective.
376 The end of options can be explicitly specified by \fB\-\-\fR.
377 Short options can be given in compact forms, for example, \fB\-i -q -P\fR to be \fB\-iqP\fR.
378 .PD
379 .TP
380 \fB*NOTE*\fR
381 The configuration of options annotated as "saved and transferred to restarted/following runs" are saved in the temporary database by the first run after cleaning the database.
382 In the following runs for any commands, the corresponding option settings are loaded from the saved configuration unless explicitly reset by \fB\-L\fR, \fB\-M\fR or \fB\-N\fR option.
383 The saved options can be checked by \fBportsreinstall options\fR command.
384 .PD
385 .SS Group 1: Just show messages and exit without operation
386 .IP \fB\-H\fR
387 .PD 0
388 .TP
389 \fB\-\-long\-help\fR
390 Show a long help whose content is the same as the manual page.
391 .PD
392 .IP \fB\-h\fR
393 .PD 0
394 .TP
395 \fB\-\-help\fR
396 .PD 0
397 .TP
398 \fB\-\-short\-help\fR
399 Show a short help.
400 .PD
401 .IP \fB\-V\fR
402 .PD 0
403 .TP
404 \fB\-\-show\-version\fR
405 Show the current version.
406 .PD
407 .SS Group 2: Effective anytime
408 .IP \fB\-a\fR
409 .PD 0
410 .TP
411 \fB\-\-batch\-mode\fR
412 Suppress messages so as to be friendly for batch operations.
413 The output formats for \fBoptions\fR and \fBshow\fR commands and \fB\-V\fR option are arranged to be more batch\-friendly.
414 It is noted that log output in build/installation processes are not suppressed.
415 .PD
416 .IP \fB\-i\fR
417 .PD 0
418 .TP
419 \fB\-\-allow\-new\-targets\fR
420 Allow \fB\-O\fR, \fB\-T\fR or \fB\-t\fR options to specify not\-yet\-installed ports.
421 If any of not\-yet\-installed ports matching the target globs are ambiguous, a dialog box is open for each of them to select the actual targets.
422 .PD
423 .IP \fB\-M\fR
424 .PD 0
425 .TP
426 \fB\-\-reset\-minor\-options\fR
427 Reset option settings for minor controls.
428 Option settings for group 4 are once reset and replaced with the newly specified ones.
429 Check the saved options by \fBportsreinstall options\fR command before specifying this option.
430 .PD
431 .IP \fB\-S\fR
432 .PD 0
433 .TP
434 \fB\-\-no\-opening\-message\fR
435 Suppress the credit, opening and terminating messages.
436 Option \fB\-a\fR takes higher priority over this option.
437 .PD
438 .SS Group 3: Effective only with redo command
439 .IP \fB\-L\fR
440 .PD 0
441 .TP
442 \fB\-\-reload\-conf\fR
443 Reload configuration files.
444 This option is effective only with \fBredo\fR command.
445 Option settings for group 6 are once reset and replaced with the newly specified ones.
446 Check the saved options by \fBportsreinstall options\fR command before specifying this option.
447 .PD
448 .IP \fB\-N\fR
449 .PD 0
450 .TP
451 \fB\-\-reset\-targets\fR
452 Re\-scan installed packages and reset option settings for target specification.
453 This option is effective only with \fBredo\fR command.
454 Option settings for group 5 are once reset and replaced with the newly specified ones.
455 Check the saved options by \fBportsreinstall options\fR command before specifying this option.
456 .PD
457 .SS Group 4: Saved and transferred to restarted runs, renewable by \-M option
458 Option settings in this group are saved at the first \fBdo\fR or \fBprepare\fR run, and transferred to the following runs.
459 Reset of the saved values for this group is available by appending \fB\-M\fR with newly specified options.
460 .IP \fB\-A\fR
461 .PD 0
462 .TP
463 \fB\-\-non\-interactive\-ports\-only\fR
464 Operations of (re)installation are made only on ports which do not require manual interaction.
465 This option conflicts with \fB\-I\fR.
466 .PD
467 .IP \fB\-B\fR
468 .PD 0
469 .TP
470 \fB\-\-exclude\-runtime\-dependencies\fR
471 Exclude run\-time dependencies in evaluation of dependencies.
472 This option affects behaviors of \fB\-t\fR, \fB\-T\fR and \fB\-q\fR options.
473 Use of this option should be just for temporary diagnosis or salvage.
474 .PD
475 .IP \fB\-b\fR
476 .PD 0
477 .TP
478 \fB\-\-include\-buildtime\-dependencies\fR
479 Include build\-time dependencies in evaluation of dependencies.
480 This option affects behaviors of \fB\-t\fR, \fB\-T\fR and \fB\-q\fR options.
481 Use of this option will result in installation of the all build-time requirements regardless of the actual necessity for upgrade of installed packages.
482 .PD
483 .IP \fB\-C\fR
484 .PD 0
485 .TP
486 \fB\-\-apply\-default\-config\fR
487 The temporary database is built by skipping executing \fBmake config\-conditional\fR so that the port options are unchanged.
488 The default values are applied to unconfigured port options.
489 The port options are unchanged and unsaved (they are saved in case of old ports trees in which \fBdialog\fR(1) is used instead of \fBdialog4ports\fR(1)).
490 .PD
491 .IP \fB\-c\fR
492 .PD 0
493 .TP
494 \fB\-\-suppress\-cleaning\-obsolete\-database\fR
495 Suppress cleaning the temporary database even if its obsolete.
496 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.
497 Use of this option may cause unexpected results and basically unrecommended.
498 .PD
499 .IP \fB\-D\fR
500 .PD 0
501 .TP
502 \fB\-\-suppress\-entire\-inspection\-distinfo\fR
503 Suppress entire inspection of distinfo files in the ports tree as a preparation for deleting obsolete distfiles.
504 By default, viz., without this option, all distfiles are preserved unless being obsolete in the current version of the ports tree.
505 For this purpose, entire inspection of distinfo files in the ports tree is carried out in order to get the complete list of distfiles.
506 This inspection can take an extremely long time if the ports tree is located in file systems with low access speeds.
507 With this option specified, distfiles for ports are deleted unless they are initially installed, added due to \fB\-i\fR option, or required by any of the installed or added ports.
508 .PD
509 .IP \fB\-d\fR
510 .PD 0
511 .TP
512 \fB\-\-keep\-distfiles\fR
513 Do not clean up obsolete or unused distfiles.
514 .PD
515 .IP \fB\-F\fR
516 .PD 0
517 .TP
518 \fB\-\-fetch\-only\fR
519 Execute fetch and checksum verification only at the (re)installation process for each port.
520 Packages are also fetched if applicable.
521 Regardless of this mode, missing essential tools for package management such as \fBpkg\fR(8) and \fBdialog4ports\fR(1) will be installed.
522 .PD
523 .IP \fB\-f\fR
524 .PD 0
525 .TP
526 \fB\-\-disallow\-force\-continuation\-for\-looped\-dependency\fR
527 Disallow forcible continuation in case that looped dependencies are found.
528 Without this option, workarounds are carried out at the phase of "Completion of *-time requirement lists" of the preparation stage.
529 In this case, when a looped dependency is detected, the first found dependency which is not run-and-build-time dependency (that is a typical pattern of dynamically linked libraries) is marked ignored to break the loop; if no such dependency is found, one connecting the end back to the start of a loop cycle is ignored for the time being.
530 .PD
531 .IP \fB\-G\fR
532 .PD 0
533 .TP
534 \fB\-\-use\-prebuilt\-package\fR
535 Use prebuilt packages for ports with the default configurations, i.e., in which and in the all required ports of which no port option is changed from the default and no knob (make environment variable or make argument) or replacement is defined in${LOCALBASE}/etc/portsreinstall.conf .
536 As long as no knob is defined in /etc/make.conf and no environment variable has effect on package builds, this option will accelerate the (re)installtion processes without harm.
537 It is noted that some ports still may be problematic with this assumption by automatic dependencies on other system configurations.
538 This problem can be resolved by configuring REBUILD_* section in ${LOCALBASE}/etc/portsreinstall.conf.
539 .RS
540 Historical background:
541 The actual merit of this option depended on the service levels and qualities of the remote package sites; since October 31, 2013, weekly-updated pkgng packages were provided for major architectures (at November 15, 2013, i386 and amd64 only) until their end-of-life while legacy packages were provided only at each release timing; the situations were different for STABLE and CURRENT versions and more various architectures were supported for legacy packages.
542 The official support of legacy packages were abandoned at September 1, 2014, but third-party services might be used by configuring PACKAGECHECKSUMROOTS and PACKAGEROOTS if available somewhere.
543 .RE
544 .PD
545 .IP \fB\-g\fR
546 .PD 0
547 .TP
548 \fB\-\-suppress\-pkgtools\-upadte\fR
549 Keep indispensable packages for the standard function of the ports/packages system untouched.
550 Concretely, this option suppresses upgrade, de/re-installation of the currently installed ports-mgmt/pkg(\-devel) and ports-mgmt/dialog4ports.
551 .PD
552 .IP \fB\-I\fR
553 .PD 0
554 .TP
555 \fB\-\-interactive\-ports\-only\fR
556 Operations of (re)installation are made only on ports which require manual interaction.
557 This option conflicts with \fB\-A\fR.
558 .PD
559 .IP \fB\-j\fR
560 .PD 0
561 .TP
562 \fB\-\-delete\-then\-reinstall\fR
563 Delete unneeded leaf and obsolete packages before (re)installation of needed ports.
564 The effects of this option will be manifested as possible shortening of the total time for (re)installation (by avoiding unrecognized conflict with moved ports) in exchange of possible longer abscent times of moved packages.
565 This option is suitable for builder chroot environments.
566 .PD
567 .IP \fB\-k\fR
568 .PD 0
569 .TP
570 \fB\-\-suppress\-self\-upadte\fR
571 Keep portsreinstall itself untouched.
572 This option suppresses upgrade, deinstallation and reinstallation of the currently installed portsreinstall.
573 .PD
574 .IP \fB\-l\fR
575 .PD 0
576 .TP
577 \fB\-use\-legacy\-package\-for\-missing\-pkgng\fR
578 If prebuilt modern-style packages are missing, use of corresponding legacy ones is attempted instead by converting them to the modern-style using \fBpkg2ng\fR.
579 This option is effective only when \fB\-G\fR option is enabled and the modern-style is employed for the current packages system, but will not be harmful even in the other cases.
580 .PD
581 .IP \fB\-n\fR
582 .PD 0
583 .TP
584 \fB\-\-dry\-run\fR
585 No operation is carried out (just for seeing what will be done).
586 This option is effective for \fBdo\fR and \fBredo\fR commands so that no deinstallation and (re)installation process is actually carried out.
587 By this option, ports/packages to be deinstalled or (re)installed can be confirmed without making changes to the current situation of packages.
588 .PD
589 .IP \fB\-q\fR
590 .PD 0
591 .TP
592 \fB\-\-skip\-unchanged\-ports\fR
593 Only new ports and their dependents are reinstalled.
594 This option is convenient when the all of the major version of the system and configurations of ports (options and knobs) are unchanged.
595 The behavior can be modified by \fB\-b\fR option.
596 .PD
597 .IP \fB\-s\fR
598 .PD 0
599 .TP
600 \fB\-\-avoid\-vulnerability\-check\fR
601 Build of vulnerable ports are avoided by triggering errors.
602 Note that already installed vulnerable packages are untouched.
603 If you desire to uninstall them, do it manually.
604 .PD
605 .IP \fB\-X\fR
606 .PD 0
607 .TP
608 \fB\-\-deselect\-all\fR
609 Automatically deselect all candidates for deinstallation of leaf or obsolete ports.
610 This option conflicts with \fB\-Y\fR option.
611 .PD
612 .IP \fB\-x\fR
613 .PD 0
614 .TP
615 \fB\-\-no\-exec\-inst\-script\fR
616 Execution of scripts in pre-installation, post-installation and deinstallation defined for each package is skipped.
617 This option is suitable for package build in \fBportsreinstall\-chroot\fR(8) or other change-rooted/jailed environment.
618 .PD
619 .IP \fB\-Y\fR
620 .PD 0
621 .TP
622 \fB\-\-select\-all\fR
623 Automatically select all candidates for deinstallation of leaf or obsolete ports.
624 This option conflicts with \fB\-X\fR option.
625 .PD
626 .SS Group 5: Saved and transferred to restarted runs, renewable by \-N option
627 Option settings in this group are saved at the first \fBdo\fR or \fBprepare\fR run, and transferred to the following runs.
628 Reset of the saved values for this group is available in the initial run of \fBredo\fR command by appending \fB\-N\fR with newly specified options.
629 .IP \fB\-O\fR\ \fIglob1\fR[\fB:\fIglob2\fR[\fB:\fR...]]
630 .PD 0
631 .TP
632 \fB\-\-target\-only\-itself=\fR\fIglob1\fR[\fB:\fIglob2\fR[\fB:\fR...]]
633 Restrict (re/de)installation within a scope consisting of the specified target ports and their missing build\-time requirements.
634 Available ports matching the specified target globs are automatically registered as necessary ports equivalently to \fBportsreinstall need add\fR command.
635 Records of successful (re)installation for the all ports in the scope are deleted so that they are to be reinstalled forcedly.
636 So this option is usable for fixing packages whose data in the package database or content files are broken.  
637 Without \fB\-i\fR option, target ports must be already installed or inspected.
638 Without \fB\-o\fR option, the temporary database is maintained to have complete data on dependencies of all installed and necessary ports.
639 Combination with options \fB\-T\fR and \fB\-t\fR is available.
640 The behavior can be modified by \fB\-B\fR, \fB\-b\fR, \fB\-i\fR and \fB\-o\fR options.
641 Use of this option should be just for temporary diagnosis or salvage.
642 .PD
643 .IP \fB\-o\fR
644 .PD 0
645 .TP
646 \fB\-\-only\-target\-scope\fR
647 Ignore ports which are outside of target scopes of \fB\-O\fR, \fB\-T\fR or \fB\-t\fR options.
648 Inspection of dependencies is made within the least-required scope for (re)installing the targets.
649 If given with \fB\-O\fR, targets themselves and their missing direct build\-time requirements are in the scope.
650 If given with \fB\-T\fR, targets themselves, their direct requirements and their missing direct build\-time requirements are in the scope.
651 If given with \fB\-t\fR, targets themselves, their already-inspected dependents and their missing direct build\-time requirements are in the scope.
652 Ports outside of the scopes are kept untouched even if they are updated.
653 It is noted that this option disables detection and deinstallation of new leaf ports.
654 This option will be useful for quick upgrades or new installation (only) before complete construction of the temporary database for the all installed ports.
655 Use of this option should be just for temporary diagnosis or salvage.
656 .PD
657 .IP \fB\-T\fR\ \fIglob1\fR[\fB:\fIglob2\fR[\fB:\fR...]]
658 .PD 0
659 .TP
660 \fB\-\-target\-and\-requirements=\fR\fIglob1\fR[\fB:\fIglob2\fR[\fB:\fR...]]
661 Restrict (re/de)installation within a scope consisting of the specified target ports, their requirements and their missing build\-time requirements.
662 Available ports matching the specified target globs are automatically registered as necessary ports equivalently to \fBportsreinstall need add\fR command.
663 Records of successful (re)installation for the all ports in the scope are deleted so that they are to be reinstalled forcedly.
664 So this option is usable for fixing packages whose data in the package database or content files are broken.  
665 Without \fB\-i\fR option, target ports must be already installed or inspected.
666 Without \fB\-o\fR option, the temporary database is maintained to have complete data on dependencies of all installed and necessary ports.
667 Combination with options \fB\-T\fR and \fB\-t\fR is available.
668 The behavior can be modified by \fB\-B\fR, \fB\-b\fR, \fB\-i\fR and \fB\-o\fR options.
669 Use of this option should be just for temporary diagnosis or salvage.
670 .PD
671 .IP \fB\-t\fR\ \fIglob1\fR[\fB:\fIglob2\fR[\fB:\fR...]]
672 .PD 0
673 .TP
674 \fB\-\-target\-and\-dependents=\fR\fIglob1\fR[\fB:\fIglob2\fR[\fB:\fR...]]
675 Restrict (re/de)installation within a scope consisting of the specified target ports, their dependents and their missing build\-time requirements.
676 Available ports matching the specified target globs are automatically registered as necessary ports equivalently to \fBportsreinstall need add\fR command.
677 Records of successful (re)installation for the all ports in the scope are deleted so that they are to be reinstalled forcedly.
678 So this option is usable for fixing packages whose data in the package database or content files are broken.  
679 Without \fB\-i\fR option, target ports must be already installed or inspected.
680 Without \fB\-o\fR option, the temporary database is maintained to have complete data on dependencies of all installed and necessary ports.
681 Combination with options \fB\-T\fR and \fB\-t\fR is available.
682 The behavior can be modified by \fB\-B\fR, \fB\-b\fR, \fB\-i\fR and \fB\-o\fR options.
683 Use of this option should be just for temporary diagnosis or salvage.
684 .PD
685 .SS Group 6: Saved and transferred to restarted runs, renewable by \-L option
686 Option settings in this group are saved at the first \fBdo\fR or \fBprepare\fR run, and transferred to the following runs.
687 Reset of the saved values for this group is available in the initial run of \fBredo\fR command by appending \fB\-L\fR with newly specified options.
688 .IP \fB\-P\fR
689 .PD 0
690 .TP
691 \fB\-\-load\-pkgtoolsconf\-as\-override\fR
692 Import settings from \fBpkgtools.conf\fR(5) as the secondary.
693 This option is effective only when \fBportupgrade\fR(1) is installed.
694 For duplicated configurations, values in portsreinstall.conf are applied first and then those in \fBpkgtools.conf\fR(5) are.
695 This option overrides preceding \fB\-p\fR option. 
696 .PD
697 .IP \fB\-p\fR
698 .PD 0
699 .TP
700 \fB\-\-load\-pkgtoolsconf\-as\-default\fR
701 Import settings from \fBpkgtools.conf\fR(5) as the primary (default).
702 This option is effective only when \fBportupgrade\fR(1) is installed.
703 For duplicated configurations, values in \fBpkgtools.conf\fR(5) are applied first and then those in portsreinstall.conf are.
704 This option overrides preceding \fB\-P\fR option. 
705 .PD
706 .IP \fB\-Q\fR
707 .PD 0
708 .TP
709 \fB\-\-ignore\-pkgtoolsconf\fR
710 Ignore \fBpkgtools.conf\fR(5) even if it exists.
711 .PD
712 .SH DETAILS
713 .SS Overview
714 This utility is a ports/packages management tool which upgrades packages to be as much as consistent regarding their dependencies by allowing repetitional retrials called "redo runs".
715 The implementation of this utility is designed for smart entire reinstallation of installed packages which takes a very long time.
716 A temporary database is used for managing the starting point, intermediate status and goal of the upgrade processes.
717 The starting point is determined by the initially installed packages.
718 The intermediate status contains various information on successes and failures of ports to judge the necessity of upgrade considering dependencies during \fBredo\fR runs.
719 The goal is determined by the ports tree, replacement to compatible ports and configurations for each port, i.e., port options configured by \fBmake config\fR and knobs (make environment variables and make arguments).
720 In order to make this utility work smartly, knob should be defined in ${LOCALBASE}/etc/portsreinstall.conf (or \fBpkgtools.conf\fR(5) if \fBportupgrade\fR(1) is installed) but not in /etc/make.conf
721 The temporary database is available until the ports tree is updated.
722 Each port is built for its (re)installation in principle, however, \fB\-G\fR option enables a function that use of prebuilt packages in remote servers are attempted for each port matching a condition that all configurations of the port and its requirements are unchanged from the default.
723 .PP
724 The algorithms of this utility are originally optimized for massive reinstallation to be invoked after major upgrade of the system where reinstallation of all third\-party applications is encouraged before cleaning up obsolete system libraries.
725 Nevertheless, the all functionalities of this utility is applicable to any situations where complete reinstallation is preferred for the whole or typical packages, e.g., when you have been lazy in upgrade of ports for a too long time.
726 .PP
727 In a standard case, the entire reinstallation will proceed in the following step:
728 .TP
729 1.
730 Update the ports tree and (except in case of the legacy package system) the \fBpkg\fR(8) repository catalog;
731 .PD
732 .TP
733 2.
734 Clean up a temporary database which stores the all information used for the whole task of reinstallation (first \fBdo\fR or \fBprepare\fR run);
735 .PD
736 .TP
737 3.
738 Record the snapshot of the all installed packages as the initial point of reinstallation (first \fBdo\fR or \fBprepare\fR run);
739 .PD
740 .TP
741 4.
742 Build up the database to store data on configurations and dependencies (which may depend on the configurations) of the all (re/de)installing packages to be the latest version according to the current ports tree (\fBdo\fR or \fBprepare\fR run);
743 .PD
744 .TP
745 5.
746 Select obsolete packages or new leaf ports/packages to deinstall or exclude if any (\fBdo\fR or \fBprepare\fR run);
747 .PD
748 .TP
749 6.
750 Execute the actual (re/de)installation (\fBdo\fR run);
751 .PD
752 .TP
753 7.
754 If some ports failed, attempt manual troubleshooting by make modification to the temporary database or manually re/de-install packages in concern (\fBok\fR, \fBtaboo\fR, \fBfreeze\fR, \fBnoneed\fR, \fBreconf\fR, etc.).
755 .PD
756 .TP
757 8.
758 Execute the retrial of the (re/de)installation (\fBredo\fR run);
759 .PD
760 .TP
761 9.
762 Repeat from 7 to 8 until the all available ports succeed.
763 .PD
764 .PP
765 A typical instance of actually executed commands for upgrading packages will be in the following flow:
766 .TP
767 1.
768 .B portsnap fetch update
769 .PD
770 .TP
771 2.
772 .B pkg update
773 .RS
774 (No need for the legacy packages system)
775 .RE
776 .PD
777 .TP
778 3.
779 .B script
780 .RS
781 (Enter \fBscript\fR(1) environment for logging)
782 .RE
783 .PD
784 .TP
785 4.
786 .B portsreinstall
787 .RS
788 (Possibly end up with some failed ports)
789 .RE
790 .PD
791 .TP
792 5.
793  ... Countermeasure to failures ...
794 .PD
795 .TP
796 6.
797 .B portsreinstall redo
798 .RS
799 (Possibly end up with some failed ports)
800 .RE
801 .PD
802 .TP
803 7.
804  ... Repetition from 6 to 7 ...
805 .PD
806 .TP
807 8.
808 .B portsreinstall redo
809 .RS
810 (All available ports succeed)
811 .RE
812 .PD
813 .PP
814 Here, in case of entire reinstallation after a major version upgrade of the operating system, \fB\-q\fR option should be removed.
815 It is usually encouraged to execute the command on \fBscript\fR(1) in order to record the make outputs for catching reasons of failures if any.
816 In many cases, the user may undergo failures in build or installation of some ports during do/redo runs.
817 Refer to subsections entitled "Workaround for failed ports: ..." for the techniques and procedures to resolve the problems.
818 .PP
819 This utility is implemented to be flexible and robust about interrupt/restart operations so as to allow the users to run only when the machine is free and terminate when it becomes busy on demand.
820 Concretely, the users can stop the process by CTRL+C (or even by unexpected termination) and restart from the stopped point at any stage throughout the whole task, i.e., from the beginning of preparation of the temporary database to the end of (re/de)installation.
821 This functionality allows the users, for example, to start this utility before lunch, terminate after lunch, restart before dinner, terminate after dinner, restart before going to bed, terminate after breakfast, restart before lunch, ..., and finally complete.
822 .PP
823 Compatibility with \fBportupgrade\fR(1) is well considered if it is installed; settings in \fBpkgtools.conf\fR(5) are reflected and the portupgrade database is updated at the end of each do/redo run.
824 The main difference of this utility with \fBportupgrade\fR(1) or \fBportmaster\fR(8) is that this utility is optimized for on\-the\-fly entire upgrade of the packages environment to be as complete as possible while the latter are for partial upgrade to get the latest versions available as quickly as possible by applying the least "patches" to the environment.
825 While this utility also has options for partial upgrade (\fB\-t\fR, \fB\-T\fR and \fB\-O\fR), they are intended as auxiliary modification of (re)installing packages.
826 This utility resolves conflicts between old and new packages automatically by referring to CONFLICTS, CONFLICTS_BUILD and CONFLICTS_INSTALL defined for each port or by redo processes for ports missing appropriate definition of them.
827 Many of the UPDATING advisories on trouble shooting in packages upgrade will be unnecessary to follow if the users use this utility instead of \fBportupgrade\fR(1) or \fBportmaster\fR(8).
828 .PP
829 If this utility has been installed by ports/packages and the corresponding port is renewed, upgrade of this utility is carried out first and then the following processes are continued by the new version after cleaning up the temporary database.
830 .PP
831 New leaf ports (primary leaves) and their exclusive requirements (secondary leaves) are automatically detected.
832 The user may specify unneeded ports explicitly by \fBportsreinstall noneed\fR command so that the specified ports are added to the new leaves if they have no non-leaf dependents.
833 If any leaf ports are detected, the user is prompted to select ones to delete by dialog.
834 Similarly, obsolete ports to delete are also selectable by dialog.
835 Here, both for leaf and obsolete ports, the selection can be modified afterward and unselected ones can be restored by following redo runs.
836 .PP
837 The scheme of this utility is divided into stages of temporary database construction and actual (re/de)installation.
838 Execution by
839 .B portsreinstall prepare
840 procedes to the end the first stage, and that without any argument procedes to the end of the second stage.
841 Each of these two major stages is divided into minor stages.
842 When a previously terminated process is restarted, completed minor stages are skipped.
843 Changes of the configurations made or notified by corresponding options or commands of this utility are reflected to the database by automatically re-executing the concerned stages in the following do/redo runs.
844 .PP
845 When option(s) \fB\-O\fR, \fB\-t\fR or \fB\-T\fR is/are specified, only the targets and their requirements or dependents within the specified scope are inspected and (re/de)installed.
846 Inspected data on the ports are preserved in the temporary database and reused in the following runs even if the targets are reset or changed with aid of \fB\-N\fR option.
847 The preserved data are basically harmless even if the corresponding ports are out of scope of new targets unless conflicts arise.
848 .SS New installation of ports: case 1
849 If the user has not executed this utility for entire reinstallation/upgrade never or after the final clean up of the temporary database,
850 .RS
851 .B portsreinstall -i -Glq -oO
852 .I globs
853 .RE
854 will be a quick way to install new packages matching glob patters \fIglobs\fR (here the options are separated into each group just for easy understanding).
855 More automated operation is possible by appending \fB\-C\fR and \fB\-Y\fR options so as to skip all dialog queries by letting all configurations default.
856 .SS New installation of ports: case 2
857 If the user already has a complete temporary database by executing entire reinstallation/upgrade,
858 .RS
859 .B portsreinstall need add
860 .I globs
861 .RE
862 followed by
863 .RS
864 .B portsreinstall -MGlq -N redo
865 .RE
866 will be a quick and smart way to install new packages matching glob patters \fIglobs\fR.
867 More automated operation is possible by appending \fB\-C\fR and \fB\-Y\fR options so as to skip all dialog queries by letting all configurations default.
868 .SS Deinstallation and restoration of leaf and obsolete ports
869 If any new leaf ports and obsolete (lost) ports are detected, dialogs are displayed for selecting which ports/packages to delete.
870 Here it is noted that detection and operations on new leaf ports are invalidated when the temporary database is incomplete due to \fB\-o\fR option.
871 Deinstallation and restoration of the packages are carried out after reinstallation of the all ports are attempted.
872 The selected packages are backed up before deinstallation.
873 .PP
874 The selection can be modified by executing
875 .RS
876 .B portsreinstall reselect leaves
877 .RE
878 for new leaf ports, and
879 .RS
880 .B portsreinstall reselect obsolete
881 .RE
882 for obsolete ports.
883 .PP
884 Then following execution of
885 .RS
886 .B portsreinstall
887 .RE
888 deinstalls newly selected packages and restores unselected ones.
889 .SS Package build in a chroot system
890 For smooth and safe on-the-fly port upgrading, the pakage build can be carried out in a \fBchroot\fR(8) system using \fBportsreinstall-chroot\fR(8). Refer to its manual page for the detail.
891 .SS Port upgrading of a cluster system
892 In a cluster system where multiple nodes have the same software configuration, packages built in one node can be used for upgrading ports in the others.
893 The conventional flow will be as follows:
894 .PP
895 1. Share file systems for /usr/ports/packages and /home among the nodes by NFS. Here we assume that the mount points are the same among the all nodes and user "admin" is used for the system administration.
896 .PP
897 2. In the builder node, update the ports tree and the package repository catalog.
898 .RS
899 root@[builder.cluster.intranet]
900 .B portsnap fetch update
901 .RE
902 .RS
903 root@[builder.cluster.intranet]
904 .B pkg update
905 .RE
906 3. Upgrade the all pakages completely by \fBportsreinstall\fR (the command line options are just an example).
907 .RS
908 root@[builder.cluster.intranet]
909 .B portsreinstall -qC
910 .RE
911 4. Create the packages and dispatching script set. This process can be skipped when \fBportsreinstall-chroot\fR(8) was used in the previous stage.
912 .RS
913 root@[builder.cluster.intranet]
914 .B portsreinstall packupgrade create
915 .RE
916 5. Crop and extract the archive of the created dispatching script set.
917 .RS
918 root@[builder.cluster.intranet]
919 .B portsreinstall packupgrade crop /home/admin/portsreinstall-upgrade.tar.gz
920 .RE
921 .RS
922 root@[builder.cluster.intranet]
923 .B rm -rf /home/admin/portsreinstall-upgrade
924 .RE
925 .RS
926 root@[builder.cluster.intranet]
927 .B mkdir -p /home/admin/portsreinstall-upgrade
928 .RE
929 .RS
930 root@[builder.cluster.intranet]
931 .B tar xzf /home/admin/portsreinstall-upgrade.tar.gz -C /home/admin/portsreinstall-upgrade
932 .RE
933 6. Execute the dispatched script at each target node.
934 .RS
935 .B ssh -l admin target01.cluster.intranet sudo /home/admin/portsreinstall-upgrade/portsreinstall-upgrade.sh
936 .RE
937 .SS Workaround for failed ports: conflicts: case 1
938 This utility automatically resolves conflicts between ports/packages by temporary deinstallation during concerned build or installation processes according to CONFLICTS, CONFLICTS_BUILD and CONFLICTS_INSTALL defined by each port.
939 This means that ports lacking proper CONFLICTS, CONFLICTS_BUILD and CONFLICTS_INSTALL definitions may undergo failures.
940 .PP
941 Some problems may be due to coexistence of the same or related software of different versions of the requirements or the unsuccessful ports themselves.
942 For analysis of the upgraded and initial requirements,
943 .RS
944 \fBportsreinstall show requirements @all,direct \fR \fIglob\fR
945 .RE
946 and
947 .RS
948 \fBportsreinstall show initrequirements @all,direct\fR \fIglob\fR
949 .RE
950 can be used, respectively, where \fIglob\fR denotes a glob specifying the unsuccessful ports.
951 For analysis of ports for the same software of different versions,
952 .RS
953 \fBportsreinstall glob\fR \fIglob_req\fR
954 .RE
955 can be used, where \fIglob_req\fR denotes a glob specifying the suspicious requirements.
956 .PP
957 If a conflict is found, first escape (back up and delete) the conflict by
958 .RS
959 \fBportsreinstall escape\fR \fIpackage_conflict\fR
960 .RE
961 where \fIpackage_conflict\fR is the conflicting package.
962 .RS
963 .PP
964 Then execute
965 .RS
966 .B portsreinstall redo
967 .RE
968 for completing (re)installation of the dependents of the resolved port.
969 .PP
970 If the (re)installation is successful, execute
971 .RS
972 \fBportsreinstall restore\fR \fIpackage_conflict\fR
973 .RE
974 to restore the escaped package (reinstallation may fail if a newer version is installed but there is no problem).
975 If any conflicts still remain unresolved, refer to case 2.
976 .SS Workaround for failed ports: conflicts: case 2
977 If some upgraded ports fundamentally conflict with each other, the output log of this utility for do/redo processes will report a message entitled "The following ports are temporarily deleted due to conflicts".
978 In this case, although not always encouraged, the user may consider replacement of the conflicting ones with one of them by assuming and expecting compatibility between them.
979 .PP
980 This workaround can be done by the following procedure.
981 First edit the configuration file ${LOCALBASE}/etc/portsreinstall.conf so as to define the corresponding REPLACE_* values.
982 If \fBportupgrade\fR(1) is installed, the corresponding configuration should be made in ALT_PKGDEP section of \fBpkgtools.conf\fR(5).
983 .PP
984 Then execute
985 .RS
986 .B portsreinstall -L redo
987 .RE
988 .RS
989 (Recover options reset by \fB\-L\fR if any by checking with the aid of \fBportsreinstall options\fR.)
990 .RE
991 for (re)installation of the concerned port by reflecting the configuration changes.
992 .SS Workaround for failed ports: conflicts: case 3
993 If some conflicts are found to be unnecessary, they can be removed in the following way.
994 The unnecessary ports are registered by executing
995 .RS
996 .B portsreinstall noneed add
997 .I globs_unnecessary
998 .RE
999 where \fIglobs_unnecessary\fR denotes globs specifying the unnecessary ports.
1000 .PP
1001 Next execute
1002 .RS
1003 .B portsreinstall show dependents @run,full
1004 .I globs_unnecessary
1005 .RE
1006 for checking whether any dependents seem unnecessary for the user.
1007 Next execute
1008 .RS
1009 .B portsreinstall noneed add
1010 .I globs_unnecessary_dependents
1011 .RE
1012 to register them, where \fIglobs_unnecessary_dependents\fR denotes globs specifying the unnecessary dependents.
1013 .PP
1014 Then execute
1015 .RS
1016 .B portsreinstall
1017 .RE
1018 .RS
1019 (If it seems effective, reconfigure options for \fB\-B\fR, \fB\-b\fR and \fB\-o\fR by using \fB\-M\fR and \fB\-N\fR.)
1020 .RE
1021 for automatic evaluation and deinstallation of new leaf ports redefined by the new unnecessary ports.
1022 If the registered ports are required by any non-leaf or non-unnecessary ports, this process will end up with no practical progress.
1023 .SS Workaround for failed ports: reconfiguration of port options
1024 If the problems may be resolved by reconfiguration of the port options, execute
1025 .B portsreinstall reconf 
1026 .I glob
1027 which invokes the dialog for reselecting options.
1028 Here \fIglob\fR denotes a glob specifying the concerned port.
1029 .PP
1030 If any change was made here, execute
1031 .RS
1032 .B portsreinstall
1033 .RE
1034 for retrial of (re)installation.
1035 .SS Workaround for failed ports: reconfiguration of knobs
1036 If the problems may be resolved by reconfiguration of the knobs, first edit the configuration file ${LOCALBASE}/etc/portsreinstall.conf so as to redefine the corresponding CONFLICT_*, MARG_*, MENV_*, BEFOREBUILD_*, BEFOREDEINSTALL_* or AFTERINSTALL_* values.
1037 If \fBportupgrade\fR(1) is installed, the corresponding configuration should be made in MAKE_ARGS, MAKE_ENV, BEFOREBUILD, BEFOREDEINSTALL or AFTERINSTALL section of \fBpkgtools.conf\fR(5).
1038 .PP
1039 Then execute
1040 .RS
1041 .B portsreinstall -L redo
1042 .RE
1043 .RS
1044 (Recover options reset by \fB\-L\fR if any by checking with the aid of \fBportsreinstall options\fR.)
1045 .RE
1046 for (re)installation of the concerned port by reflecting the configuration changes.
1047 .SS Workaround for failed ports: update of ports tree
1048 If the ports are fundamentally broken, updating the ports tree may fix the problems.
1049 In this case, execute
1050 .RS
1051 .B portsnap fetch update
1052 .RE
1053 and, followed by
1054 .RS
1055 .B pkg update
1056 .RE
1057 and then
1058 .RS
1059 .B portsreinstall reset keepstatus
1060 .RE
1061 to clean everything but the option settings, information of the initially installed packages and the progress of unchanged successful ports.
1062 Then execute
1063 .RS
1064 .B portsreinstall
1065 .RE
1066 and see whether the problems are resolved.
1067 .SH "ENVIRONMENT VARIABLES"
1068 The following environment variables can be used to change the behavior of \fBportsreinstall\fR.
1069 Some of them are the same as defined in \fBports\fR(7).
1070 Usually they should be kept to be the system default or empty.
1071 The configuration file (${LOCALBASE}/etc/portsreinstall.conf) takes priority over environment variables.
1072 .TP
1073 .B LOCALBASE
1074 Where to install files of native applications.
1075 The default is /usr/local.
1076 .TP
1077 .B LINUXBASE
1078 Where to install files of Linux applications.
1079 The default is /compat/linux.
1080 .TP
1081 .B PREFIX
1082 Where to install things in general.
1083 The default value is defined for each port; it is usually ${LOCALBASE} for most native applications and ${LINUXBASE} for Linux applications.
1084 However, some ports customize it to their own defaults, e.g., ${LOCALBASE}/kde4 for KDE4-related ones.
1085 Therefore, it is safer to keep this variable undefined by the user so as to define it automatically although traditionally this variable has been used for controlling installation paths by users.
1086 .TP
1087 .B PORT_DBDIR
1088 Where to store port option values.
1089 The default is /var/db/ports.
1090 .TP
1091 .B PORTSDIR
1092 Location of the ports tree.
1093 The default is /usr/ports.
1094 .TP
1095 .B DISTDIR
1096 Where to store distfiles.
1097 The default is ${PORTSDIR}/distfiles.
1098 .TP
1099 .B PACKAGES
1100 Where to store package archives.
1101 The default is ${PORTSDIR}/packages.
1102 .TP
1103 .B PKGREPOSITORYSUBDIR
1104 Subdirectory under ${PACKAGES} to store substances of package archives.
1105 The default is "All".
1106 .TP
1107 .B PKGREPOSITORY
1108 Where to store substances of package archives.
1109 The default is ${PACKAGES}/${PKGREPOSITORYSUBDIR}.
1110 .TP
1111 .B PKG_PATH
1112 Overriding Synonym to PKGREPOSITORY for compatibility with \fBpkgtools.conf\fR(5).
1113 .TP
1114 .B PACKAGECHECKSUMROOTS
1115 Roots of available sites for legacy package check sum to be randomly selected.
1116 Each site is separated by "|" (vertical bar).
1117 The default consists of ftp://ftp.FreeBSD.org/ and from ftp://ftp1.FreeBSD.org/ to ftp://ftp14.FreeBSD.org/.
1118 .TP
1119 .B PACKAGECHECKSUMDIR
1120 Subdirectory pattern of legacy package check sum sites.
1121 The first and second \fI%s\fR are substituted with the platform and version of OS, respectively.
1122 The default is pub/FreeBSD/ports/%s/packages-%s/All/.
1123 .TP
1124 .B PACKAGEROOTS
1125 Roots of available legacy package sites to be randomly selected.
1126 Each site is separated by "|" (vertical bar).
1127 The default is ${PACKAGECHECKSUMROOTS}, but it is relatively secure to be different from it.
1128 .TP
1129 .B PACKAGEDIR
1130 Subdirectory pattern of legacy package sites.
1131 The first and second \fI%s\fR are substituted with the platform and version of OS, respectively.
1132 The default is ${PACKAGECHECKSUMDIR}.
1133 .SH FILES/DIRECTORIES
1134 The following files and directories are referred to.
1135 .TP
1136 ${LOCALBASE}/etc/portsreinstall.conf
1137 Configuration file.
1138 .TP
1139 /var/tmp/portsreinstall.db
1140 Temporal database directory.
1141 The whole contents can be saved by \fBportsreinstall save\fR command.
1142 .TP
1143 ${LOCALBASE}/etc/pkgtools.conf
1144 Configuration file of \fBportupgrade\fR(1).
1145 .SH HISTORY
1146 This utility first appeared as Version 0.9.0 released on November 21, 2010.
1147 \fBpkg\fR(8) is supported since Version 2.1.0 released on December 10 2012.
1148 Flavor is supported since Version 4.0.0 released on June 29, 2018.
1149 .SH APPENDIX: Conditions determining the package system (general specification of FreeBSD Ports/Packages)
1150 The current package system is automatically detected according to the OS version whose serial number is obtained by
1151 .RS
1152 .B sysctl -n kern.osreldate
1153 .RE
1154 and the configuration of /etc/make.conf.
1155 Pkgng is supported for systems with serial numbers of 800505 (just before 8.1-RELEASE) or later.
1156 For systems of 1000017 (10-CURRENT) or later, Pkgng is the default.
1157 .PP
1158 In order to choose pkgng in systems from 800505 (just before 8.1-RELEASE) to just before 1000017 (10-CURRENT), put
1159 .RS
1160 .B WITH_PKGNG=yes
1161 .RE
1162 .RS
1163 or
1164 .RE
1165 .RS
1166 .B WITH_PKG=yes
1167 .RE
1168 in /etc/make.conf.
1169 .PP
1170 In order to choose the legacy one in systems of 1000017 (10-CURRENT) or later, put
1171 .RS
1172 .B WITHOUT_PKGNG=yes
1173 .RE
1174 .RS
1175 or
1176 .RE
1177 .RS
1178 .B WITHOUT_PKG=yes
1179 .RE
1180 in /etc/make.conf.
1181 .SH "SEE ALSO"
1182 \fBpkg_glob\fR(1),
1183 \fBportupgrade\fR(1),
1184 \fBportsdb\fR(1),
1185 \fBports_glob\fR(1),
1186 \fBpkgtools.conf\fR(5),
1187 \fBports\fR(7),
1188 \fBpkg\-add\fR(8),
1189 \fBpkg\-create\fR(8),
1190 \fBpkg\-delete\fR(8),
1191 \fBportmaster\fR(8)
1192 \fBportsreinstall\-chroot\fR(8),
1193 \fBportsreinstall\-chroot\-mount\fR(8),
1194 \fBportsreinstall\-upgrade\fR(8),
1195 .SH COPYRIGHT
1196 This software is distributed under the 2-Clause BSD License.
1197 .PP
1198 (C)\ 2010\-2018\ Mamoru\ Sakaue,\ MwGhennndo,\ All\ Rights\ Reserved.
1199 .PP
1200 Email:\ sakaue.mamoru@samurai.mwghennn.net
1201 .PP
1202 Homepage:\ http://www.mwghennndo.com/software/portsreinstall/