From: Geert Bevin <gbevin@theleaf.be>
To: gentoo-dev@gentoo.org
Subject: RE: [gentoo-dev] What is insopts?
Date: 30 Jan 2002 10:23:32 +0100 [thread overview]
Message-ID: <1012382612.778.9.camel@inspiron.theleaf.office> (raw)
In-Reply-To: <1012340650.18868.6.camel@nosferatu.lan>
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
next prev parent reply other threads:[~2002-01-30 9:24 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2002-01-29 21:32 [gentoo-dev] What is insopts? Sean Mitchell
2002-01-29 21:43 ` Martin Schlemmer
2002-01-30 9:23 ` Geert Bevin [this message]
-- strict thread matches above, loose matches on Subject: below --
2002-01-30 14:00 Sean Mitchell
2002-01-29 17:45 Sean Mitchell
2002-01-29 15:37 ` Chad M. Huneycutt
2002-01-29 21:22 ` Geert Bevin
2002-01-29 17:30 Sean Mitchell
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1012382612.778.9.camel@inspiron.theleaf.office \
--to=gbevin@theleaf.be \
--cc=gentoo-dev@gentoo.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox