/[gentoo-x86]/eclass/eutils.eclass
Gentoo

Diff of /eclass/eutils.eclass

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

Revision 1.371 Revision 1.372
1# Copyright 1999-2011 Gentoo Foundation 1# Copyright 1999-2011 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.371 2011/12/14 17:27:16 vapier Exp $ 3# $Header: /var/cvsroot/gentoo-x86/eclass/eutils.eclass,v 1.372 2011/12/14 17:36:18 vapier Exp $
4 4
5# @ECLASS: eutils.eclass 5# @ECLASS: eutils.eclass
6# @MAINTAINER: 6# @MAINTAINER:
7# base-system@gentoo.org 7# base-system@gentoo.org
8# @BLURB: many extra (but common) functions that are used in ebuilds 8# @BLURB: many extra (but common) functions that are used in ebuilds
1086 eerror "Unknown filetype \"${filetype}\" ?" 1086 eerror "Unknown filetype \"${filetype}\" ?"
1087 false 1087 false
1088 ;; 1088 ;;
1089 esac 1089 esac
1090 assert "failure unpacking (${filetype}) makeself ${shrtsrc} ('${ver}' +${skip})" 1090 assert "failure unpacking (${filetype}) makeself ${shrtsrc} ('${ver}' +${skip})"
1091}
1092
1093# @FUNCTION: check_license
1094# @USAGE: [license]
1095# @DESCRIPTION:
1096# Display a license for user to accept. If no license is
1097# specified, then ${LICENSE} is used.
1098check_license() {
1099 local lic=$1
1100 if [ -z "${lic}" ] ; then
1101 lic="${PORTDIR}/licenses/${LICENSE}"
1102 else
1103 if [ -e "${PORTDIR}/licenses/${lic}" ] ; then
1104 lic="${PORTDIR}/licenses/${lic}"
1105 elif [ -e "${PWD}/${lic}" ] ; then
1106 lic="${PWD}/${lic}"
1107 elif [ -e "${lic}" ] ; then
1108 lic="${lic}"
1109 fi
1110 fi
1111 local l="`basename ${lic}`"
1112
1113 # here is where we check for the licenses the user already
1114 # accepted ... if we don't find a match, we make the user accept
1115 local alic
1116 eshopts_push -o noglob # so that bash doesn't expand "*"
1117 for alic in ${ACCEPT_LICENSE} ; do
1118 if [[ ${alic} == ${l} ]]; then
1119 eshopts_pop
1120 return 0
1121 fi
1122 done
1123 eshopts_pop
1124 [ ! -f "${lic}" ] && die "Could not find requested license ${lic}"
1125
1126 local licmsg=$(emktemp)
1127 cat <<-EOF > ${licmsg}
1128 **********************************************************
1129 The following license outlines the terms of use of this
1130 package. You MUST accept this license for installation to
1131 continue. When you are done viewing, hit 'q'. If you
1132 CTRL+C out of this, the install will not run!
1133 **********************************************************
1134
1135 EOF
1136 cat ${lic} >> ${licmsg}
1137 ${PAGER:-less} ${licmsg} || die "Could not execute pager (${PAGER}) to accept ${lic}"
1138 einfon "Do you accept the terms of this license (${l})? [yes/no] "
1139 read alic
1140 case ${alic} in
1141 yes|Yes|y|Y)
1142 return 0
1143 ;;
1144 *)
1145 echo;echo;echo
1146 eerror "You MUST accept the license to continue! Exiting!"
1147 die "Failed to accept license"
1148 ;;
1149 esac
1150} 1091}
1151 1092
1152# @FUNCTION: cdrom_get_cds 1093# @FUNCTION: cdrom_get_cds
1153# @USAGE: <file on cd1> [file on cd2] [file on cd3] [...] 1094# @USAGE: <file on cd1> [file on cd2] [file on cd3] [...]
1154# @DESCRIPTION: 1095# @DESCRIPTION:
1687# @DESCRIPTION: 1628# @DESCRIPTION:
1688# If USE flag is set, echo [true output][true suffix] (defaults to "yes"), 1629# If USE flag is set, echo [true output][true suffix] (defaults to "yes"),
1689# otherwise echo [false output][false suffix] (defaults to "no"). 1630# otherwise echo [false output][false suffix] (defaults to "no").
1690usex() { use "$1" && echo "${2-yes}$4" || echo "${3-no}$5" ; } #382963 1631usex() { use "$1" && echo "${2-yes}$4" || echo "${3-no}$5" ; } #382963
1691 1632
1633check_license() { die "you no longer need this as portage supports ACCEPT_LICENSE itself"; }
1634
1692fi 1635fi

Legend:
Removed from v.1.371  
changed lines
  Added in v.1.372

  ViewVC Help
Powered by ViewVC 1.1.20