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