On 11/29/2010 01:14 PM, Sebastian Pipping wrote:
> On 11/29/10 18:33, Zac Medico wrote:
>> You could also cancel it out, by checking the state in pkg_preinst and
>> saving it in an environment variable so that you can restore it in
>> pkg_postinst.
> 
> Could you show a mockup of that?
> I'm not really sure how that would work.
> 
> Would it work for pkg_postrm code of already installed packages?
> That would great to have.

Yes, hopefully something like this will do it:

pkg_preinst() {
        main_active_python=$(eselect python show)
}

pkg_postinst() {
        if [[ -n $main_active_python &&
                $main_active_python != $(eselect python show) ]] ; then
                einfo "restoring active python interpreter"
                eselect python set "$main_active_python"
        fi
}

-- 
Thanks,
Zac

Reply via email to