1 |
On 11/29/2010 01:14 PM, Sebastian Pipping wrote: |
2 |
> On 11/29/10 18:33, Zac Medico wrote: |
3 |
>> You could also cancel it out, by checking the state in pkg_preinst and |
4 |
>> saving it in an environment variable so that you can restore it in |
5 |
>> pkg_postinst. |
6 |
> |
7 |
> Could you show a mockup of that? |
8 |
> I'm not really sure how that would work. |
9 |
> |
10 |
> Would it work for pkg_postrm code of already installed packages? |
11 |
> That would great to have. |
12 |
|
13 |
Yes, hopefully something like this will do it: |
14 |
|
15 |
pkg_preinst() { |
16 |
main_active_python=$(eselect python show) |
17 |
} |
18 |
|
19 |
pkg_postinst() { |
20 |
if [[ -n $main_active_python && |
21 |
$main_active_python != $(eselect python show) ]] ; then |
22 |
einfo "restoring active python interpreter" |
23 |
eselect python set "$main_active_python" |
24 |
fi |
25 |
} |
26 |
|
27 |
-- |
28 |
Thanks, |
29 |
Zac |