| 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.216 2005/11/09 05:57:17 mr_bones_ Exp $ |
3 | # $Header: /var/cvsroot/gentoo-x86/eclass/eutils.eclass,v 1.218 2005/11/22 11:15:34 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. |
| … | |
… | |
| 432 | [[ ${action} == "user" ]] && opts="-u" || opts="-g" |
432 | [[ ${action} == "user" ]] && opts="-u" || opts="-g" |
| 433 | fi |
433 | fi |
| 434 | |
434 | |
| 435 | pw show ${action} ${opts} "$2" -q |
435 | pw show ${action} ${opts} "$2" -q |
| 436 | ;; |
436 | ;; |
| 437 | *-netbsd*) |
437 | *-netbsd*|*-openbsd*) |
| 438 | grep "$2:\*:" /etc/$1 |
438 | grep "$2:\*:" /etc/$1 |
| 439 | ;; |
439 | ;; |
| 440 | *) |
440 | *) |
| 441 | type -p nscd >& /dev/null && nscd -i "$1" |
441 | type -p nscd >& /dev/null && nscd -i "$1" |
| 442 | getent "$1" "$2" |
442 | getent "$1" "$2" |
| … | |
… | |
| 600 | else |
600 | else |
| 601 | einfo " - Extra: $@" |
601 | einfo " - Extra: $@" |
| 602 | useradd ${opts} ${euser} "$@" || die "enewuser failed" |
602 | useradd ${opts} ${euser} "$@" || die "enewuser failed" |
| 603 | fi |
603 | fi |
| 604 | ;; |
604 | ;; |
|
|
605 | |
|
|
606 | *-openbsd*) |
|
|
607 | if [[ -z $@ ]] ; then |
|
|
608 | useradd -u ${euid} -s ${eshell} \ |
|
|
609 | -d ${ehome} -c "Added by portage for ${PN}" \ |
|
|
610 | -g ${egroups} ${euser} || die "enewuser failed" |
|
|
611 | else |
|
|
612 | einfo " - Extra: $@" |
|
|
613 | useradd -u ${euid} -s ${eshell} \ |
|
|
614 | -d ${ehome} -c "Added by portage for ${PN}" \ |
|
|
615 | -g ${egroups} ${euser} "$@" || die "enewuser failed" |
|
|
616 | fi |
|
|
617 | ;; |
|
|
618 | |
| 605 | *) |
619 | *) |
| 606 | if [[ -z $@ ]] ; then |
620 | if [[ -z $@ ]] ; then |
| 607 | useradd ${opts} ${euser} \ |
621 | useradd ${opts} ${euser} \ |
| 608 | -c "added by portage for ${PN}" \ |
622 | -c "added by portage for ${PN}" \ |
| 609 | || die "enewuser failed" |
623 | || die "enewuser failed" |
| … | |
… | |
| 1084 | # Usage: unpack_makeself [file to unpack] [offset] [tail|dd] |
1098 | # Usage: unpack_makeself [file to unpack] [offset] [tail|dd] |
| 1085 | # - If the file is not specified then unpack will utilize ${A}. |
1099 | # - If the file is not specified then unpack will utilize ${A}. |
| 1086 | # - If the offset is not specified then we will attempt to extract |
1100 | # - If the offset is not specified then we will attempt to extract |
| 1087 | # the proper offset from the script itself. |
1101 | # the proper offset from the script itself. |
| 1088 | unpack_makeself() { |
1102 | unpack_makeself() { |
|
|
1103 | local src_input=${1:-${A}} |
| 1089 | local src=$(find_unpackable_file "$1") |
1104 | local src=$(find_unpackable_file "${src_input}") |
| 1090 | local skip=$2 |
1105 | local skip=$2 |
| 1091 | local exe=$3 |
1106 | local exe=$3 |
| 1092 | |
1107 | |
| 1093 | [[ -z ${src} ]] && die "Could not locate source for '$1'" |
1108 | [[ -z ${src} ]] && die "Could not locate source for '${src_input}'" |
| 1094 | |
1109 | |
| 1095 | local shrtsrc=$(basename "${src}") |
1110 | local shrtsrc=$(basename "${src}") |
| 1096 | echo ">>> Unpacking ${shrtsrc} to ${PWD}" |
1111 | echo ">>> Unpacking ${shrtsrc} to ${PWD}" |
| 1097 | if [[ -z ${skip} ]] ; then |
1112 | if [[ -z ${skip} ]] ; then |
| 1098 | local ver=$(grep -a '#.*Makeself' "${src}" | awk '{print $NF}') |
1113 | local ver=$(grep -a '#.*Makeself' "${src}" | awk '{print $NF}') |