1 |
-- Romans Malinovskis <romans@××××.lv> spake thusly: |
2 |
|
3 |
>> I've implemented a new feature for Portage which alters the way it |
4 |
>> handles config-protected files. Instead of creating ._cfg????_* |
5 |
>> files, it copies installed config files to a tree under |
6 |
>> /var/cache/edb/config_protect, keeping a separate copy for each |
7 |
>> version installed and cleaning out old versions as config files are |
8 |
>> updated (using etc-update). |
9 |
> |
10 |
> Just an idea: |
11 |
> portage could keep origital config files in a seperate directory |
12 |
> structure (somewhere in /var), when i install a new version of |
13 |
> config file, it generates a patch(agains old original config) and |
14 |
> ask me, would i like to apply that patch to existing config in /etc.. |
15 |
|
16 |
That's pretty much what I'm doing. The scenario works like this (if |
17 |
config_automerge is enabled): |
18 |
|
19 |
emerge foo-1.0 (which has /etc/foo.conf) |
20 |
foo.conf -> /var/cache/edb/config_protect/etc/foo.conf/foo-1.0 |
21 |
foo.conf -> /etc |
22 |
|
23 |
emerge foo-1.1 (which has /etc/foo.conf) |
24 |
foo.conf -> /var/cache/edb/config_protect/etc/foo.conf/foo-1.1 |
25 |
diff /etc/foo.conf, /var/cache...foo-1.0 [no changes] |
26 |
foo.conf -> /etc |
27 |
delete /var/cache...foo-1.0 |
28 |
|
29 |
emerge foo-1.2 |
30 |
foo.conf -> /var/cache/edb/config_protect/etc/foo.conf/foo-1.2 |
31 |
diff /etc/foo.conf, /var/cache...foo-1.1 [changes] |
32 |
merge /etc/foo.conf, /var/cache...foo-1.1,foo-1.2 [success] |
33 |
=> result to /etc/foo.conf |
34 |
delete /var/cache...foo-1.1 |
35 |
|
36 |
emerge foo-1.3 |
37 |
foo.conf -> /var/cache/edb/config_protect/etc/foo.conf/foo-1.3 |
38 |
diff /etc/foo.conf, /var/cache...foo-1.2 [changes] |
39 |
merge /etc/foo.conf, /var/cache...foo-1.2,foo-1.3 [conflicts] |
40 |
Message "1 config file needs updating" |
41 |
run etc-update |
42 |
merge /etc/foo.conf, foo-1.2, foo-1.3 |
43 |
=> resolve conflicts |
44 |
=> result to /etc/foo.conf |
45 |
delete /var/cache...foo-1.2 |
46 |
|
47 |
If config_automerge is disabled, everything is the same except for the |
48 |
automatic update of foo.conf during foo-1.2. Then it's just a matter of |
49 |
doing it manually through etc-update. |
50 |
|
51 |
So far it's been serving me quite well. Updating packages like |
52 |
baselayout have generally required my intervention on at most one or |
53 |
two files (often none). The feature needs to be extensively tested, of |
54 |
course (messing up config files is not acceptable), but once it is I |
55 |
think it'll be a stellar addition. |
56 |
|
57 |
|
58 |
-- |
59 |
gentoo-dev@g.o mailing list |