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