diff options
-rw-r--r-- | eclass/portability.eclass | 3 | ||||
-rw-r--r-- | eclass/user.eclass | 23 |
2 files changed, 23 insertions, 3 deletions
diff --git a/eclass/portability.eclass b/eclass/portability.eclass index 36ff9a8bea7f..54c7619e308a 100644 --- a/eclass/portability.eclass +++ b/eclass/portability.eclass @@ -1,6 +1,6 @@ # Copyright 1999-2005 Gentoo Foundation # Distributed under the terms of the GNU General Public License v2 -# $Header: /var/cvsroot/gentoo-x86/eclass/portability.eclass,v 1.20 2011/11/03 00:26:17 vapier Exp $ +# $Header: /var/cvsroot/gentoo-x86/eclass/portability.eclass,v 1.21 2011/11/03 00:59:16 vapier Exp $ # # Author: Diego Pettenò <flameeyes@gentoo.org> # @@ -129,5 +129,4 @@ get_mounts() { } _dead_portability_user_funcs() { die "if you really need this, please file a bug for base-system@gentoo.org"; } -egetshell() { _dead_portability_user_funcs; } is-login-disabled() { _dead_portability_user_funcs; } diff --git a/eclass/user.eclass b/eclass/user.eclass index da8948723550..1d555872fdbb 100644 --- a/eclass/user.eclass +++ b/eclass/user.eclass @@ -1,6 +1,6 @@ # Copyright 1999-2011 Gentoo Foundation # Distributed under the terms of the GNU General Public License v2 -# $Header: /var/cvsroot/gentoo-x86/eclass/user.eclass,v 1.7 2011/11/03 00:35:07 vapier Exp $ +# $Header: /var/cvsroot/gentoo-x86/eclass/user.eclass,v 1.8 2011/11/03 00:59:16 vapier Exp $ # @ECLASS: user.eclass # @MAINTAINER: @@ -425,3 +425,24 @@ egethome() { egetent passwd $1 | cut -d: -f${pos} } + +# @FUNCTION: egetshell +# @USAGE: <user> +# @DESCRIPTION: +# Gets the shell for the specified user. +egetshell() { + local pos + + [[ $# -eq 1 ]] || die "usage: egetshell <user>" + + case ${CHOST} in + *-darwin*|*-freebsd*|*-dragonfly*) + pos=10 + ;; + *) # Linux, NetBSD, OpenBSD, etc... + pos=7 + ;; + esac + + egetent passwd "$1" | cut -d: -f${pos} +} |