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