summaryrefslogtreecommitdiff
blob: e463d80386cf91c14f1e145f5ab744237569c7df (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
# 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-ns/halflife-ns-2.01.ebuild,v 1.1 2004/04/16 17:47:58 vapier Exp $

inherit games eutils

BASE=ns_v2_dedicated_server.zip
PATCH=ns-v201.zip
DESCRIPTION="Halflife Natural Selection mod ... kill aliens or marines"
HOMEPAGE="http://www.natural-selection.org/"
SRC_URI="http://gamefiles.blueyonder.co.uk/blueyondergames/halflife/modifications/naturalselection/server/win32/${BASE}
	http://gamefiles.blueyonder.co.uk/blueyondergames/halflife/modifications/naturalselection/server/win32/${BASE}
	http://www.clansin.com/Downloads/patches/server/${BASE}
	http://files.redphive.org/ns/${PATCH}"

LICENSE="as-is"
SLOT="0"
KEYWORDS="-* x86"
IUSE="dedicated"

RDEPEND="games-server/halflife-server
	dedicated? ( app-misc/screen )"

S=${WORKDIR}/ns

src_unpack() {
	unpack ${BASE}
	cd ${S}
	unpack ${PATCH}
	edos2unix *.txt *.cfg *.gam *.lst
}

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

	mv ${S} ${D}/${dir}/ || die "moving ns"

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

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

	local cdir=${GAMES_SYSCONFDIR}/halflife/ns
	dodir ${cdir}
	# this allows users to upgrade w/out losing their previous settings
	dir=${dir}/ns
	for cfg in *.cfg mapcycle.txt motd.txt titles.txt ; do
		[ -e ${dir}/ns/${cfg} ] && mv ${cfg}{,.sample}
		dosym {${dir},${cdir}}/${cfg}
	done

	prepgamesdirs
}

pkg_postinst() {
	games_pkg_postinst

	local dir=${GAMES_PREFIX_OPT}/halflife/ns
	touch ${dir}/{*.cfg,mapcycle.txt,motd.txt,titles.txt}

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