]> TLD Linux GIT Repositories - packages/bacula.git/blob - bacula.spec
- updated to 11.0.6
[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:        11.0.6
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:  0e3cd4e29878b09ae4554bae64785736
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 Patch6:         no_dash.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 fd
249 Summary:        Bacula File services (Client)
250 Summary(pl.UTF-8):      Usługi Bacula File (klient)
251 Group:          Networking/Utilities
252 Requires(post): sed >= 4.0
253 Requires:       %{name}-common = %{version}-%{release}
254
255 %description fd
256 Bacula - It comes by night and sucks the vital essence from your
257 computers.
258
259 Bacula File services (or Client program) is the software program that
260 is installed on the machine to be backed up. It is specific to the
261 operating system on which it runs and is responsible for providing the
262 file attributes and data when requested by the Director. The File
263 services are also responsible for the file system dependent part of
264 restoring the file attributes and data during a recovery operation.
265 This program runs as a daemon on the machine to be backed up, and in
266 some of the documentation, the File daemon is referred to as the
267 Client (for example in Bacula configuration file).
268
269 %description fd -l pl.UTF-8
270 Bacula - przychodzi nocą i wysysa żywotny ekstrakt z komputerów.
271
272 Usługi Bacula File (inaczej program kliencki) to oprogramowanie, które
273 instaluje się na maszynach, z których mają być wykonywane kopie
274 zapasowe. Są one specyficzne dla systemu operacyjnego, pod którym
275 działa dana maszyna i odpowiadają za dostarczanie atrybutów i danych
276 plików na żądanie Directora. Usługi plikowe są także odpowiedzialne za
277 zależną od systemu plików część odzyskiwania atrybutów i danych plików
278 podczas operacji odzyskiwania danych. Program działa jako demon na
279 maszynie, która ma być backupowana i w części dokumentacji demon ten
280 (File) jest nazywany klientem (na przykład w pliku konfiguracyjnym
281 Baculi).
282
283 %package sd
284 Summary:        Bacula Storage services
285 Summary(pl.UTF-8):      Usługi Bacula Storage
286 Group:          Networking/Utilities
287 Requires(post): sed >= 4.0
288 Requires:       %{name}-common = %{version}-%{release}
289 Conflicts:      dvd+rw-tools <= 5.21.4.10.8-1
290
291 %description sd
292 Bacula - It comes by night and sucks the vital essence from your
293 computers.
294
295 Bacula Storage services consist of the software programs that perform
296 the storage and recovery of the file attributes and data to the
297 physical backup media or volumes. In other words, the Storage daemon
298 is responsible for reading and writing your tapes (or other storage
299 media, e.g. files). The Storage services runs as a daemon on the
300 machine that has the backup device (usually a tape drive).
301
302 %description sd -l pl.UTF-8
303 Bacula - przychodzi nocą i wysysa żywotny ekstrakt z komputerów.
304
305 Usługi Bacula Storage składają się z programów obsługujących
306 przechowywanie danych oraz odzyskiwanie atrybutów i danych na
307 fizycznych nośnikach lub wolumenach. Innymi słowy, demon Storage jest
308 odpowiedzialny za odczyt i zapis taśm (lub innych nośników do
309 przechowywania danych, np. plików). Usługi Storage działają jako demon
310 na maszynie, która zawiera urządzenie backupowe (zwykle napęd
311 taśmowy).
312
313 %package db-postgresql
314 Summary:        PostgreSQL database driver for Bacula
315 Summary(pl.UTF-8):      Sterownik bazy PostgreSQL dla Baculi
316 Group:          Networking/Utilities
317 Requires(post): /sbin/ldconfig
318 Requires:       %{name}-common = %{version}-%{release}
319 Provides:       bacula(db) = %{version}-%{release}
320 Obsoletes:      bacula(db)
321
322 %description db-postgresql
323 PostgreSQL database driver for Bacula.
324
325 %description db-postgresql -l pl.UTF-8
326 Sterownik bazy PostgreSQL dla Baculi.
327
328 %package db-mysql
329 Summary:        MySQL database driver for Bacula
330 Summary(pl.UTF-8):      Sterownik bazy MySQL 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-mysql
338 MySQL database driver for Bacula.
339
340 %description db-mysql -l pl.UTF-8
341 Sterownik bazy MySQL dla Baculi.
342
343 %package db-sqlite3
344 Summary:        SQLite database driver for Bacula
345 Summary(pl.UTF-8):      Sterownik bazy SQLite 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-sqlite3
353 SQLite database driver for Bacula.
354
355 %description db-sqlite3 -l pl.UTF-8
356 Sterownik bazy SQLite dla Baculi.
357
358 %package -n nagios-plugin-check_bacula
359 Summary:        Nagios plugin to check bacula
360 Group:          Networking
361 Requires:       nagios-common
362
363 %description -n nagios-plugin-check_bacula
364 Nagios plugin to check bacula.
365
366 # provided by various db libraries as a symlink
367 %define _noautoreq      libbaccats-%{version}.so
368
369 %prep
370 %setup -q
371 %patch0 -p1
372 %patch1 -p1
373 %patch2 -p1
374 %patch3 -p1
375 %patch4 -p1
376 %patch5 -p1
377 %patch6 -p1
378
379 sed -i -e 's#bindir=.*#bindir=%{_bindir}#g' \
380         src/cats/create_* src/cats/delete_* src/cats/drop_* \
381         src/cats/grant_* src/cats/make_* src/cats/update_*
382 sed -i -e 's/@hostname@/--hostname--/' src/*/*.conf.in
383 sed -i -e 's/@basename@/--hostname--/' src/*/*.conf.in
384
385 %build
386 cd autoconf
387 %{__aclocal} -I bacula-macros -I gettext-macros
388 %{__libtoolize}
389 mv autoconf/* .
390 rmdir autoconf
391 cd ..
392 %{__autoconf} --prepend-include=$(pwd)/autoconf autoconf/configure.in > configure
393
394 CPPFLAGS="-I/usr/include/ncurses -I%{_includedir}/readline"
395
396 WXCONFIG=%{_bindir}/wx-gtk2-unicode-config \
397 QMAKE=%{_bindir}/qt4-qmake \
398 %configure \
399         --with-scriptdir=%{_libexecdir}/%{name} \
400         %{?with_bat:--enable-bat} \
401         --disable-conio \
402         --enable-smartalloc \
403         --with-readline \
404         --with-tcp-wrappers \
405         --with-working-dir=%{_var}/lib/%{name} \
406         --with-dump-email="root@localhost" \
407         --with-job-email="root@localhost" \
408         --with-smtp-host=localhost \
409         --with-logdir=/var/log/bacula \
410         --with-pid-dir=/var/run \
411         --with-subsys-dir=/var/lock/subsys \
412         --with-systemd=/lib/systemd/system \
413         --enable-batch-insert \
414         %{?with_pgsql:--with-postgresql} \
415         %{?with_mysql:--with-mysql} \
416         %{?with_sqlite3:--with-sqlite3} \
417         %{?with_sqlite3_sync_off:--enable-extra-sqlite3-init="pragma synchronous=0;"} \
418         --with-dir-password="#FAKE-dir-password#" \
419         --with-fd-password="#FAKE-fd-password#" \
420         --with-sd-password="#FAKE-sd-password#" \
421         --with-mon-dir-password="#FAKE-mon-dir-password#" \
422         --with-mon-fd-password="#FAKE-mon-fd-password#" \
423         --with-mon-sd-password="#FAKE-mon-sd-password#" \
424         --with-openssl
425
426 %if %{with bat}
427 cd src/qt-console
428 qmake-qt4 bat.pro
429 cd ../..
430 %endif
431
432 %{__make} 2>&1 | tee log
433 # check for build errors
434 grep "Error in" log && exit 1
435
436 %if %{with nagios}
437 # nagios plugin
438 %{__make} -C examples/nagios/check_bacula
439 %endif
440
441 %install
442 rm -rf $RPM_BUILD_ROOT
443 install -d $RPM_BUILD_ROOT/etc/{rc.d/init.d,logrotate.d,pam.d,sysconfig}
444 install -d $RPM_BUILD_ROOT{%{_pixmapsdir},%{_desktopdir},%{_mandir},%{_bindir},/var/log/bacula}
445
446 %{__make} install \
447         DESTDIR=$RPM_BUILD_ROOT
448
449 # create copies of make_catalog_backup for specific databases; zeore default one (will be ghost)
450 for database in %{databases}; do
451         sed -e "s#default_db_type=.*#default_db_type=${database}#g" \
452                 $RPM_BUILD_ROOT%{_libdir}/%{name}/make_catalog_backup \
453                 > $RPM_BUILD_ROOT%{_libdir}/%{name}/make_${database}_catalog_backup
454                 chmod 755 $RPM_BUILD_ROOT%{_libdir}/%{name}/make_${database}_catalog_backup
455 done
456 :> $RPM_BUILD_ROOT%{_libdir}/%{name}/make_catalog_backup
457
458 # we use db dependant (at compile time) shell script only
459 rm $RPM_BUILD_ROOT%{_libexecdir}/%{name}/make_catalog_backup.pl
460
461 ## replace with empty file, replaced by ldconfig from each db-* package on intsall
462 rm $RPM_BUILD_ROOT%{_libdir}/libbaccats-%{version}.so
463 touch $RPM_BUILD_ROOT%{_libdir}/libbaccats-%{version}.so
464
465 install -p %{SOURCE10} $RPM_BUILD_ROOT/etc/rc.d/init.d/bacula-dir
466 install -p %{SOURCE11} $RPM_BUILD_ROOT/etc/rc.d/init.d/bacula-fd
467 install -p %{SOURCE12} $RPM_BUILD_ROOT/etc/rc.d/init.d/bacula-sd
468 cp -a %{SOURCE13} $RPM_BUILD_ROOT/etc/logrotate.d/%{name}-dir
469 cp -a %{SOURCE14} $RPM_BUILD_ROOT/etc/sysconfig/bacula-dir
470 cp -a %{SOURCE15} $RPM_BUILD_ROOT/etc/sysconfig/bacula-fd
471 cp -a %{SOURCE16} $RPM_BUILD_ROOT/etc/sysconfig/bacula-sd
472
473 %if %{with bat}
474 # qmake somewhy does not always create install_bins target. install our own the bin
475 rm -f $RPM_BUILD_ROOT%{_sbindir}/bat
476 libtool --silent --mode=install install src/qt-console/bat $RPM_BUILD_ROOT%{_bindir}
477 cp -a scripts/bacula.png $RPM_BUILD_ROOT%{_pixmapsdir}/bacula.png
478 cp -a scripts/bat.desktop $RPM_BUILD_ROOT%{_desktopdir}
479 %endif
480
481 touch $RPM_BUILD_ROOT/var/log/bacula/log
482
483 # place for site passwords
484 touch $RPM_BUILD_ROOT%{_sysconfdir}/{dir-password,fd-password,sd-password}
485 touch $RPM_BUILD_ROOT%{_sysconfdir}/{mon-dir-password,mon-fd-password,mon-sd-password}
486
487 mv $RPM_BUILD_ROOT%{_libexecdir}/%{name}/mtx-changer.conf $RPM_BUILD_ROOT%{_sysconfdir}/mtx-changer.conf
488
489 # some file changes
490 rm -f $RPM_BUILD_ROOT%{_libexecdir}/%{name}/{gconsole,startmysql,stopmysql,bacula,bconsole,fd}
491 touch $RPM_BUILD_ROOT%{_sysconfdir}/.pw.sed
492
493 rm $RPM_BUILD_ROOT%{_docdir}/bacula/ChangeLog
494 rm $RPM_BUILD_ROOT%{_docdir}/bacula/INSTALL
495 rm $RPM_BUILD_ROOT%{_docdir}/bacula/LICENSE
496 rm $RPM_BUILD_ROOT%{_docdir}/bacula/README
497 rm $RPM_BUILD_ROOT%{_docdir}/bacula/ReleaseNotes
498 rm $RPM_BUILD_ROOT%{_docdir}/bacula/VERIFYING
499
500 # startup scripts, those in /etc/rc.d/init.d are better
501 rm $RPM_BUILD_ROOT%{_sbindir}/bacula
502 rm $RPM_BUILD_ROOT%{_libexecdir}/%{name}/bacula-ctl-*
503
504 # unsupported
505 rm $RPM_BUILD_ROOT%{_libexecdir}/%{name}/btraceback.mdb
506
507 # rename to avoid possible conflicts
508 mv $RPM_BUILD_ROOT%{_sbindir}/{,bacula-}dbcheck
509 mv $RPM_BUILD_ROOT%{_mandir}/man8/{,bacula-}dbcheck.8.gz
510
511 # no -devel files packaged, so this is also useless
512 rm $RPM_BUILD_ROOT%{_libdir}/libbac{,cfg,find,sql}.{so,la}
513
514 %if %{with nagios}
515 install -d $RPM_BUILD_ROOT%{nagiosplugindir}
516 %{__make} -C examples/nagios/check_bacula install \
517         sbindir=%{nagiosplugindir} \
518         DESTDIR=$RPM_BUILD_ROOT
519 %endif
520
521 %clean
522 rm -rf $RPM_BUILD_ROOT
523
524 %pre common
525 %groupadd -P %{name}-common -g 136 -r -f bacula
526 %useradd -P %{name}-common -u 136 -r -d /var/lib/bacula -s /bin/false -c "Bacula User" -g bacula bacula
527
528 %define update_configs \
529 echo "Updating bacula passwords and names..." | %banner -a %{name} \
530 cd %{_sysconfdir} \
531 for f in *-password; do \
532         if [ ! -s $f ]; then \
533                 openssl rand -base64 33 > $f \
534         fi \
535         p=$(cat $f) \
536         for cf in *.conf *.conf.rpmnew; do \
537                 [ -f $cf ] && sed -i -e"s:#FAKE-$f#:$p:" "$cf" || : \
538         done \
539 done \
540 for cf in *.conf *.conf.rpmnew; do \
541         [ -f $cf ] && sed -i -e"s:--hostname--:`hostname`:" "$cf" || : \
542 done
543
544 %post common
545 /sbin/ldconfig
546 %update_configs
547
548 %postun common
549 /sbin/ldconfig
550 if [ "$1" = "0" ]; then
551         %userremove bacula
552         %groupremove bacula
553 fi
554
555 %triggerpostun dir -- %{name}-dir < %{version}-0
556 %banner bacula-dir -t3 <<EOF
557 You have upgraded from an older version of Bacula director.
558
559 You will probably need to call %{_libexecdir}/%{name}/update_bacula_tables
560 script to upgrade the database.
561
562 Ensure you database partition has enough free space before you run the upgrade,
563 i.e check that there is enough room to rebuild 'File' table (it is the largest
564 in bacula db).
565
566 EOF
567
568 %post dir
569 %update_configs
570 /sbin/chkconfig --add bacula-dir
571 %service bacula-dir restart "Bacula Director daemon"
572
573 %preun dir
574 if [ "$1" = "0" ]; then
575         %service bacula-dir stop
576         /sbin/chkconfig --del bacula-dir
577 fi
578
579 %post fd
580 %update_configs
581 /sbin/chkconfig --add bacula-fd
582 %service bacula-fd restart "Bacula File daemon"
583
584 %preun fd
585 if [ "$1" = "0" ]; then
586         %service bacula-fd stop
587         /sbin/chkconfig --del bacula-fd
588 fi
589
590 %post sd
591 %update_configs
592 /sbin/chkconfig --add bacula-sd
593 %service bacula-sd restart "Bacula Storage daemon"
594
595 %preun sd
596 if [ "$1" = "0" ]; then
597         %service bacula-sd stop
598         /sbin/chkconfig --del bacula-sd
599 fi
600
601 %pre console
602 if [ -e %{_sysconfdir}/console.conf -a ! -e %{_sysconfdir}/bconsole.conf ]; then
603         mv %{_sysconfdir}/console.conf %{_sysconfdir}/bconsole.conf
604 fi
605
606 %post console
607 %update_configs
608
609 %post console-wx
610 %update_configs
611
612 %triggerpostun common -- %{name}-common < 5.0.1-2
613 find %{_sysconfdir}/bat.conf* -perm /007 -print0 2>/dev/null | xargs -0 -r chmod 600 || :
614
615 %post console-qt4
616 %update_configs
617
618 %define db_post() \
619 /sbin/ldconfig \
620 for name in "create database" "drop tables" "drop database" "grant privileges" "make tables" "update tables"; do \
621         prefix="${name%% *}" \
622         suffix="${name#* }" \
623         ln -sf "${prefix}_%{1}_${suffix}" %{_libexecdir}/%{name}/"${prefix}_bacula_${suffix}" || : \
624 done \
625 ln -sf "make_%{1}_catalog_backup" %{_libexecdir}/%{name}/make_catalog_backup || : \
626 ln -sf libbaccats-%{1}-%{version}.so %{_libdir}/libbaccats-%{version}.so || : \
627 %service bacula-dir restart "Bacula Director daemon"
628
629 %post db-postgresql
630 %db_post postgresql
631
632 %postun db-postgresql -p /sbin/ldconfig
633
634 %post db-mysql
635 %db_post mysql
636
637 %postun db-mysql -p /sbin/ldconfig
638
639 %post db-sqlite3
640 %db_post sqlite3
641
642 %postun db-sqlite3 -p /sbin/ldconfig
643
644 %files common
645 %defattr(644,root,root,755)
646 %doc LICENSE
647 %dir %{_sysconfdir}
648 %attr(600,root,root) %config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/*-password
649 # do not remove bsmtp from files. Fix build if it is not installed.
650 %attr(755,root,root) %{_sbindir}/bsmtp
651 %attr(755,root,root) %{_sbindir}/btraceback
652 %attr(755,root,root) %{_libdir}/libbac-11*.so
653 %attr(755,root,root) %{_libdir}/libbaccfg-11*.so
654 %attr(755,root,root) %{_libdir}/libbacfind-11*.so
655 %attr(755,root,root) %{_libdir}/libbacsd-11*.so
656 %attr(755,root,root) %{_libdir}/libbacsql-11*.so
657 %{_mandir}/man8/bacula.8*
658 %{_mandir}/man1/bsmtp.1*
659 %{_mandir}/man8/btraceback.8*
660 %dir %{_libexecdir}/%{name}
661 %{_libexecdir}/%{name}/btraceback.dbx
662 %{_libexecdir}/%{name}/btraceback.gdb
663 %{_libexecdir}/%{name}/bacula_config
664 %attr(755,root,root) %{_libexecdir}/%{name}/baculabackupreport
665 %attr(770,root,bacula) %dir %{_localstatedir}
666 %attr(750,bacula,logs) %dir /var/log/bacula
667 %attr(640,bacula,logs) %ghost /var/log/bacula/log
668
669 %files dir
670 %defattr(644,root,root,755)
671 %doc ChangeLog ReleaseNotes LICENSE
672 #%doc examples %{name}-docs-%{version}/manual/{*.pdf,bacula}
673 %attr(640,root,bacula) %config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/bacula-dir.conf
674 %ghost %{_sysconfdir}/.pw.sed
675 %attr(640,root,root) %config(noreplace) /etc/logrotate.d/bacula-dir
676 %attr(754,root,root) /etc/rc.d/init.d/bacula-dir
677 %config(noreplace) %verify(not md5 mtime size) /etc/sysconfig/bacula-dir
678 %attr(755,root,root) %{_sbindir}/bacula-dir
679 %attr(755,root,root) %{_sbindir}/bdirjson
680 %attr(755,root,root) %{_sbindir}/bregex
681 %attr(755,root,root) %{_sbindir}/bwild
682 %attr(755,root,root) %{_sbindir}/bacula-dbcheck
683 %{_mandir}/man8/bacula-dir.8*
684 %{_mandir}/man8/bacula-dbcheck.8*
685 %{_mandir}/man8/bregex.8*
686 %{_mandir}/man8/bwild.8*
687 %{_libexecdir}/%{name}/query.sql
688 %attr(755,root,root) %{_libexecdir}/%{name}/delete_catalog_backup
689
690 %files db-postgresql
691 %defattr(644,root,root,755)
692 %attr(755,root,root) %{_libexecdir}/%{name}/create_postgresql_database
693 %attr(755,root,root) %{_libexecdir}/%{name}/drop_postgresql_database
694 %attr(755,root,root) %{_libexecdir}/%{name}/drop_postgresql_tables
695 %attr(755,root,root) %{_libexecdir}/%{name}/grant_postgresql_privileges
696 %attr(755,root,root) %{_libexecdir}/%{name}/make_postgresql_tables
697 %attr(755,root,root) %{_libexecdir}/%{name}/update_postgresql_*
698 %attr(755,root,root) %{_libexecdir}/%{name}/make_postgresql_catalog_backup
699 %attr(755,root,root) %{_libdir}/libbaccats-postgresql-11*.so
700
701 %ghost %attr(755,root,root) %{_libdir}/libbaccats-11*.so
702 %ghost %{_libexecdir}/%{name}/create_bacula_database
703 %ghost %{_libexecdir}/%{name}/drop_bacula_tables
704 %ghost %{_libexecdir}/%{name}/drop_bacula_database
705 %ghost %{_libexecdir}/%{name}/grant_bacula_privileges
706 %ghost %{_libexecdir}/%{name}/make_bacula_tables
707 %ghost %{_libexecdir}/%{name}/update_bacula_tables
708 %ghost %{_libexecdir}/%{name}/make_catalog_backup
709
710 %files db-mysql
711 %defattr(644,root,root,755)
712 %attr(755,root,root) %{_libexecdir}/%{name}/create_mysql_database
713 %attr(755,root,root) %{_libexecdir}/%{name}/drop_mysql_database
714 %attr(755,root,root) %{_libexecdir}/%{name}/drop_mysql_tables
715 %attr(755,root,root) %{_libexecdir}/%{name}/grant_mysql_privileges
716 %attr(755,root,root) %{_libexecdir}/%{name}/make_mysql_tables
717 %attr(755,root,root) %{_libexecdir}/%{name}/update_mysql_*
718 %attr(755,root,root) %{_libexecdir}/%{name}/make_mysql_catalog_backup
719 %attr(755,root,root) %{_libdir}/libbaccats-mysql-11*.so
720
721 %ghost %attr(755,root,root) %{_libdir}/libbaccats-11*.so
722 %ghost %{_libexecdir}/%{name}/create_bacula_database
723 %ghost %{_libexecdir}/%{name}/drop_bacula_tables
724 %ghost %{_libexecdir}/%{name}/drop_bacula_database
725 %ghost %{_libexecdir}/%{name}/grant_bacula_privileges
726 %ghost %{_libexecdir}/%{name}/make_bacula_tables
727 %ghost %{_libexecdir}/%{name}/update_bacula_tables
728 %ghost %{_libexecdir}/%{name}/make_catalog_backup
729
730 %files db-sqlite3
731 %defattr(644,root,root,755)
732 %attr(755,root,root) %{_libexecdir}/%{name}/create_sqlite3_database
733 %attr(755,root,root) %{_libexecdir}/%{name}/drop_sqlite3_database
734 %attr(755,root,root) %{_libexecdir}/%{name}/drop_sqlite3_tables
735 %attr(755,root,root) %{_libexecdir}/%{name}/grant_sqlite3_privileges
736 %attr(755,root,root) %{_libexecdir}/%{name}/make_sqlite3_tables
737 %attr(755,root,root) %{_libexecdir}/%{name}/update_sqlite3_*
738 %attr(755,root,root) %{_libexecdir}/%{name}/make_sqlite3_catalog_backup
739 %attr(755,root,root) %{_libdir}/libbaccats-sqlite3-11*.so
740
741 %ghost %attr(755,root,root) %{_libdir}/libbaccats-11*.so
742 %ghost %{_libexecdir}/%{name}/create_bacula_database
743 %ghost %{_libexecdir}/%{name}/drop_bacula_tables
744 %ghost %{_libexecdir}/%{name}/drop_bacula_database
745 %ghost %{_libexecdir}/%{name}/grant_bacula_privileges
746 %ghost %{_libexecdir}/%{name}/make_bacula_tables
747 %ghost %{_libexecdir}/%{name}/update_bacula_tables
748 %ghost %{_libexecdir}/%{name}/make_catalog_backup
749
750 %files fd
751 %defattr(644,root,root,755)
752 %doc LICENSE
753 %attr(640,root,bacula) %config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/bacula-fd.conf
754 %attr(754,root,root) /etc/rc.d/init.d/bacula-fd
755 %config(noreplace) %verify(not md5 mtime size) /etc/sysconfig/bacula-fd
756 %attr(755,root,root) %{_sbindir}/bacula-fd
757 %attr(755,root,root) %{_sbindir}/bfdjson
758 %attr(755,root,root) %{_libdir}/bpipe-fd.so
759 %{_mandir}/man8/bacula-fd.8*
760
761 %files sd
762 %defattr(644,root,root,755)
763 %doc LICENSE
764 %attr(640,root,bacula) %config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/bacula-sd.conf
765 %attr(640,root,bacula) %config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/mtx-changer.conf
766 %attr(754,root,root) /etc/rc.d/init.d/bacula-sd
767 %config(noreplace) %verify(not md5 mtime size) /etc/sysconfig/bacula-sd
768 %attr(755,root,root) %{_sbindir}/bacula-sd
769 %attr(755,root,root) %{_sbindir}/bcopy
770 %attr(755,root,root) %{_sbindir}/bextract
771 %attr(755,root,root) %{_sbindir}/bls
772 %attr(755,root,root) %{_sbindir}/bscan
773 %attr(755,root,root) %{_sbindir}/bsdjson
774 %attr(755,root,root) %{_sbindir}/btape
775 %attr(755,root,root) %{_libexecdir}/%{name}/disk-changer
776 %attr(755,root,root) %{_libexecdir}/%{name}/isworm
777 %attr(755,root,root) %{_libexecdir}/%{name}/mtx-changer
778 %attr(755,root,root) %{_libexecdir}/%{name}/tapealert
779 %{_mandir}/man8/bacula-sd.8*
780 %{_mandir}/man8/bcopy.8*
781 %{_mandir}/man8/bextract.8*
782 %{_mandir}/man8/bls.8*
783 %{_mandir}/man8/bscan.8*
784 %{_mandir}/man8/btape.8*
785
786 %files console
787 %defattr(644,root,root,755)
788 %doc LICENSE
789 %attr(640,root,bacula) %config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/bconsole.conf
790 %attr(755,root,root) %{_sbindir}/bconsole
791 %attr(755,root,root) %{_sbindir}/bbconsjson
792 %{_mandir}/man8/bconsole.8*
793
794 %if %{with bat}
795 %files console-qt4
796 %defattr(644,root,root,755)
797 %doc LICENSE
798 %{_pixmapsdir}/%{name}.png
799 %{_desktopdir}/bat.desktop
800 # Do not make this file world-readable or any user will get full access to the
801 # backup system
802 %attr(640,root,bacula) %config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/bat.conf
803 %attr(755,root,root) %{_bindir}/bat
804 %{_mandir}/man1/bat.1*
805 %{_docdir}/%{name}
806 %endif
807
808 %if %{with nagios}
809 %files -n nagios-plugin-check_bacula
810 %defattr(644,root,root,755)
811 %attr(755,root,root) %{nagiosplugindir}/check_bacula
812 %endif