| 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.7 2011/11/03 00:35:07 vapier Exp $ |
3 | # $Header: /var/cvsroot/gentoo-x86/eclass/user.eclass,v 1.8 2011/11/03 00:59:16 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) |
| … | |
… | |
| 423 | ;; |
423 | ;; |
| 424 | esac |
424 | esac |
| 425 | |
425 | |
| 426 | egetent passwd $1 | cut -d: -f${pos} |
426 | egetent passwd $1 | cut -d: -f${pos} |
| 427 | } |
427 | } |
|
|
428 | |
|
|
429 | # @FUNCTION: egetshell |
|
|
430 | # @USAGE: <user> |
|
|
431 | # @DESCRIPTION: |
|
|
432 | # Gets the shell for the specified user. |
|
|
433 | egetshell() { |
|
|
434 | local pos |
|
|
435 | |
|
|
436 | [[ $# -eq 1 ]] || die "usage: egetshell <user>" |
|
|
437 | |
|
|
438 | case ${CHOST} in |
|
|
439 | *-darwin*|*-freebsd*|*-dragonfly*) |
|
|
440 | pos=10 |
|
|
441 | ;; |
|
|
442 | *) # Linux, NetBSD, OpenBSD, etc... |
|
|
443 | pos=7 |
|
|
444 | ;; |
|
|
445 | esac |
|
|
446 | |
|
|
447 | egetent passwd "$1" | cut -d: -f${pos} |
|
|
448 | } |