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

Contents of /app-backup/bacula/bacula-5.2.13-r3.ebuild

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.3 - (show annotations) (download)
Wed May 6 05:38:52 2015 UTC (3 years, 1 month ago) by tomjbe
Branch: MAIN
CVS Tags: HEAD
Changes since 1.2: +7 -7 lines
Migrate to USE=sqlite (bug #548646)

(Portage version: 2.2.18/cvs/Linux x86_64, signed Manifest commit with key 0x762053D5)

1 # Copyright 1999-2015 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.13-r3.ebuild,v 1.2 2015/02/23 15:05:30 tomjbe Exp $
4
5 EAPI="5"
6
7 PYTHON_COMPAT=( python2_7 )
8 PYTHON_REQ_USE="threads"
9
10 inherit eutils multilib python-single-r1 qt4-r2 systemd user libtool
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 ~ppc ~sparc ~x86"
22 IUSE="acl bacula-clientonly bacula-nodir bacula-nosd examples ipv6 logwatch mysql postgres python qt4 readline +sqlite ssl static tcpd vim-syntax X"
23
24 DEPEND="
25 dev-libs/gmp
26 !bacula-clientonly? (
27 postgres? ( dev-db/postgresql[threads] )
28 mysql? ( virtual/mysql )
29 sqlite? ( dev-db/sqlite:3 )
30 !bacula-nodir? ( virtual/mta )
31 )
32 qt4? (
33 dev-qt/qtsvg:4
34 x11-libs/qwt:5
35 )
36 logwatch? ( sys-apps/logwatch )
37 tcpd? ( >=sys-apps/tcp-wrappers-7.6 )
38 readline? ( >=sys-libs/readline-4.1 )
39 static? (
40 acl? ( virtual/acl[static-libs] )
41 sys-libs/zlib[static-libs]
42 dev-libs/lzo[static-libs]
43 sys-libs/ncurses[static-libs]
44 ssl? ( dev-libs/openssl[static-libs] )
45 )
46 !static? (
47 acl? ( virtual/acl )
48 sys-libs/zlib
49 dev-libs/lzo
50 sys-libs/ncurses
51 ssl? ( dev-libs/openssl )
52 )
53 python? ( ${PYTHON_DEPS} )
54 "
55 RDEPEND="${DEPEND}
56 !bacula-clientonly? (
57 !bacula-nosd? (
58 sys-block/mtx
59 app-arch/mt-st
60 )
61 )
62 vim-syntax? ( || ( app-editors/vim app-editors/gvim ) )"
63
64 REQUIRED_USE="|| ( ^^ ( mysql postgres sqlite ) bacula-clientonly )
65 static? ( bacula-clientonly )
66 python? ( ${PYTHON_REQUIRED_USE} )"
67
68 S=${WORKDIR}/${MY_P}
69
70 pkg_setup() {
71 #XOR and !bacula-clientonly controlled by REQUIRED_USE
72 use mysql && export mydbtype="mysql"
73 use postgres && export mydbtype="postgresql"
74 use sqlite && export mydbtype="sqlite3"
75
76 # create the daemon group and user
77 if [ -z "$(egetent group bacula 2>/dev/null)" ]; then
78 enewgroup bacula
79 einfo
80 einfo "The group 'bacula' has been created. Any users you add to this"
81 einfo "group have access to files created by the daemons."
82 einfo
83 fi
84
85 if use bacula-clientonly && use static && use qt4; then
86 ewarn
87 ewarn "Building statically linked 'bat' is not supported. Ignorig 'qt4' useflag."
88 ewarn
89 fi
90
91 if ! use bacula-clientonly; then
92 if [ -z "$(egetent passwd bacula 2>/dev/null)" ]; then
93 enewuser bacula -1 -1 /var/lib/bacula bacula,disk,tape,cdrom,cdrw
94 einfo
95 einfo "The user 'bacula' has been created. Please see the bacula manual"
96 einfo "for information about running bacula as a non-root user."
97 einfo
98 fi
99 fi
100
101 use python && python-single-r1_pkg_setup
102 }
103
104 src_prepare() {
105 # adjusts default configuration files for several binaries
106 # to /etc/bacula/<config> instead of ./<config>
107 pushd src >&/dev/null || die
108 for f in console/console.c dird/dird.c filed/filed.c \
109 stored/bcopy.c stored/bextract.c stored/bls.c \
110 stored/bscan.c stored/btape.c stored/stored.c \
111 qt-console/main.cpp; do
112 sed -i -e 's|^\(#define CONFIG_FILE "\)|\1/etc/bacula/|g' "${f}" \
113 || die "sed on ${f} failed"
114 done
115 popd >&/dev/null || die
116
117 # bug 466688 drop deprecated categories from Desktop file
118 sed -i -e 's/Application;//' scripts/bat.desktop.in || die
119
120 # bug 466690 Use CXXFLAGS instead of CFLAGS
121 sed -i -e 's/@CFLAGS@/@CXXFLAGS@/' autoconf/Make.common.in || die
122
123 # drop automatic install of unneeded documentation (for bug 356499)
124 epatch "${FILESDIR}"/5.2.3/${PN}-5.2.3-doc.patch
125
126 # bug #310087
127 epatch "${FILESDIR}"/5.2.3/${PN}-5.2.3-as-needed.patch
128
129 # bug #311161
130 epatch "${FILESDIR}"/5.2.3/${PN}-5.2.3-lib-search-path.patch
131
132 # stop build for errors in subdirs
133 epatch "${FILESDIR}"/5.2.3/${PN}-5.2.3-Makefile.patch
134
135 # bat needs to respect LDFLAGS
136 epatch "${FILESDIR}"/5.2.3/${PN}-5.2.3-ldflags.patch
137
138 # bug #328701
139 epatch "${FILESDIR}"/5.2.3/${PN}-5.2.3-openssl-1.patch
140
141 epatch "${FILESDIR}"/5.2.10/${PN}-5.2.10-fix-static.patch
142
143 # do not strip binaries
144 sed -i -e "s/strip /# strip /" src/filed/Makefile.in || die
145 sed -i -e "s/strip /# strip /" src/console/Makefile.in || die
146
147 # fix file not found error during make depend
148 epatch "${FILESDIR}"/5.2.12/${PN}-5.2.12-depend.patch
149
150 # Fix systemd unit files:
151 # bug 497748
152 sed -i -e '/Requires/d' platforms/systemd/*.service.in || die
153 sed -i -e '/StandardOutput/d' platforms/systemd/*.service.in || die
154 # bug 504370
155 sed -i -e '/Alias=bacula-dir/d' platforms/systemd/bacula-dir.service.in || die
156
157 # fix bundled libtool (bug 466696)
158 # But first move directory with M4 macros out of the way.
159 # It is only needed by i autoconf and gives errors during elibtoolize.
160 mv autoconf/libtool autoconf/libtool1 || die
161 elibtoolize
162 }
163
164 src_configure() {
165 local myconf=''
166
167 if use bacula-clientonly; then
168 myconf="${myconf} \
169 $(use_enable bacula-clientonly client-only) \
170 $(use_enable !static libtool) \
171 $(use_enable static static-cons) \
172 $(use_enable static static-fd)"
173 else
174 myconf="${myconf} \
175 $(use_enable !bacula-nodir build-dird) \
176 $(use_enable !bacula-nosd build-stored)"
177 # bug #311099
178 # database support needed by dir-only *and* sd-only
179 # build as well (for building bscan, btape, etc.)
180 myconf="${myconf} \
181 --with-${mydbtype} \
182 --enable-batch-insert"
183 fi
184
185 # do not build bat if 'static' clientonly
186 if ! use bacula-clientonly || ! use static; then
187 myconf="${myconf} \
188 $(use_enable qt4 bat)"
189 fi
190
191 myconf="${myconf} \
192 --disable-tray-monitor \
193 $(use_with X x) \
194 $(use_with python) \
195 $(use_enable !readline conio) \
196 $(use_enable readline) \
197 $(use_with readline readline /usr) \
198 $(use_with ssl openssl) \
199 $(use_enable ipv6) \
200 $(use_enable acl) \
201 $(use_with tcpd tcp-wrappers)"
202
203 econf \
204 --libdir=/usr/$(get_libdir) \
205 --docdir=/usr/share/doc/${PF} \
206 --htmldir=/usr/share/doc/${PF}/html \
207 --with-pid-dir=/var/run \
208 --sysconfdir=/etc/bacula \
209 --with-subsys-dir=/var/lock/subsys \
210 --with-working-dir=/var/lib/bacula \
211 --with-logdir=/var/lib/bacula \
212 --with-scriptdir=/usr/libexec/bacula \
213 --with-systemd=$(systemd_get_unitdir) \
214 --with-dir-user=bacula \
215 --with-dir-group=bacula \
216 --with-sd-user=root \
217 --with-sd-group=bacula \
218 --with-fd-user=root \
219 --with-fd-group=bacula \
220 --enable-smartalloc \
221 --disable-afs \
222 --host=${CHOST} \
223 ${myconf}
224 # correct configuration for QT based bat
225 if use qt4 ; then
226 pushd src/qt-console
227 eqmake4
228 popd
229 fi
230 }
231
232 src_compile() {
233 # Make build log verbose (bug #447806)
234 emake NO_ECHO=""
235 }
236
237 src_install() {
238 emake DESTDIR="${D}" install
239 doicon scripts/bacula.png
240
241 # install bat icon and desktop file when enabled
242 # (for some reason ./configure doesn't pick this up)
243 if use qt4 && ! use static ; then
244 doicon src/qt-console/images/bat_icon.png
245 domenu scripts/bat.desktop
246 fi
247
248 # remove some scripts we don't need at all
249 rm -f "${D}"/usr/libexec/bacula/{bacula,bacula-ctl-dir,bacula-ctl-fd,bacula-ctl-sd,startmysql,stopmysql}
250
251 # rename statically linked apps
252 if use bacula-clientonly && use static ; then
253 pushd "${D}"/usr/sbin || die
254 mv static-bacula-fd bacula-fd || die
255 mv static-bconsole bconsole || die
256 popd || die
257 fi
258
259 # extra files which 'make install' doesn't cover
260 if ! use bacula-clientonly; then
261 # the database update scripts
262 diropts -m0750
263 insinto /usr/libexec/bacula/updatedb
264 insopts -m0754
265 doins "${S}"/updatedb/*
266 fperms 0640 /usr/libexec/bacula/updatedb/README
267
268 # the logrotate configuration
269 # (now unconditional wrt bug #258187)
270 diropts -m0755
271 insinto /etc/logrotate.d
272 insopts -m0644
273 newins "${S}"/scripts/logrotate bacula
274
275 # the logwatch scripts
276 if use logwatch; then
277 diropts -m0750
278 dodir /etc/log.d/scripts/services
279 dodir /etc/log.d/scripts/shared
280 dodir /etc/log.d/conf/logfiles
281 dodir /etc/log.d/conf/services
282 pushd "${S}"/scripts/logwatch >&/dev/null || die
283 emake DESTDIR="${D}" install
284 popd >&/dev/null || die
285 fi
286 fi
287
288 rm -vf "${D}"/usr/share/man/man1/bacula-bwxconsole.1*
289 if ! use qt4; then
290 rm -vf "${D}"/usr/share/man/man1/bat.1*
291 fi
292 rm -vf "${D}"/usr/share/man/man1/bacula-tray-monitor.1*
293 if use bacula-clientonly || use bacula-nodir; then
294 rm -vf "${D}"/usr/share/man/man8/bacula-dir.8*
295 rm -vf "${D}"/usr/share/man/man8/dbcheck.8*
296 rm -vf "${D}"/usr/share/man/man1/bsmtp.1*
297 rm -vf "${D}"/usr/libexec/bacula/create_*_database
298 rm -vf "${D}"/usr/libexec/bacula/drop_*_database
299 rm -vf "${D}"/usr/libexec/bacula/make_*_tables
300 rm -vf "${D}"/usr/libexec/bacula/update_*_tables
301 rm -vf "${D}"/usr/libexec/bacula/drop_*_tables
302 rm -vf "${D}"/usr/libexec/bacula/grant_*_privileges
303 rm -vf "${D}"/usr/libexec/bacula/*_catalog_backup
304 fi
305 if use bacula-clientonly || use bacula-nosd; then
306 rm -vf "${D}"/usr/share/man/man8/bacula-sd.8*
307 rm -vf "${D}"/usr/share/man/man8/bcopy.8*
308 rm -vf "${D}"/usr/share/man/man8/bextract.8*
309 rm -vf "${D}"/usr/share/man/man8/bls.8*
310 rm -vf "${D}"/usr/share/man/man8/bscan.8*
311 rm -vf "${D}"/usr/share/man/man8/btape.8*
312 rm -vf "${D}"/usr/libexec/bacula/disk-changer
313 rm -vf "${D}"/usr/libexec/bacula/mtx-changer
314 rm -vf "${D}"/usr/libexec/bacula/dvd-handler
315 fi
316
317 # documentation
318 dodoc ChangeLog ReleaseNotes SUPPORT technotes
319
320 # install examples (bug #457504)
321 if use examples; then
322 docinto examples/
323 dodoc -r examples/*
324 fi
325
326 # vim-files
327 if use vim-syntax; then
328 insinto /usr/share/vim/vimfiles/syntax
329 doins scripts/bacula.vim
330 insinto /usr/share/vim/vimfiles/ftdetect
331 newins scripts/filetype.vim bacula_ft.vim
332 fi
333
334 # setup init scripts
335 myscripts="bacula-fd"
336 if ! use bacula-clientonly; then
337 if ! use bacula-nodir; then
338 myscripts="${myscripts} bacula-dir"
339 fi
340 if ! use bacula-nosd; then
341 myscripts="${myscripts} bacula-sd"
342 fi
343 fi
344 for script in ${myscripts}; do
345 # copy over init script and config to a temporary location
346 # so we can modify them as needed
347 cp "${FILESDIR}/${script}".confd "${T}/${script}".confd || die "failed to copy ${script}.confd"
348 cp "${FILESDIR}/${script}".initd "${T}/${script}".initd || die "failed to copy ${script}.initd"
349
350 # now set the database dependancy for the director init script
351 case "${script}" in
352 bacula-dir)
353 case "${mydbtype}" in
354 sqlite3)
355 # sqlite databases don't have a daemon
356 sed -i -e 's/need "%database%"/:/g' "${T}/${script}".initd || die
357 ;;
358 *)
359 # all other databases have daemons
360 sed -i -e "s:%database%:${mydbtype}:" "${T}/${script}".initd || die
361 ;;
362 esac
363 ;;
364 *)
365 ;;
366 esac
367
368 # install init script and config
369 newinitd "${T}/${script}".initd "${script}"
370 newconfd "${T}/${script}".confd "${script}"
371 done
372
373 systemd_dounit "${S}"/platforms/systemd/bacula-{dir,fd,sd}.service
374 systemd_dotmpfilesd "${S}"/platforms/systemd/bacula.conf
375
376 # make sure the working directory exists
377 diropts -m0750
378 keepdir /var/lib/bacula
379
380 # make sure bacula group can execute bacula libexec scripts
381 fowners -R root:bacula /usr/libexec/bacula
382 }
383
384 pkg_postinst() {
385 if use bacula-clientonly; then
386 fowners root:bacula /var/lib/bacula
387 else
388 fowners bacula:bacula /var/lib/bacula
389 fi
390
391 if ! use bacula-clientonly && ! use bacula-nodir; then
392 einfo
393 einfo "If this is a new install, you must create the ${mydbtype} databases with:"
394 einfo " /usr/libexec/bacula/create_${mydbtype}_database"
395 einfo " /usr/libexec/bacula/make_${mydbtype}_tables"
396 einfo " /usr/libexec/bacula/grant_${mydbtype}_privileges"
397 einfo
398 fi
399
400 if use sqlite; then
401 einfo
402 einfo "Be aware that Bacula does not officially support SQLite database anymore."
403 einfo "Best use it only for a client-only installation. See Bug #445540."
404 einfo
405 fi
406
407 einfo "Please note that 'bconsole' will always be installed. To compile 'bat'"
408 einfo "you have to enable 'USE=qt4'."
409 einfo
410 }

  ViewVC Help
Powered by ViewVC 1.1.20