On Tuesday, May 10, 2016 03:13:08 PM Neil Bothwick wrote:
> On Tue, 10 May 2016 14:44:58 +0200, J. Roeleveld wrote:
> > > You can define hooks in /etc/portage/bashrc and /etc/portage/env that
> > > are run at various stages of the ebuild. A post_install hook in
> > > /etc/portage/env/cat/ftp-server should do what you want.
> > > 
> > > https://dev.gentoo.org/~zmedico/portage/doc/portage.html#config-bashrc-e
> > > buil d-phase-hooks
> > 
> > Thank you for the reply. It gave me the keywords to search for.
> > 
> > If anyone else ever needs to write something similar, here is how I got
> > it to work:
> > 
> > =====
> > # cat /etc/portage/bashrc
> > 
> > #!/bin/bash
> > 
> > if [ "${EBUILD_PHASE}" = "postinst" ]
> > then
> > 
> >   if [ "${CATEGORY}/${PN}" = "net-ftp/pure-ftpd" ]
> >   then
> >   
> >     cp /etc/openldap/schema/pureftpd.schema
> > 
> > /opt/packages/SHARED/etc/openldap/schema/pureftpd.schema
> > 
> >     echo "NOTE: LDAP Schema File copied."
> >   
> >   fi
> > 
> > fi
> > 
> > ======
> 
> Couldn't you do it with register_install_hook? I've not done it with that
> phase, but I have used hooks like this.
> 
> > This should be easy to adjust to needs.
> > 
> > Using /etc/portage/env doesn't work.
> 
> I think the approach there is to define pkg_postinst()
> in /etc/portage/cat/pkg, then that function is run after the install
> phase of the ebuild.
> 
> Something like
> 
> 
> pkg_postinst() {
>   cp /etc/openldap/schema/pureftpd.schema
>   /opt/packages/SHARED/etc/openldap/schema/pureftpd.schema
>   einfo "NOTE: LDAP Schema File copied."
> }
> 
> in /etc/portage/env/net-ftp/pure-ftpd

When I did that, it complained about the syntax.
Apparently, from what I read through google-searches, /etc/portage/env/... is 
handled by Python. And that doesn't, obviously, understand bash-syntax.

/etc/portage/bashrc is handled by Bash, which makes this possible.

The "pkg_postinst()" is for either ebuilds, or I am doing something wrong...

I am using the latest stable portage.

--
Joost

Attachment: signature.asc
Description: This is a digitally signed message part.

Reply via email to