summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChris Gianelloni <wolf31o2@gentoo.org>2003-09-22 21:08:27 +0000
committerChris Gianelloni <wolf31o2@gentoo.org>2003-09-22 21:08:27 +0000
commited83648a99967c34b5a06e98e904f91cc299bb32 (patch)
treefdf786951d56bb481d61972ea4359c5483ed9a9f /eclass/eutils.eclass
parentVersion bumped. (diff)
downloadhistorical-ed83648a99967c34b5a06e98e904f91cc299bb32.tar.gz
historical-ed83648a99967c34b5a06e98e904f91cc299bb32.tar.bz2
historical-ed83648a99967c34b5a06e98e904f91cc299bb32.zip
Adding check_license function.
Diffstat (limited to 'eclass/eutils.eclass')
-rw-r--r--eclass/eutils.eclass46
1 files changed, 45 insertions, 1 deletions
diff --git a/eclass/eutils.eclass b/eclass/eutils.eclass
index 90c0a748ee06..70f47966f1d0 100644
--- a/eclass/eutils.eclass
+++ b/eclass/eutils.eclass
@@ -1,6 +1,6 @@
# Copyright 1999-2003 Gentoo Technologies, Inc.
# Distributed under the terms of the GNU General Public License v2
-# $Header: /var/cvsroot/gentoo-x86/eclass/eutils.eclass,v 1.55 2003/09/21 09:58:47 solar Exp $
+# $Header: /var/cvsroot/gentoo-x86/eclass/eutils.eclass,v 1.56 2003/09/22 21:08:27 wolf31o2 Exp $
#
# Author: Martin Schlemmer <azarah@gentoo.org>
#
@@ -915,3 +915,47 @@ unpack_makeself() {
|| die "failure unpacking makeself ${shrtsrc} ('${ver}' +${skip})"
fi
}
+
+# Display a license for user to accept.
+#
+# Usage: check_license [license]
+# - If the file is not specified then ${LICENSE} is used.
+check_license() {
+ local src=$1
+ if [ -z "${src}" ] ; then
+ src="${PORTDIR}/licenses/${LICENSE}"
+ else
+ if [ -e "${PORTDIR}/licenses/${src}" ] ; then
+ src="${PORTDIR}/licenses/${src}"
+ elif [ -e "${PWD}/${src}" ] ; then
+ src="${PWD}/${src}"
+ elif [ -e "${src}" ] ; then
+ src="${src}"
+ fi
+ fi
+ [ ! -e "${src}" ] && die "Could not find requested license ${src}"
+
+ # here is where we check for the license...
+ # if we don't find one, we ask the user for it
+ if [ -f /usr/share/licenses/${LICENSE} ]; then
+ einfo "The license for this application has already been accepted."
+ else
+ ewarn "You MUST accept this license for installation to continue."
+ eerror "If you CTRL+C out of this, the install will not run!"
+ echo
+
+ ${PAGER} ${src} || die "Could not execute ${PAGER} ${src}
+ einfo "Do you accept the terms of this license? [yes/no]"
+ read ACCEPT_TERMS
+ case ${ACCEPT_TERMS} in
+ yes|Yes|y|Y)
+ cp ${src} /usr/share/licenses
+ exit 0
+ ;;
+ *)
+ eerror "You MUST accept the license to continue! Exiting!"
+ die "Failed to accept license"
+ ;;
+ esac
+ fi
+}