Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!

Bug 99466

Summary: asterisk ebuild adds group & user during src_install() stage instead of pkg_preinst()
Product: Gentoo Linux Reporter: Gabe <gwiebe>
Component: New packagesAssignee: voip herd (OBSOLETE) <voip+disabled>
Status: RESOLVED FIXED    
Severity: normal    
Priority: High    
Version: unspecified   
Hardware: All   
OS: Linux   
Whiteboard:
Package list:
Runtime testing required: ---

Description Gabe 2005-07-18 14:56:11 UTC
When emerging asterisk with the -G option, the environment for running asterisk
is not fully set up and therefore there is a "group & user does not exist"
error. From my observations, this is what is happening:

In the src_install() stage is where the ebuild creates the astrisk group and
user. But, when installing a binary directly, the src_unpack() compile() and
install() stages are skipped. As a result, the user does not get added.




Reproducible: Always
Steps to Reproduce:
1.emerge -G asterisk
2.
3.

Actual Results:  
asterisk is installed, but cannot run.

Expected Results:  
The ebuild should have a pkg_preinst() stage to add the group and user.  That
way, the step will always be done.
Comment 1 Gabe 2005-07-18 18:12:36 UTC
by taking these line out of the src_compile stage, the problem is gone:



pkg_preinst() {
        einfo "adding asterisk user and group"

        if [[ -z "$(egetent passwd asterisk)" ]]; then
                einfo "Adding asterisk user and group"
                enewgroup asterisk
                enewuser asterisk -1 /bin/false /var/lib/asterisk asterisk
        fi

        # fix permissions
        for x in spool run lib log; do
                chown -R asterisk:asterisk ${D}/var/${x}/asterisk
                chmod -R u=rwX,g=rX,o=     ${D}/var/${x}/asterisk
        done

        chown -R root:asterisk ${D}/etc/asterisk
        chmod -R u=rwX,g=rX,o= ${D}/etc/asterisk
}
Comment 2 Stefan Knoblich (RETIRED) gentoo-dev 2005-09-08 15:11:37 UTC
moved parts from src_install into pkg_preinst, thanks, fixed