]> TLD Linux GIT Repositories - packages/bacula.git/blob - bacula.spec
- updated to 7.4.5
[packages/bacula.git] / bacula.spec
1 # TODO:
2 #       - fix log file permissions
3 #
4 # Conditional build:
5 %bcond_without  bat                     # bat Qt4 GUI
6 %bcond_without  mysql                   # use MySQL
7 %bcond_without  pgsql                   # use PostgreSQL
8 %bcond_without  sqlite3                 # use SQLite3
9 %bcond_without  nagios          # build nagios plugin
10 %bcond_with     sqlite3_sync_off        # makes SQLite3 backend much faster, but less reliable
11
12 %if %{without sqlite3}
13 %undefine       with_sqlite3_sync_off
14 %endif
15
16 %define qtver   4.6.2
17 Summary:        Bacula - The Network Backup Solution
18 Summary(pl.UTF-8):      Bacula - rozwiązanie do wykonywania kopii zapasowych po sieci
19 Name:           bacula
20 Version:        7.4.5
21 Release:        1
22 License:        AGPL v3
23 Group:          Networking/Utilities
24 Source0:        http://downloads.sourceforge.net/bacula/%{name}-%{version}.tar.gz
25 # Source0-md5:  1e2d5bc4cb88d8ac465187b35bf2872d
26 Source10:       %{name}-dir.init
27 Source11:       %{name}-fd.init
28 Source12:       %{name}-sd.init
29 Source13:       %{name}.logrotate
30 Source14:       %{name}-dir.sysconfig
31 Source15:       %{name}-fd.sysconfig
32 Source16:       %{name}-sd.sysconfig
33 Patch0:         %{name}-mtx-changer.patch
34 Patch1:         %{name}-branding.patch
35 Patch2:         %{name}-conf.patch
36 Patch3:         %{name}-desktop.patch
37 Patch4:         make_catalog_backup-setup-home.patch
38 Patch5:         %{name}-libtool.patch
39 URL:            http://www.bacula.org/
40 BuildRequires:  acl-devel
41 BuildRequires:  autoconf
42 BuildRequires:  automake
43 BuildRequires:  gettext-devel
44 BuildRequires:  libcap-devel
45 BuildRequires:  libtool >= 2:2.2
46 BuildRequires:  libwrap-devel
47 BuildRequires:  ncurses-devel
48 BuildRequires:  openssl-devel
49 BuildRequires:  pkgconfig
50 BuildRequires:  python-devel
51 BuildRequires:  python-modules
52 %if %{with bat}
53 BuildRequires:  QtCore-devel
54 BuildRequires:  QtGui-devel
55 BuildRequires:  qt4-build >= %{qtver}
56 BuildRequires:  qt4-qmake >= %{qtver}
57 %endif
58 %{?with_mysql:BuildRequires:    mysql-devel}
59 %{?with_pgsql:BuildRequires:    postgresql-devel}
60 BuildRequires:  readline-devel
61 BuildRequires:  rpm >= 4.4.9-56
62 BuildRequires:  rpm-pythonprov
63 BuildRequires:  rpmbuild(macros) >= 1.268
64 BuildRequires:  sed >= 4.0
65 %{?with_sqlite3:BuildRequires:  sqlite3-devel}
66 BuildRequires:  which
67 BuildRequires:  zlib-devel
68 BuildRoot:      %{tmpdir}/%{name}-%{version}-root-%(id -u -n)
69
70 %define         _sysconfdir             /etc/%{name}
71 %define         _localstatedir  /var/lib/%{name}
72 %define         nagiosplugindir %{_libdir}/nagios/plugins
73
74 # from 'the worst' to 'the best'
75 %define databases %{?with_sqlite3:sqlite3} %{?with_mysql:mysql} %{?with_pgsql:postgresql}
76
77 # dependency section is broken. ccache usage is instead to makefiles
78 %undefine       with_ccache
79
80 %description
81 Bacula - It comes by night and sucks the vital essence from your
82 computers.
83
84 Bacula is a set of computer programs that permit you (or the system
85 administrator) to manage backup, recovery, and verification of
86 computer data across a network of computers of different kinds. In
87 technical terms, it is a network client/server based backup program.
88 Bacula is relatively easy to use and efficient, while offering many
89 advanced storage management features that make it easy to find and
90 recover lost or damaged files.
91
92 %description -l pl.UTF-8
93 Bacula - przychodzi nocą i wysysa żywotny ekstrakt z komputerów.
94
95 Bacula to zbiór programów umożliwiających administratorowi na
96 zarządzanie kopiami zapasowymi, odzyskiwaniem i weryfikacją danych w
97 sieci komputerów różnego rodzaju. W terminologii technicznej jest to
98 program do kopii zapasowych pracujący w architekturze klient-serwer.
99 Bacula jest stosunkowo łatwa w użyciu i wydajna, oferując przy tym
100 wiele zaawansowanych możliwości przy zarządzaniu nośnikami,
101 ułatwiających znalezienie i odzyskanie utraconych lub uszkodzonych
102 plików.
103
104 %package common
105 Summary:        Common files for bacula package
106 Summary(pl.UTF-8):      Pliki wspólne dla pakietu bacula
107 Group:          Networking/Utilities
108 Requires(post): openssl-tools
109 Requires(post): sed >= 4.0
110 Requires(post,preun):   /sbin/chkconfig
111 Requires(postun):       /usr/sbin/groupdel
112 Requires(postun):       /usr/sbin/userdel
113 Requires(pre):  /usr/sbin/groupadd
114 Requires(pre):  /usr/sbin/useradd
115 Conflicts:      bacula-console < 0:1.34.6
116 Conflicts:      bacula-dir < 0:1.34.6
117 Conflicts:      bacula-fd < 0:1.34.6
118 Conflicts:      bacula-sd < 0:1.34.6
119 Conflicts:      logrotate < 3.8.0
120
121 %description common
122 Bacula - It comes by night and sucks the vital essence from your
123 computers.
124
125 Bacula is a set of computer programs that permit you (or the system
126 administrator) to manage backup, recovery, and verification of
127 computer data across a network of computers of different kinds. In
128 technical terms, it is a network client/server based backup program.
129 Bacula is relatively easy to use and efficient, while offering many
130 advanced storage management features that make it easy to find and
131 recover lost or damaged files.
132
133 %description common -l pl.UTF-8
134 Bacula - przychodzi nocą i wysysa żywotny ekstrakt z komputerów.
135
136 Bacula to zbiór programów umożliwiających administratorowi na
137 zarządzanie kopiami zapasowymi, odzyskiwaniem i weryfikacją danych w
138 sieci komputerów różnego rodzaju. W terminologii technicznej jest to
139 program do kopii zapasowych pracujący w architekturze klient-serwer.
140 Bacula jest stosunkowo łatwa w użyciu i wydajna, oferując przy tym
141 wiele zaawansowanych możliwości przy zarządzaniu nośnikami,
142 ułatwiających znalezienie i odzyskanie utraconych lub uszkodzonych
143 plików.
144
145 %package dir
146 Summary:        Bacula Director and Catalog services
147 Summary(pl.UTF-8):      Usługi Bacula Director i Catalog
148 Group:          Networking/Utilities
149 Requires(post): sed >= 4.0
150 Requires:       %{name}-common = %{version}-%{release}
151 Requires:       bacula(db) = %{version}-%{release}
152 Obsoletes:      bacula-updatedb
153
154 %description dir
155 Bacula - It comes by night and sucks the vital essence from your
156 computers.
157
158 Bacula Director is the program that supervises all the backup,
159 restore, verify and archive operations. The system administrator uses
160 the Bacula Director to schedule backups and to recover files. Catalog
161 services are comprised of the software programs responsible for
162 maintaining the file indexes and volume databases for all files backed
163 up. The Catalog services permit the System Administrator or user to
164 quickly locate and restore any desired file, since it maintains a
165 record of all Volumes used, all Jobs run, and all Files saved.
166
167 %description dir -l pl.UTF-8
168 Bacula - przychodzi nocą i wysysa żywotny ekstrakt z komputerów.
169
170 Bacula Director to program nadzorujący wszystkie operacje wykonywania
171 kopii zapasowych, odzyskiwania, weryfikacji i archiwizowania.
172 Administrator używa Bacula Directora do szeregowania kopii zapasowych
173 oraz odzyskiwania plików. Usługi katalogowe (Catalog services) są
174 używane przez programy odpowiedzialne za zarządzanie indeksami plików
175 i bazą danych wolumenów dla wszystkich kopiowanych plików. Usługi
176 katalogowe umożliwiają administratorowi lub użytkownikowi szybko
177 zlokalizować i odtworzyć dowolny plik, ponieważ utrzymują rekord ze
178 wszystkimi używanymi wolumenami, uruchomionymi zadaniami i zapisanymi
179 plikami.
180
181 %package console
182 Summary:        Bacula Console
183 Summary(pl.UTF-8):      Konsola Baculi
184 Group:          Networking/Utilities
185 Requires(post): sed >= 4.0
186 Requires:       %{name}-common = %{version}-%{release}
187
188 %description console
189 Bacula - It comes by night and sucks the vital essence from your
190 computers.
191
192 Bacula Console is the program that allows the administrator or user to
193 communicate with the Bacula Director. This is the text only console
194 interface.
195
196 %description console -l pl.UTF-8
197 Bacula - przychodzi nocą i wysysa żywotny ekstrakt z komputerów.
198
199 Bacula Console to program umożliwiający administratorowi lub
200 użytkownikowi komunikowanie się z programem Bacula Director. To jest
201 interfejs czysto tekstowy.
202
203 %package console-wx
204 Summary:        Bacula wxWidgets Console
205 Summary(pl.UTF-8):      Konsola Baculi oparta na wxWidgets
206 Group:          Networking/Utilities
207 Requires(post): sed >= 4.0
208 Requires:       %{name}-common = %{version}-%{release}
209
210 %description console-wx
211 Bacula - It comes by night and sucks the vital essence from your
212 computers.
213
214 Bacula Console is the program that allows the administrator or user to
215 communicate with the Bacula Director. This is the wxWidgets GUI
216 interface.
217
218 %description console-wx -l pl.UTF-8
219 Bacula - przychodzi nocą i wysysa żywotny ekstrakt z komputerów.
220
221 Bacula Console to program umożliwiający administratorowi lub
222 użytkownikowi komunikowanie się z programem Bacula Director. To jest
223 interfejs graficzny oparty na wxWidgets.
224
225 %package console-qt4
226 Summary:        Bacula Qt4 Console
227 Summary(pl.UTF-8):      Konsola Baculi oparta na Qt4
228 Group:          Networking/Utilities
229 Requires(post): sed >= 4.0
230 Requires:       %{name}-common = %{version}-%{release}
231 Requires:       QtCore >= %{qtver}
232
233 %description console-qt4
234 Bacula - It comes by night and sucks the vital essence from your
235 computers.
236
237 Bacula Console is the program that allows the administrator or user to
238 communicate with the Bacula Director. This is the Qt4 GUI interface.
239
240 %description console-qt4 -l pl.UTF-8
241 Bacula - przychodzi nocą i wysysa żywotny ekstrakt z komputerów.
242
243 Bacula Console to program umożliwiający administratorowi lub
244 użytkownikowi komunikowanie się z programem Bacula Director. To jest
245 interfejs graficzny oparty na Qt4.
246
247 %package tray-monitor
248 Summary:        Bacula Tray Monitor
249 Group:          Networking/Utilities
250 Requires(post): sed >= 4.0
251 Requires:       %{name}-common = %{version}-%{release}
252
253 %description tray-monitor
254 Bacula - It comes by night and sucks the vital essence from your
255 computers.
256
257 The Monitor program is typically an icon in the system tray. However,
258 once the icon is expanded into a full window, the administrator or
259 user can obtain status information about the Director or the backup
260 status on the local workstation or any other Bacula daemon that is
261 configured.
262
263 %package fd
264 Summary:        Bacula File services (Client)
265 Summary(pl.UTF-8):      Usługi Bacula File (klient)
266 Group:          Networking/Utilities
267 Requires(post): sed >= 4.0
268 Requires:       %{name}-common = %{version}-%{release}
269
270 %description fd
271 Bacula - It comes by night and sucks the vital essence from your
272 computers.
273
274 Bacula File services (or Client program) is the software program that
275 is installed on the machine to be backed up. It is specific to the
276 operating system on which it runs and is responsible for providing the
277 file attributes and data when requested by the Director. The File
278 services are also responsible for the file system dependent part of
279 restoring the file attributes and data during a recovery operation.
280 This program runs as a daemon on the machine to be backed up, and in
281 some of the documentation, the File daemon is referred to as the
282 Client (for example in Bacula configuration file).
283
284 %description fd -l pl.UTF-8
285 Bacula - przychodzi nocą i wysysa żywotny ekstrakt z komputerów.
286
287 Usługi Bacula File (inaczej program kliencki) to oprogramowanie, które
288 instaluje się na maszynach, z których mają być wykonywane kopie
289 zapasowe. Są one specyficzne dla systemu operacyjnego, pod którym
290 działa dana maszyna i odpowiadają za dostarczanie atrybutów i danych
291 plików na żądanie Directora. Usługi plikowe są także odpowiedzialne za
292 zależną od systemu plików część odzyskiwania atrybutów i danych plików
293 podczas operacji odzyskiwania danych. Program działa jako demon na
294 maszynie, która ma być backupowana i w części dokumentacji demon ten
295 (File) jest nazywany klientem (na przykład w pliku konfiguracyjnym
296 Baculi).
297
298 %package sd
299 Summary:        Bacula Storage services
300 Summary(pl.UTF-8):      Usługi Bacula Storage
301 Group:          Networking/Utilities
302 Requires(post): sed >= 4.0
303 Requires:       %{name}-common = %{version}-%{release}
304 Conflicts:      dvd+rw-tools <= 5.21.4.10.8-1
305
306 %description sd
307 Bacula - It comes by night and sucks the vital essence from your
308 computers.
309
310 Bacula Storage services consist of the software programs that perform
311 the storage and recovery of the file attributes and data to the
312 physical backup media or volumes. In other words, the Storage daemon
313 is responsible for reading and writing your tapes (or other storage
314 media, e.g. files). The Storage services runs as a daemon on the
315 machine that has the backup device (usually a tape drive).
316
317 %description sd -l pl.UTF-8
318 Bacula - przychodzi nocą i wysysa żywotny ekstrakt z komputerów.
319
320 Usługi Bacula Storage składają się z programów obsługujących
321 przechowywanie danych oraz odzyskiwanie atrybutów i danych na
322 fizycznych nośnikach lub wolumenach. Innymi słowy, demon Storage jest
323 odpowiedzialny za odczyt i zapis taśm (lub innych nośników do
324 przechowywania danych, np. plików). Usługi Storage działają jako demon
325 na maszynie, która zawiera urządzenie backupowe (zwykle napęd
326 taśmowy).
327
328 %package db-postgresql
329 Summary:        PostgreSQL database driver for Bacula
330 Summary(pl.UTF-8):      Sterownik bazy PostgreSQL dla Baculi
331 Group:          Networking/Utilities
332 Requires(post): /sbin/ldconfig
333 Requires:       %{name}-common = %{version}-%{release}
334 Provides:       bacula(db) = %{version}-%{release}
335 Obsoletes:      bacula(db)
336
337 %description db-postgresql
338 PostgreSQL database driver for Bacula.
339
340 %description db-postgresql -l pl.UTF-8
341 Sterownik bazy PostgreSQL dla Baculi.
342
343 %package db-mysql
344 Summary:        MySQL database driver for Bacula
345 Summary(pl.UTF-8):      Sterownik bazy MySQL dla Baculi
346 Group:          Networking/Utilities
347 Requires(post): /sbin/ldconfig
348 Requires:       %{name}-common = %{version}-%{release}
349 Provides:       bacula(db) = %{version}-%{release}
350 Obsoletes:      bacula(db)
351
352 %description db-mysql
353 MySQL database driver for Bacula.
354
355 %description db-mysql -l pl.UTF-8
356 Sterownik bazy MySQL dla Baculi.
357
358 %package db-sqlite3
359 Summary:        SQLite database driver for Bacula
360 Summary(pl.UTF-8):      Sterownik bazy SQLite dla Baculi
361 Group:          Networking/Utilities
362 Requires(post): /sbin/ldconfig
363 Requires:       %{name}-common = %{version}-%{release}
364 Provides:       bacula(db) = %{version}-%{release}
365 Obsoletes:      bacula(db)
366
367 %description db-sqlite3
368 SQLite database driver for Bacula.
369
370 %description db-sqlite3 -l pl.UTF-8
371 Sterownik bazy SQLite dla Baculi.
372
373 %package -n nagios-plugin-check_bacula
374 Summary:        Nagios plugin to check bacula
375 Group:          Networking
376 Requires:       nagios-common
377
378 %description -n nagios-plugin-check_bacula
379 Nagios plugin to check bacula.
380
381 # provided by various db libraries as a symlink
382 %define _noautoreq      libbaccats-%{version}.so
383
384 %prep
385 %setup -q
386 %patch0 -p1
387 %patch1 -p1
388 %patch2 -p1
389 %patch3 -p1
390 %patch4 -p1
391 %patch5 -p1
392
393 sed -i -e 's#bindir=.*#bindir=%{_bindir}#g' \
394         src/cats/create_* src/cats/delete_* src/cats/drop_* \
395         src/cats/grant_* src/cats/make_* src/cats/update_*
396 sed -i -e 's/@hostname@/--hostname--/' src/*/*.conf.in
397 sed -i -e 's/@basename@/--hostname--/' src/*/*.conf.in
398
399 %build
400 cd autoconf
401 %{__aclocal} -I bacula-macros -I gettext-macros
402 %{__libtoolize}
403 mv autoconf/* .
404 rmdir autoconf
405 cd ..
406 %{__autoconf} --prepend-include=$(pwd)/autoconf autoconf/configure.in > configure
407
408 CPPFLAGS="-I/usr/include/ncurses -I%{_includedir}/readline"
409
410 WXCONFIG=%{_bindir}/wx-gtk2-unicode-config \
411 QMAKE=%{_bindir}/qt4-qmake \
412 %configure \
413         --with-scriptdir=%{_libexecdir}/%{name} \
414         %{?with_bat:--enable-bat} \
415         --disable-conio \
416         --enable-smartalloc \
417         --with-readline \
418         --with-tcp-wrappers \
419         --with-working-dir=%{_var}/lib/%{name} \
420         --with-dump-email="root@localhost" \
421         --with-job-email="root@localhost" \
422         --with-smtp-host=localhost \
423         --with-logdir=/var/log/bacula \
424         --with-pid-dir=/var/run \
425         --with-subsys-dir=/var/lock/subsys \
426         --with-systemd=/lib/systemd/system \
427         --enable-batch-insert \
428         %{?with_pgsql:--with-postgresql} \
429         %{?with_mysql:--with-mysql} \
430         %{?with_sqlite3:--with-sqlite3} \
431         %{?with_sqlite3_sync_off:--enable-extra-sqlite3-init="pragma synchronous=0;"} \
432         --with-dir-password="#FAKE-dir-password#" \
433         --with-fd-password="#FAKE-fd-password#" \
434         --with-sd-password="#FAKE-sd-password#" \
435         --with-mon-dir-password="#FAKE-mon-dir-password#" \
436         --with-mon-fd-password="#FAKE-mon-fd-password#" \
437         --with-mon-sd-password="#FAKE-mon-sd-password#" \
438         --with-openssl
439
440 %if %{with bat}
441 cd src/qt-console
442 qmake-qt4 bat.pro
443 cd ../..
444 %endif
445
446 %{__make} 2>&1 | tee log
447 # check for build errors
448 grep "Error in" log && exit 1
449
450 %if %{with nagios}
451 # nagios plugin
452 %{__make} -C examples/nagios/check_bacula
453 %endif
454
455 %install
456 rm -rf $RPM_BUILD_ROOT
457 install -d $RPM_BUILD_ROOT/etc/{rc.d/init.d,logrotate.d,pam.d,sysconfig}
458 install -d $RPM_BUILD_ROOT{%{_pixmapsdir},%{_desktopdir},%{_mandir},%{_bindir},/var/log/bacula}
459
460 %{__make} install \
461         DESTDIR=$RPM_BUILD_ROOT
462
463 # create copies of make_catalog_backup for specific databases; zeore default one (will be ghost)
464 for database in %{databases}; do
465         sed -e "s#default_db_type=.*#default_db_type=${database}#g" \
466                 $RPM_BUILD_ROOT%{_libdir}/%{name}/make_catalog_backup \
467                 > $RPM_BUILD_ROOT%{_libdir}/%{name}/make_${database}_catalog_backup
468                 chmod 755 $RPM_BUILD_ROOT%{_libdir}/%{name}/make_${database}_catalog_backup
469 done
470 :> $RPM_BUILD_ROOT%{_libdir}/%{name}/make_catalog_backup
471
472 # we use db dependant (at compile time) shell script only
473 rm $RPM_BUILD_ROOT%{_libexecdir}/%{name}/make_catalog_backup.pl
474
475 ## replace with empty file, replaced by ldconfig from each db-* package on intsall
476 rm $RPM_BUILD_ROOT%{_libdir}/libbaccats-%{version}.so
477 touch $RPM_BUILD_ROOT%{_libdir}/libbaccats-%{version}.so
478
479 install -p %{SOURCE10} $RPM_BUILD_ROOT/etc/rc.d/init.d/bacula-dir
480 install -p %{SOURCE11} $RPM_BUILD_ROOT/etc/rc.d/init.d/bacula-fd
481 install -p %{SOURCE12} $RPM_BUILD_ROOT/etc/rc.d/init.d/bacula-sd
482 cp -a %{SOURCE13} $RPM_BUILD_ROOT/etc/logrotate.d/%{name}-dir
483 cp -a %{SOURCE14} $RPM_BUILD_ROOT/etc/sysconfig/bacula-dir
484 cp -a %{SOURCE15} $RPM_BUILD_ROOT/etc/sysconfig/bacula-fd
485 cp -a %{SOURCE16} $RPM_BUILD_ROOT/etc/sysconfig/bacula-sd
486
487 %if %{with bat}
488 # qmake somewhy does not always create install_bins target. install our own the bin
489 rm -f $RPM_BUILD_ROOT%{_sbindir}/bat
490 libtool --silent --mode=install install src/qt-console/bat $RPM_BUILD_ROOT%{_bindir}
491 cp -a scripts/bacula.png $RPM_BUILD_ROOT%{_pixmapsdir}/bacula.png
492 cp -a scripts/bat.desktop $RPM_BUILD_ROOT%{_desktopdir}
493 %endif
494
495 touch $RPM_BUILD_ROOT/var/log/bacula/log
496
497 # place for site passwords
498 touch $RPM_BUILD_ROOT%{_sysconfdir}/{dir-password,fd-password,sd-password}
499 touch $RPM_BUILD_ROOT%{_sysconfdir}/{mon-dir-password,mon-fd-password,mon-sd-password}
500
501 mv $RPM_BUILD_ROOT%{_libexecdir}/%{name}/mtx-changer.conf $RPM_BUILD_ROOT%{_sysconfdir}/mtx-changer.conf
502
503 # some file changes
504 rm -f $RPM_BUILD_ROOT%{_libexecdir}/%{name}/{gconsole,startmysql,stopmysql,bacula,bconsole,fd}
505 touch $RPM_BUILD_ROOT%{_sysconfdir}/.pw.sed
506
507 rm $RPM_BUILD_ROOT%{_docdir}/bacula/ChangeLog
508 rm $RPM_BUILD_ROOT%{_docdir}/bacula/INSTALL
509 rm $RPM_BUILD_ROOT%{_docdir}/bacula/LICENSE
510 rm $RPM_BUILD_ROOT%{_docdir}/bacula/README
511 rm $RPM_BUILD_ROOT%{_docdir}/bacula/ReleaseNotes
512 rm $RPM_BUILD_ROOT%{_docdir}/bacula/VERIFYING
513
514 # startup scripts, those in /etc/rc.d/init.d are better
515 rm $RPM_BUILD_ROOT%{_sbindir}/bacula
516 rm $RPM_BUILD_ROOT%{_libexecdir}/%{name}/bacula-ctl-*
517
518 # unsupported
519 rm $RPM_BUILD_ROOT%{_libexecdir}/%{name}/btraceback.mdb
520
521 # rename to avoid possible conflicts
522 mv $RPM_BUILD_ROOT%{_sbindir}/{,bacula-}dbcheck
523 mv $RPM_BUILD_ROOT%{_mandir}/man8/{,bacula-}dbcheck.8.gz
524
525 # no -devel files packaged, so this is also useless
526 rm $RPM_BUILD_ROOT%{_libdir}/libbac{,cfg,find,sql}.{so,la}
527
528 %if %{with nagios}
529 install -d $RPM_BUILD_ROOT%{nagiosplugindir}
530 %{__make} -C examples/nagios/check_bacula install \
531         sbindir=%{nagiosplugindir} \
532         DESTDIR=$RPM_BUILD_ROOT
533 %endif
534
535 %clean
536 rm -rf $RPM_BUILD_ROOT
537
538 %pre common
539 %groupadd -P %{name}-common -g 136 -r -f bacula
540 %useradd -P %{name}-common -u 136 -r -d /var/lib/bacula -s /bin/false -c "Bacula User" -g bacula bacula
541
542 %define update_configs \
543 echo "Updating bacula passwords and names..." | %banner -a %{name} \
544 cd %{_sysconfdir} \
545 for f in *-password; do \
546         if [ ! -s $f ]; then \
547                 openssl rand -base64 33 > $f \
548         fi \
549         p=$(cat $f) \
550         for cf in *.conf *.conf.rpmnew; do \
551                 [ -f $cf ] && sed -i -e"s:#FAKE-$f#:$p:" "$cf" || : \
552         done \
553 done \
554 for cf in *.conf *.conf.rpmnew; do \
555         [ -f $cf ] && sed -i -e"s:--hostname--:`hostname`:" "$cf" || : \
556 done
557
558 %post common
559 /sbin/ldconfig
560 %update_configs
561
562 %postun common
563 /sbin/ldconfig
564 if [ "$1" = "0" ]; then
565         %userremove bacula
566         %groupremove bacula
567 fi
568
569 %triggerpostun dir -- %{name}-dir < %{version}-0
570 %banner bacula-dir -t3 <<EOF
571 You have upgraded from an older version of Bacula director.
572
573 You will probably need to call %{_libexecdir}/%{name}/update_bacula_tables
574 script to upgrade the database.
575
576 Ensure you database partition has enough free space before you run the upgrade,
577 i.e check that there is enough room to rebuild 'File' table (it is the largest
578 in bacula db).
579
580 EOF
581
582 %post dir
583 %update_configs
584 /sbin/chkconfig --add bacula-dir
585 %service bacula-dir restart "Bacula Director daemon"
586
587 %preun dir
588 if [ "$1" = "0" ]; then
589         %service bacula-dir stop
590         /sbin/chkconfig --del bacula-dir
591 fi
592
593 %post fd
594 %update_configs
595 /sbin/chkconfig --add bacula-fd
596 %service bacula-fd restart "Bacula File daemon"
597
598 %preun fd
599 if [ "$1" = "0" ]; then
600         %service bacula-fd stop
601         /sbin/chkconfig --del bacula-fd
602 fi
603
604 %post sd
605 %update_configs
606 /sbin/chkconfig --add bacula-sd
607 %service bacula-sd restart "Bacula Storage daemon"
608
609 %preun sd
610 if [ "$1" = "0" ]; then
611         %service bacula-sd stop
612         /sbin/chkconfig --del bacula-sd
613 fi
614
615 %pre console
616 if [ -e %{_sysconfdir}/console.conf -a ! -e %{_sysconfdir}/bconsole.conf ]; then
617         mv %{_sysconfdir}/console.conf %{_sysconfdir}/bconsole.conf
618 fi
619
620 %post console
621 %update_configs
622
623 %post console-wx
624 %update_configs
625
626 %triggerpostun common -- %{name}-common < 5.0.1-2
627 find %{_sysconfdir}/bat.conf* -perm /007 -print0 2>/dev/null | xargs -0 -r chmod 600 || :
628
629 %post console-qt4
630 %update_configs
631
632 %post tray-monitor
633 %update_configs
634
635 %define db_post() \
636 /sbin/ldconfig \
637 for name in "create database" "drop tables" "drop database" "grant privileges" "make tables" "update tables"; do \
638         prefix="${name%% *}" \
639         suffix="${name#* }" \
640         ln -sf "${prefix}_%{1}_${suffix}" %{_libexecdir}/%{name}/"${prefix}_bacula_${suffix}" || : \
641 done \
642 ln -sf "make_%{1}_catalog_backup" %{_libexecdir}/%{name}/make_catalog_backup || : \
643 ln -sf libbaccats-%{1}-%{version}.so %{_libdir}/libbaccats-%{version}.so || : \
644 %service bacula-dir restart "Bacula Director daemon"
645
646 %post db-postgresql
647 %db_post postgresql
648
649 %postun db-postgresql -p /sbin/ldconfig
650
651 %post db-mysql
652 %db_post mysql
653
654 %postun db-mysql -p /sbin/ldconfig
655
656 %post db-sqlite3
657 %db_post sqlite3
658
659 %postun db-sqlite3 -p /sbin/ldconfig
660
661 %files common
662 %defattr(644,root,root,755)
663 %doc LICENSE
664 %dir %{_sysconfdir}
665 %attr(600,root,root) %config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/*-password
666 # do not remove bsmtp from files. Fix build if it is not installed.
667 %attr(755,root,root) %{_sbindir}/bsmtp
668 %attr(755,root,root) %{_sbindir}/btraceback
669 %attr(755,root,root) %{_libdir}/libbac-7*.so
670 %attr(755,root,root) %{_libdir}/libbaccfg-7*.so
671 %attr(755,root,root) %{_libdir}/libbacfind-7*.so
672 %attr(755,root,root) %{_libdir}/libbacsql-7*.so
673 %{_mandir}/man8/bacula.8*
674 %{_mandir}/man1/bsmtp.1*
675 %{_mandir}/man8/btraceback.8*
676 %dir %{_libexecdir}/%{name}
677 %{_libexecdir}/%{name}/btraceback.dbx
678 %{_libexecdir}/%{name}/btraceback.gdb
679 %{_libexecdir}/%{name}/bacula_config
680 %attr(770,root,bacula) %dir %{_localstatedir}
681 %attr(750,bacula,logs) %dir /var/log/bacula
682 %attr(640,bacula,logs) %ghost /var/log/bacula/log
683
684 %files dir
685 %defattr(644,root,root,755)
686 %doc ChangeLog ReleaseNotes LICENSE
687 #%doc examples %{name}-docs-%{version}/manual/{*.pdf,bacula}
688 %attr(640,root,bacula) %config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/bacula-dir.conf
689 %ghost %{_sysconfdir}/.pw.sed
690 %attr(640,root,root) %config(noreplace) /etc/logrotate.d/bacula-dir
691 %attr(754,root,root) /etc/rc.d/init.d/bacula-dir
692 %config(noreplace) %verify(not md5 mtime size) /etc/sysconfig/bacula-dir
693 %attr(755,root,root) %{_sbindir}/bacula-dir
694 %attr(755,root,root) %{_sbindir}/bregex
695 %attr(755,root,root) %{_sbindir}/bwild
696 %attr(755,root,root) %{_sbindir}/bacula-dbcheck
697 %{_mandir}/man8/bacula-dir.8*
698 %{_mandir}/man8/bacula-dbcheck.8*
699 %{_mandir}/man8/bregex.8*
700 %{_mandir}/man8/bwild.8*
701 %{_libexecdir}/%{name}/query.sql
702 %attr(755,root,root) %{_libexecdir}/%{name}/delete_catalog_backup
703
704 %files db-postgresql
705 %defattr(644,root,root,755)
706 %attr(755,root,root) %{_libexecdir}/%{name}/create_postgresql_database
707 %attr(755,root,root) %{_libexecdir}/%{name}/drop_postgresql_database
708 %attr(755,root,root) %{_libexecdir}/%{name}/drop_postgresql_tables
709 %attr(755,root,root) %{_libexecdir}/%{name}/grant_postgresql_privileges
710 %attr(755,root,root) %{_libexecdir}/%{name}/make_postgresql_tables
711 %attr(755,root,root) %{_libexecdir}/%{name}/update_postgresql_*
712 %attr(755,root,root) %{_libexecdir}/%{name}/make_postgresql_catalog_backup
713 %attr(755,root,root) %{_libdir}/libbaccats-postgresql-7*.so
714
715 %ghost %attr(755,root,root) %{_libdir}/libbaccats-7*.so
716 %ghost %{_libexecdir}/%{name}/create_bacula_database
717 %ghost %{_libexecdir}/%{name}/drop_bacula_tables
718 %ghost %{_libexecdir}/%{name}/drop_bacula_database
719 %ghost %{_libexecdir}/%{name}/grant_bacula_privileges
720 %ghost %{_libexecdir}/%{name}/make_bacula_tables
721 %ghost %{_libexecdir}/%{name}/update_bacula_tables
722 %ghost %{_libexecdir}/%{name}/make_catalog_backup
723
724 %files db-mysql
725 %defattr(644,root,root,755)
726 %attr(755,root,root) %{_libexecdir}/%{name}/create_mysql_database
727 %attr(755,root,root) %{_libexecdir}/%{name}/drop_mysql_database
728 %attr(755,root,root) %{_libexecdir}/%{name}/drop_mysql_tables
729 %attr(755,root,root) %{_libexecdir}/%{name}/grant_mysql_privileges
730 %attr(755,root,root) %{_libexecdir}/%{name}/make_mysql_tables
731 %attr(755,root,root) %{_libexecdir}/%{name}/update_mysql_*
732 %attr(755,root,root) %{_libexecdir}/%{name}/make_mysql_catalog_backup
733 %attr(755,root,root) %{_libdir}/libbaccats-mysql-7*.so
734
735 %ghost %attr(755,root,root) %{_libdir}/libbaccats-7*.so
736 %ghost %{_libexecdir}/%{name}/create_bacula_database
737 %ghost %{_libexecdir}/%{name}/drop_bacula_tables
738 %ghost %{_libexecdir}/%{name}/drop_bacula_database
739 %ghost %{_libexecdir}/%{name}/grant_bacula_privileges
740 %ghost %{_libexecdir}/%{name}/make_bacula_tables
741 %ghost %{_libexecdir}/%{name}/update_bacula_tables
742 %ghost %{_libexecdir}/%{name}/make_catalog_backup
743
744 %files db-sqlite3
745 %defattr(644,root,root,755)
746 %attr(755,root,root) %{_libexecdir}/%{name}/create_sqlite3_database
747 %attr(755,root,root) %{_libexecdir}/%{name}/drop_sqlite3_database
748 %attr(755,root,root) %{_libexecdir}/%{name}/drop_sqlite3_tables
749 %attr(755,root,root) %{_libexecdir}/%{name}/grant_sqlite3_privileges
750 %attr(755,root,root) %{_libexecdir}/%{name}/make_sqlite3_tables
751 %attr(755,root,root) %{_libexecdir}/%{name}/update_sqlite3_*
752 %attr(755,root,root) %{_libexecdir}/%{name}/make_sqlite3_catalog_backup
753 %attr(755,root,root) %{_libdir}/libbaccats-sqlite3-7*.so
754
755 %ghost %attr(755,root,root) %{_libdir}/libbaccats-7*.so
756 %ghost %{_libexecdir}/%{name}/create_bacula_database
757 %ghost %{_libexecdir}/%{name}/drop_bacula_tables
758 %ghost %{_libexecdir}/%{name}/drop_bacula_database
759 %ghost %{_libexecdir}/%{name}/grant_bacula_privileges
760 %ghost %{_libexecdir}/%{name}/make_bacula_tables
761 %ghost %{_libexecdir}/%{name}/update_bacula_tables
762 %ghost %{_libexecdir}/%{name}/make_catalog_backup
763
764 %files fd
765 %defattr(644,root,root,755)
766 %doc LICENSE
767 %attr(640,root,bacula) %config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/bacula-fd.conf
768 %attr(754,root,root) /etc/rc.d/init.d/bacula-fd
769 %config(noreplace) %verify(not md5 mtime size) /etc/sysconfig/bacula-fd
770 %attr(755,root,root) %{_sbindir}/bacula-fd
771 %attr(755,root,root) %{_libdir}/bpipe-fd.so
772 %{_mandir}/man8/bacula-fd.8*
773
774 %files sd
775 %defattr(644,root,root,755)
776 %doc LICENSE
777 %attr(640,root,bacula) %config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/bacula-sd.conf
778 %attr(640,root,bacula) %config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/mtx-changer.conf
779 %attr(754,root,root) /etc/rc.d/init.d/bacula-sd
780 %config(noreplace) %verify(not md5 mtime size) /etc/sysconfig/bacula-sd
781 %attr(755,root,root) %{_sbindir}/bacula-sd
782 %attr(755,root,root) %{_sbindir}/bcopy
783 %attr(755,root,root) %{_sbindir}/bextract
784 %attr(755,root,root) %{_sbindir}/bls
785 %attr(755,root,root) %{_sbindir}/bscan
786 %attr(755,root,root) %{_sbindir}/btape
787 %attr(755,root,root) %{_libexecdir}/%{name}/mtx-changer
788 %attr(755,root,root) %{_libexecdir}/%{name}/disk-changer
789 %attr(755,root,root) %{_libexecdir}/%{name}/dvd-handler
790 %{_mandir}/man8/bacula-sd.8*
791 %{_mandir}/man8/bcopy.8*
792 %{_mandir}/man8/bextract.8*
793 %{_mandir}/man8/bls.8*
794 %{_mandir}/man8/bscan.8*
795 %{_mandir}/man8/btape.8*
796
797 %files console
798 %defattr(644,root,root,755)
799 %doc LICENSE
800 %attr(640,root,bacula) %config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/bconsole.conf
801 %attr(755,root,root) %{_sbindir}/bconsole
802 %{_mandir}/man8/bconsole.8*
803
804 %if %{with bat}
805 %files console-qt4
806 %defattr(644,root,root,755)
807 %doc LICENSE
808 %{_pixmapsdir}/%{name}.png
809 %{_desktopdir}/bat.desktop
810 # Do not make this file world-readable or any user will get full access to the
811 # backup system
812 %attr(640,root,bacula) %config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/bat.conf
813 %attr(755,root,root) %{_bindir}/bat
814 %{_mandir}/man1/bat.1*
815 %{_docdir}/%{name}
816 %endif
817
818 %if %{with nagios}
819 %files -n nagios-plugin-check_bacula
820 %defattr(644,root,root,755)
821 %attr(755,root,root) %{nagiosplugindir}/check_bacula
822 %endif