# Copyright 1999-2006 Gentoo Foundation # Distributed under the terms of the GNU General Public License v2 # $Header: $ inherit eutils games MY_P="linuxpatch1.31.tar.gz" DESCRIPTION="Uplink is a commercial hacking strategy game." HOMEPAGE="http://www.uplink.co.uk/" SRC_URI="http://www.introversion.co.uk/uplink/downloads/${MY_P}" LICENSE="uplink" SLOT="0" KEYWORDS="~amd64 ~x86" RESTRICT="nostrip nomirror" IUSE="" RDEPEND="" DEPEND="${RDEPEND} app-arch/unzip app-arch/tar" dir=${GAMES_PREFIX_OPT}/${PN} Ddir=${D}/${dir} upl_versions=( "1.0" "1.31" ) upl_files=( "uplink.zip" "uplink-complete-1.31.sh" ) uplink_find_file () { searchdir=${1} i=0 for f in ${upl_files[*]} do if [ -e ${searchdir}/${f} ] ; then export upl_file=${f} export upl_version=${upl_versions[${i}]} else i=${i}+1 fi done } pkg_setup() { export upl_version="0" export upl_file="" games_pkg_setup # If the file still exists from an earlier install, assume its the same # Otherwise copy it from the CD uplink_find_file "${DISTDIR}" # No local copy - try the CD drive if [ ${upl_version} == "0" ] ; then cdrom_get_cds linux searchdir="${CDROM_ROOT}/linux" uplink_find_file "${searchdir}" if [ ${upl_version} != "0" ] ; then einfo "Found the original Uplink CD (${upl_version})" einfo "Copying ${upl_file} to ${DISTDIR}" cp ${searchdir}/${upl_file} ${DISTDIR}/${upl_file} fi fi if [ ${upl_version} == "0" ] ; then eerror "Unable to find a known Uplink CD ROM" eerror "If you believe you have a valid Uplink CD ROM, please report this bug attaching" eerror " details of the name and location of the linux installer on the CD ROM" die fi } src_install () { echo "DEBUG: Begin src_install" echo "DEBUG: dodir ${dir}" dodir ${dir} echo "DEBUG: dodir ${Ddir}" dodir ${Ddir} echo "DEBUG: cd ${Ddir}" cd ${Ddir} if [ ${upl_file} == "uplink.zip" ] ; then # Unzip basic uplink (NB: removed -qq (ultra quiet) for debugging) echo "DEBUG: unzip ${DISTDIR}/${upl_file}" unzip ${DISTDIR}/${upl_file} else # Assume it's a .sh upl_tmp=${Ddir}/tmp echo "DEBUG: mkdir -pv ${upl_tmp}" mkdir -pv ${upl_tmp} echo "DEBUG: cd ${upl_tmp}" cd ${upl_tmp} echo "DEBUG: ${DISTDIR}/${upl_file} --noexec --keep --target ${upl_tmp}" ${DISTDIR}/${upl_file} --noexec --keep --target ${upl_tmp} echo "DEBUG: rm -rfv ${upl_tmp}/setup.data setup.sh" rm -rfv ${upl_tmp}/setup.data setup.sh echo "DEBUG: mv -v ${upl_tmp}/bin/Linux/x86/uplink ${upl_tmp}" mv -v ${upl_tmp}/bin/Linux/x86/uplink ${upl_tmp} echo "DEBUG: rm -rfv ${upl_tmp}/bin" rm -rfv ${upl_tmp}/bin echo "DEBUG: cp -rv ${upl_tmp}/* ${Ddir}" cp -rv ${upl_tmp}/* ${Ddir} echo "DEBUG: rm -rfv ${upl_tmp}" rm -rfv ${upl_tmp} fi if [ ${upl_version} != "1.31" ] ; then # Copy over patch files echo "DEBUG: cp -v ${WORKDIR}/* ./" cp -v ${WORKDIR}/* ./ fi # Correct permissions echo "DEBUG: chown -Rv root:games ${Ddir}" chown -Rv root:games ${Ddir} echo "DEBUG: chmod -Rv 640 ${Ddir}/*" chmod -Rv 640 ${Ddir}/* echo "DEBUG: chmod -v 750 ${Ddir}/uplink" chmod -v 750 ${Ddir}/uplink if [ -e ${Ddir}/lib/uplink.bin.x86 ] ; then echo "DEBUG: chmod -v 750 ${Ddir}/lib/uplink.bin.x86" chmod -v 750 ${Ddir}/lib/uplink.bin.x86 fi games_make_wrapper uplink ./uplink "${dir}" "${dir}" make_desktop_entry uplink "Uplink" "" "Game" echo "DEBUG: End src_install" } pkg_postinst () { games_pkg_postinst if [ ${upl_version} != "1.31" ] ; then einfo "The first time you start uplink, it will patch itself and then exit. Restart the game to play." fi }