Gentoo Archives: gentoo-user

From: Neil Bothwick <neil@××××××××××.uk>
To: gentoo-user@l.g.o
Subject: Re: [SOLVED] [gentoo-user] Automatically copy a file to a different location after package install/update
Date: Tue, 10 May 2016 15:09:14
Message-Id: 20160510160824.2530f00b@hactar.digimed.co.uk
In Reply to: Re: [SOLVED] [gentoo-user] Automatically copy a file to a different location after package install/update by "J. Roeleveld"
1 On Tue, 10 May 2016 16:30:49 +0200, J. Roeleveld wrote:
2
3 > > pkg_postinst() {
4 > > cp /etc/openldap/schema/pureftpd.schema
5 > > /opt/packages/SHARED/etc/openldap/schema/pureftpd.schema
6 > > einfo "NOTE: LDAP Schema File copied."
7 > > }
8 > >
9 > > in /etc/portage/env/net-ftp/pure-ftpd
10 >
11 > When I did that, it complained about the syntax.
12 > Apparently, from what I read through
13 > google-searches, /etc/portage/env/... is handled by Python. And that
14 > doesn't, obviously, understand bash-syntax.
15
16 I definitely have bash in there.
17
18 > /etc/portage/bashrc is handled by Bash, which makes this possible.
19 >
20 > The "pkg_postinst()" is for either ebuilds, or I am doing something
21 > wrong...
22
23 You can define functions as for ebuilds to have them executed in here.
24 For example, for one package that I wanted to apply a patch
25 from /etc/portage/patches, but didn't call epatch_user from its ebuild,
26 I put this in /etc/portage/env/cat/pkg
27
28 post_src_unpack() {
29 cd "${S}"
30 epatch_user
31 }
32
33 > I am using the latest stable portage.
34
35 I'm using testing here, but have used this for years, so it worked with
36 versions older than the current stable.
37
38
39 --
40 Neil Bothwick
41
42 Things are more like they are now than they ever were before.

Replies