Linux configs versioned

Sometimes it’s really fun to mess around on a Linux box – but it also can be a mess to get things back to a working state after breaking some configurations. As we are just talking about text files, things shouldn’t be too hard to do.

As a programmer I am used to revision control stuff like Subversion which offers exactly what we need. But how to do it?

The most simple way is doing it via a repository living in a different directory which we’ll be creating and connecting for use:

svnadmin create /path/to/etc-svn-repo
svn mkdir file:///path/to/etc-svn-repo/etc -m “Make a directory for /etc”
cd /etc
svn checkout file:///path/to/etc-svn-repo/etc .

Now we can add files:

svn add resolv.conf

… and check them in:

svn ci -m "adding resolv.conf"

To deal with files like .pwd.lock, we just ignore them using propset:

svn propset svn:ignore .pwd.lock .

As we changed stuff, we need to check in again. That’s pretty all of the magic we do. But keep your hands off the modprobe.d directory as the .svn directory in it gives some ugly error messages. Have fun testing, guys!


You may also like...

Leave a Reply

Your email address will not be published. Required fields are marked *

Notify me of followup comments via e-mail. You can also subscribe without commenting.