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

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

  ViewVC Help
Powered by ViewVC 1.1.20