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

Diff of /eclass/eutils.eclass

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

Revision 1.112 Revision 1.114
1# Copyright 1999-2004 Gentoo Foundation 1# Copyright 1999-2004 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.112 2004/10/05 03:43:02 vapier Exp $ 3# $Header: /var/cvsroot/gentoo-x86/eclass/eutils.eclass,v 1.114 2004/10/06 04:21:08 usata 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.
563# Joe Jezak <josejx@gmail.com> and usata@gentoo.org 563# Joe Jezak <josejx@gmail.com> and usata@gentoo.org
564# FBSD stuff: Aaron Walker <ka0ttic@gentoo.org> 564# FBSD stuff: Aaron Walker <ka0ttic@gentoo.org>
565# 565#
566# egetent(database, key) 566# egetent(database, key)
567egetent() { 567egetent() {
568 if use macos || use ppc-macos ; then 568 if useq macos || useq ppc-macos ; then
569 case "$2" in 569 case "$2" in
570 *[!0-9]*) # Non numeric 570 *[!0-9]*) # Non numeric
571 nidump $1 . | awk -F":" "{ if (\$1 ~ /^$2$/) {print \$0;exit;} }" 571 nidump $1 . | awk -F":" "{ if (\$1 ~ /^$2$/) {print \$0;exit;} }"
572 ;; 572 ;;
573 *) # Numeric 573 *) # Numeric
582 else 582 else
583 action="group" 583 action="group"
584 fi 584 fi
585 pw show "${action}" "$2" -q 585 pw show "${action}" "$2" -q
586 else 586 else
587 which nscd >& /dev/null && nscd -i "$1"
587 getent "$1" "$2" 588 getent "$1" "$2"
588 fi 589 fi
589} 590}
590 591
591# Simplify/standardize adding users to the system 592# Simplify/standardize adding users to the system
638 euid="next" 639 euid="next"
639 fi 640 fi
640 if [ "${euid}" == "next" ] 641 if [ "${euid}" == "next" ]
641 then 642 then
642 local pwrange 643 local pwrange
643 if use macos || use ppc-macos || [ "${USERLAND}" == "BSD" ] ; then 644 if [ "${USERLAND}" == "BSD" ] ; then
644 pwrange="`jot 898 101`" 645 pwrange="`jot 898 101`"
645 else 646 else
646 pwrange="`seq 101 999`" 647 pwrange="`seq 101 999`"
647 fi 648 fi
648 for euid in ${pwrange} ; do 649 for euid in ${pwrange} ; do
717 718
718 # handle extra and add the user 719 # handle extra and add the user
719 local eextra="$@" 720 local eextra="$@"
720 local oldsandbox="${SANDBOX_ON}" 721 local oldsandbox="${SANDBOX_ON}"
721 export SANDBOX_ON="0" 722 export SANDBOX_ON="0"
722 if use macos || use ppc-macos ; 723 if useq macos || useq ppc-macos ;
723 then 724 then
724 ### Make the user 725 ### Make the user
725 if [ -z "${eextra}" ] 726 if [ -z "${eextra}" ]
726 then 727 then
727 dscl . create /users/${euser} uid ${euid} 728 dscl . create /users/${euser} uid ${euid}
809 then 810 then
810 if [ "${egid}" -gt 0 ] 811 if [ "${egid}" -gt 0 ]
811 then 812 then
812 if [ -z "`egetent group ${egid}`" ] 813 if [ -z "`egetent group ${egid}`" ]
813 then 814 then
814 if use macos || use ppc-macos ; then 815 if useq macos || useq ppc-macos ; then
815 opts="${opts} ${egid}" 816 opts="${opts} ${egid}"
816 else 817 else
817 opts="${opts} -g ${egid}" 818 opts="${opts} -g ${egid}"
818 fi 819 fi
819 else 820 else
833 opts="${opts} ${eextra}" 834 opts="${opts} ${eextra}"
834 835
835 # add the group 836 # add the group
836 local oldsandbox="${SANDBOX_ON}" 837 local oldsandbox="${SANDBOX_ON}"
837 export SANDBOX_ON="0" 838 export SANDBOX_ON="0"
838 if use macos || use ppc-macos ; 839 if useq macos || useq ppc-macos ;
839 then 840 then
840 if [ ! -z "${eextra}" ]; 841 if [ ! -z "${eextra}" ];
841 then 842 then
842 einfo "Extra options are not supported on macos yet" 843 einfo "Extra options are not supported on macos yet"
843 einfo "Please report the ebuild along with the info below" 844 einfo "Please report the ebuild along with the info below"

Legend:
Removed from v.1.112  
changed lines
  Added in v.1.114

  ViewVC Help
Powered by ViewVC 1.1.20