| 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.170 2005/05/06 04:14:17 vapier Exp $ |
3 | # $Header: /var/cvsroot/gentoo-x86/eclass/eutils.eclass,v 1.182 2005/06/11 00:02:26 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. |
| … | |
… | |
| 11 | |
11 | |
| 12 | inherit multilib |
12 | inherit multilib |
| 13 | ECLASS=eutils |
13 | ECLASS=eutils |
| 14 | INHERITED="$INHERITED $ECLASS" |
14 | INHERITED="$INHERITED $ECLASS" |
| 15 | |
15 | |
| 16 | DEPEND="!bootstrap? ( sys-devel/patch )" |
16 | DEPEND="!bootstrap? ( sys-devel/patch userland_GNU? ( sys-apps/shadow ) )" |
|
|
17 | # sys-apps/shadow is needed for useradd, etc, bug #94745. |
| 17 | |
18 | |
| 18 | DESCRIPTION="Based on the ${ECLASS} eclass" |
19 | DESCRIPTION="Based on the ${ECLASS} eclass" |
| 19 | |
20 | |
| 20 | # Wait for the supplied number of seconds. If no argument is supplied, defaults |
21 | # Wait for the supplied number of seconds. If no argument is supplied, defaults |
| 21 | # to five seconds. If the EPAUSE_IGNORE env var is set, don't wait. If we're not |
22 | # to five seconds. If the EPAUSE_IGNORE env var is set, don't wait. If we're not |
| … | |
… | |
| 125 | # List of patches not to apply. Not this is only file names, |
126 | # List of patches not to apply. Not this is only file names, |
| 126 | # and not the full path .. |
127 | # and not the full path .. |
| 127 | EPATCH_EXCLUDE="" |
128 | EPATCH_EXCLUDE="" |
| 128 | # Change the printed message for a single patch. |
129 | # Change the printed message for a single patch. |
| 129 | EPATCH_SINGLE_MSG="" |
130 | EPATCH_SINGLE_MSG="" |
|
|
131 | # Change the printed message for multiple patches. |
|
|
132 | EPATCH_MULTI_MSG="Applying various patches (bugfixes/updates) ..." |
| 130 | # Force applying bulk patches even if not following the style: |
133 | # Force applying bulk patches even if not following the style: |
| 131 | # |
134 | # |
| 132 | # ??_${ARCH}_foo.${EPATCH_SUFFIX} |
135 | # ??_${ARCH}_foo.${EPATCH_SUFFIX} |
| 133 | # |
136 | # |
| 134 | EPATCH_FORCE="no" |
137 | EPATCH_FORCE="no" |
| … | |
… | |
| 238 | ;; |
241 | ;; |
| 239 | esac |
242 | esac |
| 240 | |
243 | |
| 241 | if [ "${SINGLE_PATCH}" = "no" ] |
244 | if [ "${SINGLE_PATCH}" = "no" ] |
| 242 | then |
245 | then |
| 243 | einfo "Applying various patches (bugfixes/updates) ..." |
246 | einfo "${EPATCH_MULTI_MSG}" |
| 244 | fi |
247 | fi |
| 245 | for x in ${EPATCH_SOURCE} |
248 | for x in ${EPATCH_SOURCE} |
| 246 | do |
249 | do |
| 247 | # New ARCH dependant patch naming scheme ... |
250 | # New ARCH dependant patch naming scheme ... |
| 248 | # |
251 | # |
| 249 | # ???_arch_foo.patch |
252 | # ???_arch_foo.patch |
| 250 | # |
253 | # |
| 251 | if [ -f ${x} ] && \ |
254 | if [ -f ${x} ] && \ |
| 252 | ([ "${SINGLE_PATCH}" = "yes" -o "${x/_all_}" != "${x}" -o "`eval echo \$\{x/_${ARCH}_\}`" != "${x}" ] || \ |
255 | ([ "${SINGLE_PATCH}" = "yes" -o "${x/_all_}" != "${x}" -o "${x/_${ARCH}_}" != "${x}" ] || \ |
| 253 | [ "${EPATCH_FORCE}" = "yes" ]) |
256 | [ "${EPATCH_FORCE}" = "yes" ]) |
| 254 | then |
257 | then |
| 255 | local count=0 |
258 | local count=0 |
| 256 | local popts="${EPATCH_OPTS}" |
259 | local popts="${EPATCH_OPTS}" |
| 257 | local patchname=${x##*/} |
260 | local patchname=${x##*/} |
| … | |
… | |
| 367 | then |
370 | then |
| 368 | einfo "Done with patching" |
371 | einfo "Done with patching" |
| 369 | fi |
372 | fi |
| 370 | } |
373 | } |
| 371 | |
374 | |
| 372 | # This function return true if we are using the NPTL pthreads |
|
|
| 373 | # implementation. |
|
|
| 374 | # |
|
|
| 375 | # <azarah@gentoo.org> (06 March 2003) |
|
|
| 376 | # |
|
|
| 377 | have_NPTL() { |
|
|
| 378 | cat > ${T}/test-nptl.c <<-"END" |
|
|
| 379 | #define _XOPEN_SOURCE |
|
|
| 380 | #include <unistd.h> |
|
|
| 381 | #include <stdio.h> |
|
|
| 382 | |
|
|
| 383 | int main() |
|
|
| 384 | { |
|
|
| 385 | char buf[255]; |
|
|
| 386 | char *str = buf; |
|
|
| 387 | |
|
|
| 388 | confstr(_CS_GNU_LIBPTHREAD_VERSION, str, 255); |
|
|
| 389 | if (NULL != str) { |
|
|
| 390 | printf("%s\n", str); |
|
|
| 391 | if (NULL != strstr(str, "NPTL")) |
|
|
| 392 | return 0; |
|
|
| 393 | } |
|
|
| 394 | |
|
|
| 395 | return 1; |
|
|
| 396 | } |
|
|
| 397 | END |
|
|
| 398 | |
|
|
| 399 | einfon "Checking for _CS_GNU_LIBPTHREAD_VERSION support in glibc ..." |
|
|
| 400 | if gcc -o ${T}/nptl ${T}/test-nptl.c &> /dev/null |
|
|
| 401 | then |
|
|
| 402 | echo "yes" |
|
|
| 403 | einfon "Checking what PTHREADS implementation we have ..." |
|
|
| 404 | if ${T}/nptl |
|
|
| 405 | then |
|
|
| 406 | return 0 |
|
|
| 407 | else |
|
|
| 408 | return 1 |
|
|
| 409 | fi |
|
|
| 410 | else |
|
|
| 411 | echo "no" |
|
|
| 412 | fi |
|
|
| 413 | |
|
|
| 414 | return 1 |
|
|
| 415 | } |
|
|
| 416 | |
|
|
| 417 | # This function check how many cpu's are present, and then set |
|
|
| 418 | # -j in MAKEOPTS accordingly. |
|
|
| 419 | # |
|
|
| 420 | # Thanks to nall <nall@gentoo.org> for this. |
|
|
| 421 | # |
|
|
| 422 | get_number_of_jobs() { |
|
|
| 423 | local jobs=0 |
|
|
| 424 | |
|
|
| 425 | if [ ! -r /proc/cpuinfo ] |
|
|
| 426 | then |
|
|
| 427 | return 1 |
|
|
| 428 | fi |
|
|
| 429 | |
|
|
| 430 | # This bit is from H?kan Wessberg <nacka-gentoo@refug.org>, bug #13565. |
|
|
| 431 | if [ "`egrep "^[[:space:]]*MAKEOPTS=" /etc/make.conf | wc -l`" -gt 0 ] |
|
|
| 432 | then |
|
|
| 433 | ADMINOPTS="`egrep "^[[:space:]]*MAKEOPTS=" /etc/make.conf | cut -d= -f2 | sed 's/\"//g'`" |
|
|
| 434 | ADMINPARAM="`echo ${ADMINOPTS} | gawk '{match($0, /-j *[0-9]*/, opt); print opt[0]}'`" |
|
|
| 435 | ADMINPARAM="${ADMINPARAM/-j}" |
|
|
| 436 | fi |
|
|
| 437 | |
|
|
| 438 | export MAKEOPTS="`echo ${MAKEOPTS} | sed -e 's:-j *[0-9]*::g'`" |
|
|
| 439 | |
|
|
| 440 | if [ "${ARCH}" = "amd64" -o "${ARCH}" = "x86" -o "${ARCH}" = "hppa" -o \ |
|
|
| 441 | "${ARCH}" = "arm" -o "${ARCH}" = "mips" -o "${ARCH}" = "ia64" ] |
|
|
| 442 | then |
|
|
| 443 | # these archs will always have "[Pp]rocessor" |
|
|
| 444 | jobs="$((`grep -c ^[Pp]rocessor /proc/cpuinfo` * 2))" |
|
|
| 445 | |
|
|
| 446 | elif [ "${ARCH}" = "sparc" -o "${ARCH}" = "sparc64" ] |
|
|
| 447 | then |
|
|
| 448 | # sparc always has "ncpus active" |
|
|
| 449 | jobs="$((`grep "^ncpus active" /proc/cpuinfo | sed -e "s/^.*: //"` * 2))" |
|
|
| 450 | |
|
|
| 451 | elif [ "${ARCH}" = "alpha" ] |
|
|
| 452 | then |
|
|
| 453 | # alpha has "cpus active", but only when compiled with SMP |
|
|
| 454 | if [ "`grep -c "^cpus active" /proc/cpuinfo`" -eq 1 ] |
|
|
| 455 | then |
|
|
| 456 | jobs="$((`grep "^cpus active" /proc/cpuinfo | sed -e "s/^.*: //"` * 2))" |
|
|
| 457 | else |
|
|
| 458 | jobs=2 |
|
|
| 459 | fi |
|
|
| 460 | |
|
|
| 461 | elif [ "${ARCH}" = "ppc" -o "${ARCH}" = "ppc64" ] |
|
|
| 462 | then |
|
|
| 463 | # ppc has "processor", but only when compiled with SMP |
|
|
| 464 | if [ "`grep -c "^processor" /proc/cpuinfo`" -eq 1 ] |
|
|
| 465 | then |
|
|
| 466 | jobs="$((`grep -c ^processor /proc/cpuinfo` * 2))" |
|
|
| 467 | else |
|
|
| 468 | jobs=2 |
|
|
| 469 | fi |
|
|
| 470 | elif [ "${ARCH}" = "s390" ] |
|
|
| 471 | then |
|
|
| 472 | # s390 has "# processors : " |
|
|
| 473 | jobs="$((`grep "^\# processors" /proc/cpuinfo | sed -e "s/^.*: //"` * 2))" |
|
|
| 474 | else |
|
|
| 475 | jobs="$((`grep -c ^cpu /proc/cpuinfo` * 2))" |
|
|
| 476 | die "Unknown ARCH -- ${ARCH}!" |
|
|
| 477 | fi |
|
|
| 478 | |
|
|
| 479 | # Make sure the number is valid ... |
|
|
| 480 | if [ "${jobs}" -lt 1 ] |
|
|
| 481 | then |
|
|
| 482 | jobs=1 |
|
|
| 483 | fi |
|
|
| 484 | |
|
|
| 485 | if [ -n "${ADMINPARAM}" ] |
|
|
| 486 | then |
|
|
| 487 | if [ "${jobs}" -gt "${ADMINPARAM}" ] |
|
|
| 488 | then |
|
|
| 489 | einfo "Setting make jobs to \"-j${ADMINPARAM}\" to ensure successful merge ..." |
|
|
| 490 | export MAKEOPTS="${MAKEOPTS} -j${ADMINPARAM}" |
|
|
| 491 | else |
|
|
| 492 | einfo "Setting make jobs to \"-j${jobs}\" to ensure successful merge ..." |
|
|
| 493 | export MAKEOPTS="${MAKEOPTS} -j${jobs}" |
|
|
| 494 | fi |
|
|
| 495 | fi |
|
|
| 496 | } |
|
|
| 497 | |
|
|
| 498 | # Cheap replacement for when debianutils (and thus mktemp) |
375 | # Cheap replacement for when debianutils (and thus mktemp) |
| 499 | # does not exist on the users system |
376 | # does not exist on the users system |
| 500 | # vapier@gentoo.org |
377 | # vapier@gentoo.org |
| 501 | # |
378 | # |
| 502 | # Takes just 1 optional parameter (the directory to create tmpfile in) |
379 | # Takes just 1 optional parameter (the directory to create tmpfile in) |
| … | |
… | |
| 533 | # Joe Jezak <josejx@gmail.com> and usata@gentoo.org |
410 | # Joe Jezak <josejx@gmail.com> and usata@gentoo.org |
| 534 | # FBSD stuff: Aaron Walker <ka0ttic@gentoo.org> |
411 | # FBSD stuff: Aaron Walker <ka0ttic@gentoo.org> |
| 535 | # |
412 | # |
| 536 | # egetent(database, key) |
413 | # egetent(database, key) |
| 537 | egetent() { |
414 | egetent() { |
| 538 | if useq ppc-macos ; then |
415 | if [[ "${USERLAND}" == "Darwin" ]] ; then |
| 539 | case "$2" in |
416 | case "$2" in |
| 540 | *[!0-9]*) # Non numeric |
417 | *[!0-9]*) # Non numeric |
| 541 | nidump $1 . | awk -F":" "{ if (\$1 ~ /^$2$/) {print \$0;exit;} }" |
418 | nidump $1 . | awk -F":" "{ if (\$1 ~ /^$2$/) {print \$0;exit;} }" |
| 542 | ;; |
419 | ;; |
| 543 | *) # Numeric |
420 | *) # Numeric |
| 544 | nidump $1 . | awk -F":" "{ if (\$3 == $2) {print \$0;exit;} }" |
421 | nidump $1 . | awk -F":" "{ if (\$3 == $2) {print \$0;exit;} }" |
| 545 | ;; |
422 | ;; |
| 546 | esac |
423 | esac |
| 547 | elif useq x86-fbsd ; then |
424 | elif [[ "${USERLAND}" == "BSD" ]] ; then |
| 548 | local action |
425 | local action |
| 549 | if [ "$1" == "passwd" ] |
426 | if [ "$1" == "passwd" ] |
| 550 | then |
427 | then |
| 551 | action="user" |
428 | action="user" |
| 552 | else |
429 | else |
| … | |
… | |
| 572 | # homedir: /dev/null |
449 | # homedir: /dev/null |
| 573 | # groups: none |
450 | # groups: none |
| 574 | # extra: comment of 'added by portage for ${PN}' |
451 | # extra: comment of 'added by portage for ${PN}' |
| 575 | enewuser() { |
452 | enewuser() { |
| 576 | # get the username |
453 | # get the username |
| 577 | local euser="$1"; shift |
454 | local euser=$1; shift |
| 578 | if [ -z "${euser}" ] |
455 | if [[ -z ${euser} ]] ; then |
| 579 | then |
|
|
| 580 | eerror "No username specified !" |
456 | eerror "No username specified !" |
| 581 | die "Cannot call enewuser without a username" |
457 | die "Cannot call enewuser without a username" |
| 582 | fi |
458 | fi |
| 583 | |
459 | |
| 584 | # lets see if the username already exists |
460 | # lets see if the username already exists |
| 585 | if [ "${euser}" == "`egetent passwd \"${euser}\" | cut -d: -f1`" ] |
461 | if [[ ${euser} == $(egetent passwd "${euser}" | cut -d: -f1) ]] ; then |
| 586 | then |
|
|
| 587 | return 0 |
462 | return 0 |
| 588 | fi |
463 | fi |
| 589 | einfo "Adding user '${euser}' to your system ..." |
464 | einfo "Adding user '${euser}' to your system ..." |
| 590 | |
465 | |
| 591 | # options to pass to useradd |
466 | # options to pass to useradd |
| 592 | local opts= |
467 | local opts= |
| 593 | |
468 | |
| 594 | # handle uid |
469 | # handle uid |
| 595 | local euid="$1"; shift |
470 | local euid=$1; shift |
| 596 | if [ ! -z "${euid}" ] && [ "${euid}" != "-1" ] |
471 | if [[ ! -z ${euid} ]] && [[ ${euid} != "-1" ]] ; then |
| 597 | then |
|
|
| 598 | if [ "${euid}" -gt 0 ] |
472 | if [[ ${euid} -gt 0 ]] ; then |
| 599 | then |
|
|
| 600 | if [ ! -z "`egetent passwd ${euid}`" ] |
473 | if [[ ! -z $(egetent passwd ${euid}) ]] ; then |
| 601 | then |
|
|
| 602 | euid="next" |
474 | euid="next" |
| 603 | fi |
475 | fi |
| 604 | else |
476 | else |
| 605 | eerror "Userid given but is not greater than 0 !" |
477 | eerror "Userid given but is not greater than 0 !" |
| 606 | die "${euid} is not a valid UID" |
478 | die "${euid} is not a valid UID" |
| 607 | fi |
479 | fi |
| 608 | else |
480 | else |
| 609 | euid="next" |
481 | euid="next" |
| 610 | fi |
482 | fi |
| 611 | if [ "${euid}" == "next" ] |
483 | if [[ ${euid} == "next" ]] ; then |
| 612 | then |
|
|
| 613 | local pwrange |
484 | local pwrange |
| 614 | if [ "${USERLAND}" == "BSD" ] ; then |
485 | if [[ ${USERLAND} == "BSD" ]] ; then |
| 615 | pwrange="`jot 898 101`" |
486 | pwrange=$(jot 898 101) |
| 616 | else |
487 | else |
| 617 | pwrange="`seq 101 999`" |
488 | pwrange=$(seq 101 999) |
| 618 | fi |
489 | fi |
| 619 | for euid in ${pwrange} ; do |
490 | for euid in ${pwrange} ; do |
| 620 | [ -z "`egetent passwd ${euid}`" ] && break |
491 | [[ -z $(egetent passwd ${euid}) ]] && break |
| 621 | done |
492 | done |
| 622 | fi |
493 | fi |
| 623 | opts="${opts} -u ${euid}" |
494 | opts="${opts} -u ${euid}" |
| 624 | einfo " - Userid: ${euid}" |
495 | einfo " - Userid: ${euid}" |
| 625 | |
496 | |
| 626 | # handle shell |
497 | # handle shell |
| 627 | local eshell="$1"; shift |
498 | local eshell=$1; shift |
| 628 | if [ ! -z "${eshell}" ] && [ "${eshell}" != "-1" ] |
499 | if [[ ! -z ${eshell} ]] && [[ ${eshell} != "-1" ]] ; then |
| 629 | then |
|
|
| 630 | if [ ! -e "${eshell}" ] |
500 | if [[ ! -e ${eshell} ]] ; then |
| 631 | then |
|
|
| 632 | eerror "A shell was specified but it does not exist !" |
501 | eerror "A shell was specified but it does not exist !" |
| 633 | die "${eshell} does not exist" |
502 | die "${eshell} does not exist" |
| 634 | fi |
503 | fi |
| 635 | else |
504 | else |
| 636 | if [ "${USERLAND}" == "BSD" ] |
505 | case ${USERLAND} in |
| 637 | then |
|
|
| 638 | eshell="/usr/bin/false" |
506 | Darwin) eshell="/usr/bin/false";; |
| 639 | else |
507 | BSD) eshell="/usr/sbin/nologin";; |
| 640 | eshell="/bin/false" |
508 | *) eshell="/bin/false";; |
| 641 | fi |
509 | esac |
| 642 | fi |
510 | fi |
| 643 | einfo " - Shell: ${eshell}" |
511 | einfo " - Shell: ${eshell}" |
| 644 | opts="${opts} -s ${eshell}" |
512 | opts="${opts} -s ${eshell}" |
| 645 | |
513 | |
| 646 | # handle homedir |
514 | # handle homedir |
| 647 | local ehome="$1"; shift |
515 | local ehome=$1; shift |
| 648 | if [ -z "${ehome}" ] && [ "${eshell}" != "-1" ] |
516 | if [[ -z ${ehome} ]] || [[ ${ehome} == "-1" ]] ; then |
| 649 | then |
|
|
| 650 | ehome="/dev/null" |
517 | ehome="/dev/null" |
| 651 | fi |
518 | fi |
| 652 | einfo " - Home: ${ehome}" |
519 | einfo " - Home: ${ehome}" |
| 653 | opts="${opts} -d ${ehome}" |
520 | opts="${opts} -d ${ehome}" |
| 654 | |
521 | |
| 655 | # handle groups |
522 | # handle groups |
| 656 | local egroups="$1"; shift |
523 | local egroups=$1; shift |
| 657 | if [ ! -z "${egroups}" ] |
524 | if [[ ! -z ${egroups} ]] ; then |
| 658 | then |
|
|
| 659 | local oldifs="${IFS}" |
525 | local oldifs=${IFS} |
| 660 | local defgroup="" exgroups="" |
526 | local defgroup="" exgroups="" |
| 661 | |
527 | |
| 662 | export IFS="," |
528 | export IFS="," |
| 663 | for g in ${egroups} |
529 | for g in ${egroups} ; do |
| 664 | do |
|
|
| 665 | export IFS="${oldifs}" |
530 | export IFS=${oldifs} |
| 666 | if [ -z "`egetent group \"${g}\"`" ] |
531 | if [[ -z $(egetent group "${g}") ]] ; then |
| 667 | then |
|
|
| 668 | eerror "You must add group ${g} to the system first" |
532 | eerror "You must add group ${g} to the system first" |
| 669 | die "${g} is not a valid GID" |
533 | die "${g} is not a valid GID" |
| 670 | fi |
534 | fi |
| 671 | if [ -z "${defgroup}" ] |
535 | if [[ -z ${defgroup} ]] ; then |
| 672 | then |
|
|
| 673 | defgroup="${g}" |
536 | defgroup=${g} |
| 674 | else |
537 | else |
| 675 | exgroups="${exgroups},${g}" |
538 | exgroups="${exgroups},${g}" |
| 676 | fi |
539 | fi |
| 677 | export IFS="," |
540 | export IFS="," |
| 678 | done |
541 | done |
| 679 | export IFS="${oldifs}" |
542 | export IFS=${oldifs} |
| 680 | |
543 | |
| 681 | opts="${opts} -g ${defgroup}" |
544 | opts="${opts} -g ${defgroup}" |
| 682 | if [ ! -z "${exgroups}" ] |
545 | if [[ ! -z ${exgroups} ]] ; then |
| 683 | then |
|
|
| 684 | opts="${opts} -G ${exgroups:1}" |
546 | opts="${opts} -G ${exgroups:1}" |
| 685 | fi |
547 | fi |
| 686 | else |
548 | else |
| 687 | egroups="(none)" |
549 | egroups="(none)" |
| 688 | fi |
550 | fi |
| 689 | einfo " - Groups: ${egroups}" |
551 | einfo " - Groups: ${egroups}" |
| 690 | |
552 | |
| 691 | # handle extra and add the user |
553 | # handle extra and add the user |
| 692 | local eextra="$@" |
|
|
| 693 | local oldsandbox="${SANDBOX_ON}" |
554 | local oldsandbox=${SANDBOX_ON} |
| 694 | export SANDBOX_ON="0" |
555 | export SANDBOX_ON="0" |
| 695 | if useq ppc-macos |
556 | case ${USERLAND} in |
| 696 | then |
557 | Darwin) |
| 697 | ### Make the user |
558 | ### Make the user |
| 698 | if [ -z "${eextra}" ] |
559 | if [[ -z $@ ]] ; then |
| 699 | then |
|
|
| 700 | dscl . create /users/${euser} uid ${euid} |
560 | dscl . create /users/${euser} uid ${euid} |
| 701 | dscl . create /users/${euser} shell ${eshell} |
561 | dscl . create /users/${euser} shell ${eshell} |
| 702 | dscl . create /users/${euser} home ${ehome} |
562 | dscl . create /users/${euser} home ${ehome} |
| 703 | dscl . create /users/${euser} realname "added by portage for ${PN}" |
563 | dscl . create /users/${euser} realname "added by portage for ${PN}" |
| 704 | ### Add the user to the groups specified |
564 | ### Add the user to the groups specified |
| 705 | local oldifs="${IFS}" |
565 | local oldifs=${IFS} |
| 706 | export IFS="," |
566 | export IFS="," |
| 707 | for g in ${egroups} |
567 | for g in ${egroups} ; do |
| 708 | do |
|
|
| 709 | dscl . merge /groups/${g} users ${euser} |
568 | dscl . merge /groups/${g} users ${euser} |
| 710 | done |
569 | done |
| 711 | export IFS="${oldifs}" |
570 | export IFS=${oldifs} |
| 712 | else |
571 | else |
| 713 | einfo "Extra options are not supported on macos yet" |
572 | einfo "Extra options are not supported on Darwin yet" |
| 714 | einfo "Please report the ebuild along with the info below" |
573 | einfo "Please report the ebuild along with the info below" |
| 715 | einfo "eextra: ${eextra}" |
574 | einfo "eextra: $@" |
| 716 | die "Required function missing" |
575 | die "Required function missing" |
| 717 | fi |
576 | fi |
| 718 | elif use x86-fbsd ; then |
577 | ;; |
| 719 | if [ -z "${eextra}" ] |
578 | BSD) |
| 720 | then |
579 | if [[ -z $@ ]] ; then |
| 721 | pw useradd ${euser} ${opts} \ |
580 | pw useradd ${euser} ${opts} \ |
| 722 | -c "added by portage for ${PN}" \ |
581 | -c "added by portage for ${PN}" \ |
| 723 | die "enewuser failed" |
582 | die "enewuser failed" |
| 724 | else |
583 | else |
| 725 | einfo " - Extra: ${eextra}" |
584 | einfo " - Extra: $@" |
| 726 | pw useradd ${euser} ${opts} \ |
585 | pw useradd ${euser} ${opts} \ |
| 727 | -c ${eextra} || die "enewuser failed" |
586 | "$@" || die "enewuser failed" |
| 728 | fi |
587 | fi |
| 729 | else |
588 | ;; |
| 730 | if [ -z "${eextra}" ] |
589 | *) |
| 731 | then |
590 | if [[ -z $@ ]] ; then |
| 732 | useradd ${opts} ${euser} \ |
591 | useradd ${opts} ${euser} \ |
| 733 | -c "added by portage for ${PN}" \ |
592 | -c "added by portage for ${PN}" \ |
| 734 | || die "enewuser failed" |
593 | || die "enewuser failed" |
| 735 | else |
594 | else |
| 736 | einfo " - Extra: ${eextra}" |
595 | einfo " - Extra: $@" |
| 737 | useradd ${opts} ${euser} ${eextra} \ |
596 | useradd ${opts} ${euser} "$@" \ |
| 738 | || die "enewuser failed" |
597 | || die "enewuser failed" |
| 739 | fi |
598 | fi |
| 740 | fi |
599 | ;; |
|
|
600 | esac |
| 741 | export SANDBOX_ON="${oldsandbox}" |
601 | export SANDBOX_ON=${oldsandbox} |
| 742 | |
602 | |
| 743 | if [ ! -e "${ehome}" ] && [ ! -e "${D}/${ehome}" ] |
603 | if [ ! -e "${ehome}" ] && [ ! -e "${D}/${ehome}" ] |
| 744 | then |
604 | then |
| 745 | einfo " - Creating ${ehome} in ${D}" |
605 | einfo " - Creating ${ehome} in ${D}" |
| 746 | dodir ${ehome} |
606 | dodir ${ehome} |
| … | |
… | |
| 783 | then |
643 | then |
| 784 | if [ "${egid}" -gt 0 ] |
644 | if [ "${egid}" -gt 0 ] |
| 785 | then |
645 | then |
| 786 | if [ -z "`egetent group ${egid}`" ] |
646 | if [ -z "`egetent group ${egid}`" ] |
| 787 | then |
647 | then |
| 788 | if useq ppc-macos ; then |
648 | if [[ "${USERLAND}" == "Darwin" ]]; then |
| 789 | opts="${opts} ${egid}" |
649 | opts="${opts} ${egid}" |
| 790 | else |
650 | else |
| 791 | opts="${opts} -g ${egid}" |
651 | opts="${opts} -g ${egid}" |
| 792 | fi |
652 | fi |
| 793 | else |
653 | else |
| … | |
… | |
| 807 | opts="${opts} ${eextra}" |
667 | opts="${opts} ${eextra}" |
| 808 | |
668 | |
| 809 | # add the group |
669 | # add the group |
| 810 | local oldsandbox="${SANDBOX_ON}" |
670 | local oldsandbox="${SANDBOX_ON}" |
| 811 | export SANDBOX_ON="0" |
671 | export SANDBOX_ON="0" |
| 812 | if useq ppc-macos ; then |
672 | if [[ "${USERLAND}" == "Darwin" ]]; then |
| 813 | if [ ! -z "${eextra}" ]; |
673 | if [ ! -z "${eextra}" ]; |
| 814 | then |
674 | then |
| 815 | einfo "Extra options are not supported on macos yet" |
675 | einfo "Extra options are not supported on Darwin/OS X yet" |
| 816 | einfo "Please report the ebuild along with the info below" |
676 | einfo "Please report the ebuild along with the info below" |
| 817 | einfo "eextra: ${eextra}" |
677 | einfo "eextra: ${eextra}" |
| 818 | die "Required function missing" |
678 | die "Required function missing" |
| 819 | fi |
679 | fi |
| 820 | |
680 | |
| … | |
… | |
| 825 | [ -z "`egetent group ${egid}`" ] && break |
685 | [ -z "`egetent group ${egid}`" ] && break |
| 826 | done |
686 | done |
| 827 | esac |
687 | esac |
| 828 | dscl . create /groups/${egroup} gid ${egid} |
688 | dscl . create /groups/${egroup} gid ${egid} |
| 829 | dscl . create /groups/${egroup} passwd '*' |
689 | dscl . create /groups/${egroup} passwd '*' |
| 830 | elif use x86-fbsd ; then |
690 | elif [[ "${USERLAND}" == "BSD" ]] ; then |
| 831 | case ${egid} in |
691 | case ${egid} in |
| 832 | *[!0-9]*) # Non numeric |
692 | *[!0-9]*) # Non numeric |
| 833 | for egid in `jot 898 101`; do |
693 | for egid in `jot 898 101`; do |
| 834 | [ -z "`egetent group ${egid}`" ] && break |
694 | [ -z "`egetent group ${egid}`" ] && break |
| 835 | done |
695 | done |
| … | |
… | |
| 982 | *) |
842 | *) |
| 983 | type= |
843 | type= |
| 984 | ;; |
844 | ;; |
| 985 | esac |
845 | esac |
| 986 | fi |
846 | fi |
| 987 | |
847 | if [ "${SLOT}" == "0" ] ; then |
|
|
848 | local desktop_name="${PN}" |
|
|
849 | else |
|
|
850 | local desktop_name="${PN}-${SLOT}" |
|
|
851 | fi |
| 988 | local desktop=${T}/${exec%% *}-${P}.desktop |
852 | local desktop=${T}/${exec%% *}-${desktop_name}.desktop |
| 989 | |
853 | |
| 990 | echo "[Desktop Entry] |
854 | echo "[Desktop Entry] |
| 991 | Encoding=UTF-8 |
855 | Encoding=UTF-8 |
| 992 | Version=0.9.2 |
856 | Version=0.9.2 |
| 993 | Name=${name} |
857 | Name=${name} |
| … | |
… | |
| 1570 | while ((i--)) ; do |
1434 | while ((i--)) ; do |
| 1571 | ewarn "PLEASE UPDATE TO YOUR PACKAGE TO USE linux-info.eclass" |
1435 | ewarn "PLEASE UPDATE TO YOUR PACKAGE TO USE linux-info.eclass" |
| 1572 | done |
1436 | done |
| 1573 | export EUTILS_ECLASS_PORTAGE_ARCH="${ARCH}" |
1437 | export EUTILS_ECLASS_PORTAGE_ARCH="${ARCH}" |
| 1574 | case ${ARCH} in |
1438 | case ${ARCH} in |
| 1575 | x86) export ARCH="i386";; |
1439 | x86) export ARCH="i386";; |
| 1576 | amd64) export ARCH="x86_64";; |
1440 | amd64) export ARCH="x86_64";; |
| 1577 | hppa) export ARCH="parisc";; |
1441 | hppa) export ARCH="parisc";; |
| 1578 | mips) export ARCH="mips";; |
1442 | mips) export ARCH="mips";; |
| 1579 | sparc) export ARCH="$(tc-arch-kernel)";; # Yeah this is ugly, but it's even WORSE if you don't do this. linux-info.eclass's set_arch_to_kernel is fixed, but won't get used over this one! |
1443 | sparc) export ARCH="$(tc-arch-kernel)";; # Yeah this is ugly, but it's even WORSE if you don't do this. linux-info.eclass's set_arch_to_kernel is fixed, but won't get used over this one! |
| 1580 | *) export ARCH="${ARCH}";; |
1444 | *) export ARCH="${ARCH}";; |
| 1581 | esac |
1445 | esac |
| 1582 | } |
1446 | } |
| 1583 | |
1447 | |
| 1584 | # set's ARCH back to what portage expects |
1448 | # set's ARCH back to what portage expects |
| 1585 | set_arch_to_portage() { |
1449 | set_arch_to_portage() { |
| … | |
… | |
| 1692 | dopamd() { |
1556 | dopamd() { |
| 1693 | [[ -z $1 ]] && die "dopamd requires at least one argument" |
1557 | [[ -z $1 ]] && die "dopamd requires at least one argument" |
| 1694 | |
1558 | |
| 1695 | use pam || return 0 |
1559 | use pam || return 0 |
| 1696 | |
1560 | |
| 1697 | insinto /etc/pam.d |
1561 | INSDESTTREE=/etc/pam.d \ |
| 1698 | doins "$@" || die "failed to install $@" |
1562 | doins "$@" || die "failed to install $@" |
| 1699 | } |
1563 | } |
| 1700 | # newpamd <old name> <new name> |
1564 | # newpamd <old name> <new name> |
| 1701 | # |
1565 | # |
| 1702 | # Install pam file <old name> as <new name> in /etc/pam.d |
1566 | # Install pam file <old name> as <new name> in /etc/pam.d |
| 1703 | newpamd() { |
1567 | newpamd() { |
| 1704 | [[ $# -ne 2 ]] && die "newpamd requires two arguements" |
1568 | [[ $# -ne 2 ]] && die "newpamd requires two arguements" |
| 1705 | |
1569 | |
| 1706 | use pam || return 0 |
1570 | use pam || return 0 |
| 1707 | |
1571 | |
| 1708 | insinto /etc/pam.d |
1572 | INSDESTTREE=/etc/pam.d \ |
| 1709 | newins "$1" "$2" || die "failed to install $1 as $2" |
1573 | newins "$1" "$2" || die "failed to install $1 as $2" |
| 1710 | } |
1574 | } |
| 1711 | |
1575 | |
| 1712 | # make a wrapper script ... |
1576 | # make a wrapper script ... |
| 1713 | # NOTE: this was originally games_make_wrapper, but I noticed other places where |
1577 | # NOTE: this was originally games_make_wrapper, but I noticed other places where |