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.106 2004/09/21 17:34:33 wolf31o2 Exp $ |
3 | # $Header: /var/cvsroot/gentoo-x86/eclass/eutils.eclass,v 1.107 2004/09/29 15:16:42 vapier 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. |
… | |
… | |
570 | *) # Numeric |
570 | *) # Numeric |
571 | nidump $1 . | awk -F":" "{ if (\$3 == $2) {print \$0;exit;} }" |
571 | nidump $1 . | awk -F":" "{ if (\$3 == $2) {print \$0;exit;} }" |
572 | ;; |
572 | ;; |
573 | esac |
573 | esac |
574 | else |
574 | else |
575 | getent $1 $2 |
575 | getent "$1" "$2" |
576 | fi |
576 | fi |
577 | } |
577 | } |
578 | |
578 | |
579 | # Simplify/standardize adding users to the system |
579 | # Simplify/standardize adding users to the system |
580 | # vapier@gentoo.org |
580 | # vapier@gentoo.org |
… | |
… | |
667 | # handle groups |
667 | # handle groups |
668 | local egroups="$1"; shift |
668 | local egroups="$1"; shift |
669 | if [ ! -z "${egroups}" ] |
669 | if [ ! -z "${egroups}" ] |
670 | then |
670 | then |
671 | local oldifs="${IFS}" |
671 | local oldifs="${IFS}" |
|
|
672 | local defgroup="" exgroups="" |
|
|
673 | |
672 | export IFS="," |
674 | export IFS="," |
673 | for g in ${egroups} |
675 | for g in ${egroups} |
674 | do |
676 | do |
675 | if [ -z "`egetent group \"${g}\"`" ] |
677 | if [ -z "`egetent group \"${g}\"`" ] |
676 | then |
678 | then |
677 | eerror "You must add group ${g} to the system first" |
679 | eerror "You must add group ${g} to the system first" |
678 | die "${g} is not a valid GID" |
680 | die "${g} is not a valid GID" |
679 | fi |
681 | fi |
|
|
682 | if [ -z "${defgroup}" ] |
|
|
683 | then |
|
|
684 | defgroup="${g}" |
|
|
685 | else |
|
|
686 | exgroups="${exgroups},${g}" |
|
|
687 | fi |
680 | done |
688 | done |
681 | export IFS="${oldifs}" |
689 | export IFS="${oldifs}" |
|
|
690 | |
682 | opts="${opts} -g ${egroups}" |
691 | opts="${opts} -g ${defgroup}" |
|
|
692 | if [ ! -z "${exgroups}" ] |
|
|
693 | then |
|
|
694 | opts="${opts} -G ${exgroups:1}" |
|
|
695 | fi |
683 | else |
696 | else |
684 | egroups="(none)" |
697 | egroups="(none)" |
685 | fi |
698 | fi |
686 | einfo " - Groups: ${egroups}" |
699 | einfo " - Groups: ${egroups}" |
687 | |
700 | |
… | |
… | |
699 | dscl . create /users/${euser} home ${ehome} |
712 | dscl . create /users/${euser} home ${ehome} |
700 | dscl . create /users/${euser} realname "added by portage for ${PN}" |
713 | dscl . create /users/${euser} realname "added by portage for ${PN}" |
701 | ### Add the user to the groups specified |
714 | ### Add the user to the groups specified |
702 | for g in ${egroups} |
715 | for g in ${egroups} |
703 | do |
716 | do |
|
|
717 | # $egroups is , delimited, not space |
|
|
718 | ewarn "This is code is wrong; someone on the OS X team should fix it" |
704 | dscl . merge /groups/${g} users ${euser} |
719 | dscl . merge /groups/${g} users ${euser} |
705 | done |
720 | done |
706 | else |
721 | else |
707 | einfo "Extra options are not supported on macos yet" |
722 | einfo "Extra options are not supported on macos yet" |
708 | einfo "Please report the ebuild along with the info below" |
723 | einfo "Please report the ebuild along with the info below" |