summaryrefslogtreecommitdiff
blob: 3bd7921e148417a2b2f7b48968fd7ac6fc81f165 (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
# 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-1.04.ebuild,v 1.3 2004/02/20 07:31:48 mr_bones_ Exp $

inherit games eutils

BASE=ns_v1_linux_dedicated_server.tar.gz
UPDATE=ns-v${PV/./}.zip
DESCRIPTION="Halflife Natural Selection mod ... kill aliens or marines"
HOMEPAGE="http://www.natural-selection.org/"
SRC_URI="http://files.redphive.org/${UPDATE}
	http://files.redphive.org/${BASE}"

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 ${UPDATE}
	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() {
	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"

	games_pkg_postinst
}