Ah, a Saturday morning that I should spend studying for my exam on Wednesday... What better thing to do than get all my important config files under version control?
To get all my config files under version control, I:
- Moved all my important config files to ~/.config/
- Put ~/.config/ under version control
- Wrote a script to make links from ~/.config/* to the Right Place (ie: ~/.config/vim -> ~/.vim)
- All my machines are in sync
So, the problem: I use three machines on a regular basis (my laptop, my server, my computer at work). I want to keep all my important config files in sync (ie: Bazaar and Vim). I'd also like to keep them under version control (version control is a good thing, right?) Can both happen at once? Well, with the magic of
bzr (or your favourite distributed version control tool), it turns out they can
The first step was to collect everything into one place. I moved the files I'm going to care about (in this case,
~/.config and put that under version control:
cd ~/.config; bzr init; bzr add * (it's worth noting that I had some problems with a couple of the bzr plugins which were under version control... Bzr didn't want to add them to my repository because they themselves were repositories. That problem was fixed with a quick
rm -r <plugin>/.bzr though).
The next step was replacing the old config files with links to the new (versioned) ones. That was nothing a simple shell script couldn't solve, though (take a look at install_links.sh if you're interested in now it works).
Beautiful. Everything is versioned, I've just got to distribute it.
Bazaar (and just about every other distributed VCS out there) has some wonderful facilities to push/pull it's repositories. All it took was a quick
bzr push sftp://wolever.net:443/home/wolever/.config/ to move it over, then
sshing over, checking out the files and installing the links:
$ ssh wolever.net $ cd .config $ bzr co . $ ./install_links
Finally, I put a link to the repository in a web-facing directory (http://wolever.net/~wolever/conf) so I could grab it from my work machine using
bzr get http://wolever.net/~wolever/conf/ ~/.my_config (I have to use
~/.my_config because some program (I suspect XFCE) is using
And that's all there is to it