]> git.pld-linux.org Git - packages/bacula.git/blob - bacula.spec
Version: 7.0.5
[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:        0.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 Requires:       systemd-units >= 38
77 BuildRequires:  zlib-devel
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 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
261 %description fd
262 Bacula - It comes by night and sucks the vital essence from your
263 computers.
264
265 Bacula File services (or Client program) is the software program that
266 is installed on the machine to be backed up. It is specific to the
267 operating system on which it runs and is responsible for providing the
268 file attributes and data when requested by the Director. The File
269 services are also responsible for the file system dependent part of
270 restoring the file attributes and data during a recovery operation.
271 This program runs as a daemon on the machine to be backed up, and in
272 some of the documentation, the File daemon is referred to as the
273 Client (for example in Bacula configuration file).
274
275 %description fd -l pl.UTF-8
276 Bacula - przychodzi nocą i wysysa żywotny ekstrakt z komputerów.
277
278 Usługi Bacula File (inaczej program kliencki) to oprogramowanie, które
279 instaluje się na maszynach, z których mają być wykonywane kopie
280 zapasowe. Są one specyficzne dla systemu operacyjnego, pod którym
281 działa dana maszyna i odpowiadają za dostarczanie atrybutów i danych
282 plików na żądanie Directora. Usługi plikowe są także odpowiedzialne za
283 zależną od systemu plików część odzyskiwania atrybutów i danych plików
284 podczas operacji odzyskiwania danych. Program działa jako demon na
285 maszynie, która ma być backupowana i w części dokumentacji demon ten
286 (File) jest nazywany klientem (na przykład w pliku konfiguracyjnym
287 Baculi).
288
289 %package sd
290 Summary:        Bacula Storage services
291 Summary(pl.UTF-8):      Usługi Bacula Storage
292 Group:          Networking/Utilities
293 Requires(post): sed >= 4.0
294 Requires:       %{name}-common = %{version}-%{release}
295 Suggests:       mtx
296 Conflicts:      dvd+rw-tools <= 5.21.4.10.8-1
297
298 %description sd
299 Bacula - It comes by night and sucks the vital essence from your
300 computers.
301
302 Bacula Storage services consist of the software programs that perform
303 the storage and recovery of the file attributes and data to the
304 physical backup media or volumes. In other words, the Storage daemon
305 is responsible for reading and writing your tapes (or other storage
306 media, e.g. files). The Storage services runs as a daemon on the
307 machine that has the backup device (usually a tape drive).
308
309 %description sd -l pl.UTF-8
310 Bacula - przychodzi nocą i wysysa żywotny ekstrakt z komputerów.
311
312 Usługi Bacula Storage składają się z programów obsługujących
313 przechowywanie danych oraz odzyskiwanie atrybutów i danych na
314 fizycznych nośnikach lub wolumenach. Innymi słowy, demon Storage jest
315 odpowiedzialny za odczyt i zapis taśm (lub innych nośników do
316 przechowywania danych, np. plików). Usługi Storage działają jako demon
317 na maszynie, która zawiera urządzenie backupowe (zwykle napęd
318 taśmowy).
319
320 %package db-postgresql
321 Summary:        PostgreSQL database driver for Bacula
322 Summary(pl.UTF-8):      Sterownik bazy PostgreSQL dla Baculi
323 Group:          Networking/Utilities
324 Requires(post): /sbin/ldconfig
325 Requires:       %{name}-common = %{version}-%{release}
326 Provides:       bacula(db) = %{version}-%{release}
327 Obsoletes:      bacula(db)
328
329 %description db-postgresql
330 PostgreSQL database driver for Bacula.
331
332 %description db-postgresql -l pl.UTF-8
333 Sterownik bazy PostgreSQL dla Baculi.
334
335 %package db-mysql
336 Summary:        MySQL database driver for Bacula
337 Summary(pl.UTF-8):      Sterownik bazy MySQL dla Baculi
338 Group:          Networking/Utilities
339 Requires(post): /sbin/ldconfig
340 Requires:       %{name}-common = %{version}-%{release}
341 Provides:       bacula(db) = %{version}-%{release}
342 Obsoletes:      bacula(db)
343
344 %description db-mysql
345 MySQL database driver for Bacula.
346
347 %description db-mysql -l pl.UTF-8
348 Sterownik bazy MySQL dla Baculi.
349
350 %package db-sqlite3
351 Summary:        SQLite database driver for Bacula
352 Summary(pl.UTF-8):      Sterownik bazy SQLite dla Baculi
353 Group:          Networking/Utilities
354 Requires(post): /sbin/ldconfig
355 Requires:       %{name}-common = %{version}-%{release}
356 Provides:       bacula(db) = %{version}-%{release}
357 Obsoletes:      bacula(db)
358
359 %description db-sqlite3
360 SQLite database driver for Bacula.
361
362 %description db-sqlite3 -l pl.UTF-8
363 Sterownik bazy SQLite dla Baculi.
364
365 %package -n nagios-plugin-check_bacula
366 Summary:        Nagios plugin to check bacula
367 Group:          Networking
368 Requires:       nagios-common
369
370 %description -n nagios-plugin-check_bacula
371 Nagios plugin to check bacula.
372
373 %define _noautoreq      libbaccats-%{version}.so
374 # provided by various db libraries as a symlink
375
376 %prep
377 %setup -q
378 %patch0 -p1
379 %patch1 -p1
380 %patch2 -p1
381 %patch3 -p1
382 %patch4 -p1
383
384 sed -i -e 's#bindir=.*#bindir=%{_bindir}#g' \
385         src/cats/create_* src/cats/delete_* src/cats/drop_* \
386         src/cats/grant_* src/cats/make_* src/cats/update_*
387 sed -i -e 's/@hostname@/--hostname--/' src/*/*.conf.in
388 sed -i -e 's/@basename@/--hostname--/' src/*/*.conf.in
389
390 %build
391 cd autoconf
392 %{__aclocal} -I bacula-macros -I gettext-macros -I libtool
393 ## $BUILD_DIR not seen by libtoolize, export it
394 #BUILD_DIR=.. %%{__libtoolize}
395 cd ..
396 %{__autoconf} --prepend-include=$(pwd)/autoconf autoconf/configure.in > configure
397
398 CPPFLAGS="-I/usr/include/ncurses -I%{_includedir}/readline"
399
400 QMAKE=%{_bindir}/qmake-qt4 \
401 %configure \
402         DISTNAME=pld-linux \
403         --with-scriptdir=%{_libexecdir}/%{name} \
404         %{?with_qt:--enable-bat} \
405         --disable-conio \
406         --enable-smartalloc \
407         --with-readline \
408         --with-tcp-wrappers \
409         --with-working-dir=%{_var}/lib/%{name} \
410         --with-dump-email="root@localhost" \
411         --with-job-email="root@localhost" \
412         --with-smtp-host=localhost \
413         --with-pid-dir=/var/run \
414         --with-subsys-dir=/var/lock/subsys \
415         --with-systemd=%{systemdunitdir} \
416         --enable-batch-insert \
417         %{?with_pgsql:--with-postgresql} \
418         %{?with_mysql:--with-mysql} \
419         %{?with_sqlite3:--with-sqlite3} \
420         %{?with_sqlite3_sync_off:--enable-extra-sqlite3-init="pragma synchronous=0;"} \
421         --with-dir-password="#FAKE-dir-password#" \
422         --with-fd-password="#FAKE-fd-password#" \
423         --with-sd-password="#FAKE-sd-password#" \
424         --with-mon-dir-password="#FAKE-mon-dir-password#" \
425         --with-mon-fd-password="#FAKE-mon-fd-password#" \
426         --with-mon-sd-password="#FAKE-mon-sd-password#" \
427         --with-openssl
428
429 %if %{with qt}
430 cd src/qt-console
431 qmake-qt4 bat.pro
432 cd ../..
433 %endif
434
435 %{__make} 2>&1 | tee log
436 # check for build errors
437 grep "Error in" log && exit 1
438
439 %if %{with nagios}
440 # nagios plugin
441 %{__make} -C examples/nagios/check_bacula
442 %endif
443
444 %install
445 rm -rf $RPM_BUILD_ROOT
446 install -d $RPM_BUILD_ROOT/etc/{rc.d/init.d,logrotate.d,pam.d,sysconfig} \
447                 $RPM_BUILD_ROOT{%{_pixmapsdir},%{_desktopdir}} \
448                 $RPM_BUILD_ROOT{%{_mandir},%{_bindir},/var/log{,/archive}/bacula} \
449                 $RPM_BUILD_ROOT%{systemdunitdir}
450
451 %{__make} install \
452         DESTDIR=$RPM_BUILD_ROOT
453
454 # create copies of make_catalog_backup for specific databases; zeore default one (will be ghost)
455 for database in %{databases}; do
456         sed -e "s#default_db_type=.*#default_db_type=${database}#g" \
457                 $RPM_BUILD_ROOT%{_libdir}/%{name}/make_catalog_backup \
458                 > $RPM_BUILD_ROOT%{_libdir}/%{name}/make_${database}_catalog_backup
459                 chmod 755 $RPM_BUILD_ROOT%{_libdir}/%{name}/make_${database}_catalog_backup
460 done
461 :> $RPM_BUILD_ROOT%{_libdir}/%{name}/make_catalog_backup
462
463 # we use db dependant (at compile time) shell script only
464 rm $RPM_BUILD_ROOT%{_libexecdir}/%{name}/make_catalog_backup.pl
465
466 ## replace with empty file, replaced by ldconfig from each db-* package on intsall
467 rm $RPM_BUILD_ROOT%{_libdir}/libbaccats-%{version}.so
468 touch $RPM_BUILD_ROOT%{_libdir}/libbaccats-%{version}.so
469
470 install -p %{SOURCE10} $RPM_BUILD_ROOT/etc/rc.d/init.d/bacula-dir
471 install -p %{SOURCE11} $RPM_BUILD_ROOT/etc/rc.d/init.d/bacula-fd
472 install -p %{SOURCE12} $RPM_BUILD_ROOT/etc/rc.d/init.d/bacula-sd
473 cp -a %{SOURCE13} $RPM_BUILD_ROOT/etc/logrotate.d/%{name}-dir
474 cp -a %{SOURCE14} $RPM_BUILD_ROOT/etc/sysconfig/bacula-dir
475 cp -a %{SOURCE15} $RPM_BUILD_ROOT/etc/sysconfig/bacula-fd
476 cp -a %{SOURCE16} $RPM_BUILD_ROOT/etc/sysconfig/bacula-sd
477 cp -a %{SOURCE17} $RPM_BUILD_ROOT%{systemdunitdir}/bacula-dir.service
478 cp -a %{SOURCE18} $RPM_BUILD_ROOT%{systemdunitdir}/bacula-fd.service
479 cp -a %{SOURCE19} $RPM_BUILD_ROOT%{systemdunitdir}/bacula-sd.service
480
481 %if %{with qt}
482 # qmake somewhy does not always create install_bins target. install our own the bin
483 rm -f $RPM_BUILD_ROOT%{_sbindir}/bat
484 libtool --silent --mode=install install src/qt-console/bat $RPM_BUILD_ROOT%{_bindir}
485 cp -a scripts/bacula.png $RPM_BUILD_ROOT%{_pixmapsdir}/bacula.png
486 cp -a scripts/bat.desktop $RPM_BUILD_ROOT%{_desktopdir}
487 %endif
488
489 touch $RPM_BUILD_ROOT/var/log/bacula/log
490
491 # install the updatedb scripts for older versions that last full release
492 # 2.0 -> 3.0 : 10_to_11
493 # 5.0 -> 5.2 : 12_to_14
494 install -p updatedb/update_*_tables_10_to_11 $RPM_BUILD_ROOT%{_libexecdir}/%{name}
495 install -p updatedb/update_*_tables_11_to_12 $RPM_BUILD_ROOT%{_libexecdir}/%{name}
496 install -p updatedb/update_*_tables_12_to_14 $RPM_BUILD_ROOT%{_libexecdir}/%{name}
497
498 # place for site passwords
499 touch $RPM_BUILD_ROOT%{_sysconfdir}/{dir-password,fd-password,sd-password}
500 touch $RPM_BUILD_ROOT%{_sysconfdir}/{mon-dir-password,mon-fd-password,mon-sd-password}
501
502 mv $RPM_BUILD_ROOT%{_libexecdir}/%{name}/mtx-changer.conf $RPM_BUILD_ROOT%{_sysconfdir}/mtx-changer.conf
503
504 # some file changes
505 rm -f $RPM_BUILD_ROOT%{_libexecdir}/%{name}/{gconsole,startmysql,stopmysql,bacula,bconsole,fd}
506
507 rm $RPM_BUILD_ROOT%{_docdir}/bacula/ChangeLog
508 rm $RPM_BUILD_ROOT%{_docdir}/bacula/INSTALL
509 rm $RPM_BUILD_ROOT%{_docdir}/bacula/LICENSE
510 rm $RPM_BUILD_ROOT%{_docdir}/bacula/README
511 rm $RPM_BUILD_ROOT%{_docdir}/bacula/ReleaseNotes
512 rm $RPM_BUILD_ROOT%{_docdir}/bacula/VERIFYING
513 rm $RPM_BUILD_ROOT%{_docdir}/bacula/technotes
514
515 # startup scripts, those in /etc/rc.d/init.d are better
516 rm $RPM_BUILD_ROOT%{_sbindir}/bacula
517 rm $RPM_BUILD_ROOT%{_libexecdir}/%{name}/bacula-ctl-*
518
519 # unsupported
520 rm $RPM_BUILD_ROOT%{_libexecdir}/%{name}/btraceback.mdb
521
522 # rename to avoid possible conflicts
523 mv $RPM_BUILD_ROOT%{_sbindir}/{,bacula-}dbcheck
524 mv $RPM_BUILD_ROOT%{_mandir}/man8/{,bacula-}dbcheck.8.gz
525
526 # no -devel files packaged, so this is also useless
527 rm $RPM_BUILD_ROOT%{_libdir}/libbac{,cfg,find,sql,cats}.{so,la}
528 #rm $RPM_BUILD_ROOT%{_libdir}/libbaccats*.{so,la}
529 %{?with_mysql:rm $RPM_BUILD_ROOT%{_libdir}/libbaccats-mysql.{la,so}}
530 %{?with_pgsql:rm $RPM_BUILD_ROOT%{_libdir}/libbaccats-postgresql.{la,so}}
531 %{?with_sqlite3:rm $RPM_BUILD_ROOT%{_libdir}/libbaccats-sqlite3.{la,so}}
532
533 %if %{with nagios}
534 install -d $RPM_BUILD_ROOT%{nagiosplugindir}
535 %{__make} -C examples/nagios/check_bacula install \
536         sbindir=%{nagiosplugindir} \
537         DESTDIR=$RPM_BUILD_ROOT
538 %endif
539
540 %clean
541 rm -rf $RPM_BUILD_ROOT
542
543 %pre common
544 %groupadd -P %{name}-common -g 136 -r -f bacula
545 %useradd -P %{name}-common -u 136 -r -d /var/lib/bacula -s /bin/false -c "Bacula User" -g bacula bacula
546
547 %define update_configs \
548 echo "Updating bacula passwords and names..." | %banner -a %{name} \
549 cd %{_sysconfdir} \
550 for f in *-password; do \
551         if [ ! -s $f ]; then \
552                 openssl rand -base64 33 > $f \
553         fi \
554         p=$(cat $f) \
555         for cf in *.conf *.conf.rpmnew; do \
556                 [ -f $cf ] && sed -i -e"s:#FAKE-$f#:$p:" "$cf" || : \
557         done \
558 done \
559 for cf in *.conf *.conf.rpmnew; do \
560         [ -f $cf ] && sed -i -e"s:--hostname--:`hostname`:" "$cf" || : \
561 done
562
563 %post common
564 /sbin/ldconfig
565 %update_configs
566
567 %postun common
568 /sbin/ldconfig
569 if [ "$1" = "0" ]; then
570         %userremove bacula
571         %groupremove bacula
572 fi
573
574 %triggerpostun dir -- %{name}-dir < %{version}-0
575 %banner bacula-dir -t3 <<EOF
576 You have upgraded from an older version of Bacula director.
577
578 You will probably need to call %{_libexecdir}/%{name}/update_bacula_tables
579 script to upgrade the database.
580
581 Ensure you database partition has enough free space before you run the upgrade,
582 i.e check that there is enough room to rebuild 'File' table (it is the largest
583 in bacula db).
584
585 EOF
586
587 %post dir
588 %update_configs
589 /sbin/chkconfig --add bacula-dir
590 %service bacula-dir restart "Bacula Director daemon"
591 %systemd_post bacula-dir.service
592
593 %preun dir
594 if [ "$1" = "0" ]; then
595         %service bacula-dir stop
596         /sbin/chkconfig --del bacula-dir
597 fi
598 %systemd_preun bacula-dir.service
599
600 %postun dir
601 %systemd_reload
602
603 %post fd
604 %update_configs
605 /sbin/chkconfig --add bacula-fd
606 %service bacula-fd restart "Bacula File daemon"
607 %systemd_post bacula-fd.service
608
609 %preun fd
610 if [ "$1" = "0" ]; then
611         %service bacula-fd stop
612         /sbin/chkconfig --del bacula-fd
613 fi
614 %systemd_preun bacula-fd.service
615
616 %postun fd
617 %systemd_reload
618
619 %post sd
620 %update_configs
621 /sbin/chkconfig --add bacula-sd
622 %service bacula-sd restart "Bacula Storage daemon"
623 %systemd_post bacula-sd.service
624
625 %preun sd
626 if [ "$1" = "0" ]; then
627         %service bacula-sd stop
628         /sbin/chkconfig --del bacula-sd
629 fi
630 %systemd_preun bacula-sd.service
631
632 %postun sd
633 %systemd_reload
634
635 %pre console
636 if [ -e %{_sysconfdir}/console.conf -a ! -e %{_sysconfdir}/bconsole.conf ]; then
637         mv %{_sysconfdir}/console.conf %{_sysconfdir}/bconsole.conf
638 fi
639
640 %post console
641 %update_configs
642
643 %triggerpostun common -- %{name}-common < 5.0.1-2
644 find %{_sysconfdir}/bat.conf* -perm /007 -print0 2>/dev/null | xargs -0 -r chmod 600 || :
645
646 %post console-qt
647 %update_configs
648
649 %post tray-monitor
650 %update_configs
651
652 %define db_post() \
653 /sbin/ldconfig \
654 for name in "create database" "drop tables" "drop database" "grant privileges" "make tables" "update tables"; do \
655         prefix="${name%% *}" \
656         suffix="${name#* }" \
657         ln -sf "${prefix}_%{1}_${suffix}" %{_libexecdir}/%{name}/"${prefix}_bacula_${suffix}" || : \
658 done \
659 ln -sf "make_%{1}_catalog_backup" %{_libexecdir}/%{name}/make_catalog_backup || : \
660 ln -sf libbaccats-%{1}-%{version}.so %{_libdir}/libbaccats-%{version}.so || : \
661 %service bacula-dir restart "Bacula Director daemon"
662
663 %post db-postgresql
664 %db_post postgresql
665
666 %postun db-postgresql -p /sbin/ldconfig
667
668 %post db-mysql
669 %db_post mysql
670
671 %postun db-mysql -p /sbin/ldconfig
672
673 %post db-sqlite3
674 %db_post sqlite3
675
676 %postun db-sqlite3 -p /sbin/ldconfig
677
678 %files common
679 %defattr(644,root,root,755)
680 %doc LICENSE
681 %dir %{_sysconfdir}
682 %attr(600,root,root) %config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/*-password
683 # do not remove bsmtp from files. Fix build if it is not installed.
684 %attr(755,root,root) %{_sbindir}/bpluginfo
685 %attr(755,root,root) %{_sbindir}/bsmtp
686 %attr(755,root,root) %{_sbindir}/btraceback
687 %attr(755,root,root) %{_libdir}/libbac-7*.so
688 %attr(755,root,root) %{_libdir}/libbaccfg-7*.so
689 %attr(755,root,root) %{_libdir}/libbacfind-7*.so
690 %attr(755,root,root) %{_libdir}/libbacsql-7*.so
691 %{_mandir}/man8/bacula.8*
692 %{_mandir}/man8/bpluginfo.8*
693 %{_mandir}/man1/bsmtp.1*
694 %{_mandir}/man8/btraceback.8*
695 %dir %{_libexecdir}/%{name}
696 %{_libexecdir}/%{name}/btraceback.dbx
697 %{_libexecdir}/%{name}/btraceback.gdb
698 %{_libexecdir}/%{name}/bacula_config
699 %attr(770,root,bacula) %dir %{_localstatedir}
700 %attr(750,bacula,logs) %dir /var/log/bacula
701 %attr(640,bacula,logs) %ghost /var/log/bacula/log
702 %attr(750,bacula,logs) %dir /var/log/archive/bacula
703
704 %files dir
705 %defattr(644,root,root,755)
706 %doc ChangeLog ReleaseNotes LICENSE
707 #%doc examples %{name}-docs-%{version}/manual/{*.pdf,bacula}
708 %attr(640,root,bacula) %config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/bacula-dir.conf
709 %attr(640,root,root) %config(noreplace) /etc/logrotate.d/bacula-dir
710 %attr(754,root,root) /etc/rc.d/init.d/bacula-dir
711 %config(noreplace) %verify(not md5 mtime size) /etc/sysconfig/bacula-dir
712 %{systemdunitdir}/bacula-dir.service
713 %attr(755,root,root) %{_sbindir}/bacula-dir
714 %attr(755,root,root) %{_sbindir}/bregex
715 %attr(755,root,root) %{_sbindir}/bwild
716 %attr(755,root,root) %{_sbindir}/bacula-dbcheck
717 %{_mandir}/man8/bacula-dir.8*
718 %{_mandir}/man8/bacula-dbcheck.8*
719 %{_mandir}/man8/bregex.8*
720 %{_mandir}/man8/bwild.8*
721 %{_libexecdir}/%{name}/query.sql
722 %attr(755,root,root) %{_libexecdir}/%{name}/delete_catalog_backup
723
724 %if %{with pgsql}
725 %files db-postgresql
726 %defattr(644,root,root,755)
727 %attr(755,root,root) %{_libexecdir}/%{name}/create_postgresql_database
728 %attr(755,root,root) %{_libexecdir}/%{name}/drop_postgresql_database
729 %attr(755,root,root) %{_libexecdir}/%{name}/drop_postgresql_tables
730 %attr(755,root,root) %{_libexecdir}/%{name}/grant_postgresql_privileges
731 %attr(755,root,root) %{_libexecdir}/%{name}/make_postgresql_tables
732 %attr(755,root,root) %{_libexecdir}/%{name}/update_postgresql_*
733 %attr(755,root,root) %{_libexecdir}/%{name}/make_postgresql_catalog_backup
734 %attr(755,root,root) %{_libdir}/libbaccats-postgresql-7*.so
735
736 %ghost %attr(755,root,root) %{_libdir}/libbaccats-7*.so
737 %ghost %{_libexecdir}/%{name}/create_bacula_database
738 %ghost %{_libexecdir}/%{name}/drop_bacula_tables
739 %ghost %{_libexecdir}/%{name}/drop_bacula_database
740 %ghost %{_libexecdir}/%{name}/grant_bacula_privileges
741 %ghost %{_libexecdir}/%{name}/make_bacula_tables
742 %ghost %{_libexecdir}/%{name}/update_bacula_tables
743 %ghost %{_libexecdir}/%{name}/make_catalog_backup
744 %endif
745
746 %if %{with mysql}
747 %files db-mysql
748 %defattr(644,root,root,755)
749 %attr(755,root,root) %{_libexecdir}/%{name}/create_mysql_database
750 %attr(755,root,root) %{_libexecdir}/%{name}/drop_mysql_database
751 %attr(755,root,root) %{_libexecdir}/%{name}/drop_mysql_tables
752 %attr(755,root,root) %{_libexecdir}/%{name}/grant_mysql_privileges
753 %attr(755,root,root) %{_libexecdir}/%{name}/make_mysql_tables
754 %attr(755,root,root) %{_libexecdir}/%{name}/update_mysql_*
755 %attr(755,root,root) %{_libexecdir}/%{name}/make_mysql_catalog_backup
756 %attr(755,root,root) %{_libdir}/libbaccats-mysql-7*.so
757
758 %ghost %attr(755,root,root) %{_libdir}/libbaccats-7*.so
759 %ghost %{_libexecdir}/%{name}/create_bacula_database
760 %ghost %{_libexecdir}/%{name}/drop_bacula_tables
761 %ghost %{_libexecdir}/%{name}/drop_bacula_database
762 %ghost %{_libexecdir}/%{name}/grant_bacula_privileges
763 %ghost %{_libexecdir}/%{name}/make_bacula_tables
764 %ghost %{_libexecdir}/%{name}/update_bacula_tables
765 %ghost %{_libexecdir}/%{name}/make_catalog_backup
766 %endif
767
768 %if %{with sqlite3}
769 %files db-sqlite3
770 %defattr(644,root,root,755)
771 %attr(755,root,root) %{_libexecdir}/%{name}/create_sqlite3_database
772 %attr(755,root,root) %{_libexecdir}/%{name}/drop_sqlite3_database
773 %attr(755,root,root) %{_libexecdir}/%{name}/drop_sqlite3_tables
774 %attr(755,root,root) %{_libexecdir}/%{name}/grant_sqlite3_privileges
775 %attr(755,root,root) %{_libexecdir}/%{name}/make_sqlite3_tables
776 %attr(755,root,root) %{_libexecdir}/%{name}/update_sqlite3_*
777 %attr(755,root,root) %{_libexecdir}/%{name}/make_sqlite3_catalog_backup
778 %attr(755,root,root) %{_libdir}/libbaccats-sqlite3-7*.so
779
780 %ghost %attr(755,root,root) %{_libdir}/libbaccats-7*.so
781 %ghost %{_libexecdir}/%{name}/create_bacula_database
782 %ghost %{_libexecdir}/%{name}/drop_bacula_tables
783 %ghost %{_libexecdir}/%{name}/drop_bacula_database
784 %ghost %{_libexecdir}/%{name}/grant_bacula_privileges
785 %ghost %{_libexecdir}/%{name}/make_bacula_tables
786 %ghost %{_libexecdir}/%{name}/update_bacula_tables
787 %ghost %{_libexecdir}/%{name}/make_catalog_backup
788 %endif
789
790 %files fd
791 %defattr(644,root,root,755)
792 %doc LICENSE
793 %attr(640,root,bacula) %config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/bacula-fd.conf
794 %attr(754,root,root) /etc/rc.d/init.d/bacula-fd
795 %config(noreplace) %verify(not md5 mtime size) /etc/sysconfig/bacula-fd
796 %{systemdunitdir}/bacula-fd.service
797 %attr(755,root,root) %{_sbindir}/bacula-fd
798 %attr(755,root,root) %{_libdir}/bpipe-fd.so
799 %{_mandir}/man8/bacula-fd.8*
800
801 %files sd
802 %defattr(644,root,root,755)
803 %doc LICENSE
804 %attr(640,root,bacula) %config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/bacula-sd.conf
805 %attr(640,root,bacula) %config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/mtx-changer.conf
806 %attr(754,root,root) /etc/rc.d/init.d/bacula-sd
807 %config(noreplace) %verify(not md5 mtime size) /etc/sysconfig/bacula-sd
808 %{systemdunitdir}/bacula-sd.service
809 %attr(755,root,root) %{_sbindir}/bacula-sd
810 %attr(755,root,root) %{_sbindir}/bcopy
811 %attr(755,root,root) %{_sbindir}/bextract
812 %attr(755,root,root) %{_sbindir}/bls
813 %attr(755,root,root) %{_sbindir}/bscan
814 %attr(755,root,root) %{_sbindir}/btape
815 %attr(755,root,root) %{_libexecdir}/%{name}/mtx-changer
816 %attr(755,root,root) %{_libexecdir}/%{name}/disk-changer
817 %attr(755,root,root) %{_libexecdir}/%{name}/dvd-handler
818 %{_mandir}/man8/bacula-sd.8*
819 %{_mandir}/man8/bcopy.8*
820 %{_mandir}/man8/bextract.8*
821 %{_mandir}/man8/bls.8*
822 %{_mandir}/man8/bscan.8*
823 %{_mandir}/man8/btape.8*
824
825 %files console
826 %defattr(644,root,root,755)
827 %doc LICENSE
828 %attr(640,root,bacula) %config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/bconsole.conf
829 %attr(755,root,root) %{_sbindir}/bconsole
830 %{_mandir}/man8/bconsole.8*
831
832 %if %{with qt}
833 %files console-qt
834 %defattr(644,root,root,755)
835 %doc LICENSE
836 %{_pixmapsdir}/%{name}.png
837 %{_desktopdir}/bat.desktop
838 # Do not make this file world-readable or any user will get full access to the
839 # backup system
840 %attr(640,root,bacula) %config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/bat.conf
841 %attr(755,root,root) %{_bindir}/bat
842 %{_mandir}/man1/bat.1*
843 %{_docdir}/%{name}
844 %endif
845
846 %if %{with nagios}
847 %files -n nagios-plugin-check_bacula
848 %defattr(644,root,root,755)
849 %attr(755,root,root) %{nagiosplugindir}/check_bacula
850 %endif
This page took 0.084308 seconds and 3 git commands to generate.