summaryrefslogtreecommitdiff
path: root/sysutils/etcupdate/files/etcupdate.8
blob: 279711eca5f302671bde39ef6e023bf55d6bace2 (plain)
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
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
.\"	$NetBSD: etcupdate.8,v 1.9 2003/04/05 18:17:23 perry Exp $
.\"
.\" Copyright (c) 2001 The NetBSD Foundation, Inc.
.\" All rights reserved.
.\"
.\" This code is derived from software contributed to The NetBSD Foundation
.\" by Martti Kuparinen.
.\"
.\" Redistribution and use in source and binary forms, with or without
.\" modification, are permitted provided that the following conditions
.\" are met:
.\" 1. Redistributions of source code must retain the above copyright
.\"    notice, this list of conditions and the following disclaimer.
.\" 2. Redistributions in binary form must reproduce the above copyright
.\"    notice, this list of conditions and the following disclaimer in the
.\"    documentation and/or other materials provided with the distribution.
.\" 3. All advertising materials mentioning features or use of this software
.\"    must display the following acknowledgement:
.\"        This product includes software developed by the NetBSD
.\"        Foundation, Inc. and its contributors.
.\" 4. Neither the name of The NetBSD Foundation nor the names of its
.\"    contributors may be used to endorse or promote products derived
.\"    from this software without specific prior written permission.
.\"
.\" THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
.\" ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
.\" TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
.\" PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
.\" BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
.\" CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
.\" SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
.\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
.\" CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
.\" POSSIBILITY OF SUCH DAMAGE.
.\"
.Dd April 2, 2003
.Dt ETCUPDATE 8
.Os
.Sh NAME
.Nm etcupdate
.Nd update the configuration and startup files in
.Pa /etc
.Sh SYNOPSIS
.Nm
.Op Fl a
.Op Fl b Ar srcdir
.Op Fl h
.Op Fl l
.Op Fl p Ar pager
.Op Fl s Ar srcdir
.Op Fl t Ar temproot
.Op Fl v
.Op Fl w Ar width
.Sh DESCRIPTION
.Nm
is a tool that lets the administrator update the configuration and
startup files in
.Pa /etc
(and some other directories like
.Pa /dev ,
.Pa /root
and
.Pa /var )
without having to manually check and modify every file.
The administrator should run this script after performing an operating
system update (e.g. after running
.Pa make build
in
.Pa /usr/src
or after extracting new binary distribution files)
to update to the latest configuration and startup files.
.Pp
.Nm
compares the new configuration files against the currently installed files.
The user is given the option of installing, merging or deleting each
modified or missing file.
.Nm
also detects if the user installs certain special files and performs
corresponding tasks like remaking device nodes or rebuilding a database
from the
.Xr aliases 5
file.
.Pp
.Nm
needs a clean set of new configuration files to compare the 
existing files against.
These files, called the
.Dq reference files
in this manual, may be derived from either a source or binary
distribution of
.Nx .
.Pp
If the user is updating from sources (which is the default mode),
.Nm
will first create a copy of the reference files
by running
.Pa make distribution
in
.Pa /usr/src/etc ,
installing the files to a so-called
.Pa temproot .
(See usage of the
.Fl s Ar srcdir ,
and
.Fl t Ar temproot
options later in this manual page.)
.Pp
Instead of using sources, the user can also extract one or more binary
distribution sets in a special location and use those as the reference
files (see usage of the
.Fl b Ar srcdir
option later in this manual page).
.Pp
The following options are available:
.Bl -tag -width indent
.It Fl a
.Nm
can automatically update files which have not been modified locally.
The
.Fl a
flag instructs
.Nm
to store MD5 checksums in
.Pa /var/etcupdate
and use these checksums to determine if there have been any
local modifications.
.It Fl b
Location of reference files extracted from a binary distribution of
.Nx .
Note that reference files in
.Pa srcdir
will be altered and removed by
.Nm
when using the
.Fl b Ar srcdir
option (as the
.Pa srcdir
directory is treated like
.Pa temproot ) .
.It Fl h
Prints a help text.
.It Fl l
Automatically skip files with unchanged RCS IDs.
This has the effect of leaving alone files that have been altered
locally but which have not been changed in the 
reference files.
Since this works using RCS IDs, files without RCS IDs will not be
skipped even if only modified locally.
This flag may be used together with the
.Fl a
flag described above.
.It Fl p
The pager to use when displaying files.
By default this is
.Xr more 1
but it can be changed either with this option
or by defining the
.Ev PAGER
variable.
.It Fl s
The location of the
.Nx
sources files used to create the reference files.
By default this is
.Pa /usr/src/etc
but it can be changed either with this option
or the
.Ev SRCDIR
variable.
.It Fl t
Specifies the location of the
.Pa temproot
directory.
The temporary reference files created from
.Pa /usr/src/etc
will be stored there.
By default this is
.Pa /tmp/temproot
but can be changed either with this option or the
.Ev TEMPROOT
environment variable.
.It Fl v
Makes
.Nm
verbose about its actions.
.It Fl w
Sets screen width used during interactive merge.
By default this is the number of columns
.Xr stty 1
reports but it can be changed either with this
option or by defining the
.Ev WIDTH
variable.
This is useful for
.Xr xterm 1
users with wider shell windows.
.El
.Sh ENVIRONMENT
.Bl -tag -width TEMPROOT
.It Ev TEMPROOT
Sets a default value for
.Pa temproot .
See
.Fl t
above.
.It Ev SRCDIR
The location of the
.Nx
sources files.
See
.Fl s
above.
.It Ev PAGER
The pager to use when displaying files.
See
.Fl p
above.
.It Ev WIDTH
The screen width used during interactive merge.
See
.Fl w
above.
.It Ev IGNOREFILES
A list of files that
.Nm
should ignore.
Files listed in this
variable will never be considered for updating by
.Nm .
.El
.Sh FILES
The environment variables can also be defined in the following configuration
files.
The user's personal configuration file settings override the global
settings.
.Pp
/etc/etcupdate.conf
.Pp
~/.etcupdaterc
.Sh EXAMPLES
You have just upgraded your
.Nx
host from 1.6 to 1.6.1 and now it's time
to update the configuration files as well.
To update the configuration files from the sources (if you have the
.Pa /usr/src/etc
directory):
.Pp
.Dl etcupdate
.Pp
The default location of the source files is
.Pa /usr/src/etc
but this may be overridden with the
.Fl s Ar srcdir
command line argument:
.Pp
.Dl etcupdate -s /some/where/src/etc
.Pp
To update the configuration files from binary distribution sets
do something like this:
.Pp
.Dl mkdir /tmp/temproot
.Dl cd /tmp/temproot
.Dl tar xpzf /some/where/etc.tgz
.Dl etcupdate -b /tmp/temproot
.Pp
You have modified only few files in the
.Pa /etc
directory so you would like install most of the updates without being asked.
To automatically update the unmodified configuration files:
.Pp
.Dl etcupdate -a
.Pp
To get a better idea what's going on, use the
.Fl v
flag:
.Pp
.Dl etcupdate -v
.Sh SEE ALSO
.Xr cmp 1 ,
.Xr more 1 ,
.Xr rcs 1 ,
.Xr sdiff 1 ,
.Xr stty 1 ,
.Xr aliases 5
.Sh HISTORY
The
.Nm
command appeared in
.Nx 1.6 .
.Sh AUTHORS
The script was written by
.An Martti Kuparinen
.Aq martti@NetBSD.org
and improved by several other
.Nx
users.
.Pp
The idea for this script (including code fragments, variable names etc.)
came from the
.Fx
mergemaster (by Douglas Barton).
Unlike the
.Fx
mergemaster, this does not use CVS version tags by default to compare if
the files need to be updated.
Files are compared with
.Xr cmp 1
as this is more reliable and the only way if the version numbers are the
same even though the files are different.
.\" when exactly are the version the same even though the file changes?
.\" .Pp
.\" .Sh BUGS
.\" Because of the use of
.\" .Xr cmp 1
.\" to compare files, rather than CVS versions, files that are locally changed
.\" from the distribution are always considered needing to be updated.