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

Contents of /app-backup/bacula/bacula-7.0.5-r1.ebuild

Parent Directory Parent Directory | Revision Log Revision Log


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

  ViewVC Help
Powered by ViewVC 1.1.20