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

Diff of /eclass/eutils.eclass

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

Revision 1.318 Revision 1.319
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.318 2009/08/26 21:47:56 vapier Exp $ 3# $Header: /var/cvsroot/gentoo-x86/eclass/eutils.eclass,v 1.319 2009/09/12 14:37:51 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
415# Small wrapper for getent (Linux), 415# Small wrapper for getent (Linux),
416# nidump (< Mac OS X 10.5), dscl (Mac OS X 10.5), 416# nidump (< Mac OS X 10.5), dscl (Mac OS X 10.5),
417# and pw (FreeBSD) used in enewuser()/enewgroup() 417# and pw (FreeBSD) used in enewuser()/enewgroup()
418egetent() { 418egetent() {
419 case ${CHOST} in 419 case ${CHOST} in
420 *-darwin[678])
421 case "$2" in
422 *[!0-9]*) # Non numeric
423 nidump $1 . | awk -F":" "{ if (\$1 ~ /^$2$/) {print \$0;exit;} }"
424 ;;
425 *) # Numeric
426 nidump $1 . | awk -F":" "{ if (\$3 == $2) {print \$0;exit;} }"
427 ;;
428 esac
429 ;;
420 *-darwin9) 430 *-darwin*)
421 local mytype=$1 431 local mytype=$1
422 [[ "passwd" == $mytype ]] && mytype="Users" 432 [[ "passwd" == $mytype ]] && mytype="Users"
423 [[ "group" == $mytype ]] && mytype="Groups" 433 [[ "group" == $mytype ]] && mytype="Groups"
424 case "$2" in 434 case "$2" in
425 *[!0-9]*) # Non numeric 435 *[!0-9]*) # Non numeric
427 ;; 437 ;;
428 *) # Numeric 438 *) # Numeric
429 local mykey="UniqueID" 439 local mykey="UniqueID"
430 [[ $mytype == "Groups" ]] && mykey="PrimaryGroupID" 440 [[ $mytype == "Groups" ]] && mykey="PrimaryGroupID"
431 dscl . -search /$mytype $mykey $2 2>/dev/null 441 dscl . -search /$mytype $mykey $2 2>/dev/null
432 ;;
433 esac
434 ;;
435 *-darwin*)
436 case "$2" in
437 *[!0-9]*) # Non numeric
438 nidump $1 . | awk -F":" "{ if (\$1 ~ /^$2$/) {print \$0;exit;} }"
439 ;;
440 *) # Numeric
441 nidump $1 . | awk -F":" "{ if (\$3 == $2) {print \$0;exit;} }"
442 ;; 442 ;;
443 esac 443 esac
444 ;; 444 ;;
445 *-freebsd*|*-dragonfly*) 445 *-freebsd*|*-dragonfly*)
446 local opts action="user" 446 local opts action="user"

Legend:
Removed from v.1.318  
changed lines
  Added in v.1.319

  ViewVC Help
Powered by ViewVC 1.1.20