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 $
32 .Nd merge configuration files, et al during an upgrade
36 .Op Fl m Ar /path/to/sources
37 .Op Fl t Ar /path/to/temp/root
45 utility is a Bourne shell script which is designed to aid you
46 in updating the various configuration and other files
51 recommended that you back up your
53 directory before beginning this process.
56 .Pa /usr/src/etc/Makefile
57 to build a temporary root environment from
59 down, populating that environment with the various
61 You can specify a different source directory
64 command line option, or specify the destination
68 It then compares each file in that environment
69 to its installed counterpart.
70 When the script finds a
71 change in the new file, or there is no installed
72 version of the new file it gives you four options to
74 You can install the new file as is,
75 delete the new file, merge the old and new
76 files (as appropriate) using
78 or leave the file in the temporary root environment to
81 By default it creates the temporary root in
85 version $Id/$DragonFly strings for files that have them, deleting
86 the temporary file if the strings match.
88 no $Id string, or if the strings are different it
89 compares the files themselves.
91 also specify that the script ignore the $Id strings and
96 utility checks your umask and issues a warning for anything
97 other than 022. While it is not mandatory to grant
98 world read permissions for most configuration files, you
99 may run into problems without them.
101 umask other than 022 and experience trouble later this
103 .Pa /etc/master.passwd
104 is treated as a special case.
105 If you choose to install
106 this file or a merged version of it the file permissions
107 are always 600 (rw-------) for security reasons.
109 installing an updated version of this file you should
112 with the -p option to rebuild your password databases
116 The script uses the owner and group id's
117 that the files are created with by
118 .Pa /usr/src/etc/Makefile ,
119 and file permissions as specified by the umask.
120 Unified diffs are used by default to display any
121 differences unless you choose context diffs.
125 utility will source scripts that you specify right before
126 it starts the comparison, and after it's done running.
127 The easiest way to handle this is to place the path
128 to the script(s) in the appropriate variables in your
131 The script sourced before comparison is named in
132 .Ev MM_PRE_COMPARE_SCRIPT ,
133 and the one sourced after the script is done is
135 This is the recommended way to specify local modifications,
136 or files that you want to give special handling to.
137 This includes files that you want to be deleted without
139 Because the named scripts are sourced from within
141 all of the script's variables are available for use in
144 .Pa /etc/mergemaster.rc
145 which will be read before
147 Options specified on the command line are updated last,
148 and therefore can override both files.
150 The options are as follows:
153 Perform a strict comparison, diff'ing every pair of files.
154 This comparison is performed line by line,
155 without regard to CVS $Id's.
157 Use context diffs instead of unified diffs.
161 on a previously cleaned directory, skipping the creation of
162 the temporary root environment.
163 This option is compatible
164 with all other options.
166 Be more verbose about the process.
167 You should probably use
168 this option the first time you run
170 This option also gives you a list of files that exist
171 only in the installed version of
175 This option will leave all the files that
176 differ from the installed versions in the temporary directory
177 to be dealt with by hand.
180 directory exists, it creates a new one in a previously
181 non-existent directory.
182 This option unsets the verbose flag,
183 but is compatible with all other options.
187 Display usage and help information.
189 Automatically install any files that do not exist in the
190 destination directory.
193 Compares only files known to be essential to the success of
194 {build|install}world,
201 compares your rc.conf[.local] options to the defaults.
202 .It Fl m Ar /path/to/sources
203 Specify the path to the directory where you want to do the
205 (In other words, where your sources are, but -s was already
207 .It Fl t Ar /path/to/temp/root
208 Create the temporary root environment in
209 .Pa /path/to/temp/root
210 instead of the default
211 .Pa /var/tmp/temproot .
213 Add the date and time to the name of the temporary
215 If -t is specified, this option must
216 follow it if you want the date added too.
218 Specify a numeric umask.
221 Supply an alternate screen width to the
223 command in numbers of columns.
226 Specify the destination directory for the installed files.
233 environment variable if set.
238 specifies a program outside
242 without specifying the full path,
244 prompts you with options on how to proceed.
246 .Ev MM_PRE_COMPARE_SCRIPT
249 variables are used as described above.
250 Other variables that are used by the script internally
253 as described in more detail below.
255 .Bl -tag -width $HOME/.mergemasterrc -compact
256 .It Pa /etc/mergemaster.rc
257 .It Pa $HOME/.mergemasterrc
262 utility will . (source) these files if they exist.
264 will override rc file options.
265 .Pa $HOME/.mergemasterrc
267 .Pa /etc/mergemaster.rc .
269 with all values commented out:
271 # These are options for mergemaster, with their default values listed
272 # The following options have command line overrides
274 # Directory to install the temporary root environment into
275 #TEMPROOT='/var/tmp/temproot'
277 # Strict comparison bypasses the CVS $Id tests and compares every file
280 # Type of diff, such as unified, context, etc.
283 # Additional options for diff. This will get unset when using -s.
284 #DIFF_OPTIONS='-I$\&DragonFly:.*[$]' # Ignores CVS Id tags
286 # Verbose mode includes more details and additional checks
289 # Automatically install files that do not exist on the system already
292 # Compare /etc/rc.conf[.local] to /etc/defaults/rc.conf
295 # Sourcedir is the directory to do the 'make' in (where the new files are)
296 #SOURCEDIR='/usr/src/etc'
298 # The umask for mergemaster to compare the default file's modes to
301 # Specify the destination directory for the installed files
304 # The following options have no command line overrides
305 # For those who just cannot stand including the full path to PAGER
308 # If you set 'yes' above, make sure to include the PATH to your pager
309 #PATH=/bin:/usr/bin:/usr/sbin
311 # Don't compare the old and new motd files
314 # Specify the path to scripts to run before the comparison starts,
315 # and/or after the script has finished its work
316 #MM_PRE_COMPARE_SCRIPT=
320 Exit status is 0 on successful completion, or if the user bails out
321 manually at some point during execution.
323 Exit status is 1 if it fails for one of the following reasons:
325 Invalid command line option
327 Failure to create the temporary root environment
329 Failure to populate the temporary root
331 Typically all you will need to do is type
333 at the prompt and the script will do all the work for you.
335 To use context diff's and have
337 explain more things as it goes along, use:
339 .Dl # mergemaster -cv
343 put the temporary root environment in
347 .Dl # mergemaster -t /usr/tmp/root
349 To specify a 110 column screen with a strict
352 .Dl # mergemaster -sw 110
361 .Pa /usr/src/etc/Makefile
363 .%O http://www.FreeBSD.org/doc/handbook/makeworld.html
364 .%T The Cutting Edge (using make world)
370 utility was first publicly available on one of my
371 web pages in a much simpler form under the name
373 on 13 March 1998. The idea for creating the
374 temporary root environment comes from Nik Clayton's
375 make world tutorial which is referenced above.
377 This manual page and the script itself were written by
378 .An Douglas Barton Aq Mt DougB@FreeBSD.org .
380 There are no known bugs.
381 Please report any problems,
382 comments or suggestions to the author.
384 improvements to this program have come from user