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