ETCMERGE(1) | General Commands Manual | ETCMERGE(1) |
etcmerge
—
etcmerge |
[-q ] [-S
statedir] command
[args ...] |
etcmerge
utility assists merging updates to
configuration files given the old and new upstream
etc.tgz (or xetc.tgz)
distribution sets.
The command
$ etcmerge auto old/etc.tgz
new/etc.tgz
etcmerge
will leave F intact and
create new files:
etcmerge
autoedit
F will launch the editor on the
.~merge~ file, and, if there are no conflict markers
when it exits, move the .~merge~ file into place and
delete the .~old~ and .~new~
files.
For an interactive three-way merge in a separate staging area, start by running:
$ etcmerge start old/etc.tgz
new/etc.tgz
Once the merge is started, the various subcommands
etcmerge
show
,
etcmerge
diff
,
etcmerge
edit
,
etcmerge
resolved
, and so on
display and edit state of the merge operation:
$ etcmerge show /etc/ssh/sshd_config $ etcmerge diff -l -u /etc/ssh/sshd_config $ etcmerge diff -n -u /etc/ssh/sshd_config $ etcmerge edit /etc/ssh/sshd_config $ etcmerge resolved /etc/ssh/sshd_config
When done, run either etcmerge
commit
to apply the changes outside the staging
area, or etcmerge
abort
to
give up on the merge and discard all changes.
Only one merge at a time can be in progress, unless you specify an
alternate state directory with -S
.
etcmerge
start
will refuse
to start a new merge until an ongoing one is aborted or committed.
-S
statediretcmerge
state, instead of the default
/var/etcmerge.abort
auto
[-Cdns
] [-c
resolution] [-R
rootdir] old.tgz
new.tgz-c
option. You can use
etcmerge
autoedit
to edit
the .~merge~ files to resolve conflicts.
Note: This does not use a separate staging area.
etcmerge
auto
is an
abbreviation for: etcmerge
start
-A
-c
suffix
You should make sure to resolve all the conflicts (and delete
these extra files manually if you don't use
etcmerge
autoedit
)
before the next update; etcmerge
auto
will refuse to overwrite an existing
.~old~, .~new~, or
.~merge~ file in order to avoid clobbering
incomplete merges.
autoedit
path ...<<<<<<<
,
|||||||
, =======
,
or
>>>>>>>
), then rename it to
the permanent name without .~merge~ and delete the
corresponding .~old~ and
.~new~ files.
Meant for use after etcmerge
auto
; this does not use a separate staging
area.
commit
[-d
]This moves all files from the staging area into their final
places in the file system (relative to any rootdir
specified in etcmerge
start
), and runs post-merge actions, including
MAKEDEV(8) if /dev/MAKEDEV or
/dev/MAKEDEV.local changed,
newaliases(8) if
/etc/mail/aliases changed,
pwd_mkdb(8) if
/etc/master.passwd changed, and
services_mkdb(8) if
/etc/services changed. (XXX The post-merge
actions are not yet implemented.)
With the -d
option, delete files that
have been deleted upstream. (XXX This is not yet correctly implemented
— it doesn't track local versus upstream deletions.)
conflict
[path ...]diff
[-clmnpru
] [path ...]Either -l
(local) or
-n
(new) must be specified to choose which
versions. With -m
, diff from whichever version
is selected to the current file in the staging area. Without
-m
, diff from the old (upstream) version to
whichever version is selected.
Options:
edit
[path ...]EDITOR
environment variable.
If the files have unresolved conflicts,
etcmerge
will continue to consider them
unresolved; if you have resolved them, use
etcmerge
resolved
to
mark them as resolved.
local
[path ...]etcmerge
resolved
.resolved
path ...etcmerge
edit
.
Note: If the file still has merge conflict markers, then after
etcmerge
resolved
they
will remain in the file if committed with
etcmerge
commit
.
run
command [args ...]shell
[args ...]SHELL
environment variable.show
[-c
] pathWith the -c
option, ignore the current
state and instead display the automatic merge of the file, with conflict
markers.
start
[-ACdns
] [-c
resolution] [-R
rootdir] old.tgz
new.tgzetcmerge
subcommands.
Options:
-A
etcmerge
will not create conflict markers, although it may yield nonsensical
results if diff3(1) gets confused. This may be
combined with the -C
option to autocommit only
if all upstream changes are to files unmodified locally.-C
-c
resolution-d
-A
, in the event of a
successful merge, delete files that were deleted upstream. (XXX This
is not yet correctly implemented — it doesn't track local
versus upstream deletions.)-n
-R
rootdir-s
status
undo
etcmerge
auto
or etcmerge
commit
operation. All files in the file system
outside the staging area listed in old.tgz or
new.tgz are restored to the state they were in
before etcmerge
start
.
There is only one level of undo.
etcmerge
undo
is a
convenience, not a substitute for backups — make sure to keep
good backups.
(XXX This doesn't do anything about deletions.)
upstream
[path ...]etcmerge
resolved
.-S
option.etcmerge
is new and likely buggy, and may find your
files tasty with a bit of mustard. Take backups.
etcmerge
is not a substitute for a
revision control system — it only assists with an individual merge
operation. Consider keeping important configuration files under
git(1) or hg(1) or
rcs(5).
etcmerge
must be run as root. It would be nice if it
could run unprivileged and use mtree(1) to record
permissions on files it handles, and create a tar archive for the resulting
merge outcome.
January 6, 2021 | NetBSD 9.1_STABLE |