Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

When upgrading Ubuntu (and probably other *nixes), the upgrade process will show a diff of changed configuration files and ask whether I'd like to replace them, keep the old version, or manually merge them. I couldn't find any such programs with Google or searching through the Ubuntu packaging documentation. Do you know of any such programs which have the following features?

  • Few or no dependencies (ideally a single shell script).
  • Shell only (ideally without curses).
  • Does not try to be "clever," for example by automatically merging.

Edit: I've written this small thing to do some preliminary checks and ask the user what to do, but it's not very flexible or nice:

for path
    if [ ! -e "${path}.new" ]
        # No new revision; skip

    if [[ $(diff "${path}"{,.new} | grep '^[<>]' | grep -v '^[<>][[:space:]]*\(#\|START=\)' | wc -l) -eq 0 ]]
        # No interesting lines; skip

    diff -u "${path}"{,.new}

    unset action
    while [[ ! "${action-}" =~ ^[sr]$ ]]
        echo "Do you want to replace $path with ${path}.new?"
        read -s -n 1 -p $'[s]kip, [r]eplace: \n' action

    case "$action" in
            cp -v "${path}"{,.new}
            echo "Invalid action ${action}!"
            exit 2
share|improve this question
Just for clarification: which system are you on? Ubuntu? – phunehehe Nov 3 '11 at 11:57
@phunehehe: Linux from Scratch and Ubuntu. – l0b0 Nov 3 '11 at 12:13
I'd much rather leverage version control. In fact, I wish Debian packages systematically checked the upstream versions into a branch and let me set up a merge policy. Etckeeper goes part of the way with version control for /etc, but it doesn't record upstream versions, which means you can't go merges. – Gilles Nov 3 '11 at 22:45

I strongly suspect the program you've seen is dpkg the low-level of package management in Debian-ish distributions (using apt(itude)). see here for a blog post explaining its configuration file management.

You could probably hijack this function, i.e., create your own .deb packages - which, I suspect, might be pretty much hassle for what you're trying to achieve.

There's another way to go, you could have a look at NetBSD's etcupdate tool (while it's rather NetBSD-specific, you might find its source (shell script) interesting nonetheless). Apparently, Gentoo has an etc-update, too, but I could find neither sources nor more information (the link also mentions dispatch-conf, could be interesting, too; I don't know.)

share|improve this answer
etc-update is a bash script, and I have uploaded the copy on my machine. – phunehehe Nov 3 '11 at 15:43

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.