Gentoo Archives: gentoo-dev

From: Alexander Tsoy <alexander@××××.me>
To: gentoo-dev@l.g.o
Subject: Re: [gentoo-dev] [PATCH] fcaps.eclass: Group name portability
Date: Tue, 15 Apr 2014 08:13:16
Message-Id: 20140415121307.4a478171@home.puleglot
In Reply to: Re: [gentoo-dev] [PATCH] fcaps.eclass: Group name portability by Alexander Tsoy
1 В Tue, 15 Apr 2014 12:06:44 +0400
2 Alexander Tsoy <alexander@××××.me> пишет:
3
4 > В Tue, 15 Apr 2014 11:11:53 +0900
5 > Naohiro Aota <naota@g.o> пишет:
6 >
7 > > Diego Elio Pettenò <flameeyes@×××××××××.eu> writes:
8 > >
9 > > > I'm pretty sure we have an eclass function to get the name of the
10 > > > 0 group.
11 > >
12 > > I can't find one... but found qmail.eclass is using exactly same
13 > > method.
14 > >
15 > > > export GROUP_ROOT="$(id -gn root)"
16 >
17 > "id -gn root" prints initial group name of the user root. This is
18 > exactly what you want in fcaps.eclass. In linux "id" accepts only
19 > username as argument, it doesn't support uid.
20 >
21
22 But if you really want to convert gid=0 to groupname, then use egetent()
23 as also noted by Cyprien:
24
25 inherit user
26 ...
27 local group=$(egetent group 0)
28 group=${group%%:*}
29
30 --
31 Alexander Tsoy