[prev in list] [next in list] [prev in thread] [next in thread] 

List:       gentoo-dev
Subject:    RE: [gentoo-dev] What is insopts?
From:       Sean Mitchell <SMitchell () phoenix-interactive ! com>
Date:       2002-01-30 14:00:25
[Download RAW message or body]

I like this... it not only answers my user creation question but also
how/where to handle some of the setuid stuff. The only trouble is I'm not
sure how configure/make will like --with-mail-gid=mailman and
--with-cgi-gid=mailman if mailman doesn't exist until after the install.
I'll give it a go and see....

Cheers,

Sean

-----Original Message-----
From: Geert Bevin [mailto:gbevin@theleaf.be]
Sent: Wednesday, January 30, 2002 4:24 AM
To: gentoo-dev@gentoo.org
Subject: RE: [gentoo-dev] What is insopts?


Maybe adding a user creation funcitonality to pkg_config and pkg_postrm
is a good solution. It isn't executed automatically and it removes the
burned from the user to execute the exact commands, since some packages
need to even do more things afterwards, like changing permissions and
ownership, or even create multiple users.

example from a private package:
INSTALLDIR="/opt/${PN}
MYGRP="mygrp"
MYUSR="myusr"
pkg_config() {
        einfo "Creating ${MYGRP} group if needed <=="
        if [ ! `grep -x "^${MYGRP}:.*" /etc/group` ] ; then
                groupadd ${MYGRP};
        fi

        einfo "Creating ${MYUSR} user by deleting a previous existing
entry if needed <=="
        if [ `grep -x "^${MYUSR}:.*" /etc/passwd` ] ; then
                if [ -d ${INSTALLDIR} ] ; then
                        userdel -r ${MYUSR};
                else
                        userdel ${MYUSR};
                fi
        fi
        useradd -m -d ${INSTALLDIR} -g ${MYGRP} ${MYUSR}

        echo "==> Updating permissions and ownerships <=="
        chgrp root `dirname ${INSTALLDIR}`
        chmod 755 `dirname ${INSTALLDIR}`
        chown -Rf ${MYUSR}.${MYGRP} ${D}${INSTALLDIR}
        chmod -Rf 775 ${D}${INSTALLDIR}

}

pkg_postrm() {

        einfo "Removing ${MYUSR} user if needed <=="
        if [ `grep -x "^${MYUSR}:.*" /etc/passwd` ] ; then
                if [ -d ${INSTALLDIR} ] ; then
                        userdel -r ${MYUSR};
                else
                        userdel ${MYUSR};
                fi
        fi

}

On Tue, 2002-01-29 at 22:43, Martin Schlemmer wrote:
> On Tue, 2002-01-29 at 23:32, Sean Mitchell wrote:
> > Ah! 
> > 
> > Okay... is this because there's no sanctioned way to do it from an
ebuild?
> > Seems to me that /etc/passwd could get huge if we did this for any
package
> > that wants its own userid(s).
> > 
> > I'm thinking that I should just call useradd... anyone have wisdom to
the
> > contrary to offer?
> > 
> > On a bit of a tangent, I'm wondering if a qmail or maybe a maildir USE
> > variable wouldn't be justified as it can have a big impact on other
> > packages. Mailmail is going to require some tweaking for sure.
> > 
> 
> What I would have done, is create a pkg_postinst() like
> follow:
> 
> pkg_postinst() {
> 	if [ -z "`grep "mailman" /etc/passwd`" ] ; then
> 		echo
> 		echo "***************************************"
> 		echo "* Please create a user called mailman *"
> 		echo "***************************************"
> 	fi
> }
> 
> Or similar.  I for one do not want stuff just to mess with
> my config files without me knowing.  After all, Gentoo tries
> to be user friendly without crippeling the user ... and
> how much effort is it to creat the user exactly how you like
> it ?
> 
> 
> Greetings,
> 
> -- 
> 
> Martin Schlemmer
> Gentoo Linux Developer, Desktop Team Developer
> Cape Town, South Africa
> 
-- 
Geert Bevin
the Leaf sprl/bvba
"Use what you need"           Pierre Theunisstraat 1/47
http://www.theleaf.be         1030 Brussels
gbevin@theleaf.be             Tel & Fax +32 2 241 19 98

_______________________________________________
gentoo-dev mailing list
gentoo-dev@gentoo.org
http://lists.gentoo.org/mailman/listinfo/gentoo-dev

[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic