# Copyright 1999-2006 Gentoo Foundation # Distributed under the terms of the GNU General Public License v2 # $Header: $ inherit versionator games MY_PV=$(delete_all_version_separators) DESCRIPTION="Vehicular soccer mod for UT2004" HOMEPAGE="http://www.carball.org/" SRC_URI="ftp://ftp.planetmirror.com/pub/extreme-players/Games/ut2004/mods/carball/CarBall_${MY_PV}_Full.zip" LICENSE="freedist" SLOT="0" KEYWORDS="~x86" IUSE="" RESTRICT="nomirror nostrip" DEPEND=">=games-fps/ut2004-3369-r1 app-arch/unzip" S=${WORKDIR} dir=${GAMES_PREFIX_OPT}/ut2004 MOD="CBall" INI_FILE_POS=".ut2004/System/UT2004.ini" src_unpack() { # unzip gives warning: # "file appears to use backslashes as path separators" # so cannot add "|| die" unzip "${DISTDIR}/${A}" } src_install() { insinto "${dir}" doins -r * || die "doins failed" prepgamesdirs } pkg_postinst() { einfo "To complete the installation, run:" einfo " emerge --config ${PN}" einfo "to automatically patch ~/${INI_FILE_POS} for all users" echo games_pkg_postinst } pkg_config() { for dir in /home/*; do ini_file=${dir}/${INI_FILE_POS} if [ -e ${ini_file} ]; then # Check whether the ini file has already been patched if [ $(grep -c "/CBall/" ${ini_file}) = "0" ]; then # Patch the ini file echo "Adding CBall to ${ini_file}" sed -i ${ini_file} \ -e 's:\[Core.System\]:\[Core.System\]\nPaths=../CBall/Animations/*.ukx\nPaths=../CBall/Maps/*.ut2\nPaths=../CBall/Textures/*.utx\nPaths=../CBall/StaticMeshes/*.usx\nPaths=../CBall/Sounds/*.uax\n:' \ -e 's:\[Engine.GameEngine\]:\[Engine.GameEngine\]\nServerPackages=CBall:' \ -e 's:\[Editor.EditorEngine\]:\[Editor.EditorEngine\]\nEditPackages=CBall:' \ || echo "sed failed on ${ini_file}" fi fi done }