summaryrefslogtreecommitdiff
blob: 9c947b3a03405e92bfe4c1854b7b36212dfc0c03 (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
# Copyright 1999-2004 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Header: /var/cvsroot/gentoo-x86/games-server/pvpgn/pvpgn-1.6.5.ebuild,v 1.1 2004/09/01 04:39:51 vapier Exp $

inherit games

SP="pvpgn-support-1.0"
DESCRIPTION="A gaming server for Battle.Net compatible clients"
HOMEPAGE="http://www.pvpgn.org/"
SRC_URI="mirror://sourceforge/pvpgn/${P}.tar.bz2
	mirror://sourceforge/pvpgn/${SP}.tar.gz"

LICENSE="GPL-2"
SLOT="0"
KEYWORDS="~x86"
IUSE="mysql postgres"

DEPEND="virtual/libc
	sys-libs/zlib
	mysql? ( >=dev-db/mysql-3.23 )
	postgres? ( >=dev-db/postgresql-7 )"

src_unpack() {
	unpack ${A}
	cd ${S}
	epatch ${FILESDIR}/${PV}-fhs.patch
}

src_compile() {
	cd src
	egamesconf \
		`use_with mysql` \
		`use_with postgres pgsql` \
		|| die
	emake || die "compile problem"
}

src_install() {
	dodoc README README.DEV CREDITS BUGS TODO UPDATE version-history.txt
	docinto docs
	dodoc docs/*

	cd src
	make DESTDIR=${D} install || die

	insinto ${GAMES_DATADIR}/pvpgn
	doins ${WORKDIR}/${SP}/*

	exeinto /etc/init.d
	local f
	for f in bnetd d2cs d2dbs ; do
		newexe ${FILESDIR}/init.d.rc ${f}
		sed -i \
			-e "s:NAME:${f}:g" \
			-e "s:GAMES_BINDIR:${GAMES_BINDIR}:g" \
			-e "s:GAMES_USER:${GAMES_USER}:g" \
			-e "s:GAMES_GROUP:${GAMES_GROUP}:g" \
			${D}/etc/init.d/${f}
	done

	prepgamesdirs
}

pkg_postinst() {
	einfo "Setting up permissions on ${GAMES_STATEDIR}/pvpgn"
	mkdir -p ${GAMES_STATEDIR}/pvpgn/log
	chmod 0755 ${GAMES_STATEDIR}/pvpgn/log
	chown -R ${GAMES_USER}:${GAMES_GROUP} ${GAMES_STATEDIR}/pvpgn
	chmod 0750 ${GAMES_STATEDIR}/pvpgn

	einfo "  If this is a first installation you have to configure package by"
	einfo "editing the configuration files provided in \"${GAMES_SYSCONFDIR}/pvpgn\". Also you"
	einfo "should read the documentation from /usr/share/docs/${P}/"
	einfo
	einfo "  If you are upgrading you MUST read /usr/share/docs/${P}/UPDATE.gz"
	einfo "and update your configuration acordingly."
	if use mysql ; then
		einfo
		einfo "  You have enabled MySQL storage support. You will need to edit "
		einfo "bnetd.conf to use it. Read README.storage from the docs dir."
	fi
	if use postgres ; then
		einfo
		einfo "  You have enabled PostgreSQL storage support. You will need to edit "
		einfo "bnetd.conf to use it. Read README.storage from the docs dir."
	fi
}