I have been reading about etckeeper
, but I can't work out if you can use it on any other directories other than /etc.
There seems to be no reference to /etc in any configuration file (that I can find) so I assue this is hard coded and you can't chose directories to monitor. Is this true? I'd like to also have it manage /opt. Can this be done?
It is right there in the man page.
etckeeper init -d /foo
etckeeper commit -d /foo 'message'
But as ErikA mentioned you could just as easily use git or your favorite DVCS directly.
Etckeeper is merely a wrapper for mercurial or git. It provides some nice hooks into package management tools to automatically grab a commit after updates, and optionally on a schedule. This additional functionality is most likely not needed outside of /etc.
Depending on your needs, I'd just use vanilla git (or any other version control tool you're familiar with). If needed, schedule regular commits via cron or as part of your application deployment process.
If you don't want to all the time provide "-d" you can put line:
into /etc/etckeeper/etckeeper.conf.
It's not in man, but it can be inferred from etckeeper script.