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