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