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