| 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.92 2004/08/03 17:24:52 vapier Exp $ |
3 | # $Header: /var/cvsroot/gentoo-x86/eclass/eutils.eclass,v 1.108 2004/10/01 19:23:58 ka0ttic 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. |
| … | |
… | |
| 13 | INHERITED="$INHERITED $ECLASS" |
13 | INHERITED="$INHERITED $ECLASS" |
| 14 | |
14 | |
| 15 | DEPEND="!bootstrap? ( sys-devel/patch )" |
15 | DEPEND="!bootstrap? ( sys-devel/patch )" |
| 16 | |
16 | |
| 17 | DESCRIPTION="Based on the ${ECLASS} eclass" |
17 | DESCRIPTION="Based on the ${ECLASS} eclass" |
|
|
18 | |
|
|
19 | # Wait for the supplied number of seconds. If no argument is supplied, defaults |
|
|
20 | # to five seconds. If the EPAUSE_IGNORE env var is set, don't wait. If we're not |
|
|
21 | # outputting to a terminal, don't wait. For compatability purposes, the argument |
|
|
22 | # must be an integer greater than zero. |
|
|
23 | # Bug 62950, Ciaran McCreesh <ciaranm@gentoo.org> (05 Sep 2004) |
|
|
24 | epause() { |
|
|
25 | if [ -z "$EPAUSE_IGNORE" ] && [ -t 1 ] ; then |
|
|
26 | sleep ${1:-5} |
|
|
27 | fi |
|
|
28 | } |
|
|
29 | |
|
|
30 | # Beep the specified number of times (defaults to five). If our output |
|
|
31 | # is not a terminal, don't beep. If the EBEEP_IGNORE env var is set, |
|
|
32 | # don't beep. |
|
|
33 | # Bug 62950, Ciaran McCreesh <ciaranm@gentoo.org> (05 Sep 2004) |
|
|
34 | ebeep() { |
|
|
35 | local n |
|
|
36 | if [ -z "$EBEEP_IGNORE" ] && [ -t 1 ] ; then |
|
|
37 | for ((n=1 ; n <= ${1:-5} ; n++)) ; do |
|
|
38 | echo -ne "\a" |
|
|
39 | sleep 0.1 &>/dev/null ; sleep 0,1 &>/dev/null |
|
|
40 | echo -ne "\a" |
|
|
41 | sleep 1 |
|
|
42 | done |
|
|
43 | fi |
|
|
44 | } |
|
|
45 | |
|
|
46 | # This function simply returns the desired lib directory. With portage |
|
|
47 | # 2.0.51, we now have support for installing libraries to lib32/lib64 |
|
|
48 | # to accomidate the needs of multilib systems. It's no longer a good idea |
|
|
49 | # to assume all libraries will end up in lib. Replace any (sane) instances |
|
|
50 | # where lib is named directly with $(get_libdir) if possible. |
|
|
51 | # |
|
|
52 | # Travis Tilley <lv@gentoo.org> (24 Aug 2004) |
|
|
53 | get_libdir() { |
|
|
54 | LIBDIR_TEST=$(type econf) |
|
|
55 | if [ ! -z "${CONF_LIBDIR_OVERRIDE}" ] ; then |
|
|
56 | # if there is an override, we want to use that... always. |
|
|
57 | CONF_LIBDIR="${CONF_LIBDIR_OVERRIDE}" |
|
|
58 | # We don't need to know the verison of portage. We only need to know |
|
|
59 | # if there is support for CONF_LIBDIR in econf and co. |
|
|
60 | # Danny van Dyk <kugelfang@gentoo.org> 2004/17/09 |
|
|
61 | #elif portageq has_version / '<sys-apps/portage-2.0.51_pre20' ; then |
|
|
62 | # # and if there isnt an override, and we're using a version of |
|
|
63 | # # portage without CONF_LIBDIR support, force the use of lib. dolib |
|
|
64 | # # and friends from portage 2.0.50 wont be too happy otherwise. |
|
|
65 | # CONF_LIBDIR="lib" |
|
|
66 | #fi |
|
|
67 | elif [ "${LIBDIR_TEST/CONF_LIBDIR}" == "${LIBDIR_TEST}" ]; then # we don't have CONF_LIBDIR support |
|
|
68 | # will be <portage-2.0.51_pre20 |
|
|
69 | CONF_LIBDIR="lib" |
|
|
70 | fi |
|
|
71 | # and of course, default to lib if CONF_LIBDIR isnt set |
|
|
72 | echo ${CONF_LIBDIR:=lib} |
|
|
73 | unset LIBDIR_TEST |
|
|
74 | } |
|
|
75 | |
|
|
76 | |
|
|
77 | get_multilibdir() { |
|
|
78 | echo ${CONF_MULTILIBDIR:=lib32} |
|
|
79 | } |
|
|
80 | |
|
|
81 | |
|
|
82 | # Sometimes you need to override the value returned by get_libdir. A good |
|
|
83 | # example of this is xorg-x11, where lib32 isnt a supported configuration, |
|
|
84 | # and where lib64 -must- be used on amd64 (for applications that need lib |
|
|
85 | # to be 32bit, such as adobe acrobat). Note that this override also bypasses |
|
|
86 | # portage version sanity checking. |
|
|
87 | # get_libdir_override expects one argument, the result get_libdir should |
|
|
88 | # return: |
|
|
89 | # |
|
|
90 | # get_libdir_override lib64 |
|
|
91 | # |
|
|
92 | # Travis Tilley <lv@gentoo.org> (31 Aug 2004) |
|
|
93 | get_libdir_override() { |
|
|
94 | CONF_LIBDIR="$1" |
|
|
95 | CONF_LIBDIR_OVERRIDE="$1" |
|
|
96 | } |
| 18 | |
97 | |
| 19 | # This function generate linker scripts in /usr/lib for dynamic |
98 | # This function generate linker scripts in /usr/lib for dynamic |
| 20 | # libs in /lib. This is to fix linking problems when you have |
99 | # libs in /lib. This is to fix linking problems when you have |
| 21 | # the .so in /lib, and the .a in /usr/lib. What happens is that |
100 | # the .so in /lib, and the .a in /usr/lib. What happens is that |
| 22 | # in some cases when linking dynamic, the .a in /usr/lib is used |
101 | # in some cases when linking dynamic, the .a in /usr/lib is used |
| … | |
… | |
| 33 | # to point to the latest version of the library present. |
112 | # to point to the latest version of the library present. |
| 34 | # |
113 | # |
| 35 | # <azarah@gentoo.org> (26 Oct 2002) |
114 | # <azarah@gentoo.org> (26 Oct 2002) |
| 36 | # |
115 | # |
| 37 | gen_usr_ldscript() { |
116 | gen_usr_ldscript() { |
| 38 | |
|
|
| 39 | # Just make sure it exists |
117 | # Just make sure it exists |
| 40 | dodir /usr/lib |
118 | dodir /usr/$(get_libdir) |
| 41 | |
119 | |
| 42 | cat > ${D}/usr/lib/$1 <<"END_LDSCRIPT" |
120 | cat > "${D}/usr/$(get_libdir)/$1" << END_LDSCRIPT |
| 43 | /* GNU ld script |
121 | /* GNU ld script |
| 44 | Because Gentoo have critical dynamic libraries |
122 | Because Gentoo have critical dynamic libraries |
| 45 | in /lib, and the static versions in /usr/lib, we |
123 | in /lib, and the static versions in /usr/lib, we |
| 46 | need to have a "fake" dynamic lib in /usr/lib, |
124 | need to have a "fake" dynamic lib in /usr/lib, |
| 47 | otherwise we run into linking problems. |
125 | otherwise we run into linking problems. |
| 48 | See bug #4411 on http://bugs.gentoo.org/ for |
126 | See bug #4411 on http://bugs.gentoo.org/ for |
| 49 | more info. */ |
127 | more info. */ |
| 50 | GROUP ( /lib/libxxx ) |
128 | GROUP ( /$(get_libdir)/$1 ) |
| 51 | END_LDSCRIPT |
129 | END_LDSCRIPT |
| 52 | |
|
|
| 53 | dosed "s:libxxx:$1:" /usr/lib/$1 |
|
|
| 54 | |
|
|
| 55 | return 0 |
|
|
| 56 | } |
130 | } |
| 57 | |
131 | |
| 58 | # Simple function to draw a line consisting of '=' the same length as $* |
132 | # Simple function to draw a line consisting of '=' the same length as $* |
| 59 | # |
133 | # |
| 60 | # <azarah@gentoo.org> (11 Nov 2002) |
134 | # <azarah@gentoo.org> (11 Nov 2002) |
| … | |
… | |
| 144 | local SINGLE_PATCH="no" |
218 | local SINGLE_PATCH="no" |
| 145 | local x="" |
219 | local x="" |
| 146 | |
220 | |
| 147 | if [ "$#" -gt 1 ] |
221 | if [ "$#" -gt 1 ] |
| 148 | then |
222 | then |
| 149 | eerror "Invalid arguments to epatch()" |
223 | local m="" |
| 150 | die "Invalid arguments to epatch()" |
224 | einfo "${#} patches to apply..." |
|
|
225 | for m in "$@" ; do |
|
|
226 | epatch "${m}" |
|
|
227 | done |
|
|
228 | return 0 |
| 151 | fi |
229 | fi |
| 152 | |
230 | |
| 153 | if [ -n "$1" -a -f "$1" ] |
231 | if [ -n "$1" -a -f "$1" ] |
| 154 | then |
232 | then |
| 155 | SINGLE_PATCH="yes" |
233 | SINGLE_PATCH="yes" |
| … | |
… | |
| 336 | # This function return true if we are using the NPTL pthreads |
414 | # This function return true if we are using the NPTL pthreads |
| 337 | # implementation. |
415 | # implementation. |
| 338 | # |
416 | # |
| 339 | # <azarah@gentoo.org> (06 March 2003) |
417 | # <azarah@gentoo.org> (06 March 2003) |
| 340 | # |
418 | # |
| 341 | |
|
|
| 342 | have_NPTL() { |
419 | have_NPTL() { |
| 343 | |
|
|
| 344 | cat > ${T}/test-nptl.c <<-"END" |
420 | cat > ${T}/test-nptl.c <<-"END" |
| 345 | #define _XOPEN_SOURCE |
421 | #define _XOPEN_SOURCE |
| 346 | #include <unistd.h> |
422 | #include <unistd.h> |
| 347 | #include <stdio.h> |
423 | #include <stdio.h> |
| 348 | |
424 | |
| … | |
… | |
| 466 | # vapier@gentoo.org |
542 | # vapier@gentoo.org |
| 467 | # |
543 | # |
| 468 | # Takes just 1 parameter (the directory to create tmpfile in) |
544 | # Takes just 1 parameter (the directory to create tmpfile in) |
| 469 | mymktemp() { |
545 | mymktemp() { |
| 470 | local topdir="$1" |
546 | local topdir="$1" |
| 471 | |
547 | |
| 472 | [ -z "${topdir}" ] && topdir=/tmp |
548 | [ -z "${topdir}" ] && topdir=/tmp |
| 473 | if [ "`which mktemp 2>/dev/null`" ] |
549 | if [ "`which mktemp 2>/dev/null`" ] |
| 474 | then |
550 | then |
| 475 | mktemp -p ${topdir} |
551 | mktemp -p ${topdir} |
| 476 | else |
552 | else |
| … | |
… | |
| 478 | touch ${tmp} |
554 | touch ${tmp} |
| 479 | echo ${tmp} |
555 | echo ${tmp} |
| 480 | fi |
556 | fi |
| 481 | } |
557 | } |
| 482 | |
558 | |
| 483 | # Small wrapper for getent (Linux) and nidump (Mac OS X) |
559 | # Small wrapper for getent (Linux), nidump (Mac OS X), |
| 484 | # used in enewuser()/enewgroup() |
560 | # and pw (FreeBSD) used in enewuser()/enewgroup() |
| 485 | # Joe Jezak <josejx@gmail.com> and usata@gentoo.org |
561 | # Joe Jezak <josejx@gmail.com> and usata@gentoo.org |
|
|
562 | # FBSD stuff: Aaron Walker <ka0ttic@gentoo.org> |
| 486 | # |
563 | # |
| 487 | # egetent(database, key) |
564 | # egetent(database, key) |
| 488 | egetent() { |
565 | egetent() { |
| 489 | if [ "${ARCH}" == "macos" ] ; then |
566 | if use macos || use ppc-macos ; then |
| 490 | case "$2" in |
567 | case "$2" in |
| 491 | *[!0-9]*) # Non numeric |
568 | *[!0-9]*) # Non numeric |
| 492 | nidump $1 . | awk -F":" "{ if (\$1 ~ /^$2$/) {print \$0;exit;} }" |
569 | nidump $1 . | awk -F":" "{ if (\$1 ~ /^$2$/) {print \$0;exit;} }" |
| 493 | ;; |
570 | ;; |
| 494 | *) # Numeric |
571 | *) # Numeric |
| 495 | nidump $1 . | awk -F":" "{ if (\$3 == $2) {print \$0;exit;} }" |
572 | nidump $1 . | awk -F":" "{ if (\$3 == $2) {print \$0;exit;} }" |
| 496 | ;; |
573 | ;; |
| 497 | esac |
574 | esac |
|
|
575 | elif useq x86-fbsd ; then |
|
|
576 | local action |
|
|
577 | if [ "$1" == "passwd" ] |
|
|
578 | then |
|
|
579 | action="user" |
| 498 | else |
580 | else |
|
|
581 | action="group" |
|
|
582 | fi |
|
|
583 | pw show "${action}" "$2" -q |
|
|
584 | else |
| 499 | getent $1 $2 |
585 | getent "$1" "$2" |
| 500 | fi |
586 | fi |
| 501 | } |
587 | } |
| 502 | |
588 | |
| 503 | # Simplify/standardize adding users to the system |
589 | # Simplify/standardize adding users to the system |
| 504 | # vapier@gentoo.org |
590 | # vapier@gentoo.org |
| … | |
… | |
| 550 | euid="next" |
636 | euid="next" |
| 551 | fi |
637 | fi |
| 552 | if [ "${euid}" == "next" ] |
638 | if [ "${euid}" == "next" ] |
| 553 | then |
639 | then |
| 554 | local pwrange |
640 | local pwrange |
| 555 | if [ "${ARCH}" == "macos" ] ; then |
641 | if use macos || use ppc-macos || [ "${USERLAND}" == "BSD" ] ; then |
| 556 | pwrange="`jot 898 101`" |
642 | pwrange="`jot 898 101`" |
| 557 | else |
643 | else |
| 558 | pwrange="`seq 101 999`" |
644 | pwrange="`seq 101 999`" |
| 559 | fi |
645 | fi |
| 560 | for euid in ${pwrange} ; do |
646 | for euid in ${pwrange} ; do |
| … | |
… | |
| 572 | then |
658 | then |
| 573 | eerror "A shell was specified but it does not exist !" |
659 | eerror "A shell was specified but it does not exist !" |
| 574 | die "${eshell} does not exist" |
660 | die "${eshell} does not exist" |
| 575 | fi |
661 | fi |
| 576 | else |
662 | else |
|
|
663 | if [ "${USERLAND}" == "BSD" ] |
|
|
664 | then |
|
|
665 | eshell="/usr/bin/false" |
|
|
666 | else |
| 577 | eshell="/bin/false" |
667 | eshell="/bin/false" |
|
|
668 | fi |
| 578 | fi |
669 | fi |
| 579 | einfo " - Shell: ${eshell}" |
670 | einfo " - Shell: ${eshell}" |
| 580 | opts="${opts} -s ${eshell}" |
671 | opts="${opts} -s ${eshell}" |
| 581 | |
672 | |
| 582 | # handle homedir |
673 | # handle homedir |
| … | |
… | |
| 591 | # handle groups |
682 | # handle groups |
| 592 | local egroups="$1"; shift |
683 | local egroups="$1"; shift |
| 593 | if [ ! -z "${egroups}" ] |
684 | if [ ! -z "${egroups}" ] |
| 594 | then |
685 | then |
| 595 | local oldifs="${IFS}" |
686 | local oldifs="${IFS}" |
|
|
687 | local defgroup="" exgroups="" |
|
|
688 | |
| 596 | export IFS="," |
689 | export IFS="," |
| 597 | for g in ${egroups} |
690 | for g in ${egroups} |
| 598 | do |
691 | do |
| 599 | if [ -z "`egetent group \"${g}\"`" ] |
692 | if [ -z "`egetent group \"${g}\"`" ] |
| 600 | then |
693 | then |
| 601 | eerror "You must add group ${g} to the system first" |
694 | eerror "You must add group ${g} to the system first" |
| 602 | die "${g} is not a valid GID" |
695 | die "${g} is not a valid GID" |
| 603 | fi |
696 | fi |
|
|
697 | if [ -z "${defgroup}" ] |
|
|
698 | then |
|
|
699 | defgroup="${g}" |
|
|
700 | else |
|
|
701 | exgroups="${exgroups},${g}" |
|
|
702 | fi |
| 604 | done |
703 | done |
| 605 | export IFS="${oldifs}" |
704 | export IFS="${oldifs}" |
|
|
705 | |
| 606 | opts="${opts} -g ${egroups}" |
706 | opts="${opts} -g ${defgroup}" |
|
|
707 | if [ ! -z "${exgroups}" ] |
|
|
708 | then |
|
|
709 | opts="${opts} -G ${exgroups:1}" |
|
|
710 | fi |
| 607 | else |
711 | else |
| 608 | egroups="(none)" |
712 | egroups="(none)" |
| 609 | fi |
713 | fi |
| 610 | einfo " - Groups: ${egroups}" |
714 | einfo " - Groups: ${egroups}" |
| 611 | |
715 | |
| 612 | # handle extra and add the user |
716 | # handle extra and add the user |
| 613 | local eextra="$@" |
717 | local eextra="$@" |
| 614 | local oldsandbox="${SANDBOX_ON}" |
718 | local oldsandbox="${SANDBOX_ON}" |
| 615 | export SANDBOX_ON="0" |
719 | export SANDBOX_ON="0" |
| 616 | if [ "${ARCH}" == "macos" ]; |
720 | if use macos || use ppc-macos ; |
| 617 | then |
721 | then |
| 618 | ### Make the user |
722 | ### Make the user |
| 619 | if [ -z "${eextra}" ] |
723 | if [ -z "${eextra}" ] |
| 620 | then |
724 | then |
| 621 | dscl . create /users/${euser} uid ${euid} |
725 | dscl . create /users/${euser} uid ${euid} |
| … | |
… | |
| 623 | dscl . create /users/${euser} home ${ehome} |
727 | dscl . create /users/${euser} home ${ehome} |
| 624 | dscl . create /users/${euser} realname "added by portage for ${PN}" |
728 | dscl . create /users/${euser} realname "added by portage for ${PN}" |
| 625 | ### Add the user to the groups specified |
729 | ### Add the user to the groups specified |
| 626 | for g in ${egroups} |
730 | for g in ${egroups} |
| 627 | do |
731 | do |
|
|
732 | # $egroups is , delimited, not space |
|
|
733 | ewarn "This is code is wrong; someone on the OS X team should fix it" |
| 628 | dscl . merge /groups/${g} users ${euser} |
734 | dscl . merge /groups/${g} users ${euser} |
| 629 | done |
735 | done |
| 630 | else |
736 | else |
| 631 | einfo "Extra options are not supported on macos yet" |
737 | einfo "Extra options are not supported on macos yet" |
| 632 | einfo "Please report the ebuild along with the info below" |
738 | einfo "Please report the ebuild along with the info below" |
| 633 | einfo "eextra: ${eextra}" |
739 | einfo "eextra: ${eextra}" |
| 634 | die "Required function missing" |
740 | die "Required function missing" |
|
|
741 | fi |
|
|
742 | elif use x86-fbsd ; then |
|
|
743 | if [ -z "${eextra}" ] |
|
|
744 | then |
|
|
745 | pw useradd ${euser} ${opts} \ |
|
|
746 | -c "added by portage for ${PN}" \ |
|
|
747 | die "enewuser failed" |
|
|
748 | else |
|
|
749 | einfo " - Extra: ${eextra}" |
|
|
750 | pw useradd ${euser} ${opts} \ |
|
|
751 | -c ${eextra} || die "enewuser failed" |
| 635 | fi |
752 | fi |
| 636 | else |
753 | else |
| 637 | if [ -z "${eextra}" ] |
754 | if [ -z "${eextra}" ] |
| 638 | then |
755 | then |
| 639 | useradd ${opts} ${euser} \ |
756 | useradd ${opts} ${euser} \ |
| … | |
… | |
| 690 | then |
807 | then |
| 691 | if [ "${egid}" -gt 0 ] |
808 | if [ "${egid}" -gt 0 ] |
| 692 | then |
809 | then |
| 693 | if [ -z "`egetent group ${egid}`" ] |
810 | if [ -z "`egetent group ${egid}`" ] |
| 694 | then |
811 | then |
| 695 | if [ "${ARCH}" == "macos" ] ; then |
812 | if use macos || use ppc-macos ; then |
| 696 | opts="${opts} ${egid}" |
813 | opts="${opts} ${egid}" |
| 697 | else |
814 | else |
| 698 | opts="${opts} -g ${egid}" |
815 | opts="${opts} -g ${egid}" |
| 699 | fi |
816 | fi |
| 700 | else |
817 | else |
| … | |
… | |
| 714 | opts="${opts} ${eextra}" |
831 | opts="${opts} ${eextra}" |
| 715 | |
832 | |
| 716 | # add the group |
833 | # add the group |
| 717 | local oldsandbox="${SANDBOX_ON}" |
834 | local oldsandbox="${SANDBOX_ON}" |
| 718 | export SANDBOX_ON="0" |
835 | export SANDBOX_ON="0" |
| 719 | if [ "${ARCH}" == "macos" ]; |
836 | if use macos || use ppc-macos ; |
| 720 | then |
837 | then |
| 721 | if [ ! -z "${eextra}" ]; |
838 | if [ ! -z "${eextra}" ]; |
| 722 | then |
839 | then |
| 723 | einfo "Extra options are not supported on macos yet" |
840 | einfo "Extra options are not supported on macos yet" |
| 724 | einfo "Please report the ebuild along with the info below" |
841 | einfo "Please report the ebuild along with the info below" |
| 725 | einfo "eextra: ${eextra}" |
842 | einfo "eextra: ${eextra}" |
| 726 | die "Required function missing" |
843 | die "Required function missing" |
| 727 | fi |
844 | fi |
| 728 | |
845 | |
| 729 | # If we need the next available |
846 | # If we need the next available |
| 730 | case ${egid} in |
847 | case ${egid} in |
| 731 | *[!0-9]*) # Non numeric |
848 | *[!0-9]*) # Non numeric |
| 732 | for egid in `jot 898 101`; do |
849 | for egid in `jot 898 101`; do |
| 733 | [ -z "`egetent group ${egid}`" ] && break |
850 | [ -z "`egetent group ${egid}`" ] && break |
| 734 | done |
851 | done |
| 735 | esac |
852 | esac |
| 736 | dscl . create /groups/${egroup} gid ${egid} |
853 | dscl . create /groups/${egroup} gid ${egid} |
| 737 | dscl . create /groups/${egroup} passwd '*' |
854 | dscl . create /groups/${egroup} passwd '*' |
|
|
855 | elif use x86-fbsd ; then |
|
|
856 | case ${egid} in |
|
|
857 | *[!0-9]*) # Non numeric |
|
|
858 | for egid in `jot 898 101`; do |
|
|
859 | [ -z "`egetent group ${egid}`" ] && break |
|
|
860 | done |
|
|
861 | esac |
|
|
862 | pw groupadd ${egroup} -g ${egid} || die "enewgroup failed" |
| 738 | else |
863 | else |
| 739 | groupadd ${opts} ${egroup} || die "enewgroup failed" |
864 | groupadd ${opts} ${egroup} || die "enewgroup failed" |
| 740 | fi |
865 | fi |
| 741 | export SANDBOX_ON="${oldsandbox}" |
866 | export SANDBOX_ON="${oldsandbox}" |
| 742 | } |
867 | } |
| … | |
… | |
| 776 | local exec="${1}" |
901 | local exec="${1}" |
| 777 | local name="${2:-${PN}}" |
902 | local name="${2:-${PN}}" |
| 778 | local icon="${3:-${PN}.png}" |
903 | local icon="${3:-${PN}.png}" |
| 779 | local type="${4}" |
904 | local type="${4}" |
| 780 | local subdir="${6}" |
905 | local subdir="${6}" |
| 781 | local path="${5:-${GAMES_PREFIX}}" |
906 | local path="${5:-${GAMES_BINDIR}}" |
| 782 | if [ -z "${type}" ] |
907 | if [ -z "${type}" ] |
| 783 | then |
908 | then |
| 784 | case ${CATEGORY} in |
909 | case ${CATEGORY} in |
| 785 | "app-emulation") |
910 | "app-emulation") |
| 786 | type=Emulator |
911 | type=Emulator |
| … | |
… | |
| 809 | Type=Application |
934 | Type=Application |
| 810 | Comment=${DESCRIPTION} |
935 | Comment=${DESCRIPTION} |
| 811 | Exec=${exec} |
936 | Exec=${exec} |
| 812 | Path=${path} |
937 | Path=${path} |
| 813 | Icon=${icon} |
938 | Icon=${icon} |
| 814 | Categories=Application;${type};" > ${desktop} |
939 | Categories=Application;${type};" > "${desktop}" |
| 815 | |
940 | |
| 816 | if [ -d "/usr/share/applications" ] |
941 | if [ -d "/usr/share/applications" ] |
| 817 | then |
942 | then |
| 818 | insinto /usr/share/applications |
943 | insinto /usr/share/applications |
| 819 | doins ${desktop} |
944 | doins "${desktop}" |
| 820 | fi |
945 | fi |
| 821 | |
946 | |
| 822 | #if [ -d "/usr/share/gnome/apps" ] |
947 | #if [ -d "/usr/share/gnome/apps" ] |
| 823 | #then |
948 | #then |
| 824 | # insinto /usr/share/gnome/apps/Games |
949 | # insinto /usr/share/gnome/apps/Games |
| … | |
… | |
| 835 | #fi |
960 | #fi |
| 836 | |
961 | |
| 837 | if [ -d "/usr/share/applnk" ] |
962 | if [ -d "/usr/share/applnk" ] |
| 838 | then |
963 | then |
| 839 | insinto /usr/share/applnk/${subdir} |
964 | insinto /usr/share/applnk/${subdir} |
| 840 | doins ${desktop} |
965 | doins "${desktop}" |
| 841 | fi |
966 | fi |
| 842 | |
967 | |
| 843 | return 0 |
968 | return 0 |
| 844 | } |
969 | } |
| 845 | |
970 | |
| … | |
… | |
| 1016 | tail -n +${skip} ${src} | bzip2 -dc | tar --no-same-owner -xf - |
1141 | tail -n +${skip} ${src} | bzip2 -dc | tar --no-same-owner -xf - |
| 1017 | ;; |
1142 | ;; |
| 1018 | gzip*) |
1143 | gzip*) |
| 1019 | tail -n +${skip} ${src} | tar --no-same-owner -xzf - |
1144 | tail -n +${skip} ${src} | tar --no-same-owner -xzf - |
| 1020 | ;; |
1145 | ;; |
|
|
1146 | compress*) |
|
|
1147 | tail -n +${skip} ${src} | gunzip | tar --no-same-owner -xf - |
|
|
1148 | ;; |
| 1021 | *) |
1149 | *) |
|
|
1150 | eerror "Unknown filetype \"${filetype}\" ?" |
| 1022 | false |
1151 | false |
| 1023 | ;; |
1152 | ;; |
| 1024 | esac |
1153 | esac |
| 1025 | assert "failure unpacking (${filetype}) makeself ${shrtsrc} ('${ver}' +${skip})" |
1154 | assert "failure unpacking (${filetype}) makeself ${shrtsrc} ('${ver}' +${skip})" |
| 1026 | } |
1155 | } |
| … | |
… | |
| 1045 | [ ! -f "${lic}" ] && die "Could not find requested license ${src}" |
1174 | [ ! -f "${lic}" ] && die "Could not find requested license ${src}" |
| 1046 | local l="`basename ${lic}`" |
1175 | local l="`basename ${lic}`" |
| 1047 | |
1176 | |
| 1048 | # here is where we check for the licenses the user already |
1177 | # here is where we check for the licenses the user already |
| 1049 | # accepted ... if we don't find a match, we make the user accept |
1178 | # accepted ... if we don't find a match, we make the user accept |
|
|
1179 | local shopts=$- |
| 1050 | local alic |
1180 | local alic |
|
|
1181 | set -o noglob #so that bash doesn't expand "*" |
| 1051 | for alic in "${ACCEPT_LICENSE}" ; do |
1182 | for alic in ${ACCEPT_LICENSE} ; do |
| 1052 | [ "${alic}" == "*" ] && return 0 |
1183 | if [[ ${alic} == * || ${alic} == ${l} ]]; then |
| 1053 | [ "${alic}" == "${l}" ] && return 0 |
1184 | set +o noglob; set -${shopts} #reset old shell opts |
|
|
1185 | return 0 |
|
|
1186 | fi |
| 1054 | done |
1187 | done |
|
|
1188 | set +o noglob; set -$shopts #reset old shell opts |
| 1055 | |
1189 | |
| 1056 | local licmsg="`mymktemp ${T}`" |
1190 | local licmsg="`mymktemp ${T}`" |
| 1057 | cat << EOF > ${licmsg} |
1191 | cat << EOF > ${licmsg} |
| 1058 | ********************************************************** |
1192 | ********************************************************** |
| 1059 | The following license outlines the terms of use of this |
1193 | The following license outlines the terms of use of this |
| … | |
… | |
| 1247 | read |
1381 | read |
| 1248 | fi |
1382 | fi |
| 1249 | done |
1383 | done |
| 1250 | } |
1384 | } |
| 1251 | |
1385 | |
| 1252 | # Make sure that LINGUAS only contains languages that |
1386 | # Make sure that LINGUAS only contains languages that |
| 1253 | # a package can support |
1387 | # a package can support |
| 1254 | # |
1388 | # |
| 1255 | # usage: strip-linguas <allow LINGUAS> |
1389 | # usage: strip-linguas <allow LINGUAS> |
| 1256 | # strip-linguas -i <directories of .po files> |
1390 | # strip-linguas -i <directories of .po files> |
| 1257 | # strip-linguas -u <directories of .po files> |
1391 | # strip-linguas -u <directories of .po files> |
| 1258 | # |
1392 | # |
| 1259 | # The first form allows you to specify a list of LINGUAS. |
1393 | # The first form allows you to specify a list of LINGUAS. |
| 1260 | # The -i builds a list of po files found in all the |
1394 | # The -i builds a list of po files found in all the |
| 1261 | # directories and uses the intersection of the lists. |
1395 | # directories and uses the intersection of the lists. |
| 1262 | # The -u builds a list of po files found in all the |
1396 | # The -u builds a list of po files found in all the |
| 1263 | # directories and uses the union of the lists. |
1397 | # directories and uses the union of the lists. |
| 1264 | strip-linguas() { |
1398 | strip-linguas() { |
| 1265 | local ls newls |
1399 | local ls newls |
| 1266 | if [ "$1" == "-i" ] || [ "$1" == "-u" ] ; then |
1400 | if [ "$1" == "-i" ] || [ "$1" == "-u" ] ; then |
| 1267 | local op="$1"; shift |
1401 | local op="$1"; shift |