My life in Subversion

So, it seems that having all my projects in subversion just isn't enough for me, so here is a little gem: script which will, when placed in root of your repository, overlay all directories in that repository on your root directory (/).

Why would that be useful, you might ask? Well, did you ever wanted to track changes to configuration files? How about keeping in sync config files on two different machines? Does installation of your favourite project overwrite your custom changes (or additions)?

All that can be solved simply by creating svn repository and keeping your changes in it, like this:

svnadmin create /srv/svn-config
svn mkdir -m "track /etc" file:///srv/svn-config/etc/
svn mkdir -m "track /etc/init.d" file:///srv/svn-config/etc/init.d
svn import -m "add overlay script" file:///srv/svn-config/
Now we will create make temporary checkout (which can be deleted later):
cd /srv
svn co file:///srv/svn-config local-config
cd local-config
sudo ./

After this you can rm -Rf /srv/local-config if you don't want to have another copy on your disk (it was needed so that would know repository path and that might get fixed in some future version).

After that, your /etc and /etc/init.d directories are under svn control. You will probably have to use sudo to add files to svn (or fix permissions of .svn directories), but other than that it's simple svn add something, svn commit, svn diff routine.

I don't know why I didn't came up with this earlier. I remember reading about keeping of your home directory in subversion, but it all seemed so complicated. Only thing that I can object is those .svn directories. svk might be solution for that, but in some other post...