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

Diff of /eclass/portability.eclass

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

Revision 1.6 Revision 1.7
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.6 2005/12/14 18:46:50 flameeyes Exp $ 3# $Header: /var/cvsroot/gentoo-x86/eclass/portability.eclass,v 1.7 2005/12/14 19:52:22 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#
77 cut -d: -f6 <<<${ent} 77 cut -d: -f6 <<<${ent}
78 ;; 78 ;;
79 esac 79 esac
80} 80}
81 81
82# Gets the shell for the specified user
83# it's a wrap around egetent as the position of the home directory in the line
84# varies depending on the os used.
85#
86# To use that, inherit eutils, not portability!
87egetshell() {
88 ent=$(egetent passwd "$1")
89
90 case ${CHOST} in
91 *-darwin*|*-freebsd*|*-dragonfly*)
92 # Darwin, OSX, FreeBSD and DragonFly use position 9 to store homedir
93 cut -d: -f10 <<<${ent}
94 ;;
95 *)
96 # Linux, NetBSD and OpenBSD use position 6 instead
97 cut -d: -f7 <<<${ent}
98 ;;
99 esac
100}
101
102# Returns true if specified user has a shell that precludes logins
103# on whichever operating system.
104is-login-disabled() {
105 shell=$(egetshell "$1")
106
107 case ${shell} in
108 /bin/false|/usr/bin/false|/sbin/nologin|/usr/sbin/nologin)
109 return 0 ;;
110 *)
111 return 1 ;;
112 esac
113}
114
82# Gets the name of the BSD-ish make command (pmake from NetBSD) 115# Gets the name of the BSD-ish make command (pmake from NetBSD)
83# 116#
84# This will return make (provided by system packages) for BSD userlands, 117# This will return make (provided by system packages) for BSD userlands,
85# or bsdmake for Darwin userlands and pmake for the rest of userlands, 118# or bsdmake for Darwin userlands and pmake for the rest of userlands,
86# both of which are provided by sys-devel/pmake package. 119# both of which are provided by sys-devel/pmake package.

Legend:
Removed from v.1.6  
changed lines
  Added in v.1.7

  ViewVC Help
Powered by ViewVC 1.1.20