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

Diff of /eclass/eutils.eclass

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

Revision 1.219 Revision 1.223
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.219 2005/11/29 03:37:36 vapier Exp $ 3# $Header: /var/cvsroot/gentoo-x86/eclass/eutils.eclass,v 1.223 2006/02/15 23:40:16 flameeyes 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.
383 tmp=${topdir}/tmp.${RANDOM}.${RANDOM}.${RANDOM} 383 tmp=${topdir}/tmp.${RANDOM}.${RANDOM}.${RANDOM}
384 done 384 done
385 ${exe} "${tmp}" || ${exe} -p "${tmp}" 385 ${exe} "${tmp}" || ${exe} -p "${tmp}"
386 echo "${tmp}" 386 echo "${tmp}"
387 else 387 else
388 [[ ${exe} == "touch" ]] \ 388 if [[ ${exe} == "touch" ]] ; then
389 [[ ${USERLAND} == "GNU" ]] \
389 && exe="-p" \ 390 && exe="-p" \
391 || exe="-t"
392 else
393 [[ ${USERLAND} == "GNU" ]] \
394 && exe="-d" \
390 || exe="-d" 395 || exe="-dt"
391 mktemp ${exe} "${topdir}" 396 fi
397 TMPDIR="${topdir}" mktemp ${exe} tmp
392 fi 398 fi
393} 399}
394 400
395# Small wrapper for getent (Linux), nidump (Mac OS X), 401# Small wrapper for getent (Linux), nidump (Mac OS X),
396# and pw (FreeBSD) used in enewuser()/enewgroup() 402# and pw (FreeBSD) used in enewuser()/enewgroup()
408 *) # Numeric 414 *) # Numeric
409 nidump $1 . | awk -F":" "{ if (\$3 == $2) {print \$0;exit;} }" 415 nidump $1 . | awk -F":" "{ if (\$3 == $2) {print \$0;exit;} }"
410 ;; 416 ;;
411 esac 417 esac
412 ;; 418 ;;
413 *-freebsd*) 419 *-freebsd*|*-dragonfly*)
414 local opts action="user" 420 local opts action="user"
415 [[ $1 == "passwd" ]] || action="group" 421 [[ $1 == "passwd" ]] || action="group"
416 422
417 # lookup by uid/gid 423 # lookup by uid/gid
418 if [[ $2 == [[:digit:]]* ]] ; then 424 if [[ $2 == [[:digit:]]* ]] ; then
484 einfo " - Userid: ${euid}" 490 einfo " - Userid: ${euid}"
485 491
486 # handle shell 492 # handle shell
487 local eshell=$1; shift 493 local eshell=$1; shift
488 if [[ ! -z ${eshell} ]] && [[ ${eshell} != "-1" ]] ; then 494 if [[ ! -z ${eshell} ]] && [[ ${eshell} != "-1" ]] ; then
489 if [[ ! -e ${eshell} ]] ; then 495 if [[ ! -e ${ROOT}${eshell} ]] ; then
490 eerror "A shell was specified but it does not exist !" 496 eerror "A shell was specified but it does not exist !"
491 die "${eshell} does not exist" 497 die "${eshell} does not exist in ${ROOT}"
498 fi
499 if [[ ${eshell} == */false || ${eshell} == */nologin ]] ; then
500 eerror "Do not specify ${eshell} yourself, use -1"
501 die "Pass '-1' as the shell parameter"
492 fi 502 fi
493 else 503 else
494 for shell in /sbin/nologin /usr/sbin/nologin /bin/false /usr/bin/false /dev/null ; do 504 for shell in /sbin/nologin /usr/sbin/nologin /bin/false /usr/bin/false /dev/null ; do
495 [[ -x ${ROOT}${shell} ]] && break 505 [[ -x ${ROOT}${shell} ]] && break
496 done 506 done
567 einfo "Please report the ebuild along with the info below" 577 einfo "Please report the ebuild along with the info below"
568 einfo "eextra: $@" 578 einfo "eextra: $@"
569 die "Required function missing" 579 die "Required function missing"
570 fi 580 fi
571 ;; 581 ;;
572 *-freebsd*) 582 *-freebsd*|*-dragonfly*)
573 if [[ -z $@ ]] ; then 583 if [[ -z $@ ]] ; then
574 pw useradd ${euser} ${opts} \ 584 pw useradd ${euser} ${opts} \
575 -c "added by portage for ${PN}" \ 585 -c "added by portage for ${PN}" \
576 die "enewuser failed" 586 die "enewuser failed"
577 else 587 else
705 esac 715 esac
706 dscl . create /groups/${egroup} gid ${egid} 716 dscl . create /groups/${egroup} gid ${egid}
707 dscl . create /groups/${egroup} passwd '*' 717 dscl . create /groups/${egroup} passwd '*'
708 ;; 718 ;;
709 719
710 *-freebsd*) 720 *-freebsd*|*-dragonfly*)
711 case ${egid} in 721 case ${egid} in
712 *[!0-9]*) # Non numeric 722 *[!0-9]*) # Non numeric
713 for egid in $(seq 101 999); do 723 for egid in $(seq 101 999); do
714 [ -z "`egetent group ${egid}`" ] && break 724 [ -z "`egetent group ${egid}`" ] && break
715 done 725 done
1407 echo 1417 echo
1408 einfo "If you are having trouble with the detection" 1418 einfo "If you are having trouble with the detection"
1409 einfo "of your CD, it is possible that you do not have" 1419 einfo "of your CD, it is possible that you do not have"
1410 einfo "Joliet support enabled in your kernel. Please" 1420 einfo "Joliet support enabled in your kernel. Please"
1411 einfo "check that CONFIG_JOLIET is enabled in your kernel." 1421 einfo "check that CONFIG_JOLIET is enabled in your kernel."
1412 read 1422 read || die "something is screwed with your system"
1413 done 1423 done
1414} 1424}
1415 1425
1416# Make sure that LINGUAS only contains languages that 1426# Make sure that LINGUAS only contains languages that
1417# a package can support 1427# a package can support

Legend:
Removed from v.1.219  
changed lines
  Added in v.1.223

  ViewVC Help
Powered by ViewVC 1.1.20