Gentoo Archives: gentoo-commits

From: Thomas Beierlein <tomjbe@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] repo/gentoo:master commit in: app-backup/bacula/
Date: Tue, 02 Jun 2020 13:46:37
Message-Id: 1591105564.90d89edc09a124a7f1479e48257bc3f9ab9bf8f9.tomjbe@gentoo
1 commit: 90d89edc09a124a7f1479e48257bc3f9ab9bf8f9
2 Author: Thomas Beierlein <tomjbe <AT> gentoo <DOT> org>
3 AuthorDate: Tue Jun 2 13:46:04 2020 +0000
4 Commit: Thomas Beierlein <tomjbe <AT> gentoo <DOT> org>
5 CommitDate: Tue Jun 2 13:46:04 2020 +0000
6 URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=90d89edc
7
8 app-backup/bacula: Fix installation of bpipe-fd.so
9
10 Build system originally installs plugin library with mode 0750.
11 Fixed in new revision 9.4.4-r3 and 9.6.3-r1.
12
13 Reported-by: Phil Stracchino <phils <AT> caerllewys.net>
14 Closes: https://bugs.gentoo.org/725946
15 Package-Manager: Portage-2.3.100, Repoman-2.3.22
16 Signed-off-by: Thomas Beierlein <tomjbe <AT> gentoo.org>
17
18 app-backup/bacula/bacula-9.4.4-r3.ebuild | 429 +++++++++++++++++++++++++++++++
19 app-backup/bacula/bacula-9.6.3-r1.ebuild | 428 ++++++++++++++++++++++++++++++
20 2 files changed, 857 insertions(+)
21
22 diff --git a/app-backup/bacula/bacula-9.4.4-r3.ebuild b/app-backup/bacula/bacula-9.4.4-r3.ebuild
23 new file mode 100644
24 index 00000000000..6ebe92cbe9a
25 --- /dev/null
26 +++ b/app-backup/bacula/bacula-9.4.4-r3.ebuild
27 @@ -0,0 +1,429 @@
28 +# Copyright 1999-2020 Gentoo Authors
29 +# Distributed under the terms of the GNU General Public License v2
30 +
31 +EAPI=6
32 +
33 +inherit desktop libtool qmake-utils systemd
34 +
35 +MY_PV=${PV/_beta/-b}
36 +MY_P=${PN}-${MY_PV}
37 +
38 +DESCRIPTION="Featureful client/server network backup suite"
39 +HOMEPAGE="https://www.bacula.org/"
40 +SRC_URI="mirror://sourceforge/bacula/${MY_P}.tar.gz"
41 +
42 +LICENSE="AGPL-3"
43 +SLOT="0"
44 +KEYWORDS="~amd64 ~ppc ~sparc ~x86"
45 +IUSE="acl bacula-clientonly bacula-nodir bacula-nosd +batch-insert examples ipv6 libressl logwatch mysql postgres qt5 readline +sqlite ssl static tcpd vim-syntax X"
46 +
47 +DEPEND="
48 + !bacula-clientonly? (
49 + !bacula-nodir? ( virtual/mta )
50 + postgres? ( dev-db/postgresql:=[threads] )
51 + mysql? ( || ( dev-db/mysql-connector-c dev-db/mariadb-connector-c ) )
52 + sqlite? ( dev-db/sqlite:3 )
53 + )
54 + dev-libs/gmp:0
55 + qt5? (
56 + dev-qt/qtcore:5
57 + dev-qt/qtgui:5
58 + dev-qt/qtwidgets:5
59 + dev-qt/qtsvg:5
60 + x11-libs/qwt:6
61 + )
62 + logwatch? ( sys-apps/logwatch )
63 + readline? ( sys-libs/readline:0 )
64 + static? (
65 + dev-libs/lzo[static-libs]
66 + sys-libs/ncurses:=[static-libs]
67 + sys-libs/zlib[static-libs]
68 + acl? ( virtual/acl[static-libs(+)] )
69 + ssl? (
70 + !libressl? ( dev-libs/openssl:0=[static-libs] )
71 + libressl? ( dev-libs/libressl:0=[static-libs] )
72 + )
73 + )
74 + !static? (
75 + dev-libs/lzo
76 + sys-libs/ncurses:=
77 + sys-libs/zlib
78 + acl? ( virtual/acl )
79 + ssl? (
80 + !libressl? ( dev-libs/openssl:0= )
81 + libressl? ( dev-libs/libressl:0= )
82 + )
83 + )
84 + tcpd? ( >=sys-apps/tcp-wrappers-7.6 )
85 +"
86 +RDEPEND="${DEPEND}
87 + acct-user/bacula
88 + acct-group/bacula
89 + !bacula-clientonly? (
90 + !bacula-nosd? (
91 + app-arch/mt-st
92 + sys-block/mtx
93 + )
94 + )
95 + vim-syntax? ( || ( app-editors/vim app-editors/gvim ) )
96 +"
97 +
98 +REQUIRED_USE="
99 + !bacula-clientonly? ( ^^ ( mysql postgres sqlite ) )
100 + static? ( bacula-clientonly )
101 +"
102 +
103 +S=${WORKDIR}/${MY_P}
104 +
105 +pkg_setup() {
106 + #XOR and !bacula-clientonly controlled by REQUIRED_USE
107 + use mysql && export mydbtype="mysql"
108 + use postgres && export mydbtype="postgresql"
109 + use sqlite && export mydbtype="sqlite3"
110 +
111 + if use bacula-clientonly && use static && use qt5; then
112 + ewarn
113 + ewarn "Building statically linked 'bat' is not supported. Ignorig 'qt5' useflag."
114 + ewarn
115 + fi
116 +}
117 +
118 +src_prepare() {
119 + # adjusts default configuration files for several binaries
120 + # to /etc/bacula/<config> instead of ./<config>
121 + pushd src >&/dev/null || die
122 + for f in console/console.c dird/dird.c filed/filed.c \
123 + stored/bcopy.c stored/bextract.c stored/bls.c \
124 + stored/bscan.c stored/btape.c stored/stored.c \
125 + qt-console/main.cpp; do
126 + sed -i -e 's|^\(#define CONFIG_FILE "\)|\1/etc/bacula/|g' "${f}" \
127 + || die "sed on ${f} failed"
128 + done
129 + popd >&/dev/null || die
130 +
131 + # bug 466688 drop deprecated categories from Desktop file
132 + sed -i -e 's/Application;//' scripts/bat.desktop.in || die
133 +
134 + # bug 466690 Use CXXFLAGS instead of CFLAGS
135 + sed -i -e 's/@CFLAGS@/@CXXFLAGS@/' autoconf/Make.common.in || die
136 +
137 + # drop automatic install of unneeded documentation (for bug 356499)
138 + eapply -p0 "${FILESDIR}"/7.2.0/${PN}-7.2.0-doc.patch
139 +
140 + # bug #310087
141 + eapply "${FILESDIR}"/5.2.3/${PN}-5.2.3-as-needed.patch
142 +
143 + # bug #311161
144 + eapply -p0 "${FILESDIR}"/9.0.2/${PN}-9.0.2-lib-search-path.patch
145 +
146 + # bat needs to respect LDFLAGS and CFLAGS
147 + eapply -p0 "${FILESDIR}"/9.0.6/${PN}-9.0.6-bat-pro.patch
148 +
149 + # bug #328701
150 + eapply -p0 "${FILESDIR}"/5.2.3/${PN}-5.2.3-openssl-1.patch
151 +
152 + eapply -p0 "${FILESDIR}"/9.0.8/${PN}-9.0.8-fix-static.patch
153 +
154 + # fix soname in libbaccat.so bug #602952
155 + eapply -p0 "${FILESDIR}/bacula-fix-sonames.patch"
156 +
157 + # do not strip binaries
158 + sed -i -e "s/strip /# strip /" src/filed/Makefile.in || die
159 + sed -i -e "s/strip /# strip /" src/console/Makefile.in || die
160 +
161 + # fix file not found error during make depend
162 + eapply -p0 "${FILESDIR}"/7.0.2/${PN}-7.0.2-depend.patch
163 +
164 + eapply_user
165 +
166 + # Fix systemd unit files:
167 + # bug 497748
168 + sed -i -e '/Requires/d' platforms/systemd/*.service.in || die
169 + sed -i -e '/StandardOutput/d' platforms/systemd/*.service.in || die
170 + # bug 504370
171 + sed -i -e '/Alias=bacula-dir/d' platforms/systemd/bacula-dir.service.in || die
172 + # bug 584442 and 504368
173 + sed -i -e 's/@dir_user@/root/g' platforms/systemd/bacula-dir.service.in || die
174 +
175 + # build 'bat' for Qt5
176 + export QMAKE="$(qt5_get_bindir)"/qmake
177 +
178 + # adapt to >=Qt-5.9 (see bug #644566)
179 + # qmake needs an existing target file to generate install instructions
180 + sed -i -e 's#bins.files = bat#bins.files = .libs/bat#g' \
181 + src/qt-console/bat.pro.in || die
182 + mkdir src/qt-console/.libs || die
183 + touch src/qt-console/.libs/bat || die
184 + chmod 755 src/qt-console/.libs/bat || die
185 +
186 + # fix handling of libressl version
187 + # needs separate handling for <libressl-2.7 and >=libressl2.7
188 + # (see bug #655520)
189 + if has_version "<dev-libs/libressl-2.7"; then
190 + eapply -p0 "${FILESDIR}"/9.4.0/${PN}-9.4.0-libressl26.patch
191 + else
192 + eapply -p0 "${FILESDIR}"/9.4.0/${PN}-9.4.0-libressl27.patch
193 + fi
194 +
195 + # Don't let program install man pages directly
196 + rm "${S}"/manpages/Makefile.in || die "Unable to remove man pages Makefile.in"
197 + eapply -p1 "${FILESDIR}/bacula-fix-manpages.patch"
198 +
199 + # correct installation for plugins to mode 0755 (bug #725946)
200 + sed -i -e "s/(INSTALL_PROGRAM) /(INSTALL_LIB) /" src/plugins/fd/Makefile.in ||die
201 +
202 + # fix bundled libtool (bug 466696)
203 + # But first move directory with M4 macros out of the way.
204 + # It is only needed by autoconf and gives errors during elibtoolize.
205 + mv autoconf/libtool autoconf/libtool1 || die
206 + elibtoolize
207 +}
208 +
209 +src_configure() {
210 + local myconf=''
211 +
212 + if use bacula-clientonly; then
213 + myconf="${myconf} \
214 + $(use_enable bacula-clientonly client-only) \
215 + $(use_enable !static libtool) \
216 + $(use_enable static static-cons) \
217 + $(use_enable static static-fd)"
218 + else
219 + myconf="${myconf} \
220 + $(use_enable !bacula-nodir build-dird) \
221 + $(use_enable !bacula-nosd build-stored)"
222 + # bug #311099
223 + # database support needed by dir-only *and* sd-only
224 + # build as well (for building bscan, btape, etc.)
225 + myconf="${myconf}
226 + --with-${mydbtype}"
227 + fi
228 +
229 + # do not build bat if 'static' clientonly
230 + if ! use bacula-clientonly || ! use static; then
231 + myconf="${myconf} \
232 + $(use_enable qt5 bat)"
233 + fi
234 +
235 + myconf="${myconf} \
236 + $(use_with X x) \
237 + $(use_enable batch-insert) \
238 + $(use_enable !readline conio) \
239 + $(use_enable readline) \
240 + $(use_with readline readline /usr) \
241 + $(use_with ssl openssl) \
242 + $(use_enable ipv6) \
243 + $(use_enable acl) \
244 + $(use_with tcpd tcp-wrappers)"
245 +
246 + econf \
247 + --with-pid-dir=/var/run \
248 + --sysconfdir=/etc/bacula \
249 + --with-archivedir=/var/lib/bacula/tmp \
250 + --with-subsys-dir=/var/lock/subsys \
251 + --with-working-dir=/var/lib/bacula \
252 + --with-logdir=/var/lib/bacula \
253 + --with-scriptdir=/usr/libexec/bacula \
254 + --with-systemd=$(systemd_get_systemunitdir) \
255 + --with-dir-user=bacula \
256 + --with-dir-group=bacula \
257 + --with-sd-user=root \
258 + --with-sd-group=bacula \
259 + --with-fd-user=root \
260 + --with-fd-group=bacula \
261 + --enable-smartalloc \
262 + --disable-afs \
263 + --without-s3 \
264 + --host=${CHOST} \
265 + ${myconf}
266 +}
267 +
268 +src_compile() {
269 + # Make build log verbose (bug #447806)
270 + emake NO_ECHO=""
271 +}
272 +
273 +src_install() {
274 + emake DESTDIR="${D}" install
275 + doicon scripts/bacula.png
276 +
277 + # install bat icon and desktop file when enabled
278 + # (for some reason ./configure doesn't pick this up)
279 + if use qt5 && ! use static ; then
280 + doicon src/qt-console/images/bat_icon.png
281 + domenu scripts/bat.desktop
282 + fi
283 +
284 + # remove some scripts we don't need at all
285 + rm -f "${D}"/usr/libexec/bacula/{bacula,bacula-ctl-dir,bacula-ctl-fd,bacula-ctl-sd,startmysql,stopmysql}
286 +
287 + # rename statically linked apps
288 + if use bacula-clientonly && use static ; then
289 + pushd "${D}"/usr/sbin || die
290 + mv static-bacula-fd bacula-fd || die
291 + mv static-bconsole bconsole || die
292 + popd || die
293 + fi
294 +
295 + # extra files which 'make install' doesn't cover
296 + if ! use bacula-clientonly; then
297 + # the database update scripts
298 + diropts -m0750
299 + insinto /usr/libexec/bacula/updatedb
300 + insopts -m0754
301 + doins "${S}"/updatedb/*
302 + fperms 0640 /usr/libexec/bacula/updatedb/README
303 +
304 + # the logrotate configuration
305 + # (now unconditional wrt bug #258187)
306 + diropts -m0755
307 + insinto /etc/logrotate.d
308 + insopts -m0644
309 + newins "${S}"/scripts/logrotate bacula
310 +
311 + # the logwatch scripts
312 + if use logwatch; then
313 + diropts -m0750
314 + dodir /usr/share/logwatch/scripts/services
315 + dodir /usr/share/logwatch/scripts/shared
316 + dodir /etc/logwatch/conf/logfiles
317 + dodir /etc/logwatch/conf/services
318 + pushd "${S}"/scripts/logwatch >&/dev/null || die
319 + emake DESTDIR="${D}" install
320 + popd >&/dev/null || die
321 + fi
322 + fi
323 +
324 + # Install all man pages
325 + doman "${S}"/manpages/*
326 +
327 + if ! use qt5; then
328 + rm -vf "${D}"/usr/share/man/man1/bat.1*
329 + fi
330 + rm -vf "${D}"/usr/share/man/man1/bacula-tray-monitor.1*
331 +
332 + if use bacula-clientonly || use bacula-nodir ; then
333 + rm -vf "${D}"/usr/libexec/bacula/create_*_database
334 + rm -vf "${D}"/usr/libexec/bacula/drop_*_database
335 + rm -vf "${D}"/usr/libexec/bacula/make_*_tables
336 + rm -vf "${D}"/usr/libexec/bacula/update_*_tables
337 + rm -vf "${D}"/usr/libexec/bacula/drop_*_tables
338 + rm -vf "${D}"/usr/libexec/bacula/grant_*_privileges
339 + rm -vf "${D}"/usr/libexec/bacula/*_catalog_backup
340 + fi
341 + if use bacula-clientonly || use bacula-nosd; then
342 + rm -vf "${D}"/usr/libexec/bacula/disk-changer
343 + rm -vf "${D}"/usr/libexec/bacula/mtx-changer
344 + rm -vf "${D}"/usr/libexec/bacula/dvd-handler
345 + fi
346 +
347 + # documentation
348 + dodoc ChangeLog ReleaseNotes SUPPORT
349 +
350 + # install examples (bug #457504)
351 + if use examples; then
352 + docinto examples/
353 + dodoc -r examples/*
354 + fi
355 +
356 + # vim-files
357 + if use vim-syntax; then
358 + insinto /usr/share/vim/vimfiles/syntax
359 + doins scripts/bacula.vim
360 + insinto /usr/share/vim/vimfiles/ftdetect
361 + newins scripts/filetype.vim bacula_ft.vim
362 + fi
363 +
364 + # setup init scripts
365 + myscripts="bacula-fd"
366 + if ! use bacula-clientonly; then
367 + if ! use bacula-nodir; then
368 + myscripts="${myscripts} bacula-dir"
369 + fi
370 + if ! use bacula-nosd; then
371 + myscripts="${myscripts} bacula-sd"
372 + fi
373 + fi
374 + for script in ${myscripts}; do
375 + # copy over init script and config to a temporary location
376 + # so we can modify them as needed
377 + cp "${FILESDIR}/${script}".confd "${T}/${script}".confd || die "failed to copy ${script}.confd"
378 + cp "${FILESDIR}/newscripts/${script}".initd "${T}/${script}".initd || die "failed to copy ${script}.initd"
379 +
380 + # now set the database dependancy for the director init script
381 + case "${script}" in
382 + bacula-dir)
383 + case "${mydbtype}" in
384 + sqlite3)
385 + # sqlite databases don't have a daemon
386 + sed -i -e 's/need "%database%"/:/g' "${T}/${script}".initd || die
387 + ;;
388 + *)
389 + # all other databases have daemons
390 + sed -i -e "s:%database%:${mydbtype}:" "${T}/${script}".initd || die
391 + ;;
392 + esac
393 + ;;
394 + *)
395 + ;;
396 + esac
397 +
398 + # install init script and config
399 + newinitd "${T}/${script}".initd "${script}"
400 + newconfd "${T}/${script}".confd "${script}"
401 + done
402 +
403 + systemd_dounit "${S}"/platforms/systemd/bacula-{dir,fd,sd}.service
404 +
405 + # make sure the working directory exists
406 + diropts -m0750
407 + keepdir /var/lib/bacula
408 +
409 + # make sure bacula group can execute bacula libexec scripts
410 + fowners -R root:bacula /usr/libexec/bacula
411 +}
412 +
413 +pkg_postinst() {
414 + if use bacula-clientonly; then
415 + fowners root:bacula /var/lib/bacula
416 + else
417 + fowners bacula:bacula /var/lib/bacula
418 + fi
419 +
420 + einfo
421 + einfo "A group 'bacula' has been created. Any users you add to this"
422 + einfo "group have access to files created by the daemons."
423 + einfo
424 + einfo "A user 'bacula' has been created. Please see the bacula manual"
425 + einfo "for information about running bacula as a non-root user."
426 + einfo
427 +
428 + if ! use bacula-clientonly && ! use bacula-nodir; then
429 + einfo
430 + einfo "If this is a new install, you must create the ${mydbtype} databases with:"
431 + einfo " /usr/libexec/bacula/create_${mydbtype}_database"
432 + einfo " /usr/libexec/bacula/make_${mydbtype}_tables"
433 + einfo " /usr/libexec/bacula/grant_${mydbtype}_privileges"
434 + einfo
435 +
436 + ewarn "ATTENTION!"
437 + ewarn "The format of the database may have changed."
438 + ewarn "If you just upgraded from a version below 9.0.0 you must run"
439 + ewarn "'update_bacula_tables' now."
440 + ewarn "Make sure to have a backup of your catalog before."
441 + ewarn
442 + fi
443 +
444 + if use sqlite; then
445 + einfo
446 + einfo "Be aware that Bacula does not officially support SQLite database anymore."
447 + einfo "Best use it only for a client-only installation. See Bug #445540."
448 + einfo
449 + fi
450 +
451 + einfo "Please note that 'bconsole' will always be installed. To compile 'bat'"
452 + einfo "you have to enable 'USE=qt5'."
453 + einfo
454 + einfo "/var/lib/bacula/tmp was configured for archivedir. This dir will be used during"
455 + einfo "restores, so be sure to set it to an appropriate in dir in the bacula config."
456 +}
457
458 diff --git a/app-backup/bacula/bacula-9.6.3-r1.ebuild b/app-backup/bacula/bacula-9.6.3-r1.ebuild
459 new file mode 100644
460 index 00000000000..55c0d02d3b8
461 --- /dev/null
462 +++ b/app-backup/bacula/bacula-9.6.3-r1.ebuild
463 @@ -0,0 +1,428 @@
464 +# Copyright 1999-2020 Gentoo Authors
465 +# Distributed under the terms of the GNU General Public License v2
466 +
467 +EAPI=6
468 +
469 +inherit desktop libtool qmake-utils systemd
470 +
471 +MY_PV=${PV/_beta/-b}
472 +MY_P=${PN}-${MY_PV}
473 +
474 +DESCRIPTION="Featureful client/server network backup suite"
475 +HOMEPAGE="https://www.bacula.org/"
476 +SRC_URI="mirror://sourceforge/bacula/${MY_P}.tar.gz"
477 +
478 +LICENSE="AGPL-3"
479 +SLOT="0"
480 +KEYWORDS="~amd64 ~ppc ~sparc ~x86"
481 +IUSE="acl bacula-clientonly bacula-nodir bacula-nosd +batch-insert examples ipv6 libressl logwatch mysql postgres qt5 readline +sqlite ssl static tcpd vim-syntax X"
482 +
483 +DEPEND="
484 + !bacula-clientonly? (
485 + !bacula-nodir? ( virtual/mta )
486 + postgres? ( dev-db/postgresql:=[threads] )
487 + mysql? ( || ( dev-db/mysql-connector-c dev-db/mariadb-connector-c ) )
488 + sqlite? ( dev-db/sqlite:3 )
489 + )
490 + dev-libs/gmp:0
491 + qt5? (
492 + dev-qt/qtcore:5
493 + dev-qt/qtgui:5
494 + dev-qt/qtwidgets:5
495 + dev-qt/qtsvg:5
496 + x11-libs/qwt:6
497 + )
498 + logwatch? ( sys-apps/logwatch )
499 + readline? ( sys-libs/readline:0 )
500 + static? (
501 + dev-libs/lzo[static-libs]
502 + sys-libs/ncurses:=[static-libs]
503 + sys-libs/zlib[static-libs]
504 + acl? ( virtual/acl[static-libs(+)] )
505 + ssl? (
506 + !libressl? ( dev-libs/openssl:0=[static-libs] )
507 + libressl? ( dev-libs/libressl:0=[static-libs] )
508 + )
509 + )
510 + !static? (
511 + dev-libs/lzo
512 + sys-libs/ncurses:=
513 + sys-libs/zlib
514 + acl? ( virtual/acl )
515 + ssl? (
516 + !libressl? ( dev-libs/openssl:0= )
517 + libressl? ( dev-libs/libressl:0= )
518 + )
519 + )
520 + tcpd? ( >=sys-apps/tcp-wrappers-7.6 )
521 +"
522 +RDEPEND="${DEPEND}
523 + acct-user/bacula
524 + acct-group/bacula
525 + !bacula-clientonly? (
526 + !bacula-nosd? (
527 + app-arch/mt-st
528 + sys-block/mtx
529 + )
530 + )
531 + vim-syntax? ( || ( app-editors/vim app-editors/gvim ) )
532 +"
533 +
534 +REQUIRED_USE="
535 + !bacula-clientonly? ( ^^ ( mysql postgres sqlite ) )
536 + static? ( bacula-clientonly )
537 +"
538 +
539 +S=${WORKDIR}/${MY_P}
540 +
541 +pkg_setup() {
542 + #XOR and !bacula-clientonly controlled by REQUIRED_USE
543 + use mysql && export mydbtype="mysql"
544 + use postgres && export mydbtype="postgresql"
545 + use sqlite && export mydbtype="sqlite3"
546 +
547 + if use bacula-clientonly && use static && use qt5; then
548 + ewarn
549 + ewarn "Building statically linked 'bat' is not supported. Ignorig 'qt5' useflag."
550 + ewarn
551 + fi
552 +}
553 +
554 +src_prepare() {
555 + # adjusts default configuration files for several binaries
556 + # to /etc/bacula/<config> instead of ./<config>
557 + pushd src >&/dev/null || die
558 + for f in console/console.c dird/dird.c filed/filed.c \
559 + stored/bcopy.c stored/bextract.c stored/bls.c \
560 + stored/bscan.c stored/btape.c stored/stored.c \
561 + qt-console/main.cpp; do
562 + sed -i -e 's|^\(#define CONFIG_FILE "\)|\1/etc/bacula/|g' "${f}" \
563 + || die "sed on ${f} failed"
564 + done
565 + popd >&/dev/null || die
566 +
567 + # bug 466688 drop deprecated categories from Desktop file
568 + sed -i -e 's/Application;//' scripts/bat.desktop.in || die
569 +
570 + # bug 466690 Use CXXFLAGS instead of CFLAGS
571 + sed -i -e 's/@CFLAGS@/@CXXFLAGS@/' autoconf/Make.common.in || die
572 +
573 + # drop automatic install of unneeded documentation (for bug 356499)
574 + eapply -p0 "${FILESDIR}"/7.2.0/${PN}-7.2.0-doc.patch
575 +
576 + # bug #310087
577 + eapply "${FILESDIR}"/5.2.3/${PN}-5.2.3-as-needed.patch
578 +
579 + # bug #311161
580 + eapply -p0 "${FILESDIR}"/9.0.2/${PN}-9.0.2-lib-search-path.patch
581 +
582 + # bat needs to respect LDFLAGS and CFLAGS
583 + eapply -p0 "${FILESDIR}"/9.0.6/${PN}-9.0.6-bat-pro.patch
584 +
585 + # bug #328701
586 + eapply -p0 "${FILESDIR}"/5.2.3/${PN}-5.2.3-openssl-1.patch
587 +
588 + eapply -p0 "${FILESDIR}"/9.6.3/${P}-fix-static.patch
589 +
590 + # fix soname in libbaccat.so bug #602952
591 + eapply -p0 "${FILESDIR}/bacula-fix-sonames.patch"
592 +
593 + # do not strip binaries
594 + sed -i -e "s/strip /# strip /" src/filed/Makefile.in || die
595 + sed -i -e "s/strip /# strip /" src/console/Makefile.in || die
596 +
597 + # fix file not found error during make depend
598 + eapply -p0 "${FILESDIR}"/7.0.2/${PN}-7.0.2-depend.patch
599 +
600 + eapply_user
601 +
602 + # Fix systemd unit files:
603 + # bug 497748
604 + sed -i -e '/Requires/d' platforms/systemd/*.service.in || die
605 + sed -i -e '/StandardOutput/d' platforms/systemd/*.service.in || die
606 + # bug 504370
607 + sed -i -e '/Alias=bacula-dir/d' platforms/systemd/bacula-dir.service.in || die
608 + # bug 584442 and 504368
609 + sed -i -e 's/@dir_user@/root/g' platforms/systemd/bacula-dir.service.in || die
610 +
611 + # build 'bat' for Qt5
612 + export QMAKE="$(qt5_get_bindir)"/qmake
613 +
614 + # adapt to >=Qt-5.9 (see bug #644566)
615 + # qmake needs an existing target file to generate install instructions
616 + sed -i -e 's#bins.files = bat#bins.files = .libs/bat#g' \
617 + src/qt-console/bat.pro.in || die
618 + mkdir src/qt-console/.libs || die
619 + touch src/qt-console/.libs/bat || die
620 + chmod 755 src/qt-console/.libs/bat || die
621 +
622 + # fix handling of libressl version
623 + # needs separate handling for <libressl-2.7 and >=libressl2.7
624 + # (see bug #655520)
625 + if has_version "<dev-libs/libressl-2.7"; then
626 + eapply -p0 "${FILESDIR}"/9.4.0/${PN}-9.4.0-libressl26.patch
627 + else
628 + eapply -p0 "${FILESDIR}"/9.4.0/${PN}-9.4.0-libressl27.patch
629 + fi
630 +
631 + # Don't let program install man pages directly
632 + sed -i -e 's/ manpages//' Makefile.in || die
633 +
634 + # correct installation for plugins to mode 0755 (bug #725946)
635 + sed -i -e "s/(INSTALL_PROGRAM) /(INSTALL_LIB) /" src/plugins/fd/Makefile.in ||die
636 +
637 + # fix bundled libtool (bug 466696)
638 + # But first move directory with M4 macros out of the way.
639 + # It is only needed by autoconf and gives errors during elibtoolize.
640 + mv autoconf/libtool autoconf/libtool1 || die
641 + elibtoolize
642 +}
643 +
644 +src_configure() {
645 + local myconf=''
646 +
647 + if use bacula-clientonly; then
648 + myconf="${myconf} \
649 + $(use_enable bacula-clientonly client-only) \
650 + $(use_enable !static libtool) \
651 + $(use_enable static static-cons) \
652 + $(use_enable static static-fd)"
653 + else
654 + myconf="${myconf} \
655 + $(use_enable !bacula-nodir build-dird) \
656 + $(use_enable !bacula-nosd build-stored)"
657 + # bug #311099
658 + # database support needed by dir-only *and* sd-only
659 + # build as well (for building bscan, btape, etc.)
660 + myconf="${myconf}
661 + --with-${mydbtype}"
662 + fi
663 +
664 + # do not build bat if 'static' clientonly
665 + if ! use bacula-clientonly || ! use static; then
666 + myconf="${myconf} \
667 + $(use_enable qt5 bat)"
668 + fi
669 +
670 + myconf="${myconf} \
671 + $(use_with X x) \
672 + $(use_enable batch-insert) \
673 + $(use_enable !readline conio) \
674 + $(use_enable readline) \
675 + $(use_with readline readline /usr) \
676 + $(use_with ssl openssl) \
677 + $(use_enable ipv6) \
678 + $(use_enable acl) \
679 + $(use_with tcpd tcp-wrappers)"
680 +
681 + econf \
682 + --with-pid-dir=/var/run \
683 + --sysconfdir=/etc/bacula \
684 + --with-archivedir=/var/lib/bacula/tmp \
685 + --with-subsys-dir=/var/lock/subsys \
686 + --with-working-dir=/var/lib/bacula \
687 + --with-logdir=/var/lib/bacula \
688 + --with-scriptdir=/usr/libexec/bacula \
689 + --with-systemd=$(systemd_get_systemunitdir) \
690 + --with-dir-user=bacula \
691 + --with-dir-group=bacula \
692 + --with-sd-user=root \
693 + --with-sd-group=bacula \
694 + --with-fd-user=root \
695 + --with-fd-group=bacula \
696 + --enable-smartalloc \
697 + --disable-afs \
698 + --without-s3 \
699 + --host=${CHOST} \
700 + ${myconf}
701 +}
702 +
703 +src_compile() {
704 + # Make build log verbose (bug #447806)
705 + emake NO_ECHO=""
706 +}
707 +
708 +src_install() {
709 + emake DESTDIR="${D}" install
710 + doicon scripts/bacula.png
711 +
712 + # install bat icon and desktop file when enabled
713 + # (for some reason ./configure doesn't pick this up)
714 + if use qt5 && ! use static ; then
715 + doicon src/qt-console/images/bat_icon.png
716 + domenu scripts/bat.desktop
717 + fi
718 +
719 + # remove some scripts we don't need at all
720 + rm -f "${D}"/usr/libexec/bacula/{bacula,bacula-ctl-dir,bacula-ctl-fd,bacula-ctl-sd,startmysql,stopmysql}
721 +
722 + # rename statically linked apps
723 + if use bacula-clientonly && use static ; then
724 + pushd "${D}"/usr/sbin || die
725 + mv static-bacula-fd bacula-fd || die
726 + mv static-bconsole bconsole || die
727 + popd || die
728 + fi
729 +
730 + # extra files which 'make install' doesn't cover
731 + if ! use bacula-clientonly; then
732 + # the database update scripts
733 + diropts -m0750
734 + insinto /usr/libexec/bacula/updatedb
735 + insopts -m0754
736 + doins "${S}"/updatedb/*
737 + fperms 0640 /usr/libexec/bacula/updatedb/README
738 +
739 + # the logrotate configuration
740 + # (now unconditional wrt bug #258187)
741 + diropts -m0755
742 + insinto /etc/logrotate.d
743 + insopts -m0644
744 + newins "${S}"/scripts/logrotate bacula
745 +
746 + # the logwatch scripts
747 + if use logwatch; then
748 + diropts -m0750
749 + dodir /usr/share/logwatch/scripts/services
750 + dodir /usr/share/logwatch/scripts/shared
751 + dodir /etc/logwatch/conf/logfiles
752 + dodir /etc/logwatch/conf/services
753 + pushd "${S}"/scripts/logwatch >&/dev/null || die
754 + emake DESTDIR="${D}" install
755 + popd >&/dev/null || die
756 + fi
757 + fi
758 +
759 + # Install all man pages
760 + doman "${S}"/manpages/*.[18]
761 +
762 + if ! use qt5; then
763 + rm -vf "${D}"/usr/share/man/man1/bat.1*
764 + fi
765 + rm -vf "${D}"/usr/share/man/man1/bacula-tray-monitor.1*
766 +
767 + if use bacula-clientonly || use bacula-nodir ; then
768 + rm -vf "${D}"/usr/libexec/bacula/create_*_database
769 + rm -vf "${D}"/usr/libexec/bacula/drop_*_database
770 + rm -vf "${D}"/usr/libexec/bacula/make_*_tables
771 + rm -vf "${D}"/usr/libexec/bacula/update_*_tables
772 + rm -vf "${D}"/usr/libexec/bacula/drop_*_tables
773 + rm -vf "${D}"/usr/libexec/bacula/grant_*_privileges
774 + rm -vf "${D}"/usr/libexec/bacula/*_catalog_backup
775 + fi
776 + if use bacula-clientonly || use bacula-nosd; then
777 + rm -vf "${D}"/usr/libexec/bacula/disk-changer
778 + rm -vf "${D}"/usr/libexec/bacula/mtx-changer
779 + rm -vf "${D}"/usr/libexec/bacula/dvd-handler
780 + fi
781 +
782 + # documentation
783 + dodoc ChangeLog ReleaseNotes SUPPORT
784 +
785 + # install examples (bug #457504)
786 + if use examples; then
787 + docinto examples/
788 + dodoc -r examples/*
789 + fi
790 +
791 + # vim-files
792 + if use vim-syntax; then
793 + insinto /usr/share/vim/vimfiles/syntax
794 + doins scripts/bacula.vim
795 + insinto /usr/share/vim/vimfiles/ftdetect
796 + newins scripts/filetype.vim bacula_ft.vim
797 + fi
798 +
799 + # setup init scripts
800 + myscripts="bacula-fd"
801 + if ! use bacula-clientonly; then
802 + if ! use bacula-nodir; then
803 + myscripts="${myscripts} bacula-dir"
804 + fi
805 + if ! use bacula-nosd; then
806 + myscripts="${myscripts} bacula-sd"
807 + fi
808 + fi
809 + for script in ${myscripts}; do
810 + # copy over init script and config to a temporary location
811 + # so we can modify them as needed
812 + cp "${FILESDIR}/${script}".confd "${T}/${script}".confd || die "failed to copy ${script}.confd"
813 + cp "${FILESDIR}/newscripts/${script}".initd "${T}/${script}".initd || die "failed to copy ${script}.initd"
814 +
815 + # now set the database dependancy for the director init script
816 + case "${script}" in
817 + bacula-dir)
818 + case "${mydbtype}" in
819 + sqlite3)
820 + # sqlite databases don't have a daemon
821 + sed -i -e 's/need "%database%"/:/g' "${T}/${script}".initd || die
822 + ;;
823 + *)
824 + # all other databases have daemons
825 + sed -i -e "s:%database%:${mydbtype}:" "${T}/${script}".initd || die
826 + ;;
827 + esac
828 + ;;
829 + *)
830 + ;;
831 + esac
832 +
833 + # install init script and config
834 + newinitd "${T}/${script}".initd "${script}"
835 + newconfd "${T}/${script}".confd "${script}"
836 + done
837 +
838 + systemd_dounit "${S}"/platforms/systemd/bacula-{dir,fd,sd}.service
839 +
840 + # make sure the working directory exists
841 + diropts -m0750
842 + keepdir /var/lib/bacula
843 +
844 + # make sure bacula group can execute bacula libexec scripts
845 + fowners -R root:bacula /usr/libexec/bacula
846 +}
847 +
848 +pkg_postinst() {
849 + if use bacula-clientonly; then
850 + fowners root:bacula /var/lib/bacula
851 + else
852 + fowners bacula:bacula /var/lib/bacula
853 + fi
854 +
855 + einfo
856 + einfo "A group 'bacula' has been created. Any users you add to this"
857 + einfo "group have access to files created by the daemons."
858 + einfo
859 + einfo "A user 'bacula' has been created. Please see the bacula manual"
860 + einfo "for information about running bacula as a non-root user."
861 + einfo
862 +
863 + if ! use bacula-clientonly && ! use bacula-nodir; then
864 + einfo
865 + einfo "If this is a new install, you must create the ${mydbtype} databases with:"
866 + einfo " /usr/libexec/bacula/create_${mydbtype}_database"
867 + einfo " /usr/libexec/bacula/make_${mydbtype}_tables"
868 + einfo " /usr/libexec/bacula/grant_${mydbtype}_privileges"
869 + einfo
870 +
871 + ewarn "ATTENTION!"
872 + ewarn "The format of the database may have changed."
873 + ewarn "If you just upgraded from a version below 9.0.0 you must run"
874 + ewarn "'update_bacula_tables' now."
875 + ewarn "Make sure to have a backup of your catalog before."
876 + ewarn
877 + fi
878 +
879 + if use sqlite; then
880 + einfo
881 + einfo "Be aware that Bacula does not officially support SQLite database anymore."
882 + einfo "Best use it only for a client-only installation. See Bug #445540."
883 + einfo
884 + fi
885 +
886 + einfo "Please note that 'bconsole' will always be installed. To compile 'bat'"
887 + einfo "you have to enable 'USE=qt5'."
888 + einfo
889 + einfo "/var/lib/bacula/tmp was configured for archivedir. This dir will be used during"
890 + einfo "restores, so be sure to set it to an appropriate in dir in the bacula config."
891 +}