summaryrefslogtreecommitdiff
blob: ec03a53010eefbe1bc66904eb2f88afe4661c511 (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
# Copyright 1999-2006 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Header: $

inherit eutils versionator
MY_PV=$(replace_version_separator 3 '-')
S=${WORKDIR}/${PN}
INSTALLDIR="/opt/psybnc"

DESCRIPTION="PsyBNC is a multi-user and multi-server gateway to IRC networks"
HOMEPAGE="http://www.psybnc.at/index.html"
SRC_URI="http://www.psybnc.at/download/beta/psyBNC-${MY_PV}.tar.gz"

LICENSE="GPL-2"
SLOT="0"
KEYWORDS="~x86"
IUSE=""
DEPEND=">=dev-libs/openssl-0.9.7d"

pkg_setup() {
	enewgroup psybnc
	enewuser psybnc -1 -1 ${INSTALLDIR} psybnc
}

src_unpack() {
	unpack ${A}
	cd ${S}
	epatch ${FILESDIR}/${PF}-gentoo.diff
}

src_compile() {
	emake || die "emake failed"
}

src_install() {
	dodoc CHANGES COPYING FAQ README SCRIPTING TODO
	dodir ${INSTALLDIR}/help ${INSTALLDIR}/key ${INSTALLDIR}/lang ${INSTALLDIR}/log ${INSTALLDIR}/motd ${INSTALLDIR}/scripts

	insinto ${INSTALLDIR}/help
	doins help/*
	insinto ${INSTALLDIR}/key
	doins key/*
	insinto ${INSTALLDIR}/lang
	doins lang/*
	insinto ${INSTALLDIR}/log
	doins log/*
	insinto ${INSTALLDIR}/motd
	doins motd/*
	insinto	${INSTALLDIR}/scripts
	doins scripts/*
	insinto ${INSTALLDIR}
	doins ${FILESDIR}/psybnc.conf config.h

	exeinto ${INSTALLDIR}
	doexe psybnc
	exeinto /etc/init.d
	newexe ${FILESDIR}/psybnc.initd psybnc
	insinto /etc/conf.d
	newins ${FILESDIR}/psybnc.confd psybnc

	chown -R psybnc:psybnc ${D}/${INSTALLDIR}
}

pkg_config() {
	einfo "Generating certificate request..."
	openssl req -new -out ${INSTALLDIR}/key/psybnc.req.pem -keyout ${INSTALLDIR}/key/psybnc.key.pem -nodes
	einfo "Generating self-signed certificate..."
	openssl req -x509 -days 365 -in ${INSTALLDIR}/key/psybnc.req.pem -key ${INSTALLDIR}/key/psybnc.key.pem -out ${INSTALLDIR}/key/psybnc.cert.pem
	einfo "Generating fingerprint..."
	openssl x509 -subject -dates -fingerprint -noout -in ${INSTALLDIR}/key/psybnc.cert.pem
}

pkg_postinst() {
	einfo ""
	einfo "Please run \"emerge --config =psybnc-${MY_PV}\" to create SSL certificates for your system."
	einfo "You can connect to the bnc on port 23998, user=gentoo, pass=gentoo,"
	einfo "please edit the psybnc configuration in ${INSTALLDIR}/psybnc.conf to change this."
	einfo ""
}