Strategy for managing files in /etc, suggestions?
Chris Green
cl at isbd.net
Thu Dec 17 09:34:32 UTC 2020
On Thu, Dec 17, 2020 at 11:20:57AM +1100, Cameron Simpson wrote:
> On 16Dec2020 22:32, Chris Green <cl at isbd.net> wrote:
> >I use mercurial for managing all the little bash and python utilities
> >that I write for my various Linux systems and it's very handy.
> >
> >I'm thinking that it would be an excellent idea to keep track of
> >changes I do to system configuration files in /etc, I try to keep
> >these to a minimum but some are inevitable.
> >
> >What's the best way of handling this, changes to very few files in a
> >directory with (probably) thousands of files? Is it best simply to
> >copy them out to a development area, do changes there and copy them
> >back to /etc? I'm not entirely happy with this method but I can't
> >really see a better way.
>
> You could just change them in place, and keep the copied in a dev area.
> So:
>
> cd devdir
> hg init .
> mkdir etc
> cp -a /etc/hosts etc/
> hg add etc/hosts
> hg commit -m 'etc/hosts: original /etc/hosts' etc/hosts
> ... as root, modify /etc/hosts until happy ...
> cp -a /etc/hosts etc/
> hg commit -m 'etc/hosts: changed these things..."
>
> So don't use the dev area as the master, ise the OS as the master. Just
> use the dev area to keep records of the orignal and subsequent changes.
>
Yes, that's a reasonable way of doing it, thanks.
> Also, note that in many modern OS distros there are avenues to provide
> "additional" config files without treading on the originals. Usually
> some /etc/something.d directory where you can add your own files.
> Depends on the distro and the thing you're adjusting of course.
>
Yes, so upgrades don't overwrite them, it's still useful to keep tabs
on them though.
> >Does anyone else do anything like either of the above? ... or is my
> >OCD getting the better of me! :-)
>
> No, it is a sound approach. Particularly if you want to revert things.
> Or you do an OS update and need to compare the new venodr config against
> your costom one after the update. Etc.
>
Exactly, thank you for confirming I'm not totally mad. :-)
--
Chris Green
More information about the Mercurial
mailing list