Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

Suppose some package foo...

$ apt-get install foo

..installs a dpkg blessed conffile /etc/foo.conf (ie package maintainer version)

Now suppose after the package is installed /etc/foo.conf is modifed, perhaps to add a line.

We would now like to get a diff between the package maintainer version of foo.conf and the current one (to see what local configuration changes were made).

What's the easiest way to do this?

One way would be to install the package in a chroot jail and then diff it to the clean one. Is there an easier way?

share|improve this question
add comment

2 Answers

After you have upgraded your packages, dpkg will save its new configuration file with a .dpkg-new suffix (if you chose to keep your own changes):

diff -u /etc/foo.conf /etc/foo.conf.dpkg-new

If you chose for overwriting your conffiles, it will be renamed and get a .dpkg-old suffix: diff -u /etc/foo.conf.dpkgold /etc/foo.conf

As tumbleweed said, you can also extract the .deb file. First you need to get the .deb file from somewhere and then you will be able to extract it. If you have not run apt-get clean before, you should have a .deb file already available in /var/cache/apt/archives/ which means that you can skip the apt-get download part and adjust the path for dpkg-deb -x accordingly.

apt-get download foo
dpkg-deb -x foo_<version>_<arch>.deb fs
diff -u fs/etc/foo.conf /etc/foo.conf
share|improve this answer
add comment

You could install etckeeper. It manages your /etc directory with a VCS, automatically committing before and after every time you use apt.

Or, you can extract the deb: dpkg-deb -x foo.deb foo, will dump its contents into the foo directory.

share|improve this answer
add comment

Your Answer

 
discard

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.