|
Lines 1-83
Link Here
|
| 1 |
# Copyright 1999-2006 Gentoo Foundation |
1 |
# Copyright 1999-2006 Gentoo Foundation |
| 2 |
# Distributed under the terms of the GNU General Public License v2 |
2 |
# Distributed under the terms of the GNU General Public License v2 |
| 3 |
# $Header: /var/cvsroot/gentoo-x86/net-irc/psybnc/psybnc-2.3.2.7-r1.ebuild,v 1.1 2006/10/18 15:17:02 gurligebis Exp $ |
3 |
# $Header: $ |
| 4 |
|
4 |
|
| 5 |
inherit eutils versionator |
5 |
inherit eutils versionator toolchain-funcs |
| 6 |
MY_PV=$(replace_version_separator 3 '-') |
|
|
| 7 |
S=${WORKDIR}/${PN} |
| 8 |
INSTALLDIR="/opt/psybnc" |
| 9 |
|
6 |
|
| 10 |
DESCRIPTION="PsyBNC is a multi-user and multi-server gateway to IRC networks" |
7 |
MY_PV="$(replace_version_separator 3 -)" |
|
|
8 |
PSYBNC_HOME="/var/lib/psybnc" |
| 9 |
|
| 10 |
DESCRIPTION="psyBNC is a multi-user and multi-server gateway to IRC networks" |
| 11 |
HOMEPAGE="http://www.psybnc.at/index.html" |
11 |
HOMEPAGE="http://www.psybnc.at/index.html" |
| 12 |
SRC_URI="http://www.psybnc.at/download/beta/psyBNC-${MY_PV}.tar.gz" |
12 |
SRC_URI="http://www.psybnc.at/download/beta/psyBNC-${MY_PV}.tar.gz" |
| 13 |
|
13 |
|
| 14 |
LICENSE="GPL-2" |
14 |
LICENSE="GPL-2" |
| 15 |
SLOT="0" |
15 |
SLOT="0" |
| 16 |
KEYWORDS="~x86 ~amd64" |
16 |
KEYWORDS="~x86 ~amd64" |
| 17 |
IUSE="" |
17 |
IUSE="ipv6 ssl" |
| 18 |
DEPEND=">=dev-libs/openssl-0.9.7d" |
18 |
|
|
|
19 |
DEPEND="ssl? ( >=dev-libs/openssl-0.9.7d )" |
| 20 |
RDEPEND="${DEPEND}" |
| 21 |
|
| 22 |
S="${WORKDIR}"/${PN} |
| 19 |
|
23 |
|
| 20 |
pkg_setup() { |
24 |
pkg_setup() { |
| 21 |
enewgroup psybnc |
25 |
enewgroup psybnc |
| 22 |
enewuser psybnc -1 -1 ${INSTALLDIR} psybnc |
26 |
enewuser psybnc -1 -1 "${PSYBNC_HOME}" psybnc |
| 23 |
} |
27 |
} |
| 24 |
|
28 |
|
| 25 |
src_unpack() { |
29 |
src_unpack() { |
| 26 |
unpack ${A} |
30 |
unpack ${A} |
| 27 |
cd ${S} |
31 |
cd "${S}" |
| 28 |
epatch ${FILESDIR}/${PF}-gentoo.diff |
32 |
|
|
|
33 |
# Useless files |
| 34 |
rm -f */INFO |
| 35 |
|
| 36 |
# Prevent stripping the binary |
| 37 |
sed -i -e "/@strip/ d" tools/autoconf.c |
| 38 |
|
| 39 |
# Pretend we already have a certificate, we generate it in pkg_config |
| 40 |
mkdir key |
| 41 |
touch key/psybnc.cert.pem |
| 42 |
|
| 43 |
if [[ -f ${ROOT}/usr/share/psybnc/salt.h ]] |
| 44 |
then |
| 45 |
einfo "Using existing salt.h for password encryption" |
| 46 |
cp "${ROOT}"/usr/share/psybnc/salt.h salt.h |
| 47 |
fi |
| 48 |
|
| 29 |
} |
49 |
} |
| 30 |
|
50 |
|
| 31 |
src_compile() { |
51 |
src_compile() { |
| 32 |
emake || die "emake failed" |
52 |
use ipv6 || rm -f tools/chkipv6.c |
|
|
53 |
use ssl || rm -f tools/chkssl.c |
| 54 |
|
| 55 |
emake CC="$(tc-getCC)" CFLAGS="${CFLAGS}" || die "emake failed" |
| 33 |
} |
56 |
} |
| 34 |
|
57 |
|
| 35 |
src_install() { |
58 |
src_install() { |
| 36 |
dodoc CHANGES COPYING FAQ README SCRIPTING TODO |
59 |
dobin psybnc |
| 37 |
dodir ${INSTALLDIR}/help ${INSTALLDIR}/key ${INSTALLDIR}/lang ${INSTALLDIR}/log ${INSTALLDIR}/motd ${INSTALLDIR}/scripts |
|
|
| 38 |
|
60 |
|
| 39 |
insinto ${INSTALLDIR}/help |
61 |
insinto /usr/share/psybnc |
| 40 |
doins help/* |
62 |
doins -r help lang salt.h |
| 41 |
insinto ${INSTALLDIR}/key |
63 |
fperms 0600 /usr/share/psybnc/salt.h |
| 42 |
doins key/* |
64 |
|
| 43 |
insinto ${INSTALLDIR}/lang |
65 |
insinto /etc/psybnc |
| 44 |
doins lang/* |
66 |
doins "${FILESDIR}"/psybnc.conf |
| 45 |
insinto ${INSTALLDIR}/log |
67 |
|
| 46 |
doins log/* |
68 |
keepdir "${PSYBNC_HOME}"/{log,motd,scripts} |
| 47 |
insinto ${INSTALLDIR}/motd |
69 |
dosym /usr/share/psybnc/lang "${PSYBNC_HOME}"/lang |
| 48 |
doins motd/* |
70 |
dosym /usr/share/psybnc/help "${PSYBNC_HOME}"/help |
| 49 |
insinto ${INSTALLDIR}/scripts |
71 |
|
| 50 |
doins scripts/* |
72 |
fowners psybnc:psybnc "${PSYBNC_HOME}"/{,log,motd,scripts} /etc/psybnc/psybnc.conf |
| 51 |
insinto ${INSTALLDIR} |
73 |
fperms 0750 "${PSYBNC_HOME}"/{,log,motd,scripts} |
| 52 |
doins ${FILESDIR}/psybnc.conf config.h |
74 |
fperms 0640 /etc/psybnc/psybnc.conf |
| 53 |
|
75 |
|
| 54 |
exeinto ${INSTALLDIR} |
76 |
if use ssl |
| 55 |
doexe psybnc |
77 |
then |
| 56 |
exeinto /etc/init.d |
78 |
keepdir /etc/psybnc/ssl |
| 57 |
newexe ${FILESDIR}/psybnc.initd psybnc |
79 |
dosym /etc/psybnc/ssl "${PSYBNC_HOME}"/key |
| 58 |
insinto /etc/conf.d |
80 |
else |
| 59 |
newins ${FILESDIR}/psybnc.confd psybnc |
81 |
# Drop SSL listener from psybnc.conf |
|
|
82 |
sed -i -e "/^# Default SSL listener$/,+4 d" "${D}"/etc/psybnc/psybnc.conf |
| 83 |
fi |
| 60 |
|
84 |
|
| 61 |
chown -R psybnc:psybnc ${D}/${INSTALLDIR} |
85 |
newinitd "${FILESDIR}"/psybnc.initd psybnc |
|
|
86 |
newconfd "${FILESDIR}"/psybnc.confd psybnc |
| 87 |
|
| 88 |
dodoc CHANGES COPYING FAQ README SCRIPTING TODO |
| 89 |
docinto example-script |
| 90 |
dodoc scripts/example/DEFAULT.SCRIPT |
| 62 |
} |
91 |
} |
| 63 |
|
92 |
|
| 64 |
pkg_config() { |
93 |
pkg_config() { |
| 65 |
einfo "Generating certificate request..." |
94 |
if use ssl |
| 66 |
openssl req -new -out ${INSTALLDIR}/key/psybnc.req.pem -keyout ${INSTALLDIR}/key/psybnc.key.pem -nodes |
95 |
then |
| 67 |
einfo "Generating self-signed certificate..." |
96 |
if [[ -f ${ROOT}/etc/psybnc/ssl/psybnc.cert.pem || -f ${ROOT}/etc/psybnc/ssl/psybnc.key.pem ]] |
| 68 |
openssl req -x509 -days 365 -in ${INSTALLDIR}/key/psybnc.req.pem -key ${INSTALLDIR}/key/psybnc.key.pem -out ${INSTALLDIR}/key/psybnc.cert.pem |
97 |
then |
| 69 |
einfo "Generating fingerprint..." |
98 |
ewarn "Existing /etc/psybnc/psybnc.cert.pem or /etc/psybnc/psybnc.key.pem found!" |
| 70 |
openssl x509 -subject -dates -fingerprint -noout -in ${INSTALLDIR}/key/psybnc.cert.pem |
99 |
ewarn "Remove /etc/psybnc/psybnc.*.pem and run emerge --config =${CATEGORY}/${PF} again." |
| 71 |
einfo "Setting permissions on files..." |
100 |
return |
| 72 |
chmod 0640 ${INSTALLDIR}/key/psybnc.key.pem |
101 |
fi |
| 73 |
chmod 0640 ${INSTALLDIR}/key/psybnc.req.pem |
102 |
|
| 74 |
chmod 0640 ${INSTALLDIR}/key/psybnc.cert.pem |
103 |
einfo "Generating certificate request..." |
|
|
104 |
openssl req -new -out "${ROOT}"/etc/psybnc/ssl/psybnc.req.pem -keyout "${ROOT}"/etc/psybnc/ssl/psybnc.key.pem -nodes |
| 105 |
einfo "Generating self-signed certificate..." |
| 106 |
openssl req -x509 -days 365 -in "${ROOT}"/etc/psybnc/ssl/psybnc.req.pem -key "${ROOT}"/etc/psybnc/ssl/psybnc.key.pem -out "${ROOT}"/etc/psybnc/ssl/psybnc.cert.pem |
| 107 |
einfo "Setting permissions on files..." |
| 108 |
chown root:psybnc "${ROOT}"/etc/psybnc/ssl/psybnc.{cert,key,req}.pem |
| 109 |
chmod 0640 "${ROOT}"/etc/psybnc/ssl/psybnc.{cert,key,req}.pem |
| 110 |
fi |
| 75 |
} |
111 |
} |
| 76 |
|
112 |
|
| 77 |
pkg_postinst() { |
113 |
pkg_postinst() { |
| 78 |
einfo "" |
114 |
if use ssl |
| 79 |
einfo "Please run \"emerge --config =psybnc-${PVR}\" to create SSL certificates for your system." |
115 |
then |
| 80 |
einfo "You can connect to the bnc on port 23998, user=gentoo, pass=gentoo," |
116 |
einfo |
| 81 |
einfo "please edit the psybnc configuration in ${INSTALLDIR}/psybnc.conf to change this." |
117 |
einfo "Please run \"emerge --config =${CATEGORY}/${PF}\" to create needed SSL certificates." |
| 82 |
einfo "" |
118 |
fi |
|
|
119 |
|
| 120 |
einfo |
| 121 |
einfo "You can connect to psyBNC on port 23998 with user gentoo and password gentoo." |
| 122 |
einfo "Please edit the psyBNC configuration at /etc/psybnc/psybnc.conf to change this." |
| 123 |
einfo |
| 124 |
einfo "To be able to reuse an existing psybnc.conf, you need to make sure that the" |
| 125 |
einfo "old salt.h is available at /usr/share/psybnc/salt.h when compiling a new" |
| 126 |
einfo "version of psyBNC. It is needed for password encryption and decryption." |
| 127 |
einfo |
| 83 |
} |
128 |
} |