-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

https://bugs.gentoo.org/show_bug.cgi?id=417383

reasons:
* cleaner
* easier to update/fix
* proper config protection

any reason this was not done as a separate package in the first place?
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2.0.22 (GNU/Linux)
Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/

iQEcBAEBAgAGBQJS7jhAAAoJEFpvPKfnPDWzgUQIAKk1sWnA1RZK8AY+Fjk2N62O
QPt8UnVDkdNUfQ1KlTsjviCA9rrfez3ZcJho7e7ymDXYAvYY2XZlEeQmFBqanzgx
Jx/knYRaGX2GvYjl47OikJG8D6PrsptVS/QwQJsV5UsuFM63+DCMhsQs6owVKZR+
6zHFQMOmGosC985+Kp38LmPZqL3hhtLyY5B5WtyKrc2hEUYzYSCDXLECkduh4q65
9oeWNi6y+Q0TRvxBG0nZWq+ovTa/1leWSKWQiKuauy9ETOV5F+Ta16qLqB4/hkup
X1JAzXE7uvtpm5c8lnzda0kFzePhNN4C5U+v8mx2RcHNIPiMsN3GIFZV7uabKiw=
=qpea
-----END PGP SIGNATURE-----
# Copyright 1999-2014 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Header: $

EAPI=3

inherit games

DESCRIPTION="Environment file for gentoo games"
HOMEPAGE="http://www.gentoo.org/";
SRC_URI=""

LICENSE="GPL-2"
SLOT="0"
KEYWORDS="alpha amd64 arm arm64 hppa ia64 m68k ~mips ppc ppc64 s390 sh sparc 
x86 ~ppc-aix ~amd64-fbsd ~sparc-fbsd ~x86-fbsd ~x64-freebsd ~x86-freebsd 
~hppa-hpux ~ia64-hpux ~x86-interix ~amd64-linux ~arm-linux ~ia64-linux 
~x86-linux ~ppc-macos ~x64-macos ~x86-macos ~m68k-mint ~sparc-solaris 
~sparc64-solaris ~x64-solaris ~x86-solaris"

RDEPEND=""
DEPEND=""

S=${WORKDIR}

pkg_setup() {
        games_pkg_setup
        if [[ -z "${REPLACING_VERSIONS}" ]] ; then
                if [[ "${EROOT%/}/etc/env.d/${GAMES_ENVD}" ]] ; then
                        old_envd="$(cat "${EROOT%/}/etc/env.d/${GAMES_ENVD}")"
                        rm -v "${EROOT%/}/etc/env.d/${GAMES_ENVD}" || die
                fi
        fi
}

src_prepare() {
        local d libdirs

        for d in $(get_all_libdirs) ; do
                libdirs="${libdirs}:${GAMES_PREFIX}/${d}"
        done

        cat <<-EOF > ${GAMES_ENVD} || die
        LDPATH="${libdirs:1}"
        PATH="${GAMES_BINDIR}"
        EOF
}

src_configure() { :; }

src_compile() { :; }

src_install() {
        doenvd ${GAMES_ENVD} || die
        gamesowners "${ED%/}"/etc/env.d/${GAMES_ENVD} || die
        gamesperms  "${ED%/}"/etc/env.d/${GAMES_ENVD} || die
}

pkg_preinst() { :; }

pkg_postinst() {
        if [[ -z "${REPLACING_VERSIONS}" ]] ; then
                if [[ ${old_envd} ]] ; then
                        elog "If you have previously modified 
/etc/env.d/${GAMES_ENVD}"
                        elog "then you have to reapply your changes since this 
file was"
                        elog "overwritten. The old content is:"
                        elog
                        elog "${old_envd}"
                        elog
                fi
        fi
}
move /etc/env.d/90games to a separate package wrt #417383

--- eclass/games.eclass
+++ eclass/games.eclass
@@ -18,6 +18,11 @@
 	2|3|4|5) EXPORT_FUNCTIONS pkg_setup src_configure src_compile pkg_preinst pkg_postinst ;;
 	*) die "no support for EAPI=${EAPI} yet" ;;
 esac
+
+if [[ ${PN} != "gentoo-envd" ]] ; then
+	# environment file
+	RDEPEND="games-misc/gentoo-envd"
+fi
 
 export GAMES_PREFIX=${GAMES_PREFIX:-/usr/games}
 export GAMES_PREFIX_OPT=${GAMES_PREFIX_OPT:-/opt}
@@ -124,23 +129,6 @@
 	find "${D}/${GAMES_BINDIR}" -maxdepth 1 -type f -exec chmod 750 '{}' \;
 }
 
-gamesenv() {
-	local d libdirs
-
-	for d in $(get_all_libdirs) ; do
-		libdirs="${libdirs}:${GAMES_PREFIX}/${d}"
-	done
-
-	# Wish we could use doevnd here, but we dont want the env
-	# file to be tracked in the CONTENTS of every game
-	cat <<-EOF > "${ROOT}"/etc/env.d/${GAMES_ENVD}
-	LDPATH="${libdirs:1}"
-	PATH="${GAMES_BINDIR}"
-	EOF
-	gamesowners "${ROOT}"/etc/env.d/${GAMES_ENVD}
-	gamesperms  "${ROOT}"/etc/env.d/${GAMES_ENVD}
-}
-
 games_pkg_setup() {
 	tc-export CC CXX LD AR RANLIB
 
@@ -183,9 +171,8 @@
 	done < <(find "${D}/${GAMES_STATEDIR}" -type f -printf '%P\n' 2>/dev/null)
 }
 
-# pkg_postinst function ... create env.d entry and warn about games group
+# pkg_postinst function ... warn about games group
 games_pkg_postinst() {
-	gamesenv
 	if [[ -z "${GAMES_SHOW_WARNING}" ]] ; then
 		ewarn "Remember, in order to play games, you have to"
 		ewarn "be in the '${GAMES_GROUP}' group."

Reply via email to