Gentoo Archives: gentoo-user

From: "J. Roeleveld" <joost@××××××××.org>
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 12:45:16
Message-Id: 15401227.EOBxzO5h95@andromeda
In Reply to: Re: [gentoo-user] Automatically copy a file to a different location after package install/update by Neil Bothwick
1 On Tuesday, May 10, 2016 10:01:10 AM Neil Bothwick wrote:
2 > On Tue, 10 May 2016 10:53:03 +0200, J. Roeleveld wrote:
3 > > Currently, I have to manually remember to copy the schema across when I
4 > > update the ftp-server. Is there a way to set up a little script that
5 > > will automatically copy the schema file to a different location after a
6 > > successful install/update without having to patch the ebuild-files.
7 > > (manually copying is less error-prone)
8 >
9 > You can define hooks in /etc/portage/bashrc and /etc/portage/env that are
10 > run at various stages of the ebuild. A post_install hook in
11 > /etc/portage/env/cat/ftp-server should do what you want.
12 >
13 > https://dev.gentoo.org/~zmedico/portage/doc/portage.html#config-bashrc-ebuil
14 > d-phase-hooks
15
16 Thank you for the reply. It gave me the keywords to search for.
17
18 If anyone else ever needs to write something similar, here is how I got it to
19 work:
20
21 =====
22 # cat /etc/portage/bashrc
23
24 #!/bin/bash
25
26 if [ "${EBUILD_PHASE}" = "postinst" ]
27 then
28 if [ "${CATEGORY}/${PN}" = "net-ftp/pure-ftpd" ]
29 then
30 cp /etc/openldap/schema/pureftpd.schema
31 /opt/packages/SHARED/etc/openldap/schema/pureftpd.schema
32 echo "NOTE: LDAP Schema File copied."
33 fi
34 fi
35
36 ======
37
38 This should be easy to adjust to needs.
39
40 Using /etc/portage/env doesn't work.
41
42 --
43 Joost

Attachments

File name MIME type
signature.asc application/pgp-signature

Replies