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?

jwbensley
  • 4,202
  • 11
  • 58
  • 90

3 Answers3

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.

Florian Heigl
  • 1,479
  • 12
  • 20
Zoredache
  • 130,897
  • 41
  • 276
  • 420
  • 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 :) – jwbensley Aug 13 '12 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. –  Feb 05 '15 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 https://github.com/hablutzel1/etckeeper#about-this-fork. – Jaime Hablutzel Aug 24 '20 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.

EEAA
  • 109,363
  • 18
  • 175
  • 245
  • 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. – Jaime Hablutzel Aug 24 '20 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.

Thomas
  • 4,225
  • 5
  • 23
  • 28
knightdave
  • 41
  • 1