1 .\" Copyright (c) 1998-2011 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
32 .Nd merge configuration files, et al during an upgrade
37 .Op Fl -run-updates=[always|never]
38 .Op Fl m Ar /path/to/sources
39 .Op Fl t Ar /path/to/temp/root
43 .Op Fl A Ar Target architecture
44 .Op Fl D Ar /destdir/path
48 utility is a Bourne shell script which is designed to aid you
49 in updating the various configuration and other files
54 recommended that you back up your
56 directory before beginning this process.
60 to build a temporary root environment from
62 down, populating that environment with the various
64 You can specify a different source directory
67 command line option, or specify the destination
71 It then compares each file in that environment
72 to its installed counterpart.
73 When the script finds a
74 change in the new file, or there is no installed
75 version of the new file it gives you four options to
77 You can install the new file as is,
78 delete the new file, merge the old and new
79 files (as appropriate) using
81 or leave the file in the temporary root environment to
84 By default it creates the temporary root in
87 Version Control System (VCS) Id strings ($FreeBSD)
88 for files that have them, deleting
89 the temporary file if the strings match.
91 no Id string, or if the strings are different it
92 compares the files themselves.
94 also specify that the script ignore the Id strings and
95 compare every file with the
102 will install the new file for you if they differ only by
105 The merge menu option is designed to let you easily combine your
106 customizations from the old version of a file into the new one.
107 While you can use the merge function to incorporate changes from
108 files that you have not customized,
109 it is not recommended.
113 utility checks your umask and issues a warning for anything
115 While it is not mandatory to grant
116 world read permissions for most configuration files, you
117 may run into problems without them.
119 umask other than 022 and experience trouble later this
121 .Pa /etc/master.passwd
122 is treated as a special case.
123 If you choose to install
124 this file or a merged version of it the file permissions
125 are always 600 (rw-------) for security reasons.
127 installing an updated version of this file you should
132 option to rebuild your password databases
136 The script uses the owner and group ids
137 that the files are created with by
138 .Pa /usr/src/etc/Makefile ,
139 and file permissions as specified by the umask.
140 Unified diffs are used by default to display any
141 differences unless you choose context diffs.
145 utility will source scripts that you specify right before
146 it starts the comparison, and after it is done running.
147 The easiest way to handle this is to place the path
148 to the script(s) in the appropriate variables in your
151 The script sourced before comparison is named in
152 .Ev MM_PRE_COMPARE_SCRIPT ,
153 and the one sourced after the script is done is
155 This is the recommended way to specify local modifications,
156 or files that you want to give special handling to.
157 This includes files that you want to be deleted without
159 Because the named scripts are sourced from within
161 all of the script's variables are available for use in
164 .Pa /etc/mergemaster.rc
165 which will be read before
167 Options specified on the command line are updated last,
168 and therefore can override both files.
170 When the comparison is done if there are any files remaining
171 in the temproot directory they will be listed, and if the
173 option is not in use the user will be given the option of
174 deleting the temproot directory.
175 If there are no files remaining in the temproot directory
178 The options are as follows:
181 Perform a strict comparison, diffing every pair of files.
182 This comparison is performed line by line,
183 without regard to VCS Ids.
185 Use context diffs instead of unified diffs.
189 on a previously cleaned directory, skipping the creation of
190 the temporary root environment.
191 This option is compatible
192 with all other options.
194 Be more verbose about the process.
195 You should probably use
196 this option the first time you run
198 This option also gives you a list of files that exist
199 only in the installed version of
203 This option will leave all the files that
204 differ from the installed versions in the temporary directory
205 to be dealt with by hand.
208 directory exists, it creates a new one in a previously
209 non-existent directory.
210 This option unsets the verbose flag,
211 and is not compatible with
222 Display usage and help information.
224 Automatically install any files that do not exist in the
225 destination directory.
228 Compares only files known to be essential to the success of
229 {build|install}world,
233 If the files differ only by VCS Id ($FreeBSD)
234 install the new file.
239 compares your rc.conf[.local] options to the defaults.
241 Preserve files that you replace in
242 .Pa /var/tmp/mergemaster/preserved-files-<date> ,
243 or another directory you specify in your
247 Attempt to auto upgrade files that have not been user modified.
248 This option can be dangerous when there are critical changes
249 in the new versions that affect your running system.
250 .It Fl -run-updates=[always|never]
251 Specify always or never to run newaliases, pwd_mkdb, etc.
252 at the end of the comparison run.
253 If this option is omitted the default is to prompt the user
254 for each update as necessary.
255 .It Fl m Ar /path/to/sources
256 Specify the path to the directory where you want to do the
258 (In other words, where your sources are, but -s was already
260 In previous versions of
262 you needed to specify the path all the way to
264 Starting with r186678 you only need to specify the path to
267 will convert the path for you if you use the old method.
268 .It Fl t Ar /path/to/temp/root
269 Create the temporary root environment in
270 .Pa /path/to/temp/root
271 instead of the default
272 .Pa /var/tmp/temproot .
274 Add the date and time to the name of the temporary
278 is specified, this option must
279 follow it if you want the date added too.
281 Specify a numeric umask.
284 Supply an alternate screen width to the
286 command in numbers of columns.
288 .It Fl A Ar Target architecture
289 Specify an alternative
293 Specify the destination directory for the installed files.
300 environment variable if set.
305 specifies a program outside
309 without specifying the full path,
311 prompts you with options on how to proceed.
313 .Ev MM_PRE_COMPARE_SCRIPT
316 variables are used as described above.
317 Other variables that are used by the script internally
320 as described in more detail below.
322 .Bl -tag -width $HOME/.mergemasterrc -compact
323 .It Pa /etc/mergemaster.rc
324 .It Pa $HOME/.mergemasterrc
331 (source) these files if they exist.
333 will override rc file options.
334 .Pa $HOME/.mergemasterrc
336 .Pa /etc/mergemaster.rc .
338 with all values commented out:
340 # These are options for mergemaster, with their default values listed
341 # The following options have command line overrides
343 # The target architecture (-A, unset by default)
344 #ARCHSTRING='TARGET_ARCH=<foo>'
346 # Sourcedir is the directory to do the 'make' in (-m)
347 #SOURCEDIR='/usr/src'
349 # Directory to install the temporary root environment into (-t)
350 #TEMPROOT='/var/tmp/temproot'
352 # Specify the destination directory for the installed files (-D)
355 # Strict comparison skips the VCS Id test and compares every file (-s)
358 # Type of diff, such as unified, context, etc. (-c)
361 # Install the new file if it differs only by VCS Id ($FreeBSD, -F)
364 # Verbose mode includes more details and additional checks (-v)
367 # Automatically install files that do not exist on the system already (-i)
370 # Automatically upgrade files that have not been user modified (-U)
374 # Either always or never run newaliases, pwd_mkdb at the end (--run-updates)
377 # Compare /etc/rc.conf[.local] to /etc/defaults/rc.conf (-C)
380 # Preserve files that you replace (-P)
382 #PRESERVE_FILES_DIR=/var/tmp/mergemaster/preserved-files-`date +%y%m%d-%H%M%S`
384 # The umask for mergemaster to compare the default file's modes to (-u)
387 # The following options have no command line overrides
389 # Files to always avoid comparing
390 #IGNORE_FILES='/etc/motd /etc/printcap foo bar'
392 # Additional options for diff. This will get unset when using -s.
393 #DIFF_OPTIONS='-Bb' # Ignore changes in whitespace
395 # Location to store the list of mtree values for AUTO_UPGRADE purposes
398 # For those who just cannot stand including the full path to PAGER
401 # If you set 'yes' above, make sure to include the PATH to your pager
402 #PATH=/bin:/usr/bin:/usr/sbin
404 # Delete stale files in /etc/rc.d without prompting
405 #DELETE_STALE_RC_FILES=
407 # Specify the path to scripts to run before the comparison starts,
408 # and/or after the script has finished its work
409 #MM_PRE_COMPARE_SCRIPT=
413 Exit status is 0 on successful completion, or if the user bails out
414 manually at some point during execution.
416 Exit status is 1 if it fails for one of the following reasons:
418 Invalid command line option
420 Failure to create the temporary root environment
422 Failure to populate the temporary root
424 Presence of the 'nodev' option in
425 .Pa <DESTDIR>/etc/fstab
427 Failure to install a file
429 Typically all you will need to do is type
431 at the prompt and the script will do all the work for you.
433 To use context diffs and have
435 explain more things as it goes along, use:
437 .Dl # mergemaster -cv
441 put the temporary root environment in
445 .Dl # mergemaster -t /usr/tmp/root
447 To specify a 110 column screen with a strict
450 .Dl # mergemaster -sw 110
458 .Pa /usr/src/etc/Makefile
460 .%U http://www.FreeBSD.org/doc/en_US.ISO8859-1/books/handbook/makeworld.html
461 .%T The Cutting Edge (using make world)
467 utility was first publicly available on one of my
468 web pages in a much simpler form under the name
471 The idea for creating the
472 temporary root environment comes from Nik Clayton's
473 make world tutorial which is referenced above.
475 This manual page and the script itself were written by
476 .An Douglas Barton Aq Mt dougb@FreeBSD.org .