Gentoo Archives: gentoo-dev

From: Mike Frysinger <vapier@g.o>
To: gentoo-dev@l.g.o
Subject: Re: [gentoo-dev] RFC: enewuser should force updates to shell and home
Date: Wed, 13 Jun 2012 19:04:55
Message-Id: 201206131504.07384.vapier@gentoo.org
In Reply to: Re: [gentoo-dev] RFC: enewuser should force updates to shell and home by Ian Stakenvicius
1 On Wednesday 13 June 2012 14:32:22 Ian Stakenvicius wrote:
2 > On 13/06/12 02:09 PM, Fabian Groffen wrote:
3 > > On 13-06-2012 12:00:16 -0400, Ian Stakenvicius wrote:
4 > >> Hey all - I'd like to propose that enewuser forces updates to a
5 > >> user's home dir and shell whenever it is called, so that if this
6 > >> changes with new versions of an ebuild it is dealt with
7 > >> automatically rather than having to modify them in
8 > >> pkg_postinst/pkg_setup directly.
9 > >
10 > > What if some admin purposely changed home or shell for a system
11 > > account? Would be quite annoying if every update would reset that,
12 > > wouldn't it?
13 >
14 > I considered this case, and that it might be more appropriate to
15 > duplicate 'enewuser' into a new call 'eforceuser' (or similar) which
16 > could be used instead of 'enewuser' in cases when the currently
17 > provided user settings should be forced.
18 >
19 > I decided against this as it seems also to make sense that users
20 > created by portage should be controlled by portage.
21
22 the users only get created by portage if they don't already exist. so i
23 wouldn't say that the user entries in /etc/passwd "belong" to portage.
24
25 > I suppose probably the best means of handling this would be to somehow
26 > detect whether or not the current user settings are default and only
27 > apply the updates if they are; however a means of doing that (which
28 > would be transparent to the ebuild) is somewhat beyond my knowledge
29 > and abilities.
30
31 we have egetshell and egethome already. thus it's fairly easy to detect the
32 transition case. if they installed the older version which set values that
33 you now want to change:
34 if has_version '<foo/pkg-3' && [[ $(egetshell user) == "/bad/shell" ]] ; then
35 esetshell user /good/shell
36 fi
37 if has_version '<foo/pkg-3' && [[ $(egethome user) == "/old/home" ]] ; then
38 esethome user /new/home
39 fi
40 -mike

Attachments

File name MIME type
signature.asc application/pgp-signature

Replies