1 |
On Tuesday, May 10, 2016 03:13:08 PM Neil Bothwick wrote: |
2 |
> On Tue, 10 May 2016 14:44:58 +0200, J. Roeleveld wrote: |
3 |
> > > You can define hooks in /etc/portage/bashrc and /etc/portage/env that |
4 |
> > > are run at various stages of the ebuild. A post_install hook in |
5 |
> > > /etc/portage/env/cat/ftp-server should do what you want. |
6 |
> > > |
7 |
> > > https://dev.gentoo.org/~zmedico/portage/doc/portage.html#config-bashrc-e |
8 |
> > > buil d-phase-hooks |
9 |
> > |
10 |
> > Thank you for the reply. It gave me the keywords to search for. |
11 |
> > |
12 |
> > If anyone else ever needs to write something similar, here is how I got |
13 |
> > it to work: |
14 |
> > |
15 |
> > ===== |
16 |
> > # cat /etc/portage/bashrc |
17 |
> > |
18 |
> > #!/bin/bash |
19 |
> > |
20 |
> > if [ "${EBUILD_PHASE}" = "postinst" ] |
21 |
> > then |
22 |
> > |
23 |
> > if [ "${CATEGORY}/${PN}" = "net-ftp/pure-ftpd" ] |
24 |
> > then |
25 |
> > |
26 |
> > cp /etc/openldap/schema/pureftpd.schema |
27 |
> > |
28 |
> > /opt/packages/SHARED/etc/openldap/schema/pureftpd.schema |
29 |
> > |
30 |
> > echo "NOTE: LDAP Schema File copied." |
31 |
> > |
32 |
> > fi |
33 |
> > |
34 |
> > fi |
35 |
> > |
36 |
> > ====== |
37 |
> |
38 |
> Couldn't you do it with register_install_hook? I've not done it with that |
39 |
> phase, but I have used hooks like this. |
40 |
> |
41 |
> > This should be easy to adjust to needs. |
42 |
> > |
43 |
> > Using /etc/portage/env doesn't work. |
44 |
> |
45 |
> I think the approach there is to define pkg_postinst() |
46 |
> in /etc/portage/cat/pkg, then that function is run after the install |
47 |
> phase of the ebuild. |
48 |
> |
49 |
> Something like |
50 |
> |
51 |
> |
52 |
> pkg_postinst() { |
53 |
> cp /etc/openldap/schema/pureftpd.schema |
54 |
> /opt/packages/SHARED/etc/openldap/schema/pureftpd.schema |
55 |
> einfo "NOTE: LDAP Schema File copied." |
56 |
> } |
57 |
> |
58 |
> in /etc/portage/env/net-ftp/pure-ftpd |
59 |
|
60 |
When I did that, it complained about the syntax. |
61 |
Apparently, from what I read through google-searches, /etc/portage/env/... is |
62 |
handled by Python. And that doesn't, obviously, understand bash-syntax. |
63 |
|
64 |
/etc/portage/bashrc is handled by Bash, which makes this possible. |
65 |
|
66 |
The "pkg_postinst()" is for either ebuilds, or I am doing something wrong... |
67 |
|
68 |
I am using the latest stable portage. |
69 |
|
70 |
-- |
71 |
Joost |