1 |
I like this... it not only answers my user creation question but also |
2 |
how/where to handle some of the setuid stuff. The only trouble is I'm not |
3 |
sure how configure/make will like --with-mail-gid=mailman and |
4 |
--with-cgi-gid=mailman if mailman doesn't exist until after the install. |
5 |
I'll give it a go and see.... |
6 |
|
7 |
Cheers, |
8 |
|
9 |
Sean |
10 |
|
11 |
-----Original Message----- |
12 |
From: Geert Bevin [mailto:gbevin@×××××××.be] |
13 |
Sent: Wednesday, January 30, 2002 4:24 AM |
14 |
To: gentoo-dev@g.o |
15 |
Subject: RE: [gentoo-dev] What is insopts? |
16 |
|
17 |
|
18 |
Maybe adding a user creation funcitonality to pkg_config and pkg_postrm |
19 |
is a good solution. It isn't executed automatically and it removes the |
20 |
burned from the user to execute the exact commands, since some packages |
21 |
need to even do more things afterwards, like changing permissions and |
22 |
ownership, or even create multiple users. |
23 |
|
24 |
example from a private package: |
25 |
INSTALLDIR="/opt/${PN} |
26 |
MYGRP="mygrp" |
27 |
MYUSR="myusr" |
28 |
pkg_config() { |
29 |
einfo "Creating ${MYGRP} group if needed <==" |
30 |
if [ ! `grep -x "^${MYGRP}:.*" /etc/group` ] ; then |
31 |
groupadd ${MYGRP}; |
32 |
fi |
33 |
|
34 |
einfo "Creating ${MYUSR} user by deleting a previous existing |
35 |
entry if needed <==" |
36 |
if [ `grep -x "^${MYUSR}:.*" /etc/passwd` ] ; then |
37 |
if [ -d ${INSTALLDIR} ] ; then |
38 |
userdel -r ${MYUSR}; |
39 |
else |
40 |
userdel ${MYUSR}; |
41 |
fi |
42 |
fi |
43 |
useradd -m -d ${INSTALLDIR} -g ${MYGRP} ${MYUSR} |
44 |
|
45 |
echo "==> Updating permissions and ownerships <==" |
46 |
chgrp root `dirname ${INSTALLDIR}` |
47 |
chmod 755 `dirname ${INSTALLDIR}` |
48 |
chown -Rf ${MYUSR}.${MYGRP} ${D}${INSTALLDIR} |
49 |
chmod -Rf 775 ${D}${INSTALLDIR} |
50 |
|
51 |
} |
52 |
|
53 |
pkg_postrm() { |
54 |
|
55 |
einfo "Removing ${MYUSR} user if needed <==" |
56 |
if [ `grep -x "^${MYUSR}:.*" /etc/passwd` ] ; then |
57 |
if [ -d ${INSTALLDIR} ] ; then |
58 |
userdel -r ${MYUSR}; |
59 |
else |
60 |
userdel ${MYUSR}; |
61 |
fi |
62 |
fi |
63 |
|
64 |
} |
65 |
|
66 |
On Tue, 2002-01-29 at 22:43, Martin Schlemmer wrote: |
67 |
> On Tue, 2002-01-29 at 23:32, Sean Mitchell wrote: |
68 |
> > Ah! |
69 |
> > |
70 |
> > Okay... is this because there's no sanctioned way to do it from an |
71 |
ebuild? |
72 |
> > Seems to me that /etc/passwd could get huge if we did this for any |
73 |
package |
74 |
> > that wants its own userid(s). |
75 |
> > |
76 |
> > I'm thinking that I should just call useradd... anyone have wisdom to |
77 |
the |
78 |
> > contrary to offer? |
79 |
> > |
80 |
> > On a bit of a tangent, I'm wondering if a qmail or maybe a maildir USE |
81 |
> > variable wouldn't be justified as it can have a big impact on other |
82 |
> > packages. Mailmail is going to require some tweaking for sure. |
83 |
> > |
84 |
> |
85 |
> What I would have done, is create a pkg_postinst() like |
86 |
> follow: |
87 |
> |
88 |
> pkg_postinst() { |
89 |
> if [ -z "`grep "mailman" /etc/passwd`" ] ; then |
90 |
> echo |
91 |
> echo "***************************************" |
92 |
> echo "* Please create a user called mailman *" |
93 |
> echo "***************************************" |
94 |
> fi |
95 |
> } |
96 |
> |
97 |
> Or similar. I for one do not want stuff just to mess with |
98 |
> my config files without me knowing. After all, Gentoo tries |
99 |
> to be user friendly without crippeling the user ... and |
100 |
> how much effort is it to creat the user exactly how you like |
101 |
> it ? |
102 |
> |
103 |
> |
104 |
> Greetings, |
105 |
> |
106 |
> -- |
107 |
> |
108 |
> Martin Schlemmer |
109 |
> Gentoo Linux Developer, Desktop Team Developer |
110 |
> Cape Town, South Africa |
111 |
> |
112 |
-- |
113 |
Geert Bevin |
114 |
the Leaf sprl/bvba |
115 |
"Use what you need" Pierre Theunisstraat 1/47 |
116 |
http://www.theleaf.be 1030 Brussels |
117 |
gbevin@×××××××.be Tel & Fax +32 2 241 19 98 |
118 |
|
119 |
_______________________________________________ |
120 |
gentoo-dev mailing list |
121 |
gentoo-dev@g.o |
122 |
http://lists.gentoo.org/mailman/listinfo/gentoo-dev |