| 1 | # Copyright 1999-2011 Gentoo Foundation |
1 | # Copyright 1999-2011 Gentoo Foundation |
| 2 | # Distributed under the terms of the GNU General Public License v2 |
2 | # Distributed under the terms of the GNU General Public License v2 |
| 3 | # $Header: /var/cvsroot/gentoo-x86/eclass/user.eclass,v 1.16 2011/11/29 19:31:20 vapier Exp $ |
3 | # $Header: /var/cvsroot/gentoo-x86/eclass/user.eclass,v 1.17 2011/11/29 19:32:23 vapier Exp $ |
| 4 | |
4 | |
| 5 | # @ECLASS: user.eclass |
5 | # @ECLASS: user.eclass |
| 6 | # @MAINTAINER: |
6 | # @MAINTAINER: |
| 7 | # base-system@gentoo.org (Linux) |
7 | # base-system@gentoo.org (Linux) |
| 8 | # Joe Jezak <josejx@gmail.com> (OS X) |
8 | # Joe Jezak <josejx@gmail.com> (OS X) |
| … | |
… | |
| 301 | fi |
301 | fi |
| 302 | |
302 | |
| 303 | # Some targets need to find the next available GID manually |
303 | # Some targets need to find the next available GID manually |
| 304 | _enewgroup_next_gid() { |
304 | _enewgroup_next_gid() { |
| 305 | if [[ ${egid} == *[!0-9]* ]] ; then |
305 | if [[ ${egid} == *[!0-9]* ]] ; then |
| 306 | # Non numeric |
306 | # Non numeric |
| 307 | for ((egid = 101; egid <= 999; egid++)) ; do |
307 | for ((egid = 101; egid <= 999; egid++)) ; do |
| 308 | [[ -z $(egetent group ${egid}) ]] && break |
308 | [[ -z $(egetent group ${egid}) ]] && break |
| 309 | done |
309 | done |
| 310 | fi |
310 | fi |
| 311 | } |
311 | } |
| … | |
… | |
| 329 | ;; |
329 | ;; |
| 330 | |
330 | |
| 331 | *) |
331 | *) |
| 332 | local opts |
332 | local opts |
| 333 | if [[ ${egid} == *[!0-9]* ]] ; then |
333 | if [[ ${egid} == *[!0-9]* ]] ; then |
| 334 | # Non numeric; let groupadd figure out a GID for us |
334 | # Non numeric; let groupadd figure out a GID for us |
| 335 | opts="" |
335 | opts="" |
| 336 | else |
336 | else |
| 337 | opts="-g ${egid}" |
337 | opts="-g ${egid}" |
| 338 | fi |
338 | fi |
| 339 | # We specify -r so that we get a GID in the system range from login.defs |
339 | # We specify -r so that we get a GID in the system range from login.defs |