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