]> TLD Linux GIT Repositories - packages/bacula.git/blob - bacula.spec
49ef46f745321ea2921ccf4d95746bf72dbca0ae
[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:        15.0.2
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:  258c6fec54b1b559b9b249e55808acb7
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 # shebang fixes
563 sed -i -e '1s@#!.*python@#!%{__python3}@' \
564         $RPM_BUILD_ROOT%{_libexecdir}/bacula/key-manager.py \
565         $RPM_BUILD_ROOT%{_sbindir}/md5tobase64.py
566
567 %if %{with nagios}
568 install -d $RPM_BUILD_ROOT%{nagiosplugindir}
569 %{__make} -C examples/nagios/check_bacula install \
570         sbindir=%{nagiosplugindir} \
571         DESTDIR=$RPM_BUILD_ROOT
572 %endif
573
574 %clean
575 rm -rf $RPM_BUILD_ROOT
576
577 %pre common
578 %groupadd -P %{name}-common -g 136 -r -f bacula
579 %useradd -P %{name}-common -u 136 -r -d /var/lib/bacula -s /bin/false -c "Bacula User" -g bacula bacula
580
581 %define update_configs \
582 echo "Updating bacula passwords and names..." | %banner -a %{name} \
583 cd %{_sysconfdir} \
584 for f in *-password; do \
585         if [ ! -s $f ]; then \
586                 openssl rand -base64 33 > $f \
587         fi \
588         p=$(cat $f) \
589         for cf in *.conf *.conf.rpmnew; do \
590                 [ -f $cf ] && sed -i -e"s:#FAKE-$f#:$p:" "$cf" || : \
591         done \
592 done \
593 for cf in *.conf *.conf.rpmnew; do \
594         [ -f $cf ] && sed -i -e"s:--hostname--:`hostname`:" "$cf" || : \
595 done
596
597 %post common
598 /sbin/ldconfig
599 %update_configs
600
601 %postun common
602 /sbin/ldconfig
603 if [ "$1" = "0" ]; then
604         %userremove bacula
605         %groupremove bacula
606 fi
607
608 %triggerpostun dir -- %{name}-dir < %{version}-0
609 %banner bacula-dir -t3 <<EOF
610 You have upgraded from an older version of Bacula director.
611
612 You will probably need to call %{_libexecdir}/%{name}/update_bacula_tables
613 script to upgrade the database.
614
615 Ensure you database partition has enough free space before you run the upgrade,
616 i.e check that there is enough room to rebuild 'File' table (it is the largest
617 in bacula db).
618
619 EOF
620
621 %post dir
622 %update_configs
623 /sbin/chkconfig --add bacula-dir
624 %service bacula-dir restart "Bacula Director daemon"
625
626 %preun dir
627 if [ "$1" = "0" ]; then
628         %service bacula-dir stop
629         /sbin/chkconfig --del bacula-dir
630 fi
631
632 %post fd
633 %update_configs
634 /sbin/chkconfig --add bacula-fd
635 %service bacula-fd restart "Bacula File daemon"
636
637 %preun fd
638 if [ "$1" = "0" ]; then
639         %service bacula-fd stop
640         /sbin/chkconfig --del bacula-fd
641 fi
642
643 %post sd
644 %update_configs
645 /sbin/chkconfig --add bacula-sd
646 %service bacula-sd restart "Bacula Storage daemon"
647
648 %preun sd
649 if [ "$1" = "0" ]; then
650         %service bacula-sd stop
651         /sbin/chkconfig --del bacula-sd
652 fi
653
654 %pre console
655 if [ -e %{_sysconfdir}/console.conf -a ! -e %{_sysconfdir}/bconsole.conf ]; then
656         mv %{_sysconfdir}/console.conf %{_sysconfdir}/bconsole.conf
657 fi
658
659 %post console
660 %update_configs
661
662 %triggerpostun common -- %{name}-common < 5.0.1-2
663 find %{_sysconfdir}/bat.conf* -perm /007 -print0 2>/dev/null | xargs -0 -r chmod 600 || :
664
665 %post console-qt
666 %update_configs
667
668 %post tray-monitor
669 %update_configs
670
671 %define db_post() \
672 /sbin/ldconfig \
673 for name in "create database" "drop tables" "drop database" "grant privileges" "make tables" "update tables"; do \
674         prefix="${name%% *}" \
675         suffix="${name#* }" \
676         ln -sf "${prefix}_%{1}_${suffix}" %{_libexecdir}/%{name}/"${prefix}_bacula_${suffix}" || : \
677 done \
678 ln -sf "make_%{1}_catalog_backup" %{_libexecdir}/%{name}/make_catalog_backup || : \
679 ln -sf libbaccats-%{1}-%{version}.so %{_libdir}/libbaccats-%{version}.so || : \
680 %service bacula-dir restart "Bacula Director daemon"
681
682 %post db-postgresql
683 %db_post postgresql
684
685 %postun db-postgresql -p /sbin/ldconfig
686
687 %post db-mysql
688 %db_post mysql
689
690 %postun db-mysql -p /sbin/ldconfig
691
692 %post db-sqlite3
693 %db_post sqlite3
694
695 %postun db-sqlite3 -p /sbin/ldconfig
696
697 %files common
698 %defattr(644,root,root,755)
699 %doc LICENSE
700 %dir %{_sysconfdir}
701 %attr(600,root,root) %config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/*-password
702 # do not remove bsmtp from files. Fix build if it is not installed.
703 %attr(755,root,root) %{_sbindir}/bsmtp
704 %attr(755,root,root) %{_sbindir}/btraceback
705 %attr(755,root,root) %{_libdir}/libbac-15*.so
706 %attr(755,root,root) %{_libdir}/libbaccfg-15*.so
707 %attr(755,root,root) %{_libdir}/libbacsd-15*.so
708 %attr(755,root,root) %{_libdir}/libbacfind-15*.so
709 %attr(755,root,root) %{_libdir}/libbacsql-15*.so
710 %{_mandir}/man8/bacula.8*
711 %{_mandir}/man1/bsmtp.1*
712 %{_mandir}/man8/btraceback.8*
713 %dir %{_libexecdir}/%{name}
714 %{_libexecdir}/%{name}/btraceback.dbx
715 %{_libexecdir}/%{name}/btraceback.gdb
716 %{_libexecdir}/%{name}/bacula_config
717 %attr(770,root,bacula) %dir %{_localstatedir}
718 %attr(750,bacula,logs) %dir /var/log/bacula
719 %attr(640,bacula,logs) %ghost /var/log/bacula/log
720 %attr(750,bacula,logs) %dir /var/log/archive/bacula
721
722 %files dir
723 %defattr(644,root,root,755)
724 %doc ChangeLog ReleaseNotes LICENSE
725 #%doc examples %{name}-docs-%{version}/manual/{*.pdf,bacula}
726 %attr(640,root,bacula) %config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/bacula-dir.conf
727 %attr(640,root,root) %config(noreplace) /etc/logrotate.d/bacula-dir
728 %attr(754,root,root) /etc/rc.d/init.d/bacula-dir
729 %config(noreplace) %verify(not md5 mtime size) /etc/sysconfig/bacula-dir
730 %attr(755,root,root) %{_sbindir}/bacula-dir
731 %attr(755,root,root) %{_sbindir}/bdirjson
732 %attr(755,root,root) %{_sbindir}/bregex
733 %attr(755,root,root) %{_sbindir}/bwild
734 %attr(755,root,root) %{_sbindir}/bacula-dbcheck
735 %attr(755,root,root) %{_sbindir}/get_malware_abuse.ch
736 %attr(755,root,root) %{_sbindir}/md5tobase64.py
737 %{_mandir}/man8/bacula-dir.8*
738 %{_mandir}/man8/bacula-dbcheck.8*
739 %{_mandir}/man8/bdirjson.8*
740 %{_mandir}/man8/bregex.8*
741 %{_mandir}/man8/bwild.8*
742 %{_libexecdir}/%{name}/query.sql
743 %attr(755,root,root) %{_libexecdir}/%{name}/delete_catalog_backup
744 %attr(755,root,root) %{_libexecdir}/%{name}/install-key-manager.sh
745 %attr(755,root,root) %{_libexecdir}/%{name}/key-manager.py
746
747 %if %{with pgsql}
748 %files db-postgresql
749 %defattr(644,root,root,755)
750 %attr(755,root,root) %{_libexecdir}/%{name}/create_postgresql_database
751 %attr(755,root,root) %{_libexecdir}/%{name}/drop_postgresql_database
752 %attr(755,root,root) %{_libexecdir}/%{name}/drop_postgresql_tables
753 %attr(755,root,root) %{_libexecdir}/%{name}/grant_postgresql_privileges
754 %attr(755,root,root) %{_libexecdir}/%{name}/make_postgresql_tables
755 %attr(755,root,root) %{_libexecdir}/%{name}/update_postgresql_*
756 %attr(755,root,root) %{_libexecdir}/%{name}/make_postgresql_catalog_backup
757 %attr(755,root,root) %{_libdir}/libbaccats-postgresql-15*.so
758
759 %ghost %attr(755,root,root) %{_libdir}/libbaccats-15*.so
760 %ghost %{_libexecdir}/%{name}/create_bacula_database
761 %ghost %{_libexecdir}/%{name}/drop_bacula_tables
762 %ghost %{_libexecdir}/%{name}/drop_bacula_database
763 %ghost %{_libexecdir}/%{name}/grant_bacula_privileges
764 %ghost %{_libexecdir}/%{name}/make_bacula_tables
765 %ghost %{_libexecdir}/%{name}/update_bacula_tables
766 %ghost %{_libexecdir}/%{name}/make_catalog_backup
767 %endif
768
769 %if %{with mysql}
770 %files db-mysql
771 %defattr(644,root,root,755)
772 %attr(755,root,root) %{_libexecdir}/%{name}/create_mysql_database
773 %attr(755,root,root) %{_libexecdir}/%{name}/drop_mysql_database
774 %attr(755,root,root) %{_libexecdir}/%{name}/drop_mysql_tables
775 %attr(755,root,root) %{_libexecdir}/%{name}/grant_mysql_privileges
776 %attr(755,root,root) %{_libexecdir}/%{name}/make_mysql_tables
777 %attr(755,root,root) %{_libexecdir}/%{name}/update_mysql_*
778 %attr(755,root,root) %{_libexecdir}/%{name}/make_mysql_catalog_backup
779 %attr(755,root,root) %{_libdir}/libbaccats-mysql-15*.so
780
781 %ghost %attr(755,root,root) %{_libdir}/libbaccats-15*.so
782 %ghost %{_libexecdir}/%{name}/create_bacula_database
783 %ghost %{_libexecdir}/%{name}/drop_bacula_tables
784 %ghost %{_libexecdir}/%{name}/drop_bacula_database
785 %ghost %{_libexecdir}/%{name}/grant_bacula_privileges
786 %ghost %{_libexecdir}/%{name}/make_bacula_tables
787 %ghost %{_libexecdir}/%{name}/update_bacula_tables
788 %ghost %{_libexecdir}/%{name}/make_catalog_backup
789 %endif
790
791 %if %{with sqlite3}
792 %files db-sqlite3
793 %defattr(644,root,root,755)
794 %attr(755,root,root) %{_libexecdir}/%{name}/create_sqlite3_database
795 %attr(755,root,root) %{_libexecdir}/%{name}/drop_sqlite3_database
796 %attr(755,root,root) %{_libexecdir}/%{name}/drop_sqlite3_tables
797 %attr(755,root,root) %{_libexecdir}/%{name}/grant_sqlite3_privileges
798 %attr(755,root,root) %{_libexecdir}/%{name}/make_sqlite3_tables
799 %attr(755,root,root) %{_libexecdir}/%{name}/update_sqlite3_*
800 %attr(755,root,root) %{_libexecdir}/%{name}/make_sqlite3_catalog_backup
801 %attr(755,root,root) %{_libdir}/libbaccats-sqlite3-15*.so
802
803 %ghost %attr(755,root,root) %{_libdir}/libbaccats-15*.so
804 %ghost %{_libexecdir}/%{name}/create_bacula_database
805 %ghost %{_libexecdir}/%{name}/drop_bacula_tables
806 %ghost %{_libexecdir}/%{name}/drop_bacula_database
807 %ghost %{_libexecdir}/%{name}/grant_bacula_privileges
808 %ghost %{_libexecdir}/%{name}/make_bacula_tables
809 %ghost %{_libexecdir}/%{name}/update_bacula_tables
810 %ghost %{_libexecdir}/%{name}/make_catalog_backup
811 %endif
812
813 %files fd
814 %defattr(644,root,root,755)
815 %doc LICENSE
816 %attr(640,root,bacula) %config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/bacula-fd.conf
817 %attr(754,root,root) /etc/rc.d/init.d/bacula-fd
818 %config(noreplace) %verify(not md5 mtime size) /etc/sysconfig/bacula-fd
819 %attr(755,root,root) %{_sbindir}/bacula-fd
820 %attr(755,root,root) %{_sbindir}/bfdjson
821 %attr(755,root,root) %{_libdir}/bpipe-fd.so
822 %{_mandir}/man8/bacula-fd.8*
823 %{_mandir}/man8/bfdjson.8*
824
825 %files sd
826 %defattr(644,root,root,755)
827 %doc LICENSE
828 %attr(640,root,bacula) %config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/bacula-sd.conf
829 %attr(640,root,bacula) %config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/mtx-changer.conf
830 %attr(754,root,root) /etc/rc.d/init.d/bacula-sd
831 %config(noreplace) %verify(not md5 mtime size) /etc/sysconfig/bacula-sd
832 %attr(755,root,root) %{_sbindir}/bacula-sd
833 %attr(755,root,root) %{_sbindir}/bcopy
834 %attr(755,root,root) %{_sbindir}/bextract
835 %attr(755,root,root) %{_sbindir}/bls
836 %attr(755,root,root) %{_sbindir}/bscan
837 %attr(755,root,root) %{_sbindir}/bsdjson
838 %attr(755,root,root) %{_sbindir}/btape
839 %attr(755,root,root) %{_libexecdir}/%{name}/baculabackupreport
840 %attr(755,root,root) %{_libexecdir}/%{name}/bacula-tray-monitor.desktop
841 %attr(755,root,root) %{_libexecdir}/%{name}/disk-changer
842 %attr(755,root,root) %{_libexecdir}/%{name}/isworm
843 %attr(755,root,root) %{_libexecdir}/%{name}/mtx-changer
844 %attr(755,root,root) %{_libexecdir}/%{name}/tapealert
845 %attr(755,root,root) %{_libdir}/bacula-sd-aligned-driver-15.*.so
846 %if %{with s3}
847 %attr(755,root,root) %{_libdir}/bacula-sd-cloud-driver-15.*.so
848 %endif
849
850 %{_mandir}/man8/bacula-sd.8*
851 %{_mandir}/man8/bcopy.8*
852 %{_mandir}/man8/bextract.8*
853 %{_mandir}/man8/bls.8*
854 %{_mandir}/man8/bscan.8*
855 %{_mandir}/man8/bsdjson.8*
856 %{_mandir}/man8/btape.8*
857
858 %files console
859 %defattr(644,root,root,755)
860 %doc LICENSE
861 %attr(640,root,bacula) %config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/bconsole.conf
862 %attr(755,root,root) %{_sbindir}/bconsole
863 %attr(755,root,root) %{_sbindir}/bbconsjson
864 %{_mandir}/man8/bbconsjson.8*
865 %{_mandir}/man8/bconsole.8*
866
867 %if %{with qt}
868 %files console-qt
869 %defattr(644,root,root,755)
870 %doc LICENSE
871 %{_pixmapsdir}/%{name}.png
872 %{_desktopdir}/bat.desktop
873 # Do not make this file world-readable or any user will get full access to the
874 # backup system
875 %attr(640,root,bacula) %config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/bat.conf
876 %attr(755,root,root) %{_bindir}/bat
877 %{_mandir}/man1/bat.1*
878 %{_docdir}/%{name}
879 %endif
880
881 %if %{with nagios}
882 %files -n nagios-plugin-check_bacula
883 %defattr(644,root,root,755)
884 %attr(755,root,root) %{nagiosplugindir}/check_bacula
885 %endif