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

Diff of /eclass/eutils.eclass

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

Revision 1.196 Revision 1.200
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/eutils.eclass,v 1.196 2005/09/06 01:59:22 vapier Exp $ 3# $Header: /var/cvsroot/gentoo-x86/eclass/eutils.eclass,v 1.200 2005/09/23 20:44:26 wolf31o2 Exp $
4# 4#
5# Author: Martin Schlemmer <azarah@gentoo.org> 5# Author: Martin Schlemmer <azarah@gentoo.org>
6# 6#
7# This eclass is for general purpose functions that most ebuilds 7# This eclass is for general purpose functions that most ebuilds
8# have to implement themselves. 8# have to implement themselves.
9# 9#
10# NB: If you add anything, please comment it! 10# NB: If you add anything, please comment it!
11 11
12inherit multilib 12inherit multilib portability
13 13
14DEPEND="!bootstrap? ( sys-devel/patch )" 14DEPEND="!bootstrap? ( sys-devel/patch )"
15# sys-apps/shadow is needed for useradd, etc, bug #94745. 15# sys-apps/shadow is needed for useradd, etc, bug #94745.
16 16
17DESCRIPTION="Based on the ${ECLASS} eclass" 17DESCRIPTION="Based on the ${ECLASS} eclass"
477 fi 477 fi
478 else 478 else
479 euid="next" 479 euid="next"
480 fi 480 fi
481 if [[ ${euid} == "next" ]] ; then 481 if [[ ${euid} == "next" ]] ; then
482 local pwrange 482 for euid in $(seq 101 999) ; do
483 if [[ ${USERLAND} == "BSD" ]] ; then
484 pwrange=$(jot 898 101)
485 else
486 pwrange=$(seq 101 999)
487 fi
488 for euid in ${pwrange} ; do
489 [[ -z $(egetent passwd ${euid}) ]] && break 483 [[ -z $(egetent passwd ${euid}) ]] && break
490 done 484 done
491 fi 485 fi
492 opts="${opts} -u ${euid}" 486 opts="${opts} -u ${euid}"
493 einfo " - Userid: ${euid}" 487 einfo " - Userid: ${euid}"
498 if [[ ! -e ${eshell} ]] ; then 492 if [[ ! -e ${eshell} ]] ; then
499 eerror "A shell was specified but it does not exist !" 493 eerror "A shell was specified but it does not exist !"
500 die "${eshell} does not exist" 494 die "${eshell} does not exist"
501 fi 495 fi
502 else 496 else
503 case ${USERLAND} in 497 for shell in /sbin/nologin /usr/sbin/nologin /bin/false /usr/bin/false /dev/null; do
504 Darwin) eshell="/usr/bin/false";; 498 [[ -x ${ROOT}${shell} ]] && break;
505 BSD) eshell="/usr/sbin/nologin";; 499 done
506 *) eshell="/bin/false";; 500
507 esac 501 if [[ ${shell} == "/dev/null" ]]; then
502 eerror "Unable to identify the shell to use"
503 die "Unable to identify the shell to use"
504 fi
505
506 eshell=${shell}
508 fi 507 fi
509 einfo " - Shell: ${eshell}" 508 einfo " - Shell: ${eshell}"
510 opts="${opts} -s ${eshell}" 509 opts="${opts} -s ${eshell}"
511 510
512 # handle homedir 511 # handle homedir
677 fi 676 fi
678 677
679 # If we need the next available 678 # If we need the next available
680 case ${egid} in 679 case ${egid} in
681 *[!0-9]*) # Non numeric 680 *[!0-9]*) # Non numeric
682 for egid in `jot 898 101`; do 681 for egid in $(seq 101 999); do
683 [ -z "`egetent group ${egid}`" ] && break 682 [ -z "`egetent group ${egid}`" ] && break
684 done 683 done
685 esac 684 esac
686 dscl . create /groups/${egroup} gid ${egid} 685 dscl . create /groups/${egroup} gid ${egid}
687 dscl . create /groups/${egroup} passwd '*' 686 dscl . create /groups/${egroup} passwd '*'
688 elif [[ "${USERLAND}" == "BSD" ]] ; then 687 elif [[ "${USERLAND}" == "BSD" ]] ; then
689 case ${egid} in 688 case ${egid} in
690 *[!0-9]*) # Non numeric 689 *[!0-9]*) # Non numeric
691 for egid in `jot 898 101`; do 690 for egid in $(seq 101 999); do
692 [ -z "`egetent group ${egid}`" ] && break 691 [ -z "`egetent group ${egid}`" ] && break
693 done 692 done
694 esac 693 esac
695 pw groupadd ${egroup} -g ${egid} || die "enewgroup failed" 694 pw groupadd ${egroup} -g ${egid} || die "enewgroup failed"
696 else 695 else
1135check_license() { 1134check_license() {
1136 local lic=$1 1135 local lic=$1
1137 if [ -z "${lic}" ] ; then 1136 if [ -z "${lic}" ] ; then
1138 lic="${PORTDIR}/licenses/${LICENSE}" 1137 lic="${PORTDIR}/licenses/${LICENSE}"
1139 else 1138 else
1140 if [ -e "${PORTDIR}/licenses/${src}" ] ; then 1139 if [ -e "${PORTDIR}/licenses/${lic}" ] ; then
1141 lic="${PORTDIR}/licenses/${src}" 1140 lic="${PORTDIR}/licenses/${lic}"
1142 elif [ -e "${PWD}/${src}" ] ; then 1141 elif [ -e "${PWD}/${lic}" ] ; then
1143 lic="${PWD}/${src}" 1142 lic="${PWD}/${lic}"
1144 elif [ -e "${src}" ] ; then 1143 elif [ -e "${lic}" ] ; then
1145 lic="${src}" 1144 lic="${lic}"
1146 fi
1147 fi 1145 fi
1146 fi
1148 [ ! -f "${lic}" ] && die "Could not find requested license ${src}" 1147 [ ! -f "${lic}" ] && die "Could not find requested license ${lic}"
1149 local l="`basename ${lic}`" 1148 local l="`basename ${lic}`"
1150 1149
1151 # here is where we check for the licenses the user already 1150 # here is where we check for the licenses the user already
1152 # accepted ... if we don't find a match, we make the user accept 1151 # accepted ... if we don't find a match, we make the user accept
1153 local shopts=$- 1152 local shopts=$-

Legend:
Removed from v.1.196  
changed lines
  Added in v.1.200

  ViewVC Help
Powered by ViewVC 1.1.20