[arch-general] Source control on /etc

Alfredo Palhares masterkorp at masterkorp.net
Thu Feb 23 02:48:15 EST 2012


Hello Don, 

Excerpts from Don deJuan's message of Thu Feb 23 07:35:52 +0100 2012:
> What is considered the Arch way to have version control over the configs 
> in /etc? I would like to be able to see at least a few changes back in 
> my config history at the minimum.

I too keep my /etc directory under version control. I have a a detached worktree. 
Wich enables me to have the .git directory outside of /etc. The process is simple: 

You create a bare repo:
$ mkdir etc.git
$ git init --bare
Now lets congigure it to chek the files elsewhere:
$ git config core.worktree /etc
And export these vars to you current session 
$ export GIT_DIR=/path/to/etc.git
$ export GIT_WORK_TREE=/etc

Tip here a script[1] easy to work it. Just rember to run it with "." or "source" 
*not* with "sh" since it open another bash session and kills it when script is done.

Now you would be able to git add and git commit in your etc while keeping it clean. :)

> I have seen the package etckeeper and it does not seem to really fully 
> be setup to work with pacman. Both AUR packages are very outdated.
etckeeper doesn't really fit pacman cause pacman doesn't merge files automatically, only
apt does that (if you silly enough to configure it to do that :p ). Also etckeeper commits 
all the files in /etc wich makes quite dummy commits. They not really resetable... 
I use use it on debian server only as the last resource.

The Arch way is quite simpler, every time you merge a pacnew or add a feature to a config file
you commit it and keep the same workflow as a normal code repo. Much simpler. 

> Would I just be best off just copying the ones I change and then push 
> the changes to a separate dir that is under control of say git? What 
> methods do you employ?
Well this is kinda hard to do (believe me i tried) Also having the .git on /etc and other dirs like
$HOME is quite anoying since i get the (branch) in red on my bash prompt[2].

I hope this can help you. 

[1] https://github.com/masterkorp/Home-files/blob/master/scripts/export_git.sh
[2] https://github.com/masterkorp/Home-files/blob/master/.bashrc

-- 
Regards, 
Alfredo Palhares


More information about the arch-general mailing list