| 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.9 2011/11/03 15:29:39 vapier Exp $ |
3 | # $Header: /var/cvsroot/gentoo-x86/eclass/user.eclass,v 1.10 2011/11/04 13:08:23 naota 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) |
| … | |
… | |
| 76 | esac |
76 | esac |
| 77 | |
77 | |
| 78 | # lookup by uid/gid |
78 | # lookup by uid/gid |
| 79 | local opts |
79 | local opts |
| 80 | if [[ ${key} == [[:digit:]]* ]] ; then |
80 | if [[ ${key} == [[:digit:]]* ]] ; then |
| 81 | [[ ${action} == "user" ]] && opts="-u" || opts="-g" |
81 | [[ ${db} == "user" ]] && opts="-u" || opts="-g" |
| 82 | fi |
82 | fi |
| 83 | |
83 | |
| 84 | pw show ${action} ${opts} "${key}" -q |
84 | pw show ${db} ${opts} "${key}" -q |
| 85 | ;; |
85 | ;; |
| 86 | *-netbsd*|*-openbsd*) |
86 | *-netbsd*|*-openbsd*) |
| 87 | grep "${key}:\*:" /etc/${db} |
87 | grep "${key}:\*:" /etc/${db} |
| 88 | ;; |
88 | ;; |
| 89 | *) |
89 | *) |