Saturday, March 03, 2012

Diffing Configs After an RPM install

Some daemon not starting?  Think you may have mucked with the config and you don't know how?  Let's talk about stashing your configs in an SCM, you lamer, or maybe doing a backup every month or so?  (ha, gotcha) For now, let's find out what you've done.
[root@gator ~]# mkdir /tmp/bz75819
[root@gator ~]# yumdownloader --destdir !$ `rpm -qf --qf "%{name}\n" /etc/httpd/conf/httpd.conf`
yumdownloader --destdir /tmp/bz75819 `rpm -qf --qf "%{name}\n" /etc/httpd/conf/httpd.conf`
[root@gator ~]# rpm2cpio /tmp/bz75819/*.rpm | cpio -tv | grep /etc/httpd/conf/httpd.conf
6573 blocks
-rw-r--r--   1 root     root        33726 Oct 20 14:05 ./etc/httpd/conf/httpd.conf
[root@gator ~]# rpm2cpio /tmp/bz75819/*.rpm | cpio -i --to-stdout */etc/httpd/conf/httpd.conf | diff -u - /etc/httpd/conf/httpd.conf
6573 blocks
--- -   2012-03-03 16:05:07.411845000 -0800
+++ /etc/httpd/conf/httpd.conf  2012-03-03 16:05:01.000000000 -0800
@@ -131,7 +131,7 @@
 # prevent Apache from glomming onto all bound IP addresses (0.0.0.0)
 #
 #Listen 12.34.56.78:80
-Listen 80
+#Listen 80

 #
 # Dynamic Shared Object (DSO) Support
So that's what you've done.  Yeah, it looks contrived, but I saw that this week.  So when I see it again this week, I know what to do.

Have you ever needed to find out just what you've changed in a config since a package has been installed?

Labels: , , , , , ,