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

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

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.13 - (show annotations) (download)
Sun Sep 23 18:28:42 2012 UTC (2 years ago) by ago
Branch: MAIN
CVS Tags: HEAD
Changes since 1.12: +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.5.ebuild,v 1.12 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
188 # correct configuration for QT based bat
189 if use qt4 ; then
190 pushd src/qt-console
191 eqmake4
192 popd
193 fi
194 }
195
196 src_install() {
197 emake DESTDIR="${D}" install
198 doicon scripts/bacula.png
199
200 # install bat icon and desktop file when enabled
201 # (for some reason ./configure doesn't pick this up)
202 if use qt4 && ! use static ; then
203 doicon src/qt-console/images/bat_icon.png
204 domenu scripts/bat.desktop
205 fi
206
207 # remove some scripts we don't need at all
208 rm -f "${D}"/usr/libexec/bacula/{bacula,bacula-ctl-dir,bacula-ctl-fd,bacula-ctl-sd,startmysql,stopmysql}
209
210 # rename statically linked apps
211 if use bacula-clientonly && use static ; then
212 pushd "${D}"/usr/sbin || die
213 mv static-bacula-fd bacula-fd || die
214 mv static-bconsole bconsole || die
215 popd || die
216 fi
217
218 # extra files which 'make install' doesn't cover
219 if ! use bacula-clientonly; then
220 # the database update scripts
221 diropts -m0750
222 insinto /usr/libexec/bacula/updatedb
223 insopts -m0754
224 doins "${S}"/updatedb/*
225 fperms 0640 /usr/libexec/bacula/updatedb/README
226
227 # the logrotate configuration
228 # (now unconditional wrt bug #258187)
229 diropts -m0755
230 insinto /etc/logrotate.d
231 insopts -m0644
232 newins "${S}"/scripts/logrotate bacula
233
234 # the logwatch scripts
235 if use logwatch; then
236 diropts -m0750
237 dodir /etc/log.d/scripts/services
238 dodir /etc/log.d/scripts/shared
239 dodir /etc/log.d/conf/logfiles
240 dodir /etc/log.d/conf/services
241 pushd "${S}"/scripts/logwatch >&/dev/null || die
242 emake DESTDIR="${D}" install
243 popd >&/dev/null || die
244 fi
245 fi
246
247 rm -vf "${D}"/usr/share/man/man1/bacula-bwxconsole.1*
248 if ! use qt4; then
249 rm -vf "${D}"/usr/share/man/man1/bat.1*
250 fi
251 rm -vf "${D}"/usr/share/man/man1/bacula-tray-monitor.1*
252 if use bacula-clientonly || use bacula-nodir; then
253 rm -vf "${D}"/usr/share/man/man8/bacula-dir.8*
254 rm -vf "${D}"/usr/share/man/man8/dbcheck.8*
255 rm -vf "${D}"/usr/share/man/man1/bsmtp.1*
256 rm -vf "${D}"/usr/libexec/bacula/create_*_database
257 rm -vf "${D}"/usr/libexec/bacula/drop_*_database
258 rm -vf "${D}"/usr/libexec/bacula/make_*_tables
259 rm -vf "${D}"/usr/libexec/bacula/update_*_tables
260 rm -vf "${D}"/usr/libexec/bacula/drop_*_tables
261 rm -vf "${D}"/usr/libexec/bacula/grant_*_privileges
262 rm -vf "${D}"/usr/libexec/bacula/*_catalog_backup
263 fi
264 if use bacula-clientonly || use bacula-nosd; then
265 rm -vf "${D}"/usr/share/man/man8/bacula-sd.8*
266 rm -vf "${D}"/usr/share/man/man8/bcopy.8*
267 rm -vf "${D}"/usr/share/man/man8/bextract.8*
268 rm -vf "${D}"/usr/share/man/man8/bls.8*
269 rm -vf "${D}"/usr/share/man/man8/bscan.8*
270 rm -vf "${D}"/usr/share/man/man8/btape.8*
271 rm -vf "${D}"/usr/libexec/bacula/disk-changer
272 rm -vf "${D}"/usr/libexec/bacula/mtx-changer
273 rm -vf "${D}"/usr/libexec/bacula/dvd-handler
274 fi
275
276 # documentation
277 dodoc ChangeLog ReleaseNotes SUPPORT technotes
278
279 # vim-files
280 if use vim-syntax; then
281 insinto /usr/share/vim/vimfiles/syntax
282 doins scripts/bacula.vim
283 insinto /usr/share/vim/vimfiles/ftdetect
284 newins scripts/filetype.vim bacula_ft.vim
285 fi
286
287 # set the value of $mydbtype depending on which database we
288 # specified in the use flags.
289 if use sqlite3; then
290 mydbtype="sqlite3"
291 fi
292 if use postgres; then
293 mydbtype="postgresql"
294 fi
295 if use mysql; then
296 mydbtype="mysql"
297 fi
298 # setup init scripts
299 myscripts="bacula-fd"
300 if ! use bacula-clientonly; then
301 if ! use bacula-nodir; then
302 myscripts="${myscripts} bacula-dir"
303 fi
304 if ! use bacula-nosd; then
305 myscripts="${myscripts} bacula-sd"
306 fi
307 fi
308 for script in ${myscripts}; do
309 # copy over init script and config to a temporary location
310 # so we can modify them as needed
311 cp "${FILESDIR}/${script}".confd "${T}/${script}".confd || die "failed to copy ${script}.confd"
312 cp "${FILESDIR}/${script}".initd "${T}/${script}".initd || die "failed to copy ${script}.initd"
313
314 # now set the database dependancy for the director init script
315 case "${script}" in
316 bacula-dir)
317 case "${mydbtype}" in
318 sqlite3)
319 # sqlite3 databases don't have a daemon
320 sed -i -e 's/need "%database%"/:/g' "${T}/${script}".initd || die
321 ;;
322 *)
323 # all other databases have daemons
324 sed -i -e "s:%database%:${mydbtype}:" "${T}/${script}".initd || die
325 ;;
326 esac
327 ;;
328 *)
329 ;;
330 esac
331
332 # install init script and config
333 newinitd "${T}/${script}".initd "${script}"
334 newconfd "${T}/${script}".confd "${script}"
335 done
336
337 # make sure the working directory exists
338 diropts -m0750
339 keepdir /var/lib/bacula
340
341 # make sure bacula group can execute bacula libexec scripts
342 fowners -R root:bacula /usr/libexec/bacula
343 }
344
345 pkg_postinst() {
346 if use bacula-clientonly; then
347 fowners root:bacula /var/lib/bacula
348 else
349 fowners bacula:bacula /var/lib/bacula
350 fi
351
352 if ! use bacula-clientonly && ! use bacula-nodir; then
353 einfo
354 einfo "If this is a new install, you must create the ${mydbtype} databases with:"
355 einfo " /usr/libexec/bacula/create_${mydbtype}_database"
356 einfo " /usr/libexec/bacula/make_${mydbtype}_tables"
357 einfo " /usr/libexec/bacula/grant_${mydbtype}_privileges"
358 einfo
359 fi
360
361 einfo "Please note that 'bconsole' will always be installed. To compile 'bat'"
362 einfo "you have to enable 'USE=qt4'."
363 einfo
364 }

  ViewVC Help
Powered by ViewVC 1.1.20