Main index | Section 8 | Options |
To perform a three-way merge, etcupdate keeps copies of the current and previous versions of files that it manages. These copies are stored in two trees known as the "current" and "previous" trees. During a merge, etcupdate compares the "current" and "previous" copies of each file to determine which changes need to be merged into the local version of each file. If a file can be updated without generating a conflict, etcupdate will update the file automatically. If the local changes to a file conflict with the changes made to a file in the source tree, then a merge conflict is generated. The conflict must be resolved after the merge has finished. The etcupdate utility will not perform a new merge until all conflicts from an earlier merge are resolved.
If the
Next, etcupdate compares the files in the "current" and "previous" trees. If a file was removed from the "current" tree, then it will be removed from the destination directory only if it does not have any local modifications. If a file was added to the "current" tree, then it will be copied to the destination directory only if it would not clobber an existing file. If a file is changed in the "current" tree, then etcupdate will attempt to merge the changes into the version of the file in the destination directory. If the merge encounters conflicts, then a version of the file with conflict markers will be saved for future resolution. If the merge does not encounter conflicts, then the merged version of the file will be saved in the destination directory. If etcupdate is not able to safely merge in changes to a file other than a merge conflict, it will generate a warning.
For each file that is updated a line will be output with a leading character to indicate the action taken. The possible actions follow:
A | Added |
C | Conflict |
D | Deleted |
M | Merged |
U | Updated |
Finally, if any warnings were encountered they are displayed after the merge has completed.
Note that for certain files etcupdate will perform post-install actions any time that the file is updated. Specifically, pwd_mkdb(8) is invoked if /etc/master.passwd is changed, cap_mkdb(1) is invoked to update /etc/login.conf.db if /etc/login.conf is changed, newaliases(1) is invoked if /etc/mail/aliases is changed, services_mkdb(8) is invoked if /etc/services is changed, tzsetup(8) is invoked if /etc/localtime is changed and if /var/db/zoneinfo exists, and /etc/rc.d/motd is invoked if /etc/motd is changed. One exception is that if /etc/mail/aliases is changed and the destination directory is not the default, then a warning will be issued instead. This is due to a limitation of the newaliases(1) command. Similarly, if /etc/motd is changed and the destination directory is not the default, then /etc/rc.d/motd will not be executed due to a limitation of that script. In this case no warning is issued as the result of /etc/rc.d/motd is merely cosmetic and will be corrected on the next reboot.
(p) postpone | Ignore this conflict for now. |
(df) diff-full | Show all changes made to the merged file as a unified diff. |
(e) edit | Change the merged file in an editor. |
(r) resolved | Install the merged version of the file into the destination directory. |
(mf) mine-full | Use the version of the file in the destination directory and ignore any changes made to the file in the "current" tree. |
(tf) theirs-full | |
Use the version of the file from the "current" tree and discard any local changes made to the file. | |
(h) help | Display the list of commands. |
| |
Always install the new version of any files that match any of the patterns
listed in
patterns.
Each pattern is evaluated as an
sh(1)
shell pattern.
This option may be specified multiple times to specify multiple patterns.
Multiple space-separated patterns may also be specified in a single
option.
Note that ignored files specified via the
IGNORE_FILES
variable or the
| |
| Do not build generated files in a private object tree. Instead, reuse the generated files from a previously built object tree that matches the source tree. This can be useful to avoid gratuitous conflicts in sendmail(8) configuration files when bootstrapping. It can also be useful for building a tarball that matches a specific world build. |
| |
Specify an alternate destination directory as the target of a merge. This is analogous to the DESTDIR variable used with 'make installworld'. The default destination directory is an empty string which results in merges updating /etc on the local machine. | |
| |
Specify an alternate directory to use as the work directory. The work directory is used to store the "current" and "previous" trees as well as unresolved conflicts. The default work directory is <destdir>/var/db/etcupdate. | |
|
Ignore changes in the FreeBSD ID string when comparing files in the
destination directory to files in either of the
"current"
or
"previous"
trees.
In
diff
mode,
this reduces noise due to FreeBSD ID string changes in the output.
During an update this can simplify handling for harmless conflicts caused
by FreeBSD ID string changes.
Specifically, if a file in the destination directory is identical to the same file in the "previous" tree modulo the FreeBSD ID string, then the file is treated as if it was unmodified and the "current" version of the file will be installed. Similarly, if a file in the destination directory is identical to the same file in the "current" tree modulo the FreeBSD ID string, then the "current" version of the file will be installed to update the ID string. If the "previous" and "current" versions of the file are identical, then etcupdate will not change the file in the destination directory. Due to limitations in the diff(1) command, this option may not have an effect if there are other changes in a file that are close to the FreeBSD ID string. |
| |
Ignore any files that match any of the patterns listed in patterns. No warnings or other messages will be generated for those files during a merge. Each pattern is evaluated as an sh(1) shell pattern. This option may be specified multiple times to specify multiple patterns. Multiple space-separated patterns may also be specified in a single option. | |
| |
Specify an alternate path for the log file. The etcupdate utility logs each command that it invokes along with the standard output and standard error to this file. By default the log file is stored in a file named log in the work directory. | |
| |
Pass options as additional parameters to make(1) when building a "current" tree. This can be used for to set the TARGET or TARGET_ARCH variables for a cross-build. | |
|
Enable
"dry-run"
mode.
Do not merge any changes to the destination directory.
Instead,
report what actions would be taken during a merge.
Note that the existing
"current"
and
"previous"
trees will not be changed.
If the
|
| Enable "pre-world" mode. Only merge changes to files that are necessary to successfully run 'make installworld' or 'make installkernel'. When this flag is enabled, the existing "current" and "previous" trees are left alone. Instead, a temporary tree is populated with the necessary files. This temporary tree is compared against the "current" tree. This allows a normal update to be run after 'make installworld' has completed. Any conflicts generated during a "pre-world" update should be resolved by a "pre-world" resolve. |
| Do not update the "current" and "previous" trees during a merge. This can be used to "re-run" a previous merge operation. |
| |
Specify an alternate source tree to use when building or extracting a "current" tree. The default source tree is /usr/src. | |
| |
Extract a new "current" tree from a tarball previously generated by the build command rather than building the tree from a source tree. | |
ALWAYS_INSTALL | |
Always install files that match any of the patterns listed in this variable
similar to the
| |
DESTDIR |
Specify an alternate destination directory similar to the
|
EDITOR | Specify a program to edit merge conflicts. |
FREEBSD_ID |
Ignore changes in the FreeBSD ID string similar to the
|
IGNORE_FILES |
Ignore files that match any of the patterns listed in this variable
similar to the
|
LOGFILE |
Specify an alternate path for the log file similar to the
|
MAKE_OPTIONS |
Pass additional options to
make(1)
when building a
"current"
tree similar to the
|
SRCDIR |
Specify an alternate source tree similar to the
|
WORKDIR |
Specify an alternate work directory similar to the
|
/etc/etcupdate.conf | Optional config file. |
/var/db/etcupdate | Default work directory used to store trees and other data. |
/var/db/etcupdate/log | |
Default log file. | |
etcupdate diff
To merge changes after an upgrade via the buildworld and installworld process:
etcupdate
To resolve any conflicts generated during a merge:
etcupdate resolve
Bootstrapping etcupdate requires a source tree that matches the currently installed world. The easiest way to ensure this is to bootstrap etcupdate before updating the source tree to start the next world upgrade cycle. First, generate a reference tree:
etcupdate extract
Second, use the diff command to compare the reference tree to your current files in /etc. Undesired differences should be removed using an editor, patch(1), or by copying files from the reference tree ( located at /var/db/etcupdate/current by default )
If the tree at /usr/src is already newer than the currently installed world, a new tree matching the currently installed world can be checked out to a temporary location. The reference tree for etcupdate can then be generated via:
etcupdate extract -s /path/to/tree
The diff command can be used as above to remove undesired differences. Afterwards, the changes in the tree at /usr/src can be merged via a regular merge.
Directory mismatch: <path> (<type>) | An attempt was made to create a directory at path but an existing file of type "type" already exists for that path name. |
Modified link changed: <file> (<old> became <new>) | The target of a symbolic link named file was changed from "old" to "new" in the "current" tree. The symbolic link has been modified to point to a target that is neither "old" nor "new" in the destination directory. |
Modified mismatch: <file> (<new> vs <dest>) | A file named file of type "new" was modified in the "current" tree, but the file exists as a different type "dest" in the destination directory. |
Modified <type> changed: <file> (<old> became <new>) | A file named file changed type from "old" in the "previous" tree to type "new" in the "current" tree. The file in the destination directory of type "type" has been modified, so it could not be merged automatically. |
Modified <type> remains: <file> | The file of type "type" named file has been removed from the "current" tree, but it has been locally modified. The modified version of the file remains in the destination directory. |
Needs update: /etc/localtime (required manual update via tzsetup(8)) | The /var/db/zoneinfo file does not exist, so etcupdate was not able to refresh /etc/localtime from its source file in /usr/share/zoneinfo. Running tzsetup(8) will both refresh /etc/localtime and generate /var/db/zoneinfo permitting future updates to refresh /etc/localtime automatically. |
Needs update: /etc/mail/aliases.db (required manual update via newaliases(1)) | The file /etc/mail/aliases was updated during a merge with a non-empty destination directory. Due to a limitation of the newaliases(1) command, etcupdate was not able to automatically update the corresponding aliases database. |
New file mismatch: <file> (<new> vs <dest>) | A new file named file of type "new" has been added to the "current" tree. A file of that name already exists in the destination directory, but it is of a different type "dest". |
New link conflict: <file> (<new> vs <dest>) | A symbolic link named file has been added to the "current" tree that links to "new". A symbolic link of the same name already exists in the destination directory, but it links to a different target "dest". |
Non-empty directory remains: <file> | The directory file was removed from the "current" tree, but it contains additional files in the destination directory. These additional files as well as the directory remain. |
Remove mismatch: <file> (<old> became <new>) | A file named file changed from type "old" in the "previous" tree to type "new" in the "current" tree, but it has been removed in the destination directory. |
Removed file changed: <file> | A file named file was modified in the "current" tree, but it has been removed in the destination directory. |
Removed link changed: <file> (<old> became <new>) | The target of a symbolic link named file was changed from "old" to "new" in the "current" tree, but it has been removed in the destination directory. |
There is no way to easily automate conflict resolution for specific files. For example, one can imagine a syntax along the lines of
etcupdate resolve tf /some/file
to resolve a specific conflict in an automated fashion.
Bootstrapping
etcupdate
often results in gratuitous diffs in
/etc/mail/*.cf
that cause conflicts in the first merge.
If an object tree that matches the source tree is present when bootstrapping,
then passing the
ETCUPDATE (8) | April 20, 2021 |
Main index | Section 8 | Options |
Please direct any comments about this manual page service to Ben Bullock. Privacy policy.
“ | A computer would deserve to be called intelligent if it could deceive a human into believing that it was human. | ” |
— Alan Turing |