11

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?

3 Answers 3

19

It is right there in the man page.

  • Create a directory /foo
  • Initialize with etckeeper: etckeeper init -d /foo
  • Commit apply commits to the directory: etckeeper commit -d /foo 'message'

But as ErikA mentioned you could just as easily use git or your favorite DVCS directly.

3
  • Ah yes I see now, I just had to play around with this option a bit until I could get the behaviour I wanted. Thanks :)
    – Baldrick
    Aug 13, 2012 at 10:44
  • 3
    The reason for using etckeeper is that it keeps metadata like permissions for files. That makes it a very interesting upgrade to git for plenty of things. You can also wrap etckeeper -d /home/username in a bash/zsh/fish alias, then you could for example run homekeeper commit instead.
    – user68729
    Feb 5, 2015 at 19:44
  • 2
    I forked etckeeper to improve its capability to keep under version control (with a single Git repository) several paths under /. Now, this is a work in progress but you can find about it in github.com/hablutzel1/etckeeper#about-this-fork. Aug 24, 2020 at 17:34
5

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.

1
  • 1
    When using Git as the backing VCS, etckeeper is more than a merely wrapper, especially, it augments Git functionality by managing metadata that Git can't, e.g. it keeps track of empty folders and file ownership/permissions. Aug 24, 2020 at 17:32
4

If you don't want to all the time provide "-d" you can put line:

ETCKEEPER_DIR=/opt

into /etc/etckeeper/etckeeper.conf.
It's not in man, but it can be inferred from etckeeper script.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .