1.\" $NetBSD: etcupdate.8,v 1.10 2003/04/02 19:30:57 wiz Exp $ 2.\" 3.\" Copyright (c) 2001 The NetBSD Foundation, Inc. 4.\" All rights reserved. 5.\" 6.\" This code is derived from software contributed to The NetBSD Foundation 7.\" by Martti Kuparinen. 8.\" 9.\" Redistribution and use in source and binary forms, with or without 10.\" modification, are permitted provided that the following conditions 11.\" are met: 12.\" 1. Redistributions of source code must retain the above copyright 13.\" notice, this list of conditions and the following disclaimer. 14.\" 2. Redistributions in binary form must reproduce the above copyright 15.\" notice, this list of conditions and the following disclaimer in the 16.\" documentation and/or other materials provided with the distribution. 17.\" 3. All advertising materials mentioning features or use of this software 18.\" must display the following acknowledgement: 19.\" This product includes software developed by the NetBSD 20.\" Foundation, Inc. and its contributors. 21.\" 4. Neither the name of The NetBSD Foundation nor the names of its 22.\" contributors may be used to endorse or promote products derived 23.\" from this software without specific prior written permission. 24.\" 25.\" THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS 26.\" ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED 27.\" TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 28.\" PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS 29.\" BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 30.\" CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 31.\" SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 32.\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 33.\" CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 34.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 35.\" POSSIBILITY OF SUCH DAMAGE. 36.\" 37.Dd April 2, 2003 38.Dt ETCUPDATE 8 39.Os 40.Sh NAME 41.Nm etcupdate 42.Nd update the configuration and startup files in 43.Pa /etc 44.Sh SYNOPSIS 45.Nm 46.Op Fl ahlv 47.Op Fl b Ar srcdir 48.Op Fl p Ar pager 49.Op Fl s Ar srcdir 50.Op Fl t Ar temproot 51.Op Fl w Ar width 52.Sh DESCRIPTION 53.Nm 54is a tool that lets the administrator update the configuration and 55startup files in 56.Pa /etc 57(and some other directories like 58.Pa /dev , 59.Pa /root 60and 61.Pa /var ) 62without having to manually check and modify every file. 63The administrator should run this script after performing an operating 64system update (e.g. after running 65.Pa make build 66in 67.Pa /usr/src 68or after extracting new binary distribution files) 69to update to the latest configuration and startup files. 70.Pp 71.Nm 72compares the new configuration files against the currently installed files. 73The user is given the option of installing, merging or deleting each 74modified or missing file. 75.Nm 76also detects if the user installs certain special files and performs 77corresponding tasks like remaking device nodes or rebuilding a database 78from the 79.Xr aliases 5 80file. 81.Pp 82.Nm 83needs a clean set of new configuration files to compare the 84existing files against. 85These files, called the 86.Dq reference files 87in this manual, may be derived from either a source or binary 88distribution of 89.Nx . 90.Pp 91If the user is updating from sources (which is the default mode), 92.Nm 93will first create a copy of the reference files 94by running 95.Pa make distribution 96in 97.Pa /usr/src/etc , 98installing the files to a so-called 99.Pa temproot . 100(See usage of the 101.Fl s Ar srcdir 102and 103.Fl t Ar temproot 104options later in this manual page.) 105.Pp 106Instead of using sources, the user can also extract one or more binary 107distribution sets in a special location and use those as the reference 108files (see usage of the 109.Fl b Ar srcdir 110option later in this manual page). 111.Pp 112The following options are available: 113.Bl -tag -width XXtXtemprootX 114.It Fl a 115.Nm 116can automatically update files which have not been modified locally. 117The 118.Fl a 119flag instructs 120.Nm 121to store MD5 checksums in 122.Pa /var/etcupdate 123and use these checksums to determine if there have been any 124local modifications. 125.It Fl b Ar srcdir 126Location of reference files extracted from a binary distribution of 127.Nx . 128Note that reference files in 129.Pa srcdir 130will be altered and removed by 131.Nm 132when using the 133.Fl b Ar srcdir 134option (as the 135.Pa srcdir 136directory is treated like 137.Pa temproot ) . 138.It Fl h 139Prints a help text. 140.It Fl l 141Automatically skip files with unchanged RCS IDs. 142This has the effect of leaving alone files that have been altered 143locally but which have not been changed in the 144reference files. 145Since this works using RCS IDs, files without RCS IDs will not be 146skipped even if only modified locally. 147This flag may be used together with the 148.Fl a 149flag described above. 150.It Fl p Ar pager 151The pager to use when displaying files. 152By default this is 153.Xr more 1 154but it can be changed either with this option 155or by defining the 156.Ev PAGER 157variable. 158.It Fl s Ar srcdir 159The location of the 160.Nx 161sources files used to create the reference files. 162By default this is 163.Pa /usr/src/etc 164but it can be changed either with this option 165or the 166.Ev SRCDIR 167variable. 168.It Fl t Ar temproot 169Specifies the location of the 170.Pa temproot 171directory. 172The temporary reference files created from 173.Pa /usr/src/etc 174will be stored there. 175By default this is 176.Pa /tmp/temproot 177but can be changed either with this option or the 178.Ev TEMPROOT 179environment variable. 180.It Fl v 181Makes 182.Nm 183verbose about its actions. 184.It Fl w Ar width 185Sets screen width used during interactive merge. 186By default this is the number of columns 187.Xr stty 1 188reports but it can be changed either with this 189option or by defining the 190.Ev WIDTH 191variable. 192This is useful for 193.Xr xterm 1 194users with wider shell windows. 195.El 196.Sh ENVIRONMENT 197.Bl -tag -width IGNOREFILESXX 198.It Ev TEMPROOT 199Sets a default value for 200.Pa temproot . 201See 202.Fl t 203above. 204.It Ev SRCDIR 205The location of the 206.Nx 207sources files. 208See 209.Fl s 210above. 211.It Ev PAGER 212The pager to use when displaying files. 213See 214.Fl p 215above. 216.It Ev WIDTH 217The screen width used during interactive merge. 218See 219.Fl w 220above. 221.It Ev IGNOREFILES 222A list of files that 223.Nm 224should ignore. 225Files listed in this 226variable will never be considered for updating by 227.Nm . 228.El 229.Sh FILES 230The environment variables can also be defined in the following configuration 231files. 232The user's personal configuration file settings override the global 233settings. 234.Pp 235/etc/etcupdate.conf 236.Pp 237~/.etcupdaterc 238.Sh EXAMPLES 239You have just upgraded your 240.Nx 241host from 1.6 to 1.6.1 and now it's time 242to update the configuration files as well. 243To update the configuration files from the sources (if you have the 244.Pa /usr/src/etc 245directory): 246.Pp 247.Dl etcupdate 248.Pp 249The default location of the source files is 250.Pa /usr/src/etc 251but this may be overridden with the 252.Fl s Ar srcdir 253command line argument: 254.Pp 255.Dl etcupdate -s /some/where/src/etc 256.Pp 257To update the configuration files from binary distribution sets 258do something like this: 259.Pp 260.Dl mkdir /tmp/temproot 261.Dl cd /tmp/temproot 262.Dl tar xpzf /some/where/etc.tgz 263.Dl etcupdate -b /tmp/temproot 264.Pp 265You have modified only few files in the 266.Pa /etc 267directory so you would like install most of the updates without being asked. 268To automatically update the unmodified configuration files: 269.Pp 270.Dl etcupdate -a 271.Pp 272To get a better idea what's going on, use the 273.Fl v 274flag: 275.Pp 276.Dl etcupdate -v 277.Sh SEE ALSO 278.Xr cmp 1 , 279.Xr more 1 , 280.Xr rcs 1 , 281.Xr sdiff 1 , 282.Xr stty 1 , 283.Xr aliases 5 284.Sh HISTORY 285The 286.Nm 287command appeared in 288.Nx 1.6 . 289.Sh AUTHORS 290The script was written by 291.An Martti Kuparinen 292.Aq martti@NetBSD.org 293and improved by several other 294.Nx 295users. 296.Pp 297The idea for this script (including code fragments, variable names etc.) 298came from the 299.Fx 300mergemaster (by Douglas Barton). 301Unlike the 302.Fx 303mergemaster, this does not use CVS version tags by default to compare if 304the files need to be updated. 305Files are compared with 306.Xr cmp 1 307as this is more reliable and the only way if the version numbers are the 308same even though the files are different. 309.\" when exactly are the version the same even though the file changes? 310.\" .Pp 311.\" .Sh BUGS 312.\" Because of the use of 313.\" .Xr cmp 1 314.\" to compare files, rather than CVS versions, files that are locally changed 315.\" from the distribution are always considered needing to be updated. 316