]> TLD Linux GIT Repositories - packages/bacula.git/blob - bacula.spec
- updated to 7.2.0
[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.2.0
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:  8381b6523dab31648a0bae417e60832b
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 # install the updatedb scripts for older versions that last full release
498 # 2.0 -> 3.0 : 10_to_11
499 # 5.0 -> 5.2 : 12_to_14
500 install -p updatedb/update_*_tables_10_to_11 $RPM_BUILD_ROOT%{_libexecdir}/%{name}
501 install -p updatedb/update_*_tables_11_to_12 $RPM_BUILD_ROOT%{_libexecdir}/%{name}
502 install -p updatedb/update_*_tables_12_to_13 $RPM_BUILD_ROOT%{_libexecdir}/%{name}
503 install -p updatedb/update_*_tables_13_to_14 $RPM_BUILD_ROOT%{_libexecdir}/%{name}
504
505 # place for site passwords
506 touch $RPM_BUILD_ROOT%{_sysconfdir}/{dir-password,fd-password,sd-password}
507 touch $RPM_BUILD_ROOT%{_sysconfdir}/{mon-dir-password,mon-fd-password,mon-sd-password}
508
509 mv $RPM_BUILD_ROOT%{_libexecdir}/%{name}/mtx-changer.conf $RPM_BUILD_ROOT%{_sysconfdir}/mtx-changer.conf
510
511 # some file changes
512 rm -f $RPM_BUILD_ROOT%{_libexecdir}/%{name}/{gconsole,startmysql,stopmysql,bacula,bconsole,fd}
513 touch $RPM_BUILD_ROOT%{_sysconfdir}/.pw.sed
514
515 rm $RPM_BUILD_ROOT%{_docdir}/bacula/ChangeLog
516 rm $RPM_BUILD_ROOT%{_docdir}/bacula/INSTALL
517 rm $RPM_BUILD_ROOT%{_docdir}/bacula/LICENSE
518 rm $RPM_BUILD_ROOT%{_docdir}/bacula/README
519 rm $RPM_BUILD_ROOT%{_docdir}/bacula/ReleaseNotes
520 rm $RPM_BUILD_ROOT%{_docdir}/bacula/VERIFYING
521
522 # startup scripts, those in /etc/rc.d/init.d are better
523 rm $RPM_BUILD_ROOT%{_sbindir}/bacula
524 rm $RPM_BUILD_ROOT%{_libexecdir}/%{name}/bacula-ctl-*
525
526 # unsupported
527 rm $RPM_BUILD_ROOT%{_libexecdir}/%{name}/btraceback.mdb
528
529 # rename to avoid possible conflicts
530 mv $RPM_BUILD_ROOT%{_sbindir}/{,bacula-}dbcheck
531 mv $RPM_BUILD_ROOT%{_mandir}/man8/{,bacula-}dbcheck.8.gz
532
533 # no -devel files packaged, so this is also useless
534 rm $RPM_BUILD_ROOT%{_libdir}/libbac{,cfg,find,sql}.{so,la}
535
536 %if %{with nagios}
537 install -d $RPM_BUILD_ROOT%{nagiosplugindir}
538 %{__make} -C examples/nagios/check_bacula install \
539         sbindir=%{nagiosplugindir} \
540         DESTDIR=$RPM_BUILD_ROOT
541 %endif
542
543 %clean
544 rm -rf $RPM_BUILD_ROOT
545
546 %pre common
547 %groupadd -P %{name}-common -g 136 -r -f bacula
548 %useradd -P %{name}-common -u 136 -r -d /var/lib/bacula -s /bin/false -c "Bacula User" -g bacula bacula
549
550 %define update_configs \
551 echo "Updating bacula passwords and names..." | %banner -a %{name} \
552 cd %{_sysconfdir} \
553 for f in *-password; do \
554         if [ ! -s $f ]; then \
555                 openssl rand -base64 33 > $f \
556         fi \
557         p=$(cat $f) \
558         for cf in *.conf *.conf.rpmnew; do \
559                 [ -f $cf ] && sed -i -e"s:#FAKE-$f#:$p:" "$cf" || : \
560         done \
561 done \
562 for cf in *.conf *.conf.rpmnew; do \
563         [ -f $cf ] && sed -i -e"s:--hostname--:`hostname`:" "$cf" || : \
564 done
565
566 %post common
567 /sbin/ldconfig
568 %update_configs
569
570 %postun common
571 /sbin/ldconfig
572 if [ "$1" = "0" ]; then
573         %userremove bacula
574         %groupremove bacula
575 fi
576
577 %triggerpostun dir -- %{name}-dir < %{version}-0
578 %banner bacula-dir -t3 <<EOF
579 You have upgraded from an older version of Bacula director.
580
581 You will probably need to call %{_libexecdir}/%{name}/update_bacula_tables
582 script to upgrade the database.
583
584 Ensure you database partition has enough free space before you run the upgrade,
585 i.e check that there is enough room to rebuild 'File' table (it is the largest
586 in bacula db).
587
588 EOF
589
590 %post dir
591 %update_configs
592 /sbin/chkconfig --add bacula-dir
593 %service bacula-dir restart "Bacula Director daemon"
594
595 %preun dir
596 if [ "$1" = "0" ]; then
597         %service bacula-dir stop
598         /sbin/chkconfig --del bacula-dir
599 fi
600
601 %post fd
602 %update_configs
603 /sbin/chkconfig --add bacula-fd
604 %service bacula-fd restart "Bacula File daemon"
605
606 %preun fd
607 if [ "$1" = "0" ]; then
608         %service bacula-fd stop
609         /sbin/chkconfig --del bacula-fd
610 fi
611
612 %post sd
613 %update_configs
614 /sbin/chkconfig --add bacula-sd
615 %service bacula-sd restart "Bacula Storage daemon"
616
617 %preun sd
618 if [ "$1" = "0" ]; then
619         %service bacula-sd stop
620         /sbin/chkconfig --del bacula-sd
621 fi
622
623 %pre console
624 if [ -e %{_sysconfdir}/console.conf -a ! -e %{_sysconfdir}/bconsole.conf ]; then
625         mv %{_sysconfdir}/console.conf %{_sysconfdir}/bconsole.conf
626 fi
627
628 %post console
629 %update_configs
630
631 %post console-wx
632 %update_configs
633
634 %triggerpostun common -- %{name}-common < 5.0.1-2
635 find %{_sysconfdir}/bat.conf* -perm /007 -print0 2>/dev/null | xargs -0 -r chmod 600 || :
636
637 %post console-qt4
638 %update_configs
639
640 %post tray-monitor
641 %update_configs
642
643 %define db_post() \
644 /sbin/ldconfig \
645 for name in "create database" "drop tables" "drop database" "grant privileges" "make tables" "update tables"; do \
646         prefix="${name%% *}" \
647         suffix="${name#* }" \
648         ln -sf "${prefix}_%{1}_${suffix}" %{_libexecdir}/%{name}/"${prefix}_bacula_${suffix}" || : \
649 done \
650 ln -sf "make_%{1}_catalog_backup" %{_libexecdir}/%{name}/make_catalog_backup || : \
651 ln -sf libbaccats-%{1}-%{version}.so %{_libdir}/libbaccats-%{version}.so || : \
652 %service bacula-dir restart "Bacula Director daemon"
653
654 %post db-postgresql
655 %db_post postgresql
656
657 %postun db-postgresql -p /sbin/ldconfig
658
659 %post db-mysql
660 %db_post mysql
661
662 %postun db-mysql -p /sbin/ldconfig
663
664 %post db-sqlite3
665 %db_post sqlite3
666
667 %postun db-sqlite3 -p /sbin/ldconfig
668
669 %files common
670 %defattr(644,root,root,755)
671 %doc LICENSE
672 %dir %{_sysconfdir}
673 %attr(600,root,root) %config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/*-password
674 # do not remove bsmtp from files. Fix build if it is not installed.
675 %attr(755,root,root) %{_sbindir}/bsmtp
676 %attr(755,root,root) %{_sbindir}/btraceback
677 %attr(755,root,root) %{_libdir}/libbac-7*.so
678 %attr(755,root,root) %{_libdir}/libbaccfg-7*.so
679 %attr(755,root,root) %{_libdir}/libbacfind-7*.so
680 %attr(755,root,root) %{_libdir}/libbacsql-7*.so
681 %{_mandir}/man8/bacula.8*
682 %{_mandir}/man1/bsmtp.1*
683 %{_mandir}/man8/btraceback.8*
684 %dir %{_libexecdir}/%{name}
685 %{_libexecdir}/%{name}/btraceback.dbx
686 %{_libexecdir}/%{name}/btraceback.gdb
687 %{_libexecdir}/%{name}/bacula_config
688 %attr(770,root,bacula) %dir %{_localstatedir}
689 %attr(750,bacula,logs) %dir /var/log/bacula
690 %attr(640,bacula,logs) %ghost /var/log/bacula/log
691
692 %files dir
693 %defattr(644,root,root,755)
694 %doc ChangeLog ReleaseNotes LICENSE
695 #%doc examples %{name}-docs-%{version}/manual/{*.pdf,bacula}
696 %attr(640,root,bacula) %config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/bacula-dir.conf
697 %ghost %{_sysconfdir}/.pw.sed
698 %attr(640,root,root) %config(noreplace) /etc/logrotate.d/bacula-dir
699 %attr(754,root,root) /etc/rc.d/init.d/bacula-dir
700 %config(noreplace) %verify(not md5 mtime size) /etc/sysconfig/bacula-dir
701 %attr(755,root,root) %{_sbindir}/bacula-dir
702 %attr(755,root,root) %{_sbindir}/bregex
703 %attr(755,root,root) %{_sbindir}/bwild
704 %attr(755,root,root) %{_sbindir}/bacula-dbcheck
705 %{_mandir}/man8/bacula-dir.8*
706 %{_mandir}/man8/bacula-dbcheck.8*
707 %{_mandir}/man8/bregex.8*
708 %{_mandir}/man8/bwild.8*
709 %{_libexecdir}/%{name}/query.sql
710 %attr(755,root,root) %{_libexecdir}/%{name}/delete_catalog_backup
711
712 %files db-postgresql
713 %defattr(644,root,root,755)
714 %attr(755,root,root) %{_libexecdir}/%{name}/create_postgresql_database
715 %attr(755,root,root) %{_libexecdir}/%{name}/drop_postgresql_database
716 %attr(755,root,root) %{_libexecdir}/%{name}/drop_postgresql_tables
717 %attr(755,root,root) %{_libexecdir}/%{name}/grant_postgresql_privileges
718 %attr(755,root,root) %{_libexecdir}/%{name}/make_postgresql_tables
719 %attr(755,root,root) %{_libexecdir}/%{name}/update_postgresql_*
720 %attr(755,root,root) %{_libexecdir}/%{name}/make_postgresql_catalog_backup
721 %attr(755,root,root) %{_libdir}/libbaccats-postgresql-7*.so
722
723 %ghost %attr(755,root,root) %{_libdir}/libbaccats-7*.so
724 %ghost %{_libexecdir}/%{name}/create_bacula_database
725 %ghost %{_libexecdir}/%{name}/drop_bacula_tables
726 %ghost %{_libexecdir}/%{name}/drop_bacula_database
727 %ghost %{_libexecdir}/%{name}/grant_bacula_privileges
728 %ghost %{_libexecdir}/%{name}/make_bacula_tables
729 %ghost %{_libexecdir}/%{name}/update_bacula_tables
730 %ghost %{_libexecdir}/%{name}/make_catalog_backup
731
732 %files db-mysql
733 %defattr(644,root,root,755)
734 %attr(755,root,root) %{_libexecdir}/%{name}/create_mysql_database
735 %attr(755,root,root) %{_libexecdir}/%{name}/drop_mysql_database
736 %attr(755,root,root) %{_libexecdir}/%{name}/drop_mysql_tables
737 %attr(755,root,root) %{_libexecdir}/%{name}/grant_mysql_privileges
738 %attr(755,root,root) %{_libexecdir}/%{name}/make_mysql_tables
739 %attr(755,root,root) %{_libexecdir}/%{name}/update_mysql_*
740 %attr(755,root,root) %{_libexecdir}/%{name}/make_mysql_catalog_backup
741 %attr(755,root,root) %{_libdir}/libbaccats-mysql-7*.so
742
743 %ghost %attr(755,root,root) %{_libdir}/libbaccats-7*.so
744 %ghost %{_libexecdir}/%{name}/create_bacula_database
745 %ghost %{_libexecdir}/%{name}/drop_bacula_tables
746 %ghost %{_libexecdir}/%{name}/drop_bacula_database
747 %ghost %{_libexecdir}/%{name}/grant_bacula_privileges
748 %ghost %{_libexecdir}/%{name}/make_bacula_tables
749 %ghost %{_libexecdir}/%{name}/update_bacula_tables
750 %ghost %{_libexecdir}/%{name}/make_catalog_backup
751
752 %files db-sqlite3
753 %defattr(644,root,root,755)
754 %attr(755,root,root) %{_libexecdir}/%{name}/create_sqlite3_database
755 %attr(755,root,root) %{_libexecdir}/%{name}/drop_sqlite3_database
756 %attr(755,root,root) %{_libexecdir}/%{name}/drop_sqlite3_tables
757 %attr(755,root,root) %{_libexecdir}/%{name}/grant_sqlite3_privileges
758 %attr(755,root,root) %{_libexecdir}/%{name}/make_sqlite3_tables
759 %attr(755,root,root) %{_libexecdir}/%{name}/update_sqlite3_*
760 %attr(755,root,root) %{_libexecdir}/%{name}/make_sqlite3_catalog_backup
761 %attr(755,root,root) %{_libdir}/libbaccats-sqlite3-7*.so
762
763 %ghost %attr(755,root,root) %{_libdir}/libbaccats-7*.so
764 %ghost %{_libexecdir}/%{name}/create_bacula_database
765 %ghost %{_libexecdir}/%{name}/drop_bacula_tables
766 %ghost %{_libexecdir}/%{name}/drop_bacula_database
767 %ghost %{_libexecdir}/%{name}/grant_bacula_privileges
768 %ghost %{_libexecdir}/%{name}/make_bacula_tables
769 %ghost %{_libexecdir}/%{name}/update_bacula_tables
770 %ghost %{_libexecdir}/%{name}/make_catalog_backup
771
772 %files fd
773 %defattr(644,root,root,755)
774 %doc LICENSE
775 %attr(640,root,bacula) %config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/bacula-fd.conf
776 %attr(754,root,root) /etc/rc.d/init.d/bacula-fd
777 %config(noreplace) %verify(not md5 mtime size) /etc/sysconfig/bacula-fd
778 %attr(755,root,root) %{_sbindir}/bacula-fd
779 %attr(755,root,root) %{_libdir}/bpipe-fd.so
780 %{_mandir}/man8/bacula-fd.8*
781
782 %files sd
783 %defattr(644,root,root,755)
784 %doc LICENSE
785 %attr(640,root,bacula) %config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/bacula-sd.conf
786 %attr(640,root,bacula) %config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/mtx-changer.conf
787 %attr(754,root,root) /etc/rc.d/init.d/bacula-sd
788 %config(noreplace) %verify(not md5 mtime size) /etc/sysconfig/bacula-sd
789 %attr(755,root,root) %{_sbindir}/bacula-sd
790 %attr(755,root,root) %{_sbindir}/bcopy
791 %attr(755,root,root) %{_sbindir}/bextract
792 %attr(755,root,root) %{_sbindir}/bls
793 %attr(755,root,root) %{_sbindir}/bscan
794 %attr(755,root,root) %{_sbindir}/btape
795 %attr(755,root,root) %{_libexecdir}/%{name}/mtx-changer
796 %attr(755,root,root) %{_libexecdir}/%{name}/disk-changer
797 %attr(755,root,root) %{_libexecdir}/%{name}/dvd-handler
798 %{_mandir}/man8/bacula-sd.8*
799 %{_mandir}/man8/bcopy.8*
800 %{_mandir}/man8/bextract.8*
801 %{_mandir}/man8/bls.8*
802 %{_mandir}/man8/bscan.8*
803 %{_mandir}/man8/btape.8*
804
805 %files console
806 %defattr(644,root,root,755)
807 %doc LICENSE
808 %attr(640,root,bacula) %config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/bconsole.conf
809 %attr(755,root,root) %{_sbindir}/bconsole
810 %{_mandir}/man8/bconsole.8*
811
812 %if %{with bat}
813 %files console-qt4
814 %defattr(644,root,root,755)
815 %doc LICENSE
816 %{_pixmapsdir}/%{name}.png
817 %{_desktopdir}/bat.desktop
818 # Do not make this file world-readable or any user will get full access to the
819 # backup system
820 %attr(640,root,bacula) %config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/bat.conf
821 %attr(755,root,root) %{_bindir}/bat
822 %{_mandir}/man1/bat.1*
823 %{_docdir}/%{name}
824 %endif
825
826 %if %{with nagios}
827 %files -n nagios-plugin-check_bacula
828 %defattr(644,root,root,755)
829 %attr(755,root,root) %{nagiosplugindir}/check_bacula
830 %endif