# 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 () { dodir ${dir} dodir ${Ddir} cd ${Ddir} if [ ${upl_file} == "uplink.zip" ] ; then # Unzip basic uplink unzip qq ${DISTDIR}/${upl_file} else # Assume it's a .sh # Create a temporary directory to extract the .sh to upl_tmp=${Ddir}/tmp mkdir -p ${upl_tmp} cd ${upl_tmp} # Extract the .sh using its own routines ${DISTDIR}/${upl_file} --noexec --keep --target ${upl_tmp} # Delete unnecessary files and move the executable script to where it expects to be rm -rf ${upl_tmp}/setup.data setup.sh mv ${upl_tmp}/bin/Linux/x86/uplink ${upl_tmp} rm -rf ${upl_tmp}/bin # Copy everything to Ddir cp -r ${upl_tmp}/* ${Ddir} # cd out of upl_tmp to avoid errors when we delete it. cd ${Ddir} # Delete the temporary files rm -rf ${upl_tmp} fi if [ ${upl_version} != "1.31" ] ; then # Copy over patch files cp ${WORKDIR}/* ./ fi # Correct permissions chown -R root:games ${Ddir} chmod -R 640 ${Ddir}/* chmod 750 ${Ddir}/uplink if [ -e ${Ddir}/lib ] ; then chmod 750 ${Ddir}/lib if [ -e ${Ddir}/lib/uplink.bin.x86 ] ; then chmod 750 ${Ddir}/lib/uplink.bin.x86 fi fi games_make_wrapper uplink ./uplink "${dir}" "${dir}" make_desktop_entry uplink "Uplink" "" "Game" } 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 }