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