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

Diff of /eclass/eutils.eclass

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

Revision 1.107 Revision 1.108
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.107 2004/09/29 15:16:42 vapier Exp $ 3# $Header: /var/cvsroot/gentoo-x86/eclass/eutils.eclass,v 1.108 2004/10/01 19:23:58 ka0ttic 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.
554 touch ${tmp} 554 touch ${tmp}
555 echo ${tmp} 555 echo ${tmp}
556 fi 556 fi
557} 557}
558 558
559# Small wrapper for getent (Linux) and nidump (Mac OS X) 559# Small wrapper for getent (Linux), nidump (Mac OS X),
560# used in enewuser()/enewgroup() 560# and pw (FreeBSD) used in enewuser()/enewgroup()
561# Joe Jezak <josejx@gmail.com> and usata@gentoo.org 561# Joe Jezak <josejx@gmail.com> and usata@gentoo.org
562# FBSD stuff: Aaron Walker <ka0ttic@gentoo.org>
562# 563#
563# egetent(database, key) 564# egetent(database, key)
564egetent() { 565egetent() {
565 if use macos || use ppc-macos ; then 566 if use macos || use ppc-macos ; then
566 case "$2" in 567 case "$2" in
569 ;; 570 ;;
570 *) # Numeric 571 *) # Numeric
571 nidump $1 . | awk -F":" "{ if (\$3 == $2) {print \$0;exit;} }" 572 nidump $1 . | awk -F":" "{ if (\$3 == $2) {print \$0;exit;} }"
572 ;; 573 ;;
573 esac 574 esac
575 elif useq x86-fbsd ; then
576 local action
577 if [ "$1" == "passwd" ]
578 then
579 action="user"
580 else
581 action="group"
582 fi
583 pw show "${action}" "$2" -q
574 else 584 else
575 getent "$1" "$2" 585 getent "$1" "$2"
576 fi 586 fi
577} 587}
578 588
626 euid="next" 636 euid="next"
627 fi 637 fi
628 if [ "${euid}" == "next" ] 638 if [ "${euid}" == "next" ]
629 then 639 then
630 local pwrange 640 local pwrange
631 if use macos || use ppc-macos ; then 641 if use macos || use ppc-macos || [ "${USERLAND}" == "BSD" ] ; then
632 pwrange="`jot 898 101`" 642 pwrange="`jot 898 101`"
633 else 643 else
634 pwrange="`seq 101 999`" 644 pwrange="`seq 101 999`"
635 fi 645 fi
636 for euid in ${pwrange} ; do 646 for euid in ${pwrange} ; do
648 then 658 then
649 eerror "A shell was specified but it does not exist !" 659 eerror "A shell was specified but it does not exist !"
650 die "${eshell} does not exist" 660 die "${eshell} does not exist"
651 fi 661 fi
652 else 662 else
663 if [ "${USERLAND}" == "BSD" ]
664 then
665 eshell="/usr/bin/false"
666 else
653 eshell="/bin/false" 667 eshell="/bin/false"
668 fi
654 fi 669 fi
655 einfo " - Shell: ${eshell}" 670 einfo " - Shell: ${eshell}"
656 opts="${opts} -s ${eshell}" 671 opts="${opts} -s ${eshell}"
657 672
658 # handle homedir 673 # handle homedir
722 einfo "Extra options are not supported on macos yet" 737 einfo "Extra options are not supported on macos yet"
723 einfo "Please report the ebuild along with the info below" 738 einfo "Please report the ebuild along with the info below"
724 einfo "eextra: ${eextra}" 739 einfo "eextra: ${eextra}"
725 die "Required function missing" 740 die "Required function missing"
726 fi 741 fi
742 elif use x86-fbsd ; then
743 if [ -z "${eextra}" ]
744 then
745 pw useradd ${euser} ${opts} \
746 -c "added by portage for ${PN}" \
747 die "enewuser failed"
748 else
749 einfo " - Extra: ${eextra}"
750 pw useradd ${euser} ${opts} \
751 -c ${eextra} || die "enewuser failed"
752 fi
727 else 753 else
728 if [ -z "${eextra}" ] 754 if [ -z "${eextra}" ]
729 then 755 then
730 useradd ${opts} ${euser} \ 756 useradd ${opts} ${euser} \
731 -c "added by portage for ${PN}" \ 757 -c "added by portage for ${PN}" \
824 [ -z "`egetent group ${egid}`" ] && break 850 [ -z "`egetent group ${egid}`" ] && break
825 done 851 done
826 esac 852 esac
827 dscl . create /groups/${egroup} gid ${egid} 853 dscl . create /groups/${egroup} gid ${egid}
828 dscl . create /groups/${egroup} passwd '*' 854 dscl . create /groups/${egroup} passwd '*'
855 elif use x86-fbsd ; then
856 case ${egid} in
857 *[!0-9]*) # Non numeric
858 for egid in `jot 898 101`; do
859 [ -z "`egetent group ${egid}`" ] && break
860 done
861 esac
862 pw groupadd ${egroup} -g ${egid} || die "enewgroup failed"
829 else 863 else
830 groupadd ${opts} ${egroup} || die "enewgroup failed" 864 groupadd ${opts} ${egroup} || die "enewgroup failed"
831 fi 865 fi
832 export SANDBOX_ON="${oldsandbox}" 866 export SANDBOX_ON="${oldsandbox}"
833} 867}

Legend:
Removed from v.1.107  
changed lines
  Added in v.1.108

  ViewVC Help
Powered by ViewVC 1.1.20