summaryrefslogtreecommitdiff
blob: 577a39ed65d47401bb968939244e0b412ffccc81 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
# Copyright 1999-2004 Gentoo Technologies, Inc.
# Distributed under the terms of the GNU General Public License v2
# $Header: /var/cvsroot/gentoo-x86/games-server/halflife-server/halflife-server-3.1.1.0.ebuild,v 1.10 2004/06/01 20:13:56 mr_bones_ Exp $

inherit games eutils

MY_PV=${PV//.}
MY_PN=hlds_l_${MY_PV}_full
DESCRIPTION="Halflife Linux Server"
HOMEPAGE="http://www.valve.com/"
SRC_URI="${MY_PN}.bin boffix_v3.tar.gz"

LICENSE="ValveServer"
SLOT="0"
KEYWORDS="x86"
IUSE=""
RESTRICT="nostrip fetch"

DEPEND="sys-apps/util-linux"
RDEPEND="app-misc/screen"

S=${WORKDIR}/hlds_l

pkg_nofetch() {
	einfo "Please goto fileplanet and d/l ${MY_BIN}"
	einfo "http://www.fileplanet.com/files/50000/58368.shtml"
	einfo "Then download boffix_v3.tar.gz from here:"
	einfo "http://miklos.clanhost.dk/boffix_v3.tar.gz"
}

src_unpack() {
	unpack_pdv ${MY_PN}.bin 4
	echo ">>> Unpacking ${MY_PN}.tar.gz to ${S}"
	tar -zxf ${MY_PN}.tar.gz || die "unpacking ${MY_PN}.tar.gz failed"
	rm ${MY_PN}.tar.gz
	cd ${S}
	unpack boffix_v3.tar.gz
	epatch ${FILESDIR}/${PV}-hlds_run-boffix.patch
}

src_install() {
	local dir=${GAMES_PREFIX_OPT}/halflife
	dodir ${dir}

	mv ${S}/* ${D}/${dir}/ || die
	dodir ${dir}/valve/logs

	dogamesbin ${FILESDIR}/hlds
	dosed "s:GENTOO_DIR:${dir}:" ${GAMES_BINDIR}/hlds

	exeinto /etc/init.d ; newexe ${FILESDIR}/hlds.rc hlds
	dosed "s:GENTOO_DIR:${GAMES_BINDIR}:" /etc/init.d/hlds
	dosed "s:GENTOO_GAMES_USER:${GAMES_USER_DED}:" /etc/init.d/hlds
	insinto /etc/conf.d ; newins ${FILESDIR}/hlds.conf.d hlds
	dosed "s:GENTOO_DIR:${dir}:" /etc/conf.d/hlds

	local cdir=${GAMES_SYSCONFDIR}/halflife
	dodir ${cdir}
	# this allows users to upgrade w/out losing their previous settings
	[ -e ${dir}/hltv.cfg ] && mv ${D}/${dir}/hltv.cfg{,.sample}
	dosym {${dir},${cdir}}/hltv.cfg
	for mod in tfc valve dmc ricochet ; do
		dodir ${cdir}/${mod}
		for cfg in server.cfg liblist.gam mapcycle.txt motd.txt ; do
			[ -e ${dir}/${mod}/${cfg} ] && [ -e ${D}/${dir}/${mod}/${cfg} ] && \
				mv ${D}/${dir}/${mod}/${cfg}{,.sample}
			dosym {${dir},${cdir}}/${mod}/${cfg}
		done
	done

	prepgamesdirs
	chown -R ${GAMES_USER_DED}:${GAMES_GROUP} ${D}/${dir}
}

pkg_postinst() {
	local dir=${GAMES_PREFIX_OPT}/halflife
	touch ${dir}/hltv.cfg
	touch ${dir}/{dmc,ricochet,tfc,valve}/{server.cfg,liblist.gam,mapcycle.txt,motd.txt}

	games_pkg_postinst

	einfo "To start the dedicated server, just run"
	einfo "/etc/init.d/hlds start"
	echo
	einfo "The server utilizes screen so you can get to"
	einfo "the console by typing:"
	einfo " screen -r hlds"
	echo
	einfo "To configure your server, just edit the file:"
	einfo "${GAMES_PREFIX_OPT}/halflife/valve/server.cfg"
}