Gentoo Archives: gentoo-dev

From: Joakim Tjernlund <joakim.tjernlund@×××××××××.se>
To: "gentoo-dev@l.g.o" <gentoo-dev@l.g.o>
Subject: Re: [gentoo-dev] Managing etc/* in an embbeded system
Date: Wed, 22 Jul 2015 14:59:31
Message-Id: 1437577159.10831.123.camel@transmode.se
In Reply to: Re: [gentoo-dev] Managing etc/* in an embbeded system by Jason Zaman
1 On Wed, 2015-07-22 at 22:38 +0800, Jason Zaman wrote:
2 > On Wed, Jul 22, 2015 at 01:20:10PM +0000, Joakim Tjernlund wrote:
3 > > On Wed, 2015-07-22 at 14:30 +0200, Michał Górny wrote:
4 > > >
5 > > > Joakim Tjernlund <joakim.tjernlund@×××××××××.se> napisał:
6 > > >
7 > > > > We got an embedded gentoo system where we need to manage many conf
8 > > > > files under /etc that we have
9 > > > > modified and should be under our control when an SW upgrade is
10 > > > > performed.
11 > > > >
12 > > > > Cloning every ebuild where we have modified its conf file(s) under /etc
13 > > > > feels awkward so
14 > > > > I am looking for some other way to do this automatically during SW
15 > > > > upgrade and I figured
16 > > > > this can not be an unique problem for us, so I wonder how other people
17 > > > > have solved this problem?
18 > > > > Our customers will not use emerge directly and we will provide binary
19 > > > > pkgs.
20 > > > >
21 > > > > Any ideas welcome :)
22 > > > >
23 > > > > Jocke
24 > > >
25 > > > Maybe post-phase hooks would help you. Not around a PC right now but I think they're described in
26 > > > portage.5.
27 > > > Long story short, you create per-package env files in /etc/portage/env (you can pin them generically or
28 > > > to a
29 > > > specific version, or package spec via package.env) and declare post_src_install() where you add your
30 > > > custom
31 > > > config files atop the package.
32 > > >
33 > >
34 > > hmm, that sounds interesting but I don't quite get what to do, you think I should copy over /etc/inittab
35 > > after
36 > > it has been installed by sys-apps/sysvinit with my own version(which is stored where?)
37 > >
38 > > This gave me an idea though:
39 > > In /etc/portage/env/install-mask.conf I add
40 > > INSTALL_MASK="${INSTALL_MASK} /etc/inittab /etc/xxx"
41 > > then in /etc/portage/package.env/install-mask
42 > > sys-apps/sysvinit install-mask.conf
43 > > sys-apps/xxx install-mask.conf
44 > > ...
45 > > (Can I do this from my own custom profile instead? how?)
46 > >
47 > > This should prevent sys-apps/sysvinit to install conf files I want to manage, right?
48 > >
49 > > Then I create my own new ebuild holding all config files I have changed myself.
50 >
51 > Or you can put a script in /etc/portage/hooks/install/, it will get run
52 > after src_install() during generation of VDB and all that, you could
53 > probably move everything from /etc/ to /etc-orig/ then all packages will
54 > be have things set there, then put your own files in /etc and you can
55 > always refer to /etc-orig/ or even use overlayfs or something to mount
56 > your files on top so they cover the package ones.
57
58 This also seems viable, need to look at hooks and such though. Are such hooks native to portage?
59
60 Jocke