| 1 | # Copyright 1999-2003 Gentoo Technologies, Inc. |
1 | # Copyright 1999-2003 Gentoo Technologies, Inc. |
| 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.63 2003/10/13 15:00:19 vapier Exp $ |
3 | # $Header: /var/cvsroot/gentoo-x86/eclass/eutils.eclass,v 1.67 2003/11/18 18:45:04 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. |
| … | |
… | |
| 529 | fi |
529 | fi |
| 530 | einfo " - Userid: ${euid}" |
530 | einfo " - Userid: ${euid}" |
| 531 | |
531 | |
| 532 | # handle shell |
532 | # handle shell |
| 533 | local eshell="$1"; shift |
533 | local eshell="$1"; shift |
| 534 | if [ ! -z "${eshell}" ] |
534 | if [ ! -z "${eshell}" ] && [ "${eshell}" != "-1" ] |
| 535 | then |
535 | then |
| 536 | if [ ! -e "${eshell}" ] |
536 | if [ ! -e "${eshell}" ] |
| 537 | then |
537 | then |
| 538 | eerror "A shell was specified but it does not exist !" |
538 | eerror "A shell was specified but it does not exist !" |
| 539 | die "${eshell} does not exist" |
539 | die "${eshell} does not exist" |
| … | |
… | |
| 544 | einfo " - Shell: ${eshell}" |
544 | einfo " - Shell: ${eshell}" |
| 545 | opts="${opts} -s ${eshell}" |
545 | opts="${opts} -s ${eshell}" |
| 546 | |
546 | |
| 547 | # handle homedir |
547 | # handle homedir |
| 548 | local ehome="$1"; shift |
548 | local ehome="$1"; shift |
| 549 | if [ -z "${ehome}" ] |
549 | if [ -z "${ehome}" ] && [ "${eshell}" != "-1" ] |
| 550 | then |
550 | then |
| 551 | ehome="/dev/null" |
551 | ehome="/dev/null" |
| 552 | fi |
552 | fi |
| 553 | einfo " - Home: ${ehome}" |
553 | einfo " - Home: ${ehome}" |
| 554 | opts="${opts} -d ${ehome}" |
554 | opts="${opts} -d ${ehome}" |
| … | |
… | |
| 706 | type=Emulator |
706 | type=Emulator |
| 707 | ;; |
707 | ;; |
| 708 | "games-"*) |
708 | "games-"*) |
| 709 | type=Game |
709 | type=Game |
| 710 | ;; |
710 | ;; |
|
|
711 | "net-"*) |
|
|
712 | type=Network; |
|
|
713 | ;; |
| 711 | *) |
714 | *) |
| 712 | type= |
715 | type= |
| 713 | ;; |
716 | ;; |
| 714 | esac |
717 | esac |
| 715 | fi |
718 | fi |
| … | |
… | |
| 969 | local pipestatus="${PIPESTATUS[*]}" |
972 | local pipestatus="${PIPESTATUS[*]}" |
| 970 | pipestatus="${pipestatus// }" |
973 | pipestatus="${pipestatus// }" |
| 971 | if [ "${pipestatus//0}" != "" ] |
974 | if [ "${pipestatus//0}" != "" ] |
| 972 | then |
975 | then |
| 973 | # maybe it isnt gzipped ... they usually are, but not always ... |
976 | # maybe it isnt gzipped ... they usually are, but not always ... |
| 974 | tail -n +${skip} ${src} | tar -x --no-same-owner -f - \ |
977 | tail -n +${skip} ${src} 2>/dev/null \ |
|
|
978 | | tar -x --no-same-owner -f - 2>/dev/null |
|
|
979 | pipestatus="${pipestatus// }" |
|
|
980 | if [ "${pipestatus//0}" != "" ] |
|
|
981 | then |
|
|
982 | # and every once in a while they are bzipped2 ... |
|
|
983 | tail -n +${skip} ${src} 2>/dev/null \ |
|
|
984 | | bunzip2 -c 2>/dev/null \ |
|
|
985 | | tar -x --no-same-owner -f - 2>/dev/null \ |
| 975 | || die "failure unpacking makeself ${shrtsrc} ('${ver}' +${skip})" |
986 | || die "failure unpacking makeself ${shrtsrc} ('${ver}' +${skip})" |
|
|
987 | fi |
| 976 | fi |
988 | fi |
| 977 | } |
989 | } |
| 978 | |
990 | |
| 979 | # Display a license for user to accept. |
991 | # Display a license for user to accept. |
| 980 | # |
992 | # |
| … | |
… | |
| 992 | elif [ -e "${src}" ] ; then |
1004 | elif [ -e "${src}" ] ; then |
| 993 | lic="${src}" |
1005 | lic="${src}" |
| 994 | fi |
1006 | fi |
| 995 | fi |
1007 | fi |
| 996 | [ ! -f "${lic}" ] && die "Could not find requested license ${src}" |
1008 | [ ! -f "${lic}" ] && die "Could not find requested license ${src}" |
|
|
1009 | local l="`basename ${lic}`" |
| 997 | |
1010 | |
| 998 | # here is where we check for the licenses the user already |
1011 | # here is where we check for the licenses the user already |
| 999 | # accepted ... if we don't find a match, we make the user accept |
1012 | # accepted ... if we don't find a match, we make the user accept |
| 1000 | local alic |
1013 | local alic |
| 1001 | for alic in "${ACCEPT_LICENSE}" ; do |
1014 | for alic in ${ACCEPT_LICENSE} ; do |
| 1002 | [ "${alic}" == "*" ] && return 0 |
1015 | [ "${alic}" == "*" ] && return 0 |
| 1003 | [ "${alic}" == "${lic}" ] && return 0 |
1016 | [ "${alic}" == "${l}" ] && return 0 |
| 1004 | done |
1017 | done |
| 1005 | |
1018 | |
| 1006 | local licmsg="`mymktemp ${T}`" |
1019 | local licmsg="`mymktemp ${T}`" |
| 1007 | cat << EOF > ${licmsg} |
1020 | cat << EOF > ${licmsg} |
| 1008 | ********************************************************** |
1021 | ********************************************************** |
| … | |
… | |
| 1013 | ********************************************************** |
1026 | ********************************************************** |
| 1014 | |
1027 | |
| 1015 | EOF |
1028 | EOF |
| 1016 | cat ${lic} >> ${licmsg} |
1029 | cat ${lic} >> ${licmsg} |
| 1017 | ${PAGER:-less} ${licmsg} || die "Could not execute pager (${PAGER}) to accept ${lic}" |
1030 | ${PAGER:-less} ${licmsg} || die "Could not execute pager (${PAGER}) to accept ${lic}" |
| 1018 | einfon "Do you accept the terms of this license? [yes/no] " |
1031 | einfon "Do you accept the terms of this license (${l})? [yes/no] " |
| 1019 | read alic |
1032 | read alic |
| 1020 | case ${alic} in |
1033 | case ${alic} in |
| 1021 | yes|Yes|y|Y) |
1034 | yes|Yes|y|Y) |
| 1022 | return 0 |
1035 | return 0 |
| 1023 | ;; |
1036 | ;; |