Making mergemaster skip certain files

Giorgos Keramidas keramida at
Sat Nov 17 10:12:46 PST 2007

On 2007-11-16 22:34, "J. Porter Clark" <jpc at> wrote:
> Is there any way to keep certain files out of the reach of
> mergemaster?  I understand the need for carefully merging the
> old and the new, but I really shouldn't ever have to for files
> like these:
>   /etc/aliases
>   /etc/hosts
>   /etc/hosts.allow
>   /etc/manpath.config
>   ... and many others.

You can hook into mergemaster, using shell scripts.  See the manpage of
mergemaster for more details, but here's a short description of what I
use on my laptop for some time now:

1. A `.mergemasterrc' file in the HOME directory of the `root' user,
   which contains:


2. The `/root/' script contains the following:


        # NOTE: No PATH needed, because mm's PATH is already
	# draconian enough.

	# If TEMPROOT is not set, or it is set to a path which
	# resolves to the real root filesystem, abort early, before we
	# trash the config files of the installed root filesystem.

        if test -z "${TEMPROOT}" ; then
                echo >&2 "$0: error: TEMPROOT is unset or empty."
                exit 1
        p=`realpath "${TEMPROOT}"`
        if test "${p}" = '/' ; then
                echo >&2 "$0: error: TEMPROOT is the real root filesystem."
                exit 2

        case "${PRE_WORLD}" in
                # The following files always have local changes.
                # Remove them from ${TEMPROOT} to force mergemaster(8)
                # to ignore these files when comparing /etc directories.

                rm -f "${TEMPROOT}/.cshrc"
                rm -f "${TEMPROOT}/.profile"
                rm -f "${TEMPROOT}/root/.cshrc"
                rm -f "${TEMPROOT}/root/.profile"

                rm -f "${TEMPROOT}/etc/hosts"
                rm -f "${TEMPROOT}/etc/networks"

                rm -f "${TEMPROOT}/etc/motd"
                rm -f "${TEMPROOT}/etc/printcap"


More information about the freebsd-questions mailing list