Gentoo Archives: gentoo-user

From: Harry Putnam <reader@×××××××.com>
To: gentoo-user@l.g.o
Subject: [gentoo-user] Re: tools currently available for update of etc files after updates
Date: Sat, 15 Nov 2008 23:06:25
Message-Id: 87iqqoh9nv.fsf@newsguy.com
In Reply to: [gentoo-user] tools currently available for update of etc files after updates by Harry Putnam
1 Lots of good input... thanks.
2
3 I did try `cfg-update' but I thought it was really slow. Ditto for
4 etc-update which I tried some time ago.
5
6 What made me ask about this was that I was beginning to think my home
7 made perl script was too slow and wondered if there was something a
8 little more sophisticated and fast.
9
10 Mostly because I'm used to using it I suppose, but the homely little
11 script seems much faster and convenient to me.
12
13 Here is what it does:
14
15 1) finds the new config files when fed a directory
16
17 2) presents them to the user like this:
18
19 ---------- 8< ---------- 8< ---------- 8< ----------
20
21
22 [...] snipped other built in explanatory dialog
23
24 Incoming </etc/._cfg0000_wgetrc>
25 Shall we install it as described; overwriting the existing one?
26
27 Anything but <y> will rename the new conf listed above to
28 /etc/START_STOP/NOUSE._cfg0000_wgetrc-111508_165416
29 for reference
30
31 **Take a look at the diffs before deciding if you need to**
32 diff /etc/._cfg0000_wgetrc /etc/wgetrc
33
34 [y/n] >
35
36 ---------- 8< ---------- 8< ---------- 8< ----------
37
38 So the program itself does no work on comparing and simply presents
39 a ready made diff command to be used in a separate terminal.
40
41 3) if you say `y' then the old config is overwritten, but first backed
42 up like this:
43 STOP-USE_whois.conf-111508_104703 (<= my own file dating system)
44 [date +"%m%d%y_%H%M%S"]
45 (Of course the date is arrived at a little differently in perl)
46 And the incoming new config is also backed up like:
47 START-USE._cfg0000_whois.conf-111508_104703
48
49 The backups all go into a directory `START_STOP' created by the
50 program in whatever directory the config is in.
51
52 [ so I do end up with that directory sprinkled around in a few
53 places ]
54
55 If you say `n'
56 the new config is dated and stored like:
57 NOUSE._cfg0000_syslog.conf_010107_202225
58
59 4) There is also a routine for when there is no old config.
60
61 This script is probably as poorly written as humanly possible since I'm
62 far from a perl programmer, and it is not sophisticated at all.
63
64 I wrote it quite a good while back and revised it a little a few times.
65 So I've used it quite a lot, and so far it hasn't eaten `/' or leveled
66 all /etc configs....
67
68 I find that the majority of new configs are either the
69 `*.example' variety or else a diff shows the changed lines are all
70 commented in both old or new, so a simple yes and move on.
71
72 A three pane merge in xxdiff like cfg-update does by default, seems
73 really clunky and somewhat overkill. Not to mention painfully slow.
74
75 With configs that need intervention, I'm usually able to get it done with a
76 simple diff and some hand work carried out in a different xterm or if
77 in text mode I'll be using `screen' and switch to a different terminal to do
78 the hand work, or even break out emacs and use its `ediff' tools on
79 the two files.
80
81 The perl script will have made backups of both for the advent of
82 mistakes.
83
84 Others here probably have vastly more complicated config files than
85 me, but with this little perl script I'm usually able to blaze thru
86 15-20 new configs in very short order.
87 I may have to do something by hand with 2-3 and occasionally I'll skip a
88 complicated one and deal with it after disposing all the easy ones.
89
90 I'm too embarrassed to post the script, but if someone really wants to
91 try it I will make it available. Be advised though that I haven't
92 paid much attention to security or other dangers...

Replies

Subject Author
Re: [gentoo-user] Re: tools currently available for update of etc files after updates Dirk Heinrichs <dirk.heinrichs@××××××.de>