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

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

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.1 - (hide annotations) (download)
Thu Aug 16 11:07:14 2012 UTC (20 months ago) by tomjbe
Branch: MAIN
Version bump

(Portage version: 2.1.11.10/cvs/Linux i686)

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

  ViewVC Help
Powered by ViewVC 1.1.20