1 |
Max Kalika wrote: |
2 |
|
3 |
> Quoting Rainer Groesslinger <scandium@g.o>: |
4 |
> |
5 |
> |
6 |
>>I know this issue has been brought up in the past (as I wrote), I just |
7 |
>>wanted to know if people are actively working on this or if it will take |
8 |
>>another few months since the "meta bug" for this isn't very active. |
9 |
> |
10 |
> |
11 |
> I tried to revive it a few times at some point, but folks are busy. Maybe |
12 |
> a GLEP would get things started moving in the right direction? |
13 |
> |
14 |
Hm, just read the comments on bug 8634 and eutils.eclass. I must be |
15 |
missing something but I can't see the problem ;). Some ebuilds need to |
16 |
be able to add users, hence they may specify at least a name and maybe a |
17 |
uid and other things like the shell... The system has to ensure, that |
18 |
names and uid's are unique (enewuser() does this for the name but not |
19 |
for the uid. adding this it quite trivial.) |
20 |
Why not use glibc's NSS via getent() to get all currently used |
21 |
names/uid's? That would solve all LDAP, NIS, WINBIND related problems: |
22 |
|
23 |
enewuser(){ |
24 |
local euser="$1"; shift |
25 |
if [ -z "{euser}" ];then |
26 |
eerror "No username specified !" |
27 |
die "Cannot call eneuser without a username." |
28 |
fi |
29 |
local euid="$1"; shift |
30 |
local realuser="$(getent passwd | grep ^${euser} | awk |
31 |
-F":" \ '{print $1}')" |
32 |
|
33 |
if [ "${euser}" == "${realuser}" ];then |
34 |
return 0 |
35 |
if [ ! -z ${euid} ] && [ ${euid} != "-1" ];then |
36 |
if [ "${euid}" -gt 0 ];then |
37 |
for e in $(getent passwd);do |
38 |
local curr_uid = "$(echo ${e}| awk -F":" '{print $3}')" |
39 |
if [ "${curr_uid}" == "${euid}" ];then |
40 |
eerror "uid ${euid} already in use." |
41 |
die "UID in use." |
42 |
fi |
43 |
done |
44 |
else |
45 |
eerror "Userid given but is not greater than 0 !" |
46 |
die "${euid} is not a valid UID" |
47 |
fi |
48 |
else |
49 |
euid = "next available" |
50 |
fi |
51 |
einfo " - Userid: ${euid} |
52 |
|
53 |
... |
54 |
... |
55 |
|
56 |
(All errors are mine ;). Comments? |
57 |
|
58 |
|
59 |
|
60 |
|
61 |
|
62 |
|
63 |
|
64 |
|
65 |
|
66 |
-- |
67 |
gentoo-dev@g.o mailing list |