[arch-general] Source control on /etc

Don deJuan donjuansjiz at gmail.com
Thu Feb 23 03:11:49 EST 2012


On 02/22/2012 11:48 PM, Alfredo Palhares wrote:
> 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
>
Awesome!! Thanks for that, I will have to read this throughly and give 
it a shot in the morning. I have read a few snips on detached worktree 
and was unsure if that was ideal for my want.

I will post back if I have more questions and again thanks for the in 
depth answer :D


More information about the arch-general mailing list