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