blob: 2240cf77faca64b9d8bb3524d6b715648b108139 (
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
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
|
# Copyright 1999-2008 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Header: /var/cvsroot/gentoo-x86/net-irc/rbot/rbot-9999-r8.ebuild,v 1.2 2008/06/23 14:51:12 flameeyes Exp $
inherit ruby gems eutils
[[ ${PV} == "9999" ]] && inherit git
DESCRIPTION="rbot is a ruby IRC bot"
HOMEPAGE="http://ruby-rbot.org/"
LICENSE="as-is"
SLOT="0"
KEYWORDS=""
IUSE="spell aspell timezone translator shorturl nls dict"
ILINGUAS="zh ru nl de fr it en ja"
for lang in $ILINGUAS; do
IUSE="${IUSE} linguas_${lang}"
done
RDEPEND=">=virtual/ruby-1.8
dev-ruby/ruby-bdb
timezone? ( dev-ruby/tzinfo )
spell? (
aspell? ( app-text/aspell )
!aspell? ( app-text/ispell )
)
translator? ( dev-ruby/mechanize )
shorturl? ( dev-ruby/shorturl )
nls? ( dev-ruby/ruby-gettext )
dict? ( dev-ruby/ruby-dict )
figlet? ( app-misc/figlet )
fortune? ( games-misc/fortune-mod )
cal? ( || ( sys-apps/util-linux sys-freebsd/freebsd-ubin ) )
host? ( net-dns/bind-tools )"
DEPEND=""
if [[ ${PV} == "9999" ]]; then
SRC_URI=""
EGIT_REPO_URI="git://ruby-rbot.org/rbot.git"
DEPEND="${DEPEND}
dev-ruby/rake
app-arch/zip
dev-ruby/ruby-gettext"
IUSE="${IUSE} snapshot"
else
SRC_URI="http://www.linuxbrit.co.uk/downloads/${P}.gem"
fi
pkg_setup() {
enewuser rbot -1 -1 /var/lib/rbot nobody
}
src_unpack() {
[[ ${PV} == "9999" ]] || return 0
git_src_unpack
cd "${S}"
sed -i -e "/s.version =/s:'.\+':'9999':" Rakefile \
|| die "Unable to fix Rakefile version."
sed -i -e '/\$version=/s:".\+":"'9999'":' bin/rbot \
|| die "Unable to fix rbot script version."
}
src_compile() {
[[ ${PV} == "9999" ]] || return 0
rake makemo || die "locale generation failed"
rake || die "Gem generation failed"
}
src_install() {
if [[ ${PV} == "9999" ]]; then
GEM_SRC="${S}/pkg/rbot-9999.gem"
MY_P="${PN}-9999"
else
MY_P="${P}"
fi
gems_src_install
diropts -o rbot -g nobody -m 0700
keepdir /var/lib/rbot
newinitd "${FILESDIR}/rbot.init" rbot
newconfd "${FILESDIR}/rbot.conf" rbot
local rbot_datadir="${D}/${GEMSDIR}"/gems/${MY_P}/data/rbot
disable_rbot_plugin() {
mv "${rbot_datadir}"/plugins/$1.rb{,.disabled}
}
if ! use spell; then
disable_rbot_plugin spell || die "Unable to disable spell plugin"
elif use aspell; then
# This is not officially supported, but as ispell is quite a
# bad piece of code, at least give an opportunity to use
# something that works a bit better.
sed -i -e 's:ispell:ispell-aspell:' \
"${rbot_datadir}"/plugins/spell.rb \
|| die "Unable to replace ispell with aspell."
fi
use timezone || disable_rbot_plugin time
use translator || disable_rbot_plugin translator
use shorturl || disable_rbot_plugin shortenurls
use dict || disable_rbot_plugin dictclient
use figlet || disable_rbot_plugin figlet
use fortune || disable_rbot_plugin fortune
use cal || disable_rbot_plugin cal
use host || disable_rbot_plugin host
# This is unfortunately pretty manual at the moment, but it's just
# to avoid having to run special scripts to package new versions
# of rbot. The default if new languages are added that are not
# considered for an opt-out here is to install them, so you just
# need to add them later.
strip-linguas ${ILINGUAS}
if [[ -n ${LINGUAS} ]]; then
# As the the language name used by the rbot data files does
# not correspond to the ISO codes we usually use for LINGUAS,
# the following list of local varables will work as a
# dictionary to get the name used by rbot from the ISO code.
local lang_rbot_zh="traditional_chinese"
local lang_rbot_ru="russian"
local lang_rbot_nl="dutch"
local lang_rbot_de="german"
local lang_rbot_fr="french"
local lang_rbot_it="italian"
local lang_rbot_en="english"
local lang_rbot_ja="japanese"
for lang in ${ILINGUAS}; do
use linguas_${lang} && continue
lang="lang_rbot_${lang}"
lang_rbot=${!lang}
rm \
${rbot_datadir}/languages/${lang_rbot}.lang \
${rbot_datadir}/templates/lart/larts-${lang_rbot} \
${rbot_datadir}/templates/lart/praises-${lang_rbot} \
${rbot_datadir}/templates/salut/salut-${lang_rbot}
done
fi
}
pkg_postinst() {
einfo
elog "rbot now can be started as a normal service."
elog "Check /etc/conf.d/rbot file for more information about this feature."
einfo
}
|