Web lists-archives.com

Re: How do I trace changes in configuration files?




Den 2019-05-01 kl. 13:29, skrev Dan Purgert:
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA256

Erik Josefsson wrote:
I'm trying to learn how to set up my two Teres laptops so that they are
identical.

[...]

I have tried to document my personal preferences before, but I have
always ended up with unreadable handwritten notes.

This time I thought I should do it in a more systematic way by somehow
capture the difference between the default install and the result of my
(often irrational) efforts to make my machines look and feel like I want
it to.

So, is there a way to trace/record/capture changes in all configuration
files?

There are as many as people reading this channel :)

Probably the simplest (and, to some extent, most error prone) is to
simply make copies, edit only the copies. For example:

   cp orig.conf orig.conf.$(date +%y-%m-%d_%H%M%S)
   vi orig.conf

and then you'll end up with stuff like

   orig.conf
   orig.19-05-01_065356
   orig.19-05-01_104022
   (etc)

Then just use 'diff' against any two files to see what changed between
them.


Thanks Dan, I'll start with that method and maybe later I'll try Jonas' proposal with etckeeper and git.

But first, in which top level directories could files that change be located?

There are quite a few to choose from: bin, boot, dev, etc, home, lib, lib64, lost+found, media, mnt, opt, proc, root, run, sbin, srv, sys, tmp, usr and var.



Or you can use a revision tool. I ran across "rcs" a few years ago, and
while it's not something I always use, when I remember, it's pretty good
at what it does.

Either of these could be wrapped up in a little script --

   #!/bin/bash
   # 'rvi' - "revision-controlled" vi wrapper
   # create a backup then edit the original file

   cp -p "$1" "$1".$(date +%y-%m-%d_%H%M%S)
   vi "$1"

   ALTERNATE

   #!/bin/bash
   #'rvi' - revision control vi wrapper
   # use the 'rcs' tool to checkout/checkin files

   co -l "$1"
   vi "$1"
   ci -u "$1"

Personally I like vi, but if you don't, replace it with whatever your
editor of choice is.  The scripts probably have flaws that someone will
point out soon (like calling it with no file, or multiple files, etc).

The idea is then to just replace the default configuration files with
the files where my preferences have been saved.
As far as actually propagating changes, that gets a little more
difficult -- but if all the config files are in $HOME/.config ... well,
just use a cronjob to sync daily or something.


For now, I just want to see where (and if) my setup is stored (e.g. where does my wifi's SSID and passphrase end up? maybe in more than one place?).

Thanks for your help Dan!

//Erik