On 01/02/2013 03:48 AM, Pacho Ramos wrote: > El mar, 01-01-2013 a las 16:01 -0800, Zac Medico escribió: >> On 01/01/2013 05:39 AM, Pacho Ramos wrote: >>> El mar, 01-01-2013 a las 14:32 +0100, Pacho Ramos escribió: >>>> pkg_postinst() { >>>> @@ -48,6 +56,8 @@ >>>> elog >>>> fi >>>> >>>> + echo ${CONFIGURATION_INSTRUCTIONS} | fmt | while read -s ELINE; do >>>> elog "${ELINE}"; done >>>> + >>>> # files/systemd/acpid.socket -> ListenStream=/run/acpid.socket >>>> mkdir -p "${ROOT}"/run >>>> >>>> This could probably be moved to eutils.eclass to use it on this kind of >>>> ebuilds >>> >>> Well, "elog" part should be behind: >>> if ! has_version "${CATEGORY}/${PN}"; then >>> echo ${CONFIGURATION_INSTRUCTIONS} | fmt | while read -s ELINE; do elog >>> "${ELINE}"; done >>> fi >>> >> >> Not that `has_version "${CATEGORY}/${PN}"` is always true in >> pkg_postinst, since the package is already installed. So, you should >> choose one of these alternatives for it to work as intended: >> >> 1) call has_version in pkg_preinst >> 2) use [[ ${REPLACING_VERSIONS} ]] instead >> > > Yeah, that is true (and looks like current acpid ebuild is buggy in > this). I wouldn't have any problem on either solution, but using first > one would work in all eapis, is there any reason for printing this kind > of messages in pkg_postinst?
If you need to use pkg_postinst for any reason, you can still call has_version in pkg_preinst and use a variable to store the result, like this: pkg_preinst() { has_version "${CATEGORY}/${PN}" has_version_result=$? } pkg_postinst() { if [ ${has_version_result} -eq 0 ] ; then elog "${CONFIGURATION_INSTRUCTIONS}" fi } -- Thanks, Zac