1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
|
.\" $OpenBSD: sysmerge.8,v 1.54 2014/08/09 16:39:25 jmc Exp $
.\"
.\" Copyright (c) 2008 Antoine Jacoutot <ajacoutot@openbsd.org>
.\"
.\" Permission to use, copy, modify, and distribute this software for any
.\" purpose with or without fee is hereby granted, provided that the above
.\" copyright notice and this permission notice appear in all copies.
.\"
.\" THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
.\" WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
.\" MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
.\" ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
.\" WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
.\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
.\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
.\"
.Dd $Mdocdate: August 9 2014 $
.Dt SYSMERGE 8
.Os
.Sh NAME
.Nm sysmerge
.Nd update system configuration files
.Sh SYNOPSIS
.Nm
.Bk -words
.Op Fl bdS
.Op Fl s Op Ar src \*(Ba etcXX.tgz
.Op Fl x Ar xetcXX.tgz
.Ek
.Sh DESCRIPTION
.Nm
is a
.Xr ksh 1
script designed to help the administrator update configuration files
after upgrading to a new release or snapshot.
.Pp
.Nm
works by comparing a temporary reference root directory
against currently installed files.
The reference files are created from a
.Xr cvs 1
source tree or a
.Dq .tgz
release or snapshot file.
All work is done under
.Pa ${TMPDIR}/sysmerge.XXXXXXXXXX
(known as the
.Em work directory ) .
The temporary root directory
.Pa temproot
is created under the work directory.
Each modified and/or replaced file is saved under the
.Pa backup
directory inside the work directory.
.Pp
If no source is specified on the command line,
.Nm
uses
.Xr ftp 1
to fetch the required sets from the URL pointed to by the
.Ev SM_PATH
environment variable, and falls back to
.Pa /usr/src
if this variable is unset.
.Pp
To make sure configuration files are in sync with the actual binaries,
use the same source as was used to upgrade the system:
.Pa /usr/src
when upgrading from source;
.Pa etcXX.tgz
and
.Pa xetcXX.tgz
when upgrading from tgz sets.
When using sets,
.Nm
will cryptographically verify their integrity,
stopping immediately should signatures not match.
.Pp
.Nm
will work through the fileset,
offering the chance to merge any differences using ${MERGE_CMD}.
Merged files may be edited using the default editor or be left to deal
with at a later date.
Should any problems occur,
such as a failure to upgrade a file,
the user will be notified and will have to deal with the issue by hand.
.Pp
By default (if
.Fl d
is not used)
.Nm
only compares files whose reference sources have changed since the last run
and attempts to automatically upgrade them to the newest version,
provided that they have no local changes.
It automatically installs missing files and binaries,
and updates files differing only by CVS Id.
Files whose reference sources have matching CVS Id are skipped from comparison.
.Pa /etc/fbtab
and
.Pa /etc/ttys
are created using helper scripts and are
.Sy always
compared.
Users and groups that are missing from the current installation but
present in the new
.Xr master.passwd 5
and
.Xr group 5
files will
.Sy always
be automatically (re)created.
.Pp
Each time
.Nm
is run it will compare the checksum of each file stored under
.Pa /etc/examples
against the previous one, then warn if it does not match and the
corresponding file exists under
.Pa /etc .
.Pp
.Nm
will finish by running
.Xr mtree 8
to make sure the directory structure has correct permissions.
.Pp
The options are as follows:
.Bl -tag -width Ds
.It Fl b
Batch mode.
.Nm
runs non-interactively,
saving differing files for later manual processing.
.It Fl d
Diff mode.
.Nm
does not take any automatic action, allowing for a full diff comparison.
.It Fl p
Package mode.
.Nm
compares the default configuration files of installed
.Xr packages 7
against their target on the system (@sample).
.It Fl S
Do not verify signatures for tgz sets.
This option has no effect when sets aren't used.
.It Fl s Op Ar src \*(Ba etcXX.tgz
Specify a path to an
.Ox
top src directory or an etcXX.tgz tarball.
A tarball path specified as a URL will be passed
to
.Xr ftp 1 .
.It Fl x Ar xetcXX.tgz
Specify a path to an
xetcXX.tgz tarball.
A tarball path specified as a URL will be passed
to
.Xr ftp 1 .
.El
.Pp
The
.Fl p
option is mutually exclusive with
.Fl s
and
.Fl x .
.Pp
Files and directories can be excluded from comparison
by listing them in the file
.Pa /etc/sysmerge.ignore ,
each entry separated by white space or a new line.
The following files will always be skipped from comparison:
.Pa /etc/*.db ,
.Pa /etc/localtime ,
.Pa /etc/mail/*.db ,
.Pa /etc/passwd ,
.Pa /etc/motd ,
.Pa /etc/myname ,
.Pa /var/db/locate.database ,
.Pa /usr/share/sysmerge/etcsum ,
.Pa /usr/share/sysmerge/examplessum ,
.Pa /usr/share/sysmerge/xetcsum ,
.Pa /var/mail/root .
.Pp
The
.Xr sendmail 8
configuration files
.Pa /etc/mail/localhost.cf ,
.Pa /etc/mail/sendmail.cf
and
.Pa /etc/mail/submit.cf
will always differ because they include their build date and directories.
A special test was added to handle this
and they are offered for comparison only if they really differ.
.Sh ENVIRONMENT
.Bl -tag -width "DESTDIRXXX"
.It Ev DBDIR
Directory in which checksum files are stored.
If unset, this defaults to
.Pa /usr/share/sysmerge .
.It Ev DESTDIR
Directory in which to merge and install files.
If unset, this defaults to
.Pa / .
.It Ev EDITOR , VISUAL
Specifies an editor to use.
If both
.Ev EDITOR
and
.Ev VISUAL
are set,
.Ev VISUAL
takes precedence.
If neither
.Ev EDITOR
nor
.Ev VISUAL
are set,
the default is
.Xr vi 1 .
.It Ev FTP_KEEPALIVE
Have
.Xr ftp 1
send a byte after every
.Ev FTP_KEEPALIVE
seconds,
so that incorrectly configured network equipment won't aggressively drop it.
See
.Dq ftp -k
for more information.
.It Ev MERGE_CMD
Command used to merge diffs.
This will be called with three arguments: the first argument is the
output file to create, the second argument is the currently installed
file and the third argument is the reference file.
If unset, this defaults to
.Dq sdiff -as -w ${SWIDTH} -o .
.It Ev PAGER
Specifies the pagination program to use.
.It Ev REPORT
Log summary which may contain information for further, manual,
updating.
Defaults to
.Pa ${WRKDIR}/sysmerge.log .
.It Ev SM_PATH
A URL, specifying the directory to search for sets matching the
currently running release if none are specified on the command line.
.It Ev TMPDIR
Directory in which the work directory is created.
If unset, this defaults to
.Pa /var/tmp .
.El
.Sh FILES
.Bl -tag -width "${TMPDIR}/sysmerge.XXXXXXXXXX" -compact
.It ${TMPDIR}/sysmerge.XXXXXXXXXX
Default work directory.
The
.Sy temproot
and
.Sy backup
directories are created relative to this.
.It ${WRKDIR}/sysmerge.log
Default log file.
.It /etc/sysmerge.ignore
Files and directories to ignore from comparison.
.El
.Sh SEE ALSO
.Xr more 1 ,
.Xr sdiff 1
.Pp
.Pa /usr/src/etc/Makefile
.Pp
.Lk http://www.openbsd.org/faq/current.html
.Lk http://www.openbsd.org/faq/upgradeXX.html
.Sh HISTORY
The
.Nm
script first appeared in
.Ox 4.4 .
.Sh AUTHORS
.An -nosplit
The
.Nm
shell script was written by
.An Antoine Jacoutot Aq Mt ajacoutot@openbsd.org
using
.Fx
mergemaster written by
.An Douglas Barton Aq Mt DougB@FreeBSD.org
as a base.
|