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

Diff of /eclass/portability.eclass

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

Revision 1.1 Revision 1.2
1# Copyright 1999-2005 Gentoo Foundation 1# Copyright 1999-2005 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/portability.eclass,v 1.1 2005/09/18 17:33:44 flameeyes Exp $ 3# $Header: /var/cvsroot/gentoo-x86/eclass/portability.eclass,v 1.2 2005/09/20 13:13:42 flameeyes Exp $
4# 4#
5# Author: Diego Pettenò <flameeyes@gentoo.org> 5# Author: Diego Pettenò <flameeyes@gentoo.org>
6# 6#
7# This eclass is created to avoid using non-portable GNUisms inside ebuilds 7# This eclass is created to avoid using non-portable GNUisms inside ebuilds
8# 8#
71 if [[ ${ELIBC} != *BSD ]]; then 71 if [[ ${ELIBC} != *BSD ]]; then
72 echo "-ldl" 72 echo "-ldl"
73 fi 73 fi
74} 74}
75 75
76# Gets the home directory for the specified user
77# it's a wrap around egetent as the position of the home directory in the line
78# varies depending on the os used.
79#
80# To use that, inherit eutils, not portability!
81egethome() {
82 ent=$(egetent passwd $1)
83
84 if [[ "${USERLAND}" == "Darwin" || "${ELIBC}" == "FreeBSD" ]]; then
85 # Darwin/OSX and FreeBSD uses position 9 to store the home dir
86 cut -d: -f9 <<<${ent}
87 else
88 # Linux and NetBSD uses position 6 instead
89 cut -d: -f6 <<<${ent}
90 fi
91}

Legend:
Removed from v.1.1  
changed lines
  Added in v.1.2

  ViewVC Help
Powered by ViewVC 1.1.20