Versioning /etc with bzr for fun and profit

Since mid October I rented a room to Godog, here in Bologna (erm ... Italy :-)). Living with another DD so far has been utterly fun: our lives proceed normally, but when we occasionally met it's like hack time: brainstorming and implementation of the first hackish ideas that come to mind.

The first idea we deemed nice to be implemented has been versioning /etc of our server (which we co-administer) with bzr. The requirements we set forth where:

  1. who is changing stuff should be somehow forced to document and commit its changes;

  2. automatic changes performed by package upgrades should be automatically versioned.

Our current solution consists in a couple of hacks:

  • the plugin for bzr we wrote (to be put in ~/.bazaar/plugins/), which adds a snapshot command to bzr which takes a snapshot of the current status (i.e. it automatically adds all unknown files and commit changes, removals, ...);

  • the following hook in /etc/apt/apt.conf.d/

      DPkg::Post-Invoke { "cd /etc && bzr snapshot"; };
  • a loop at the end of .bash_profile for ensuring that root is not allowed to logout when pending changes have been left in /etc. Have a look at the end of our .bash profile.

What's next? Well, Enrico already set forth the idea of an housewarming bug squashing party with all DDs living in the Bologna area. Sounds cool!