summaryrefslogtreecommitdiff
path: root/eclass
diff options
context:
space:
mode:
authorMike Frysinger <vapier@gentoo.org>2011-11-03 00:26:17 +0000
committerMike Frysinger <vapier@gentoo.org>2011-11-03 00:26:17 +0000
commitcdee26f78315d439cbbdcfec4e8ff5ef35b02175 (patch)
tree929debfc104d3b414e3bd5d697a3f1d7d045936a /eclass
parentclean up egetent style to make it clear how it works (diff)
downloadgentoo-2-cdee26f78315d439cbbdcfec4e8ff5ef35b02175.tar.gz
gentoo-2-cdee26f78315d439cbbdcfec4e8ff5ef35b02175.tar.bz2
gentoo-2-cdee26f78315d439cbbdcfec4e8ff5ef35b02175.zip
restore egethome as some packages in the tree have been parsing getent directly for this
Diffstat (limited to 'eclass')
-rw-r--r--eclass/portability.eclass3
-rw-r--r--eclass/user.eclass21
2 files changed, 21 insertions, 3 deletions
diff --git a/eclass/portability.eclass b/eclass/portability.eclass
index cdfb7a2c2002..36ff9a8bea7f 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.19 2011/10/31 17:39:52 vapier Exp $
+# $Header: /var/cvsroot/gentoo-x86/eclass/portability.eclass,v 1.20 2011/11/03 00:26:17 vapier Exp $
#
# Author: Diego Pettenò <flameeyes@gentoo.org>
#
@@ -129,6 +129,5 @@ get_mounts() {
}
_dead_portability_user_funcs() { die "if you really need this, please file a bug for base-system@gentoo.org"; }
-egethome() { _dead_portability_user_funcs; }
egetshell() { _dead_portability_user_funcs; }
is-login-disabled() { _dead_portability_user_funcs; }
diff --git a/eclass/user.eclass b/eclass/user.eclass
index 4631ca10e2ba..1ae623d38dbf 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.5 2011/11/03 00:24:19 vapier Exp $
+# $Header: /var/cvsroot/gentoo-x86/eclass/user.eclass,v 1.6 2011/11/03 00:26:17 vapier Exp $
# @ECLASS: user.eclass
# @MAINTAINER:
@@ -404,3 +404,22 @@ enewgroup() {
esac
export SANDBOX_ON="${oldsandbox}"
}
+
+# @FUNCTION: egethome
+# @USAGE: <user>
+# @DESCRIPTION:
+# Gets the home directory for the specified user.
+egethome() {
+ local pos
+
+ case ${CHOST} in
+ *-darwin*|*-freebsd*|*-dragonfly*)
+ pos=9
+ ;;
+ *) # Linux, NetBSD, OpenBSD, etc...
+ pos=6
+ ;;
+ esac
+
+ egetent passwd $1 | cut -d: -f${pos}
+}