1 .\" Copyright (c) 1998-2003 Douglas Barton
2 .\" All rights reserved.
4 .\" Redistribution and use in source and binary forms, with or without
5 .\" modification, are permitted provided that the following conditions
7 .\" 1. Redistributions of source code must retain the above copyright
8 .\" notice, this list of conditions and the following disclaimer.
9 .\" 2. Redistributions in binary form must reproduce the above copyright
10 .\" notice, this list of conditions and the following disclaimer in the
11 .\" documentation and/or other materials provided with the distribution.
13 .\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
14 .\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
15 .\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
16 .\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
17 .\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
18 .\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
19 .\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
20 .\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
21 .\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
22 .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
25 .\" $FreeBSD: src/usr.sbin/mergemaster/mergemaster.8,v 1.5.2.12 2003/03/02 02:45:01 dougb Exp $
26 .\" $DragonFly: src/usr.sbin/mergemaster/mergemaster.8,v 1.5 2008/05/02 02:05:08 swildner Exp $
33 .Nd merge configuration files, et al during an upgrade
37 .Op Fl m Ar /path/to/sources
38 .Op Fl t Ar /path/to/temp/root
46 utility is a Bourne shell script which is designed to aid you
47 in updating the various configuration and other files
52 recommended that you back up your
54 directory before beginning this process.
57 .Pa /usr/src/etc/Makefile
58 to build a temporary root environment from
60 down, populating that environment with the various
62 You can specify a different source directory
65 command line option, or specify the destination
69 It then compares each file in that environment
70 to its installed counterpart.
71 When the script finds a
72 change in the new file, or there is no installed
73 version of the new file it gives you four options to
75 You can install the new file as is,
76 delete the new file, merge the old and new
77 files (as appropriate) using
79 or leave the file in the temporary root environment to
82 By default it creates the temporary root in
86 version $Id/$DragonFly strings for files that have them, deleting
87 the temporary file if the strings match.
89 no $Id string, or if the strings are different it
90 compares the files themselves.
92 also specify that the script ignore the $Id strings and
97 utility checks your umask and issues a warning for anything
98 other than 022. While it is not mandatory to grant
99 world read permissions for most configuration files, you
100 may run into problems without them.
102 umask other than 022 and experience trouble later this
104 .Pa /etc/master.passwd
105 is treated as a special case.
106 If you choose to install
107 this file or a merged version of it the file permissions
108 are always 600 (rw-------) for security reasons.
110 installing an updated version of this file you should
113 with the -p option to rebuild your password databases
117 The script uses the owner and group id's
118 that the files are created with by
119 .Pa /usr/src/etc/Makefile ,
120 and file permissions as specified by the umask.
121 Unified diffs are used by default to display any
122 differences unless you choose context diffs.
126 utility will source scripts that you specify right before
127 it starts the comparison, and after it's done running.
128 The easiest way to handle this is to place the path
129 to the script(s) in the appropriate variables in your
132 The script sourced before comparison is named in
133 .Ev MM_PRE_COMPARE_SCRIPT ,
134 and the one sourced after the script is done is
136 This is the recommended way to specify local modifications,
137 or files that you want to give special handling to.
138 This includes files that you want to be deleted without
140 Because the named scripts are sourced from within
142 all of the script's variables are available for use in
145 .Pa /etc/mergemaster.rc
146 which will be read before
148 Options specified on the command line are updated last,
149 and therefore can override both files.
151 The options are as follows:
154 Perform a strict comparison, diff'ing every pair of files.
155 This comparison is performed line by line,
156 without regard to CVS $Id's.
158 Use context diffs instead of unified diffs.
162 on a previously cleaned directory, skipping the creation of
163 the temporary root environment.
164 This option is compatible
165 with all other options.
167 Be more verbose about the process.
168 You should probably use
169 this option the first time you run
171 This option also gives you a list of files that exist
172 only in the installed version of
176 This option will leave all the files that
177 differ from the installed versions in the temporary directory
178 to be dealt with by hand.
181 directory exists, it creates a new one in a previously
182 non-existent directory.
183 This option unsets the verbose flag,
184 but is compatible with all other options.
188 Display usage and help information.
190 Automatically install any files that do not exist in the
191 destination directory.
194 Compares only files known to be essential to the success of
195 {build|install}world,
202 compares your rc.conf[.local] options to the defaults.
203 .It Fl m Ar /path/to/sources
204 Specify the path to the directory where you want to do the
206 (In other words, where your sources are, but -s was already
208 .It Fl t Ar /path/to/temp/root
209 Create the temporary root environment in
210 .Pa /path/to/temp/root
211 instead of the default
212 .Pa /var/tmp/temproot .
214 Add the date and time to the name of the temporary
216 If -t is specified, this option must
217 follow it if you want the date added too.
219 Specify a numeric umask.
222 Supply an alternate screen width to the
224 command in numbers of columns.
227 Specify the destination directory for the installed files.
234 environment variable if set.
239 specifies a program outside
243 without specifying the full path,
245 prompts you with options on how to proceed.
247 .Ev MM_PRE_COMPARE_SCRIPT
250 variables are used as described above.
251 Other variables that are used by the script internally
254 as described in more detail below.
256 .Bl -tag -width $HOME/.mergemasterrc -compact
257 .It Pa /etc/mergemaster.rc
258 .It Pa $HOME/.mergemasterrc
263 utility will . (source) these files if they exist.
265 will override rc file options.
266 .Pa $HOME/.mergemasterrc
268 .Pa /etc/mergemaster.rc .
270 with all values commented out:
272 # These are options for mergemaster, with their default values listed
273 # The following options have command line overrides
275 # Directory to install the temporary root environment into
276 #TEMPROOT='/var/tmp/temproot'
278 # Strict comparison bypasses the CVS $Id tests and compares every file
281 # Type of diff, such as unified, context, etc.
284 # Additional options for diff. This will get unset when using -s.
285 #DIFF_OPTIONS='-I$\&DragonFly:.*[$]' # Ignores CVS Id tags
287 # Verbose mode includes more details and additional checks
290 # Automatically install files that do not exist on the system already
293 # Compare /etc/rc.conf[.local] to /etc/defaults/rc.conf
296 # Sourcedir is the directory to do the 'make' in (where the new files are)
297 #SOURCEDIR='/usr/src/etc'
299 # The umask for mergemaster to compare the default file's modes to
302 # Specify the destination directory for the installed files
305 # The following options have no command line overrides
306 # For those who just cannot stand including the full path to PAGER
309 # If you set 'yes' above, make sure to include the PATH to your pager
310 #PATH=/bin:/usr/bin:/usr/sbin
312 # Don't compare the old and new motd files
315 # Specify the path to scripts to run before the comparison starts,
316 # and/or after the script has finished its work
317 #MM_PRE_COMPARE_SCRIPT=
321 Typically all you will need to do is type
323 at the prompt and the script will do all the work for you.
325 To use context diff's and have
327 explain more things as it goes along, use:
329 .Dl # mergemaster -cv
333 put the temporary root environment in
337 .Dl # mergemaster -t /usr/tmp/root
339 To specify a 110 column screen with a strict
342 .Dl # mergemaster -sw 110
344 Exit status is 0 on successful completion, or if the user bails out
345 manually at some point during execution.
347 Exit status is 1 if it fails for one of the following reasons:
349 Invalid command line option
351 Failure to create the temporary root environment
353 Failure to populate the temporary root
362 .Pa /usr/src/etc/Makefile
364 .%O http://www.FreeBSD.org/doc/handbook/makeworld.html
365 .%T The Cutting Edge (using make world)
371 utility was first publicly available on one of my
372 web pages in a much simpler form under the name
374 on 13 March 1998. The idea for creating the
375 temporary root environment comes from Nik Clayton's
376 make world tutorial which is referenced above.
378 This manual page and the script itself were written by
379 .An Douglas Barton Aq DougB@FreeBSD.org .
381 There are no known bugs.
382 Please report any problems,
383 comments or suggestions to the author.
385 improvements to this program have come from user