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