1 |
On 01/02/2013 03:48 AM, Pacho Ramos wrote: |
2 |
> El mar, 01-01-2013 a las 16:01 -0800, Zac Medico escribió: |
3 |
>> On 01/01/2013 05:39 AM, Pacho Ramos wrote: |
4 |
>>> El mar, 01-01-2013 a las 14:32 +0100, Pacho Ramos escribió: |
5 |
>>>> pkg_postinst() { |
6 |
>>>> @@ -48,6 +56,8 @@ |
7 |
>>>> elog |
8 |
>>>> fi |
9 |
>>>> |
10 |
>>>> + echo ${CONFIGURATION_INSTRUCTIONS} | fmt | while read -s ELINE; do |
11 |
>>>> elog "${ELINE}"; done |
12 |
>>>> + |
13 |
>>>> # files/systemd/acpid.socket -> ListenStream=/run/acpid.socket |
14 |
>>>> mkdir -p "${ROOT}"/run |
15 |
>>>> |
16 |
>>>> This could probably be moved to eutils.eclass to use it on this kind of |
17 |
>>>> ebuilds |
18 |
>>> |
19 |
>>> Well, "elog" part should be behind: |
20 |
>>> if ! has_version "${CATEGORY}/${PN}"; then |
21 |
>>> echo ${CONFIGURATION_INSTRUCTIONS} | fmt | while read -s ELINE; do elog |
22 |
>>> "${ELINE}"; done |
23 |
>>> fi |
24 |
>>> |
25 |
>> |
26 |
>> Not that `has_version "${CATEGORY}/${PN}"` is always true in |
27 |
>> pkg_postinst, since the package is already installed. So, you should |
28 |
>> choose one of these alternatives for it to work as intended: |
29 |
>> |
30 |
>> 1) call has_version in pkg_preinst |
31 |
>> 2) use [[ ${REPLACING_VERSIONS} ]] instead |
32 |
>> |
33 |
> |
34 |
> Yeah, that is true (and looks like current acpid ebuild is buggy in |
35 |
> this). I wouldn't have any problem on either solution, but using first |
36 |
> one would work in all eapis, is there any reason for printing this kind |
37 |
> of messages in pkg_postinst? |
38 |
|
39 |
If you need to use pkg_postinst for any reason, you can still call |
40 |
has_version in pkg_preinst and use a variable to store the result, like |
41 |
this: |
42 |
|
43 |
pkg_preinst() { |
44 |
has_version "${CATEGORY}/${PN}" |
45 |
has_version_result=$? |
46 |
} |
47 |
|
48 |
pkg_postinst() { |
49 |
if [ ${has_version_result} -eq 0 ] ; then |
50 |
elog "${CONFIGURATION_INSTRUCTIONS}" |
51 |
fi |
52 |
} |
53 |
-- |
54 |
Thanks, |
55 |
Zac |