/[gentoo-x86]/eclass/eutils.eclass
Gentoo

Diff of /eclass/eutils.eclass

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

Revision 1.309 Revision 1.310
1# Copyright 1999-2007 Gentoo Foundation 1# Copyright 1999-2007 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/eutils.eclass,v 1.309 2009/02/07 10:57:38 pva Exp $ 3# $Header: /var/cvsroot/gentoo-x86/eclass/eutils.eclass,v 1.310 2009/02/15 20:09:09 grobian Exp $
4 4
5# @ECLASS: eutils.eclass 5# @ECLASS: eutils.eclass
6# @MAINTAINER: 6# @MAINTAINER:
7# base-system@gentoo.org 7# base-system@gentoo.org
8# @BLURB: many extra (but common) functions that are used in ebuilds 8# @BLURB: many extra (but common) functions that are used in ebuilds
387# base-system@gentoo.org (Linux) 387# base-system@gentoo.org (Linux)
388# Joe Jezak <josejx@gmail.com> (OS X) 388# Joe Jezak <josejx@gmail.com> (OS X)
389# usata@gentoo.org (OS X) 389# usata@gentoo.org (OS X)
390# Aaron Walker <ka0ttic@gentoo.org> (FreeBSD) 390# Aaron Walker <ka0ttic@gentoo.org> (FreeBSD)
391# @DESCRIPTION: 391# @DESCRIPTION:
392# Small wrapper for getent (Linux), nidump (Mac OS X), 392# Small wrapper for getent (Linux),
393# nidump (< Mac OS X 10.5), dscl (Mac OS X 10.5),
393# and pw (FreeBSD) used in enewuser()/enewgroup() 394# and pw (FreeBSD) used in enewuser()/enewgroup()
394egetent() { 395egetent() {
395 case ${CHOST} in 396 case ${CHOST} in
397 *-darwin9)
398 local mytype=$1
399 [[ "passwd" == $mytype ]] && mytype="Users"
400 [[ "group" == $mytype ]] && mytype="Groups"
401 case "$2" in
402 *[!0-9]*) # Non numeric
403 dscl . -read /$mytype/$2 2>/dev/null |grep RecordName
404 ;;
405 *) # Numeric
406 local mykey="UniqueID"
407 [[ $mytype == "Groups" ]] && mykey="PrimaryGroupID"
408 dscl . -search /$mytype $mykey $2 2>/dev/null
409 ;;
410 esac
411 ;;
396 *-darwin*) 412 *-darwin*)
397 case "$2" in 413 case "$2" in
398 *[!0-9]*) # Non numeric 414 *[!0-9]*) # Non numeric
399 nidump $1 . | awk -F":" "{ if (\$1 ~ /^$2$/) {print \$0;exit;} }" 415 nidump $1 . | awk -F":" "{ if (\$1 ~ /^$2$/) {print \$0;exit;} }"
400 ;; 416 ;;

Legend:
Removed from v.1.309  
changed lines
  Added in v.1.310

  ViewVC Help
Powered by ViewVC 1.1.20