3c2b458230
refers to tgz files or to a directory in which tgz files have already been extracted, make it an error for the files that should have come from etc.tgz to be missing. This is intended to prevent users from accidentally deleting necessary files when they run "postinstall -s xetc.tgz fix". Use the absence of .../etc/mtree/set.etc in the extracted directory as a test for the error case.
433 lines
11 KiB
Groff
433 lines
11 KiB
Groff
.\" $NetBSD: etcupdate.8,v 1.18 2008/10/04 08:07:38 apb Exp $
|
|
.\"
|
|
.\" Copyright (c) 2001-2008 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.
|
|
.\"
|
|
.\" 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 October 4, 2008
|
|
.Dt ETCUPDATE 8
|
|
.Os
|
|
.Sh NAME
|
|
.Nm etcupdate
|
|
.Nd update the configuration and startup files in
|
|
.Pa /etc
|
|
.Sh SYNOPSIS
|
|
.Nm
|
|
.Op Fl ahlv
|
|
.Op Fl p Ar pager
|
|
.Op Fl s Brq Ar srcdir | Ar tgzdir | Ar tgzfile
|
|
.Op Fl t Ar temproot
|
|
.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.
|
|
The user can also view the differences between the files.
|
|
By default, it shows the differences in the unified diff format.
|
|
The default format can be toggled to show the differences
|
|
in unified, context, or side by side formats or an user-defined
|
|
command may be used to view differences.
|
|
(And if
|
|
.Nm wdiff
|
|
is installed, it can also show differences on a word by word basis.)
|
|
.Pp
|
|
.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.
|
|
Finally,
|
|
.Nm
|
|
runs
|
|
.Xr postinstall 8
|
|
to check the results.
|
|
.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.)
|
|
Although this is the default mode, it is not recommended
|
|
(see the
|
|
.Dq BUGS
|
|
section).
|
|
.Pp
|
|
Instead of using sources, it is recommended that the user should extract
|
|
one or more binary distribution sets in a special location and use those
|
|
as the reference files (see usage of the
|
|
.Fl s Ar tgzdir
|
|
option later in this manual page),
|
|
or specify one or more binary distribution sets directly
|
|
(see usage of the
|
|
.Fl s Ar tgzfile
|
|
option later in this manual page).
|
|
.Pp
|
|
The following options are available:
|
|
.Bl -tag -width XXtXtemprootX
|
|
.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 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 Ar pager
|
|
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 Brq Ar srcdir | Ar tgzdir | Ar tgzfile
|
|
The location of the reference files, or the
|
|
.Nx
|
|
source files used to create the reference files.
|
|
This may be specified in one of three ways:
|
|
.Bl -tag -width XXsXtgzfileXX
|
|
.It Fl s Ar srcdir
|
|
The top level directory of the
|
|
.Nx
|
|
source tree.
|
|
By default this is
|
|
.Pa /usr/src
|
|
but it can be changed either with this option
|
|
or the
|
|
.Ev SRCDIR
|
|
variable.
|
|
The reference files will be created by running
|
|
.Dq "make distribution"
|
|
in the
|
|
.Ar srcdir Ns Pa /etc
|
|
directory.
|
|
Note that
|
|
.Ar srcdir
|
|
should refer to the top of the source directory tree;
|
|
earlier versions of
|
|
.Nm
|
|
expected
|
|
.Ar srcdir
|
|
to refer to the
|
|
.Pa etc
|
|
subdirectory within the source tree.
|
|
.It Fl s Ar tgzdir
|
|
A directory in which reference files have been
|
|
extracted from a binary distribution of
|
|
.Nx .
|
|
The files that are distributed in the
|
|
.Dq Pa etc.tgz
|
|
set file must be present.
|
|
The files that are distributed in the
|
|
.Dq Pa xetc.tgz
|
|
set file are optional.
|
|
The reference files from the specified directory will be copied to the
|
|
.Pa temproot
|
|
directory.
|
|
.It Fl s Ar tgzfile
|
|
The location of a set file
|
|
(or
|
|
.Dq "tgz file" )
|
|
such as
|
|
.Dq Pa etc.tgz
|
|
or
|
|
.Dq Pa xetc.tgz
|
|
from a binary distribution of
|
|
.Nx .
|
|
Each set file is a compressed archive containing reference files,
|
|
which will be extracted to the
|
|
.Pa temproot
|
|
directory.
|
|
Multiple
|
|
.Fl s
|
|
options may be used to specify multiple set files.
|
|
The
|
|
.Dq Pa etc.tgz
|
|
set file must be specified.
|
|
The
|
|
.Dq Pa xetc.tgz
|
|
set file is optional.
|
|
.El
|
|
.It Fl t Ar temproot
|
|
Specifies the location of the
|
|
.Pa temproot
|
|
directory.
|
|
This directory will be used for a temporary copy of
|
|
the reference files created by running
|
|
.Dq "make distribution"
|
|
in the source directory specified by
|
|
.Fl s Ar srcdir ,
|
|
or a temporary copy of the reference files extracted from
|
|
the binary sets specified by
|
|
.Fl s Ar tgzfile ,
|
|
or a temporary copy of the reference files from the directory specified by
|
|
.Fl s Ar tempdir .
|
|
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 Ar width
|
|
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 IGNOREFILESXX
|
|
.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 3.0 to 4.0 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
|
|
but this may be overridden with the
|
|
.Fl s Ar srcdir
|
|
command line argument:
|
|
.Pp
|
|
.Dl etcupdate -s /some/where/src
|
|
.Pp
|
|
To update the configuration files from binary distribution sets
|
|
do something like this:
|
|
.Pp
|
|
.Dl etcupdate -s /some/where/etc.tgz -s /some/where/xetc.tgz
|
|
.Pp
|
|
or like this:
|
|
.Pp
|
|
.Dl mkdir /tmp/temproot
|
|
.Dl cd /tmp/temproot
|
|
.Dl tar -xpzf /some/where/etc.tgz
|
|
.Dl tar -xpzf /some/where/xetc.tgz
|
|
.Dl etcupdate -s /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 ,
|
|
.Xr postinstall 8
|
|
.Sh HISTORY
|
|
The
|
|
.Nm
|
|
command appeared in
|
|
.Nx 1.6 .
|
|
.Pp
|
|
In
|
|
.Nx 4.0 ,
|
|
the
|
|
.Fl s Ar tgzfile
|
|
option was added, the
|
|
.Fl b Ar tempdir
|
|
option was converted to
|
|
.Fl s Ar tgzdir ,
|
|
and the
|
|
.Fl s Ar srcdir
|
|
option was changed to refer to the top of the
|
|
source directory tree rather than to the
|
|
.Pa etc
|
|
subdirectory.
|
|
.Pp
|
|
In
|
|
.Nx 5.0 ,
|
|
the the ability to specify multiple colon-separated files with a single
|
|
.Fl s
|
|
option was deprecated,
|
|
and options deprecated in
|
|
.Nx 4.0
|
|
were removed.
|
|
.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
|
|
If a source directory is specified via the
|
|
.Dq Fl s Ar srcdir
|
|
option (or if the
|
|
.Pa /usr/src
|
|
directory is used by default), then
|
|
.Nm
|
|
will run
|
|
.Dq "make distribution"
|
|
in the
|
|
.Pa etc
|
|
subdirectory of the source directory, but it will not use the same
|
|
options or environment variables that would be used during a full build
|
|
of the operating system.
|
|
For this reason, use of the
|
|
.Dq Fl s Ar srcdir
|
|
option is not recommended, and use of the
|
|
.Dq Fl s Ar tgzdir
|
|
or
|
|
.Dq Fl s Ar tgzfile
|
|
options is recommended.
|
|
.\" .Pp
|
|
.\" 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.
|