7

I used to have my system configuration files all in one directory for better management but now i need to use some version control on it.

But the problem is that git doesn't understand symbolic links that point to outside of the repository, and i can't invert the role ( having the real files on the repository and the symbolic links on their proper path ) since some files are read before the kernel loads.

I think that I can use unison to sync the files in the repo and and the their paths, but it's just not practical. And hard links will probably be broken. Any idea ?

sysadmin1138
  • 133,124
  • 18
  • 176
  • 300
Alfredo Palhares
  • 169
  • 1
  • 1
  • 2

4 Answers4

2

If manually is the only way those files are edited, you could put the canoncial versions into the system config dir and set up a post-commit hook in git that would copy them out to their 'real' locations.

pjz
  • 10,595
  • 1
  • 32
  • 40
2

On Debian and derived distributions, you can use etckeeper to manage /etc. It's as simple as installing etckeeper, running etckeeper init once and running etckeeper commit when you've changed something.

I don't know if etckeeper is directly available for Arch Linux, but there are success reports on the web.

Etckeeper uses git hooks to handle metadata such as permissions, ownership and symbolic links.

2

You can use the --work-tree flag and the --git-dir flag (git help git, set both to absolute paths and make an alias) to have the .git folder outside the versioned directory.

Tobu
  • 4,437
  • 1
  • 24
  • 31
-2

Make it hard links, and not soft links.

I have the same problem, I use etckeeper, and it copies my files into /etc, which I don't want.

So, instead of

ln -s /srv/www/site/apache.conf srv_site.com

do

ln /srv/www/site/apache.conf srv_site.com

and it works! :D

  • 1
    no hasrd links will be broken by git, actually i found the solution here : http://tensixtyone.com/perma/the-version-controlled-home-directory – Alfredo Palhares Sep 27 '10 at 11:10
  • The link in the previous comment by @AlfredoPalhares is broken, so we don't know what the solution was anymore. – ywarnier Jul 24 '18 at 16:21
  • 2
    @ywarnier Thank you archive.org for not letting internet die: https://web.archive.org/web/20120325085518/http://tensixtyone.com/perma/the-version-controlled-home-directory – Panayotis Feb 17 '20 at 00:11