/[gentoo-x86]/app-backup/bacula/bacula-5.2.9.ebuild
Gentoo

Contents of /app-backup/bacula/bacula-5.2.9.ebuild

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.7 - (show annotations) (download)
Sat Sep 22 21:42:06 2012 UTC (21 months, 2 weeks ago) by ago
Branch: MAIN
CVS Tags: HEAD
Changes since 1.6: +1 -1 lines
FILE REMOVED
Remove old

(Portage version: 2.1.11.9/cvs/Linux x86_64)

1 # Copyright 1999-2012 Gentoo Foundation
2 # Distributed under the terms of the GNU General Public License v2
3 # $Header: /var/cvsroot/gentoo-x86/app-backup/bacula/bacula-5.2.9.ebuild,v 1.6 2012/09/05 08:29:58 jlec Exp $
4
5 EAPI="4"
6 PYTHON_DEPEND="python? 2"
7 PYTHON_USE_WITH="threads"
8 PYTHON_USE_WITH_OPT="python"
9
10 inherit eutils multilib python qt4-r2 user
11
12 MY_PV=${PV/_beta/-b}
13 MY_P=${PN}-${MY_PV}
14
15 DESCRIPTION="Featureful client/server network backup suite"
16 HOMEPAGE="http://www.bacula.org/"
17 SRC_URI="mirror://sourceforge/bacula/${MY_P}.tar.gz"
18
19 LICENSE="AGPL-3"
20 SLOT="0"
21 KEYWORDS="~amd64 ~hppa ~ppc ~sparc ~x86"
22 IUSE="bacula-clientonly bacula-nodir bacula-nosd ipv6 logwatch mysql postgres python qt4 readline +sqlite3 ssl static tcpd vim-syntax X"
23
24 DEPEND="
25 >=sys-libs/zlib-1.1.4
26 dev-libs/gmp
27 !bacula-clientonly? (
28 postgres? ( dev-db/postgresql-base[threads] )
29 mysql? ( virtual/mysql )
30 sqlite3? ( dev-db/sqlite:3 )
31 !bacula-nodir? ( virtual/mta )
32 )
33 qt4? (
34 x11-libs/qt-svg:4
35 x11-libs/qwt:5
36 )
37 ssl? ( dev-libs/openssl )
38 logwatch? ( sys-apps/logwatch )
39 tcpd? ( >=sys-apps/tcp-wrappers-7.6 )
40 readline? ( >=sys-libs/readline-4.1 )
41 dev-libs/lzo
42 sys-libs/ncurses"
43 RDEPEND="${DEPEND}
44 !bacula-clientonly? (
45 !bacula-nosd? (
46 sys-block/mtx
47 app-arch/mt-st
48 )
49 )
50 vim-syntax? ( || ( app-editors/vim app-editors/gvim ) )"
51
52 REQUIRED_USE="|| ( ^^ ( mysql postgres sqlite3 ) bacula-clientonly )"
53
54 S=${WORKDIR}/${MY_P}
55
56 pkg_setup() {
57 # create the daemon group and user
58 if [ -z "$(egetent group bacula 2>/dev/null)" ]; then
59 enewgroup bacula
60 einfo
61 einfo "The group 'bacula' has been created. Any users you add to this"
62 einfo "group have access to files created by the daemons."
63 einfo
64 fi
65
66 if use bacula-clientonly && use static && use qt4; then
67 ewarn
68 ewarn "Building statically linked 'bat' is not supported. Ignorig 'qt4' useflag."
69 ewarn
70 fi
71
72 if ! use bacula-clientonly; then
73 # USE=static only supported for bacula-clientonly
74 if use static; then
75 ewarn
76 ewarn "USE=static only supported together with USE=bacula-clientonly."
77 ewarn "Ignoring 'static' useflag."
78 ewarn
79 fi
80 if [ -z "$(egetent passwd bacula 2>/dev/null)" ]; then
81 enewuser bacula -1 -1 /var/lib/bacula bacula,disk,tape,cdrom,cdrw
82 einfo
83 einfo "The user 'bacula' has been created. Please see the bacula manual"
84 einfo "for information about running bacula as a non-root user."
85 einfo
86 fi
87 fi
88
89 if use python; then
90 python_set_active_version 2
91 python_pkg_setup
92 fi
93 }
94
95 src_prepare() {
96 # adjusts default configuration files for several binaries
97 # to /etc/bacula/<config> instead of ./<config>
98 pushd src >&/dev/null || die
99 for f in console/console.c dird/dird.c filed/filed.c \
100 stored/bcopy.c stored/bextract.c stored/bls.c \
101 stored/bscan.c stored/btape.c stored/stored.c \
102 qt-console/main.cpp; do
103 sed -i -e 's|^\(#define CONFIG_FILE "\)|\1/etc/bacula/|g' "${f}" \
104 || die "sed on ${f} failed"
105 done
106 popd >&/dev/null || die
107
108 # drop automatic install of unneeded documentation (for bug 356499)
109 epatch "${FILESDIR}"/5.2.3/${PN}-5.2.3-doc.patch
110
111 # bug #310087
112 epatch "${FILESDIR}"/5.2.3/${PN}-5.2.3-as-needed.patch
113
114 # bug #311161
115 epatch "${FILESDIR}"/5.2.3/${PN}-5.2.3-lib-search-path.patch
116
117 # stop build for errors in subdirs
118 epatch "${FILESDIR}"/5.2.3/${PN}-5.2.3-Makefile.patch
119
120 # bat needs to respect LDFLAGS
121 epatch "${FILESDIR}"/5.2.3/${PN}-5.2.3-ldflags.patch
122
123 # bug #328701
124 epatch "${FILESDIR}"/5.2.3/${PN}-5.2.3-openssl-1.patch
125
126 epatch "${FILESDIR}"/5.2.3/${PN}-5.2.3-fix-static.patch
127 }
128
129 src_configure() {
130 local myconf=''
131
132 if use bacula-clientonly; then
133 myconf="${myconf} \
134 $(use_enable bacula-clientonly client-only) \
135 $(use_enable !static libtool) \
136 $(use_enable static static-cons) \
137 $(use_enable static static-fd)"
138 else
139 myconf="${myconf} \
140 $(use_enable !bacula-nodir build-dird) \
141 $(use_enable !bacula-nosd build-stored)"
142 # bug #311099
143 # database support needed by dir-only *and* sd-only
144 # build as well (for building bscan, btape, etc.)
145 myconf="${myconf} \
146 $(use_with mysql) \
147 $(use_with sqlite3) \
148 $(use_with postgres postgresql) \
149 --enable-batch-insert"
150 fi
151
152 # do not build bat if 'static' clientonly
153 if ! use bacula-clientonly || ! use static; then
154 myconf="${myconf} \
155 $(use_enable qt4 bat)"
156 fi
157
158 myconf="${myconf} \
159 --disable-tray-monitor \
160 $(use_with X x) \
161 $(use_with python) \
162 $(use_enable !readline conio) \
163 $(use_enable readline) \
164 $(use_with readline readline /usr) \
165 $(use_with ssl openssl) \
166 $(use_enable ipv6) \
167 $(use_with tcpd tcp-wrappers)"
168
169 econf \
170 --libdir=/usr/$(get_libdir) \
171 --docdir=/usr/share/doc/${PF} \
172 --htmldir=/usr/share/doc/${PF}/html \
173 --with-pid-dir=/var/run \
174 --sysconfdir=/etc/bacula \
175 --with-subsys-dir=/var/lock/subsys \
176 --with-working-dir=/var/lib/bacula \
177 --with-scriptdir=/usr/libexec/bacula \
178 --with-dir-user=bacula \
179 --with-dir-group=bacula \
180 --with-sd-user=root \
181 --with-sd-group=bacula \
182 --with-fd-user=root \
183 --with-fd-group=bacula \
184 --enable-smartalloc \
185 --host=${CHOST} \
186 ${myconf}
187 # correct configuration for QT based bat
188 if use qt4 ; then
189 pushd src/qt-console
190 eqmake4
191 popd
192 fi
193 }
194
195 src_install() {
196 emake DESTDIR="${D}" install
197 doicon scripts/bacula.png
198
199 # install bat icon and desktop file when enabled
200 # (for some reason ./configure doesn't pick this up)
201 if use qt4 && ! use static ; then
202 doicon src/qt-console/images/bat_icon.png
203 domenu scripts/bat.desktop
204 fi
205
206 # remove some scripts we don't need at all
207 rm -f "${D}"/usr/libexec/bacula/{bacula,bacula-ctl-dir,bacula-ctl-fd,bacula-ctl-sd,startmysql,stopmysql}
208
209 # rename statically linked apps
210 if use bacula-clientonly && use static ; then
211 pushd "${D}"/usr/sbin || die
212 mv static-bacula-fd bacula-fd || die
213 mv static-bconsole bconsole || die
214 popd || die
215 fi
216
217 # extra files which 'make install' doesn't cover
218 if ! use bacula-clientonly; then
219 # the database update scripts
220 diropts -m0750
221 insinto /usr/libexec/bacula/updatedb
222 insopts -m0754
223 doins "${S}"/updatedb/*
224 fperms 0640 /usr/libexec/bacula/updatedb/README
225
226 # the logrotate configuration
227 # (now unconditional wrt bug #258187)
228 diropts -m0755
229 insinto /etc/logrotate.d
230 insopts -m0644
231 newins "${S}"/scripts/logrotate bacula
232
233 # the logwatch scripts
234 if use logwatch; then
235 diropts -m0750
236 dodir /etc/log.d/scripts/services
237 dodir /etc/log.d/scripts/shared
238 dodir /etc/log.d/conf/logfiles
239 dodir /etc/log.d/conf/services
240 pushd "${S}"/scripts/logwatch >&/dev/null || die
241 emake DESTDIR="${D}" install
242 popd >&/dev/null || die
243 fi
244 fi
245
246 rm -vf "${D}"/usr/share/man/man1/bacula-bwxconsole.1*
247 if ! use qt4; then
248 rm -vf "${D}"/usr/share/man/man1/bat.1*
249 fi
250 rm -vf "${D}"/usr/share/man/man1/bacula-tray-monitor.1*
251 if use bacula-clientonly || use bacula-nodir; then
252 rm -vf "${D}"/usr/share/man/man8/bacula-dir.8*
253 rm -vf "${D}"/usr/share/man/man8/dbcheck.8*
254 rm -vf "${D}"/usr/share/man/man1/bsmtp.1*
255 rm -vf "${D}"/usr/libexec/bacula/create_*_database
256 rm -vf "${D}"/usr/libexec/bacula/drop_*_database
257 rm -vf "${D}"/usr/libexec/bacula/make_*_tables
258 rm -vf "${D}"/usr/libexec/bacula/update_*_tables
259 rm -vf "${D}"/usr/libexec/bacula/drop_*_tables
260 rm -vf "${D}"/usr/libexec/bacula/grant_*_privileges
261 rm -vf "${D}"/usr/libexec/bacula/*_catalog_backup
262 fi
263 if use bacula-clientonly || use bacula-nosd; then
264 rm -vf "${D}"/usr/share/man/man8/bacula-sd.8*
265 rm -vf "${D}"/usr/share/man/man8/bcopy.8*
266 rm -vf "${D}"/usr/share/man/man8/bextract.8*
267 rm -vf "${D}"/usr/share/man/man8/bls.8*
268 rm -vf "${D}"/usr/share/man/man8/bscan.8*
269 rm -vf "${D}"/usr/share/man/man8/btape.8*
270 rm -vf "${D}"/usr/libexec/bacula/disk-changer
271 rm -vf "${D}"/usr/libexec/bacula/mtx-changer
272 rm -vf "${D}"/usr/libexec/bacula/dvd-handler
273 fi
274
275 # documentation
276 dodoc ChangeLog ReleaseNotes SUPPORT technotes
277
278 # vim-files
279 if use vim-syntax; then
280 insinto /usr/share/vim/vimfiles/syntax
281 doins scripts/bacula.vim
282 insinto /usr/share/vim/vimfiles/ftdetect
283 newins scripts/filetype.vim bacula_ft.vim
284 fi
285
286 # set the value of $mydbtype depending on which database we
287 # specified in the use flags.
288 if use sqlite3; then
289 mydbtype="sqlite3"
290 fi
291 if use postgres; then
292 mydbtype="postgresql"
293 fi
294 if use mysql; then
295 mydbtype="mysql"
296 fi
297 # setup init scripts
298 myscripts="bacula-fd"
299 if ! use bacula-clientonly; then
300 if ! use bacula-nodir; then
301 myscripts="${myscripts} bacula-dir"
302 fi
303 if ! use bacula-nosd; then
304 myscripts="${myscripts} bacula-sd"
305 fi
306 fi
307 for script in ${myscripts}; do
308 # copy over init script and config to a temporary location
309 # so we can modify them as needed
310 cp "${FILESDIR}/${script}".confd "${T}/${script}".confd || die "failed to copy ${script}.confd"
311 cp "${FILESDIR}/${script}".initd "${T}/${script}".initd || die "failed to copy ${script}.initd"
312
313 # now set the database dependancy for the director init script
314 case "${script}" in
315 bacula-dir)
316 case "${mydbtype}" in
317 sqlite3)
318 # sqlite3 databases don't have a daemon
319 sed -i -e 's/need "%database%"/:/g' "${T}/${script}".initd || die
320 ;;
321 *)
322 # all other databases have daemons
323 sed -i -e "s:%database%:${mydbtype}:" "${T}/${script}".initd || die
324 ;;
325 esac
326 ;;
327 *)
328 ;;
329 esac
330
331 # install init script and config
332 newinitd "${T}/${script}".initd "${script}"
333 newconfd "${T}/${script}".confd "${script}"
334 done
335
336 # make sure the working directory exists
337 diropts -m0750
338 keepdir /var/lib/bacula
339
340 # make sure bacula group can execute bacula libexec scripts
341 fowners -R root:bacula /usr/libexec/bacula
342 }
343
344 pkg_postinst() {
345 if use bacula-clientonly; then
346 fowners root:bacula /var/lib/bacula
347 else
348 fowners bacula:bacula /var/lib/bacula
349 fi
350
351 if ! use bacula-clientonly && ! use bacula-nodir; then
352 einfo
353 einfo "If this is a new install, you must create the ${mydbtype} databases with:"
354 einfo " /usr/libexec/bacula/create_${mydbtype}_database"
355 einfo " /usr/libexec/bacula/make_${mydbtype}_tables"
356 einfo " /usr/libexec/bacula/grant_${mydbtype}_privileges"
357 einfo
358 fi
359
360 einfo "Please note that 'bconsole' will always be installed. To compile 'bat'"
361 einfo "you have to enable 'USE=qt4'."
362 einfo
363 }

  ViewVC Help
Powered by ViewVC 1.1.20