| 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.220 2005/12/13 14:08:29 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. |
| … | |
… | |
| 408 | *) # Numeric |
408 | *) # Numeric |
| 409 | nidump $1 . | awk -F":" "{ if (\$3 == $2) {print \$0;exit;} }" |
409 | nidump $1 . | awk -F":" "{ if (\$3 == $2) {print \$0;exit;} }" |
| 410 | ;; |
410 | ;; |
| 411 | esac |
411 | esac |
| 412 | ;; |
412 | ;; |
| 413 | *-freebsd*) |
413 | *-freebsd*|*-dragonfly*) |
| 414 | local opts action="user" |
414 | local opts action="user" |
| 415 | [[ $1 == "passwd" ]] || action="group" |
415 | [[ $1 == "passwd" ]] || action="group" |
| 416 | |
416 | |
| 417 | # lookup by uid/gid |
417 | # lookup by uid/gid |
| 418 | if [[ $2 == [[:digit:]]* ]] ; then |
418 | if [[ $2 == [[:digit:]]* ]] ; then |
| … | |
… | |
| 567 | einfo "Please report the ebuild along with the info below" |
567 | einfo "Please report the ebuild along with the info below" |
| 568 | einfo "eextra: $@" |
568 | einfo "eextra: $@" |
| 569 | die "Required function missing" |
569 | die "Required function missing" |
| 570 | fi |
570 | fi |
| 571 | ;; |
571 | ;; |
| 572 | *-freebsd*) |
572 | *-freebsd*|*-dragonfly*) |
| 573 | if [[ -z $@ ]] ; then |
573 | if [[ -z $@ ]] ; then |
| 574 | pw useradd ${euser} ${opts} \ |
574 | pw useradd ${euser} ${opts} \ |
| 575 | -c "added by portage for ${PN}" \ |
575 | -c "added by portage for ${PN}" \ |
| 576 | die "enewuser failed" |
576 | die "enewuser failed" |
| 577 | else |
577 | else |
| … | |
… | |
| 705 | esac |
705 | esac |
| 706 | dscl . create /groups/${egroup} gid ${egid} |
706 | dscl . create /groups/${egroup} gid ${egid} |
| 707 | dscl . create /groups/${egroup} passwd '*' |
707 | dscl . create /groups/${egroup} passwd '*' |
| 708 | ;; |
708 | ;; |
| 709 | |
709 | |
| 710 | *-freebsd*) |
710 | *-freebsd*|*-dragonfly*) |
| 711 | case ${egid} in |
711 | case ${egid} in |
| 712 | *[!0-9]*) # Non numeric |
712 | *[!0-9]*) # Non numeric |
| 713 | for egid in $(seq 101 999); do |
713 | for egid in $(seq 101 999); do |
| 714 | [ -z "`egetent group ${egid}`" ] && break |
714 | [ -z "`egetent group ${egid}`" ] && break |
| 715 | done |
715 | done |