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