The mergemaster utility is a Bourne shell script which is designed to aid you in updating the various configuration and other files associated with
.Fx . It is HIGHLY recommended that you back up your /etc directory before beginning this process.
The script uses /usr/src/etc/Makefile to build a temporary root environment from / down, populating that environment with the various files. You can specify a different source directory with the [-m] command line option, or specify the destination directory with the [-D] option. It then compares each file in that environment to its installed counterpart. When the script finds a change in the new file, or there is no installed version of the new file it gives you four options to deal with it. You can install the new file as is, delete the new file, merge the old and new files (as appropriate) using sdiff(1) or leave the file in the temporary root environment to merge by hand later.
By default it creates the temporary root in /var/tmp/temproot and compares the cvs(1) version $Id/$FreeBSD strings for files that have them, deleting the temporary file if the strings match. If there is no $Id string, or if the strings are different it compares the files themselves. You can also specify that the script ignore the $Id strings and compare every file.
The merge menu option is designed to let you easily combine your customizations from the old version of a file into the new one. While you can use the merge function to incorporate changes from files that you have not customized, it is not recommended.
The mergemaster utility checks your umask and issues a warning for anything other than 022. While it is not mandatory to grant world read permissions for most configuration files, you may run into problems without them. If you choose a umask other than 022 and experience trouble later this could be the cause. /etc/master.passwd is treated as a special case. If you choose to install this file or a merged version of it the file permissions are always 600 (rw-------) for security reasons. After installing an updated version of this file you should probably run pwd_mkdb(8) with the -p option to rebuild your password databases and recreate /etc/passwd.
The script uses the owner and group ids that the files are created with by /usr/src/etc/Makefile, and file permissions as specified by the umask. Unified diffs are used by default to display any differences unless you choose context diffs.
The mergemaster utility will source scripts that you specify right before it starts the comparison, and after it is done running. The easiest way to handle this is to place the path to the script(s) in the appropriate variables in your .mergemasterrc file. The script sourced before comparison is named in MM_PRE_COMPARE_SCRIPT, and the one sourced after the script is done is MM_EXIT_SCRIPT. This is the recommended way to specify local modifications, or files that you want to give special handling to. This includes files that you want to be deleted without being compared. Because the named scripts are sourced from within mergemaster, all of the scripts variables are available for use in your custom script. You can also use /etc/mergemaster.rc which will be read before .mergemasterrc. Options specified on the command line are updated last, and therefore can override both files.
The options are as follows: