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