Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to manage /etc files #110

Open
a-sk opened this issue Mar 2, 2014 · 14 comments · May be fixed by #283
Open

How to manage /etc files #110

a-sk opened this issue Mar 2, 2014 · 14 comments · May be fixed by #283

Comments

@a-sk
Copy link
Contributor

a-sk commented Mar 2, 2014

Hello.

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

@dfc
Copy link

dfc commented Mar 3, 2014

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

@a-sk
Copy link
Contributor Author

a-sk commented Mar 3, 2014

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

@dfc
Copy link

dfc commented Mar 3, 2014

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

@alerque
Copy link
Collaborator

alerque commented Mar 3, 2014

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?

@a-sk
Copy link
Contributor Author

a-sk commented Mar 3, 2014

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.

@alerque
Copy link
Collaborator

alerque commented Mar 3, 2014

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.

@deweysasser
Copy link

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

@RichiH
Copy link
Owner

RichiH commented Mar 4, 2014

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.

@deweysasser
Copy link

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.

@RichiH
Copy link
Owner

RichiH commented Mar 4, 2014

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 RichiH mentioned this issue Mar 5, 2014
@nfarrar
Copy link

nfarrar commented Oct 25, 2014

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?

@alerque
Copy link
Collaborator

alerque commented Apr 2, 2021

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.

@RichiH
Copy link
Owner

RichiH commented Apr 2, 2021

CC @bremner for potential interest.

@hvhaugwitz
Copy link

hvhaugwitz commented Apr 2, 2021

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
7 participants