Gentoo Archives: gentoo-dev

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

Replies

Subject Author
Re: [gentoo-dev] Managing etc/* in an embbeded system Joakim Tjernlund <joakim.tjernlund@×××××××××.se>