vcsh icon indicating copy to clipboard operation
vcsh copied to clipboard

How to manage /etc files

Open a-sk opened this issue 11 years ago • 14 comments

Hello.

Could you guys, tell me how to manage /etc files with vcsh, I didn't find any clean solution.

a-sk avatar Mar 02 '14 19:03 a-sk

I use etc-keeper. But its not a 1:1 feature mapping.

dfc avatar Mar 03 '14 02:03 dfc

I was thinking about etckeeper, will give it a try, thanks.

a-sk avatar Mar 03 '14 05:03 a-sk

I am not a git master so there is probably better ways to use etckeeper. I really just use etckeeper to see the diff between a file/directory on one machine and some other box.(NB: Normally I would not use a bug tracker for one product to talk about another project but rich might have a better way for both of us. Plus it might help someone else who thinks vcsh + /etc)

I set it up so that all of my machines push to a machine specific branch on the remote repository.

host1234 # git remote add keptetcs blah@blah
host1234 # git push keptetcs master:host1234

hostXYZ # git remote add keptetcs blah@blah
hostXYZ # git push keptetcs master:hostXYZ

Then I can see the differences:


hostXYZ # git fetch --all
hostXYZ # git diff keptetcs:host1234 daemon/daemon.conf

I have never used any actual git commands to change the files under etc. Most of the time a manual review of git diff ... is enough to remind me what I need to do. If there is a big difference I generate a patch and then apply the patch manually just because I am timid of screwing things up:


hostXYZ # git diff keptetcs:host1234 daemon/daemon.conf > /tmp/daemonconf.patch

dfc avatar Mar 03 '14 06:03 dfc

In theory you could hack a version on vcsh to not use the home dir and use /etc instead. I don't think you could do this without a modified source at this point.

Is there a reason not to use etcekeeper instead?

alerque avatar Mar 03 '14 07:03 alerque

I wanted to use one tool to manage home and /etc, I also wanted to manage /etc in a modular way, like I do with my $HOME right now.

Etckeeper is a great tool, but is manages /etc as a single entity. I will think about how to hack vcsh source to make it capable of managing not only $HOME.

a-sk avatar Mar 03 '14 08:03 a-sk

The major difference is that etckeeper has hooks to automate the process for whet you use a package manager. I would almost think it would be easier to fork etckeeper and add the ability to use fake roots and per-package repos using vcsh and myrepos as a guide than it would be to jury-rig vcsh to interface with the package manager. Of course if you want 100% manual control over etc then that is a non issue and a hacked version of vcsh could be pressed into service.

alerque avatar Mar 03 '14 08:03 alerque

On 03/03/2014 03:08 AM, Skurikhin Alexander wrote:

I wanted to use one tool to manage home and |/etc|, I also wanted to manage |/etc| in a modular way, like I do with my |$HOME| right now.

|Etckeeper| is a great tool, but is manages |/etc| as a single entity. I will think about how to hack |vcsh| source to make it capable of managing not only |$HOME|.

I would like vcsh to be able to do this. I have several use cases for managing multiple repos contributing to a single working directory that to not involve $HOME.

In fact, I was surprised by the attachment to $HOME -- I was expecting vcsh to ascend the directory tree until finding e.g. a ".vcsh" directory, similar to the way git does. When I first tried to use it (not on my home directory -- I wanted to play in a safe sandbox) I thought it wasn't working because the error message was not clear

BTW, when I realized the issue I simply ran "HOME=/tmp/test-vcsh bash" and it worked beautifully in my safe sandbox. Not that I want to discourage making vcsh more general, but I imagine you could use the same trick ("HOME=/etc vcsh ...") to manage files in /etc with vcsh.

Dewey

deweysasser avatar Mar 03 '14 17:03 deweysasser

That would be great!

I have a local branch that started work on supporting /etc, but it kinda died.

Most, maybe all, of this should already be possible with config files. If not, patching that in would be the best course of action.

RichiH avatar Mar 04 '14 16:03 RichiH

OK, I've written such a script to do this. It's a pretty trivial wrapper around vcsh.

RichiH, would you prefer me to push this to my own repo or would you like me to fork vcsh and give you a pull request? I've named it "vcsha" ("a" for "anywhere"). Or I can just mail it to you.

deweysasser avatar Mar 04 '14 16:03 deweysasser

I would prefer a proper fork, branch, pull request.

The goal should be to get this back into mainline vcsh, not to fork off.

RichiH avatar Mar 04 '14 17:03 RichiH

I've been playing around with etckeeper and boxen (OS X) for version controlling my etc files on OSX and Linux. Any updates on doing this with vcsh? Is it something you're interested in extending vcsh to do @RichiH, or should we be looking to other tools?

miseqsprime avatar Oct 25 '14 18:10 miseqsprime

I'd be happy to review work that make vcsh more flexible and robust at dealing with non-HOME base points. To this end I've re-opened #115 as #283 for further review.

For my own part I use etckeeper for /etc and am quite happy with it, but I can see the use case for some people and could see this being useful for other reasons.

If anybody else is still actively interested in working on this please feel free to jump in.

alerque avatar Apr 02 '21 08:04 alerque

CC @bremner for potential interest.

RichiH avatar Apr 02 '21 13:04 RichiH

FWIW one can use repo-specific configuration to manage /etc files with vcsh:

$ mkdir -p ~/.config/vcsh/config.d
$ echo "VCSH_BASE=/etc" > ~/.config/vcsh/config.d/etc
$ vcsh init etc
$ vcsh etc add /etc/login.defs
$ vcsh version
vcsh 1.20151229
git version 2.31.0

hvhaugwitz avatar Apr 02 '21 15:04 hvhaugwitz