1 .\" Copyright (c) 2010-2013 Hudson River Trading LLC
2 .\" Written by: John H. Baldwin <jhb@FreeBSD.org>
3 .\" All rights reserved.
5 .\" Redistribution and use in source and binary forms, with or without
6 .\" modification, are permitted provided that the following conditions
8 .\" 1. Redistributions of source code must retain the above copyright
9 .\" notice, this list of conditions and the following disclaimer.
10 .\" 2. Redistributions in binary form must reproduce the above copyright
11 .\" notice, this list of conditions and the following disclaimer in the
12 .\" documentation and/or other materials provided with the distribution.
14 .\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
15 .\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
16 .\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
17 .\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
18 .\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
19 .\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
20 .\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
21 .\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
22 .\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
23 .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
33 .Nd "manage updates to system files not updated by installworld"
38 .Op Fl r | Fl s Ar source | Fl t Ar tarball
64 .Op Fl s Ar source | Fl t Ar tarball
88 utility is a tool for managing updates to files that are not updated as
93 It manages updates by doing a three-way merge of changes made to these
94 files against the local versions.
95 It is also designed to minimize the amount of user intervention with
96 the goal of simplifying upgrades for clusters of machines.
98 To perform a three-way merge,
100 keeps copies of the current and previous versions of files that it manages.
101 These copies are stored in two trees known as the
112 copies of each file to determine which changes need to be merged into the
113 local version of each file.
114 If a file can be updated without generating a conflict,
116 will update the file automatically.
117 If the local changes to a file conflict with the changes made to a file in
119 then a merge conflict is generated.
120 The conflict must be resolved after the merge has finished.
123 utility will not perform a new merge until all conflicts from an earlier
128 utility supports several modes of operation.
129 The mode is specified via an optional command argument.
130 If present, the command must be the first argument on the command line.
131 If a command is not specified, the default mode is used.
133 The default mode merges changes from the source tree to the destination
142 it compares the two trees merging changes into the destination directory.
144 it displays warnings for any conditions it could not handle automatically.
148 option is not specified,
149 then the first step taken is to update the
157 then that tree is saved as the
162 tree is removed if it exists.
165 tree is built from a source tree.
167 if a tarball is specified via the
170 then the tree is extracted from that tarball instead.
174 compares the files in the
179 If a file was removed from the
182 then it will be removed from the destination directory only if it
183 does not have any local modifications.
184 If a file was added to the
187 then it will be copied to the destination directory only if it
188 would not clobber an existing file.
189 If a file is changed in the
194 will attempt to merge the changes into the version of the file in the
195 destination directory.
196 If the merge encounters conflicts,
197 then a version of the file with conflict markers will be saved for
199 If the merge does not encounter conflicts,
200 then the merged version of the file will be saved in the destination
204 is not able to safely merge in changes to a file other than a merge conflict,
205 it will generate a warning.
207 For each file that is updated a line will be output with a leading character
208 to indicate the action taken.
209 The possible actions follow:
211 .Bl -tag -width "A" -compact -offset indent
225 if any warnings were encountered they are displayed after the merge has
228 Note that for certain files
230 will perform post-install actions any time that the file is updated.
234 .Pa /etc/master.passwd
238 .Pa /etc/login.conf.db
244 .Pa /etc/mail/aliases
261 One exception is that if
262 .Pa /etc/mail/aliases
263 is changed and the destination directory is not the default,
264 then a warning will be issued instead.
265 This is due to a limitation of the
271 is changed and the destination directory is not the default,
274 will not be executed due to a limitation of that script.
275 In this case no warning is issued as the result of
277 is merely cosmetic and will be corrected on the next reboot.
281 mode is used to build a tarball that contains a snapshot of a
284 This tarball can be used by the default and extract modes.
285 Using a tarball can allow
287 to perform a merge without requiring a source tree that matches the
288 currently installed world.
291 argument specifies the name of the file to create.
299 mode compares the versions of files in the destination directory to the
301 tree and generates a unified format diff of the changes.
302 This can be used to determine which files have been locally modified and how.
305 does not manage files that are not maintained in the source tree such as
315 Unlike the default mode,
316 it does not save any existing
318 tree and does not modify any existing
323 tree can either be built from a source tree or extracted from a tarball.
327 mode is used to resolve any conflicts encountered during a merge.
330 iterates over any existing conflicts prompting the user for actions to take
331 on each conflicted file.
332 For each file, the following actions are available:
334 .Bl -tag -width "(tf) theirs-full" -compact
336 Ignore this conflict for now.
338 Show all changes made to the merged file as a unified diff.
340 Change the merged file in an editor.
342 Install the merged version of the file into the destination directory.
344 Use the version of the file in the destination directory and ignore any
345 changes made to the file in the
349 Use the version of the file from the
351 tree and discard any local changes made to the file.
353 Display the list of commands.
358 mode is used to restore the stock versions of files.
361 installs the stock version of requested files.
362 This mode cannot be used to restore directories, only individual files.
366 mode shows a summary of the results of the most recent merge.
367 First it lists any files for which there are unresolved conflicts.
368 Next it lists any warnings generated during the last merge.
369 If the last merge did not generate any conflicts or warnings,
370 then nothing will be output.
372 The following options are available.
373 Note that most options do not apply to all modes.
374 .Bl -tag -width ".Fl A Ar patterns"
376 Always install the new version of any files that match any of the patterns
379 Each pattern is evaluated as an
382 This option may be specified multiple times to specify multiple patterns.
383 Multiple space-separated patterns may also be specified in a single
385 Note that ignored files specified via the
389 option will not be installed.
391 Do not build generated files in a private object tree.
393 reuse the generated files from a previously built object tree that matches
395 This can be useful to avoid gratuitous conflicts in
398 files when bootstrapping.
399 It can also be useful for building a tarball that matches a specific
402 Specify an alternate destination directory as the target of a merge.
403 This is analogous to the
406 .Sq make installworld .
407 The default destination directory is an empty string which results in
410 on the local machine.
412 Specify an alternate directory to use as the work directory.
413 The work directory is used to store the
417 trees as well as unresolved conflicts.
418 The default work directory is
419 .Pa <destdir>/var/db/etcupdate .
421 Ignore changes in the FreeBSD ID string when comparing files in the
422 destination directory to files in either of the
430 this reduces noise due to FreeBSD ID string changes in the output.
431 During an update this can simplify handling for harmless conflicts caused
432 by FreeBSD ID string changes.
435 if a file in the destination directory is identical to the same file in the
437 tree modulo the FreeBSD ID string,
438 then the file is treated as if it was unmodified and the
440 version of the file will be installed.
442 if a file in the destination directory is identical to the same file in the
444 tree modulo the FreeBSD ID string,
447 version of the file will be installed to update the ID string.
452 versions of the file are identical,
455 will not change the file in the destination directory.
457 Due to limitations in the
460 this option may not have an effect if there are other changes in a file that
461 are close to the FreeBSD ID string.
463 Ignore any files that match any of the patterns listed in
465 No warnings or other messages will be generated for those files during a
467 Each pattern is evaluated as an
470 This option may be specified multiple times to specify multiple patterns.
471 Multiple space-separated patterns may also be specified in a single
474 Specify an alternate path for the log file.
477 utility logs each command that it invokes along with the standard output
478 and standard error to this file.
479 By default the log file is stored in a file named
481 in the work directory.
485 as additional parameters to
490 This can be used for to set the
494 variables for a cross-build.
500 binary when building a
507 Do not merge any changes to the destination directory.
509 report what actions would be taken during a merge.
510 Note that the existing
514 trees will not be changed.
517 option is not specified,
520 tree will be extracted to perform the comparison.
524 build when building a
527 The resulting tree will include a corresponding
534 Only merge changes to files that are necessary to successfully run
535 .Sq make installworld
537 .Sq make installkernel .
538 When this flag is enabled,
543 trees are left alone.
545 a temporary tree is populated with the necessary files.
546 This temporary tree is compared against the
549 This allows a normal update to be run after
550 .Sq make installworld
552 Any conflicts generated during a
554 update should be resolved by a
562 trees during a merge.
565 a previous merge operation.
567 Specify an alternate source tree to use when building or extracting a
570 The default source tree is
575 tree from a tarball previously generated by the
577 command rather than building the tree from a source tree.
582 utility can also be configured by setting variables in an optional
583 configuration file named
584 .Pa /etc/etcupdate.conf .
585 Note that command line options override settings in the configuration file.
586 The configuration file is executed by
588 so it uses that syntax to set configuration variables.
589 The following variables can be set:
590 .Bl -tag -width ".Ev ALWAYS_INSTALL"
591 .It Ev ALWAYS_INSTALL
592 Always install files that match any of the patterns listed in this variable
597 Specify an alternate destination directory similar to the
601 Specify a program to edit merge conflicts.
603 Ignore changes in the FreeBSD ID string similar to the
606 This is enabled by setting the variable to a non-empty value.
608 Ignore files that match any of the patterns listed in this variable
613 Specify an alternate path for the log file similar to the
619 binary when building a
625 Pass additional options to
633 Specify an alternate source tree similar to the
637 Specify an alternate work directory similar to the
644 utility uses the program identified in the
646 environment variable to edit merge conflicts.
651 is used as the default editor.
653 .Bl -tag -width ".Pa /var/db/etcupdate/log" -compact
654 .It Pa /etc/etcupdate.conf
655 Optional config file.
656 .It Pa /var/db/etcupdate
657 Default work directory used to store trees and other data.
658 .It Pa /var/db/etcupdate/log
664 To compare the files in
666 with the stock versions:
670 To merge changes after an upgrade via the buildworld and installworld process:
674 To resolve any conflicts generated during a merge:
676 .Dl "etcupdate resolve"
680 utility may need to be bootstrapped before it can be used.
683 command will fail with an error about a missing reference tree if
684 bootstrapping is needed.
688 requires a source tree that matches the currently installed world.
689 The easiest way to ensure this is to bootstrap
691 before updating the source tree to start the next world upgrade cycle.
693 generate a reference tree:
695 .Dl "etcupdate extract"
700 command to compare the reference tree to your current files in
702 Undesired differences should be removed using an editor,
704 or by copying files from the reference tree
707 .Pa /var/db/etcupdate/current
714 is already newer than the currently installed world,
715 a new tree matching the currently installed world can be checked out to
716 a temporary location.
717 The reference tree for
719 can then be generated via:
721 .Dl "etcupdate extract -s /path/to/tree"
725 command can be used as above to remove undesired differences.
727 the changes in the tree at
729 can be merged via a regular merge.
731 The following warning messages may be generated during a merge.
732 Note that several of these warnings cover obscure cases that should occur
733 rarely if at all in practice.
735 if a file changes from a file to a directory in the
738 and the file was modified in the destination directory,
739 then a warning will be triggered.
741 when a warning references a pathname,
742 the corresponding file in the destination directory is not changed by a
745 .It "Directory mismatch: <path> (<type>)"
746 An attempt was made to create a directory at
748 but an existing file of type
750 already exists for that path name.
751 .It "Modified link changed: <file> (<old> became <new>)"
752 The target of a symbolic link named
761 The symbolic link has been modified to point to a target that is neither
765 in the destination directory.
766 .It "Modified mismatch: <file> (<new> vs <dest>)"
774 but the file exists as a different type
776 in the destination directory.
777 .It "Modified <type> changed: <file> (<old> became <new>)"
789 The file in the destination directory of type
792 so it could not be merged automatically.
793 .It "Modified <type> remains: <file>"
798 has been removed from the
801 but it has been locally modified.
802 The modified version of the file remains in the destination directory.
803 .It "Needs update: /etc/localtime (required manual update via tzsetup(8))"
809 was not able to refresh
811 from its source file in
812 .Fa /usr/share/zoneinfo .
819 permitting future updates to refresh
822 .It "Needs update: /etc/mail/aliases.db (required manual update via newaliases(1))"
824 .Pa /etc/mail/aliases
825 was updated during a merge with a non-empty destination directory.
826 Due to a limitation of the
830 was not able to automatically update the corresponding aliases database.
831 .It "New file mismatch: <file> (<new> vs <dest>)"
836 has been added to the
839 A file of that name already exists in the destination directory,
840 but it is of a different type
842 .It "New link conflict: <file> (<new> vs <dest>)"
843 A symbolic link named
845 has been added to the
849 A symbolic link of the same name already exists in the destination
851 but it links to a different target
853 .It "Non-empty directory remains: <file>"
859 but it contains additional files in the destination directory.
860 These additional files as well as the directory remain.
861 .It "Remove mismatch: <file> (<old> became <new>)"
873 but it has been removed in the destination directory.
874 .It "Removed file changed: <file>"
880 but it has been removed in the destination directory.
881 .It "Removed link changed: <file> (<old> became <new>)"
882 The target of a symbolic link named
891 but it has been removed in the destination directory.
901 .Xr services_mkdb 8 ,
906 utility first appeared in
911 utility was written by
912 .An John Baldwin Aq Mt jhb@FreeBSD.org .
914 Rerunning a merge does not automatically delete conflicts left over from a
916 Any conflicts must be resolved before the merge can be rerun.
917 It is not clear if this is a feature or a bug.
919 There is no way to easily automate conflict resolution for specific files.
920 For example, one can imagine a syntax along the lines of
922 .Dl "etcupdate resolve tf /some/file"
924 to resolve a specific conflict in an automated fashion.
928 often results in gratuitous diffs in
930 that cause conflicts in the first merge.
931 If an object tree that matches the source tree is present when bootstrapping,
936 command can work around this.