Portage's pkg_setup() was run by both trigger_ebuild_preinstall and trigger_ebuild_postinstall triggers. So move the code to a stand-alone function.
Portage's pkg_setup() was run by both trigger_ebuild_preinstall and trigger_ebuild_postinstall triggers. So move the code to a stand-alone function.