| 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.113 2004/10/05 05:15:59 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) |
| 567 | egetent() { |
567 | egetent() { |
| 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 |
| … | |
… | |
| 639 | euid="next" |
639 | euid="next" |
| 640 | fi |
640 | fi |
| 641 | if [ "${euid}" == "next" ] |
641 | if [ "${euid}" == "next" ] |
| 642 | then |
642 | then |
| 643 | local pwrange |
643 | local pwrange |
| 644 | if use macos || use ppc-macos || [ "${USERLAND}" == "BSD" ] ; then |
644 | if [ "${USERLAND}" == "BSD" ] ; then |
| 645 | pwrange="`jot 898 101`" |
645 | pwrange="`jot 898 101`" |
| 646 | else |
646 | else |
| 647 | pwrange="`seq 101 999`" |
647 | pwrange="`seq 101 999`" |
| 648 | fi |
648 | fi |
| 649 | for euid in ${pwrange} ; do |
649 | for euid in ${pwrange} ; do |
| … | |
… | |
| 718 | |
718 | |
| 719 | # handle extra and add the user |
719 | # handle extra and add the user |
| 720 | local eextra="$@" |
720 | local eextra="$@" |
| 721 | local oldsandbox="${SANDBOX_ON}" |
721 | local oldsandbox="${SANDBOX_ON}" |
| 722 | export SANDBOX_ON="0" |
722 | export SANDBOX_ON="0" |
| 723 | if use macos || use ppc-macos ; |
723 | if useq macos || useq ppc-macos ; |
| 724 | then |
724 | then |
| 725 | ### Make the user |
725 | ### Make the user |
| 726 | if [ -z "${eextra}" ] |
726 | if [ -z "${eextra}" ] |
| 727 | then |
727 | then |
| 728 | dscl . create /users/${euser} uid ${euid} |
728 | dscl . create /users/${euser} uid ${euid} |
| … | |
… | |
| 810 | then |
810 | then |
| 811 | if [ "${egid}" -gt 0 ] |
811 | if [ "${egid}" -gt 0 ] |
| 812 | then |
812 | then |
| 813 | if [ -z "`egetent group ${egid}`" ] |
813 | if [ -z "`egetent group ${egid}`" ] |
| 814 | then |
814 | then |
| 815 | if use macos || use ppc-macos ; then |
815 | if useq macos || useq ppc-macos ; then |
| 816 | opts="${opts} ${egid}" |
816 | opts="${opts} ${egid}" |
| 817 | else |
817 | else |
| 818 | opts="${opts} -g ${egid}" |
818 | opts="${opts} -g ${egid}" |
| 819 | fi |
819 | fi |
| 820 | else |
820 | else |
| … | |
… | |
| 834 | opts="${opts} ${eextra}" |
834 | opts="${opts} ${eextra}" |
| 835 | |
835 | |
| 836 | # add the group |
836 | # add the group |
| 837 | local oldsandbox="${SANDBOX_ON}" |
837 | local oldsandbox="${SANDBOX_ON}" |
| 838 | export SANDBOX_ON="0" |
838 | export SANDBOX_ON="0" |
| 839 | if use macos || use ppc-macos ; |
839 | if useq macos || useq ppc-macos ; |
| 840 | then |
840 | then |
| 841 | if [ ! -z "${eextra}" ]; |
841 | if [ ! -z "${eextra}" ]; |
| 842 | then |
842 | then |
| 843 | einfo "Extra options are not supported on macos yet" |
843 | einfo "Extra options are not supported on macos yet" |
| 844 | einfo "Please report the ebuild along with the info below" |
844 | einfo "Please report the ebuild along with the info below" |