]> git.pld-linux.org Git - packages/bacula.git/blob - bacula.spec
- spaces-> tabs
[packages/bacula.git] / bacula.spec
1 # TODO:
2 # - files section
3 # - rpm scripts
4 #
5 Summary:        Bacula - The Network Backup Solution
6 Name:           bacula
7 Version:        1.34.6
8 Release:        0.1
9 Epoch:          0
10 Group:          Networking/Utilities
11 License:        GPL v2
12 Source0:        http://dl.sourceforge.net/bacula/%{name}-%{version}.tar.gz
13 # Source0-md5:  9de593cb206df126a8e27774281c5bf6
14 Source1:        http://www.tux.org/pub/distributions/tinylinux/tomsrtbt/tomsrtbt-2.0.103.tar.gz
15 # Source1-md5:  d5ee50efb28986d564547d5da5de2483
16 Source2:        %{name}-manpages.tar.bz2
17 # Source2-md5:  e4dae86d6574b360e831efd3913e7f4c
18 Source10:       %{name}-dir.init
19 Source11:       %{name}-fd.init
20 Source12:       %{name}-sd.init
21 Source13:       %{name}.logrotate
22 Patch0:         %{name}-pidfile.patch
23 URL:            http://www.bacula.org/
24 BuildRequires:  mtx
25 BuildRequires:  wxGTK2-devel
26 BuildRequires:  openssl-devel
27 BuildRequires:  pkgconfig
28 BuildRequires:  ncurses-devel
29 BuildRequires:  readline-devel
30 BuildRequires:  sqlite2-devel
31 BuildRequires:  libwrap-devel
32 BuildRequires:  zlib-devel
33 BuildRequires:  acl-devel
34 BuildRequires:  libstdc++-devel
35 BuildRequires:  glibc-static
36 BuildRequires:  acl-static
37 BuildRequires:  libwrap-static
38 BuildRequires:  libstdc++-static
39 BuildRequires:  sed >= 4.0
40 BuildRoot:      %{tmpdir}/%{name}-%{version}-root-%(id -u -n)
41
42 %define         _sysconfdir     /etc/%{name}
43 %define         _localstatedir  /var/lib/%{name}
44
45 %description
46 Bacula - It comes by night and sucks the vital essence from your
47 computers.
48
49 Bacula is a set of computer programs that permit you (or the system
50 administrator) to manage backup, recovery, and verification of
51 computer data across a network of computers of different kinds. In
52 technical terms, it is a network client/server based backup program.
53 Bacula is relatively easy to use and efficient, while offering many
54 advanced storage management features that make it easy to find and
55 recover lost or damaged files.
56
57 %package common
58 Summary:        Common files for bacula package
59 Group:          Networking/Utilities
60 Conflicts:      bacula-dir < %{epoch}:%{version}-%{release}
61 Conflicts:      bacula-fd < %{epoch}:%{version}-%{release}
62 Conflicts:      bacula-sd < %{epoch}:%{version}-%{release}
63 Conflicts:      bacula-console < %{epoch}:%{version}-%{release}
64
65 %description common
66 Bacula - It comes by night and sucks the vital essence from your
67 computers.
68
69 Bacula is a set of computer programs that permit you (or the system
70 administrator) to manage backup, recovery, and verification of
71 computer data across a network of computers of different kinds. In
72 technical terms, it is a network client/server based backup program.
73 Bacula is relatively easy to use and efficient, while offering many
74 advanced storage management features that make it easy to find and
75 recover lost or damaged files.
76
77 %package dir
78 Summary:        Bacula Director and Catalog services
79 Group:          Networking/Utilities
80 Prereq:         bacula-common = %{epoch}:%{version}-%{release}
81
82 %description dir
83 Bacula - It comes by night and sucks the vital essence from your
84 computers.
85
86 Bacula Director is the program that supervises all the backup,
87 restore, verify and archive operations. The system administrator uses
88 the Bacula Director to schedule backups and to recover files. Catalog
89 services are comprised of the software programs responsible for
90 maintaining the file indexes and volume databases for all files backed
91 up. The Catalog services permit the System Administrator or user to
92 quickly locate and restore any desired file, since it maintains a
93 record of all Volumes used, all Jobs run, and all Files saved. This
94 build requires sqlite to be installed separately as the catalog
95 database.
96
97 %package console
98 Summary:        Bacula Console
99 Group:          Networking/Utilities
100 Prereq:         bacula-common = %{epoch}:%{version}-%{release}
101
102 %description console
103 Bacula - It comes by night and sucks the vital essence from your
104 computers.
105
106 Bacula Console is the program that allows the administrator or user to
107 communicate with the Bacula Director. This is the text only console
108 interface.
109
110 %package console-wx
111 Summary:        Bacula wxWindows Console
112 Group:          Networking/Utilities
113 Prereq:         bacula-common = %{epoch}:%{version}-%{release}
114
115 %description console-wx
116 Bacula - It comes by night and sucks the vital essence from your
117 computers.
118
119 Bacula Console is the program that allows the administrator or user to
120 communicate with the Bacula Director. This is the wxWindows GUI
121 interface.
122
123 %package fd
124 Summary:        Bacula File services (Client)
125 Group:          Networking/Utilities
126 Prereq:         bacula-common = %{epoch}:%{version}-%{release}
127
128 %description fd
129 Bacula - It comes by night and sucks the vital essence from your
130 computers.
131
132 Bacula File services (or Client program) is the software program that
133 is installed on the machine to be backed up. It is specific to the
134 operating system on which it runs and is responsible for providing the
135 file attributes and data when requested by the Director. The File
136 services are also responsible for the file system dependent part of
137 restoring the file attributes and data during a recovery operation.
138 This program runs as a daemon on the machine to be backed up, and in
139 some of the documentation, the File daemon is referred to as the
140 Client (for example in Bacula configuration file).
141
142 %package sd
143 Summary:        Bacula Storage services
144 Group:          Networking/Utilities
145 Prereq:         bacula-common = %{epoch}:%{version}-%{release}
146
147 %description sd
148 Bacula - It comes by night and sucks the vital essence from your
149 computers.
150
151 Bacula Storage services consist of the software programs that perform
152 the storage and recovery of the file attributes and data to the
153 physical backup media or volumes. In other words, the Storage daemon
154 is responsible for reading and writing your tapes (or other storage
155 media, e.g. files). The Storage services runs as a daemon on the
156 machine that has the backup device (usually a tape drive).
157
158 %package rescue
159 Summary:        Bacula - The Network Backup Solution
160 Group:          Networking/Utilities
161 Requires:       coreutils
162 Requires:       util-linux
163 Requires:       bacula-fd
164
165 %description rescue
166 Bacula - It comes by night and sucks the vital essence from your
167 computers.
168
169 Bacula is a set of computer programs that permit you (or the system
170 administrator) to manage backup, recovery, and verification of
171 computer data across a network of computers of different kinds. In
172 technical terms, it is a network client/server based backup program.
173 Bacula is relatively easy to use and efficient, while offering many
174 advanced storage management features that make it easy to find and
175 recover lost or damaged files. Bacula source code has been released
176 under the GPL version 2 license.
177
178 This package installs scripts for disaster recovery and builds rescue
179 floppy disks for bare metal recovery. This package includes tomsrtbt
180 (http://www.toms.net/rb/, by Tom Oehser, Tom@Toms.NET) to provide a
181 tool to build a boot floppy disk.
182
183 To create a boot disk run "./getdiskinfo" from the
184 %{_sysconfdir}/rescue directory (this is done when the package is
185 first installed), then run "./install.s" from the
186 %{_sysconfdir}/rescue/tomsrtbt/ directory. To make the bacula rescue
187 disk run "./make_rescue_disk --copy-static-bacula
188 - --copy-etc-files" from the %{_sysconfdir}/rescue directory. To
189   recreate the rescue information for this system run ./getdiskinfo
190   again.
191
192 %package updatedb
193 Summary:        Bacula - The Network Backup Solution
194 Group:          Networking/Utilities
195
196 %description updatedb
197 Bacula - It comes by night and sucks the vital essence from your
198 computers.
199
200 Bacula is a set of computer programs that permit you (or the system
201 administrator) to manage backup, recovery, and verification of
202 computer data across a network of computers of different kinds. In
203 technical terms, it is a network client/server based backup program.
204 Bacula is relatively easy to use and efficient, while offering many
205 advanced storage management features that make it easy to find and
206 recover lost or damaged files. Bacula source code has been released
207 under the GPL version 2 license.
208
209 This package installs scripts for updating older versions of the
210 bacula database.
211
212 %prep
213 %setup -q -a 1 -a 2
214 %patch0 -p1
215 sed -i -e 's#wx-config#wxgtk2-2.4-config#g' configure*
216 sed -i -e 's#-lreadline -ltermcap#-lreadline#g' configure*
217 sed -i -e 's#bindir=.*#bindir=%{_bindir}#g' \
218         src/cats/create_* src/cats/delete_* src/cats/drop_* \
219         src/cats/grant_* src/cats/make_* src/cats/update_*
220
221 %build
222 CPPFLAGS="-I%{_includedir}/ncurses -I%{_includedir}/readline"
223 %configure \
224         --with-scriptdir=%{_libexecdir}/%{name} \
225         --disable-gnome \
226         --disable-conio \
227         --enable-smartalloc \
228         --enable-wx-console \
229         --with-readline \
230         --with-tcp-wrappers \
231         --with-working-dir=%{_var}/lib/%{name} \
232         --with-dump-email="root@localhost" \
233         --with-job-email="root@localhost" \
234         --with-smtp-host=localhost \
235         --with-pid-dir=/var/run \
236         --with-subsys-dir=/var/lock/subsys \
237         --with-sqlite \
238         --enable-static-fd \
239         --with-dir-password="#FAKE#DIR#PASSWORD#PLD#" \
240         --with-fd-password="#FAKE#FD#PASSWORD#PLD#" \
241         --with-sd-password="#FAKE#SD#PASSWORD#PLD#"
242
243 %{__make}
244
245 %install
246 rm -rf $RPM_BUILD_ROOT
247
248 install -d $RPM_BUILD_ROOT/etc/{rc.d/init.d,logrotate.d,pam.d,security/console.apps}
249 install -d $RPM_BUILD_ROOT%{_sysconfdir}/{rescue/tomsrtbt,updatedb}
250 install -d $RPM_BUILD_ROOT{%{_pixmapsdir},%{_mandir},%{_bindir}}
251
252 %{__make} install \
253         DESTDIR=$RPM_BUILD_ROOT
254
255 # static daemon
256 strip src/filed/static-bacula-fd
257 install src/filed/static-bacula-fd $RPM_BUILD_ROOT%{_sysconfdir}/rescue/bacula-fd
258
259 install %{SOURCE10} $RPM_BUILD_ROOT/etc/rc.d/init.d/bacula-dir
260 install %{SOURCE11} $RPM_BUILD_ROOT/etc/rc.d/init.d/bacula-fd
261 install %{SOURCE12} $RPM_BUILD_ROOT/etc/rc.d/init.d/bacula-sd
262 install %{SOURCE13} $RPM_BUILD_ROOT/etc/logrotate.d/%{name}-dir
263
264 install scripts/bacula.png $RPM_BUILD_ROOT%{_pixmapsdir}/bacula.png
265
266 # install the rescue stuff, these are the rescue scripts
267 install rescue/linux/backup.etc.list $RPM_BUILD_ROOT%{_sysconfdir}/rescue/
268 install rescue/linux/format_floppy $RPM_BUILD_ROOT%{_sysconfdir}/rescue/
269 install rescue/linux/getdiskinfo $RPM_BUILD_ROOT%{_sysconfdir}/rescue/
270 install rescue/linux/make_rescue_disk $RPM_BUILD_ROOT%{_sysconfdir}/rescue/
271 install rescue/linux/restore_bacula $RPM_BUILD_ROOT%{_sysconfdir}/rescue/
272 install rescue/linux/restore_etc $RPM_BUILD_ROOT%{_sysconfdir}/rescue/
273 install rescue/linux/run_grub $RPM_BUILD_ROOT%{_sysconfdir}/rescue/
274 install rescue/linux/run_lilo $RPM_BUILD_ROOT%{_sysconfdir}/rescue/
275 install rescue/linux/sfdisk.bz2 $RPM_BUILD_ROOT%{_sysconfdir}/rescue/
276
277 # this is the tom's root boot disk
278 install tomsrtbt-*/* $RPM_BUILD_ROOT%{_sysconfdir}/rescue/tomsrtbt/
279
280 # install the updatedb scripts
281 install updatedb/* $RPM_BUILD_ROOT%{_sysconfdir}/updatedb/
282
283 # manual
284 cp -a man1 man8 $RPM_BUILD_ROOT%{_mandir}
285
286 install -d html-manual
287 cp -a doc/html-manual/*.{html,jpg,gif,css} html-manual/
288
289 # some file changes
290 rm -f $RPM_BUILD_ROOT%{_libexecdir}/%{name}/{gconsole,startmysql,stopmysql,bacula,bconsole,fd}
291 rm -f $RPM_BUILD_ROOT%{_sbindir}/static-bacula-fd
292 rm -f $RPM_BUILD_ROOT%{_mandir}/man1/gnome*
293 touch $RPM_BUILD_ROOT%{_sysconfdir}/.pw.sed
294
295 cat << EOF > $RPM_BUILD_ROOT/etc/security/console.apps/bconsole
296 USER=root
297 PROGRAM=%{_sbindir}/bconsole
298 SESSION=true
299 EOF
300 install scripts/gnome-console.pamd $RPM_BUILD_ROOT/etc/pam.d/bconsole
301 ln -s consolehelper $RPM_BUILD_ROOT%{_bindir}/bconsole
302
303 cat << EOF > $RPM_BUILD_ROOT/etc/security/console.apps/wx-console
304 USER=root
305 PROGRAM=%{_sbindir}/wx-console
306 SESSION=true
307 EOF
308 cp -p scripts/gnome-console.pamd $RPM_BUILD_ROOT/etc/pam.d/wx-console
309 ln -s consolehelper $RPM_BUILD_ROOT%{_bindir}/wx-console
310
311 %pre common
312 if [ -n "`getgid bacula`" ]; then
313         if [ "`getgid bacula`" != "136" ]; then
314                 echo "Error: group bacula doesn't have gid=136. Correct this before installing bacula." 1>&2
315                 exit 1
316         fi
317 else
318         /usr/sbin/groupadd -g 136 -r -f bacula
319 fi
320 if [ -n "`id -u bacula 2>/dev/null`" ]; then
321         if [ "`id -u bacula`" != "136" ]; then
322                 echo "Error: user bacula doesn't have uid=136. Correct this before installing bacula." 1>&2
323                 exit 1
324         fi
325 else
326         /usr/sbin/useradd -u 136 -r -d /var/lib/bacula -s /bin/false -c "Bacula User" -g bacula bacula 1>&2
327 fi
328
329 %postun common
330 if [ "$1" = "0" ]; then
331         %userremove bacula
332         %groupremove bacula
333 fi
334
335 %post dir
336 umask 077
337 [ -s %{_localstatedir}/bacula.db ] && \
338         DB_VER=`echo "select * from Version;" | \
339         %{_bindir}/sqlite %{_localstatedir}/bacula.db | tail -n 1 2>/dev/null`
340 if [ -z "$DB_VER" ]; then
341 # grant privileges and create tables
342         %{_libexecdir}/%{name}/grant_bacula_privileges > dev/null
343         %{_libexecdir}/%{name}/create_bacula_database > dev/null
344         %{_libexecdir}/%{name}/make_bacula_tables > dev/null
345 elif [ "$DB_VER" -lt "7" ]; then
346         echo "Backing up bacula tables"
347         echo ".dump" | sqlite %{_localstatedir}/bacula.db | bzip2 > %{_localstatedir}/bacula_backup.sql.bz2
348         type=sqlite
349         echo "Upgrading bacula tables"
350         if [ "$DB_VER" -lt "6" ]; then
351                 if [ "$DB_VER" -lt "5" ]; then
352                         %{_libexecdir}/%{name}/update_${type}_tables_4_to_5
353                 fi
354                 %{_libexecdir}/%{name}/update_${type}_tables_5_to_6
355         fi
356         %{_libexecdir}/%{name}/update_bacula_tables
357         echo "If bacula works correctly you can remove the backup file %{_localstatedir}/bacula_backup.sql.bz2"
358 fi
359 chown -R bacula:bacula %{_localstatedir}
360 chmod -R u+rX,go-rwx %{_localstatedir}/*
361
362 /sbin/chkconfig --add bacula-dir
363 if [ -f /var/lock/subsys/bacula-dir ]; then
364         /etc/rc.d/init.d/bacula-dir restart 1>&2
365 else
366         echo "Run \"/etc/rc.d/init.d/bacula-dir start\" to start Bacula Director daemon."
367 fi
368
369 %preun dir
370 if [ "$1" = "0" ]; then
371         if [ -f /var/lock/subsys/bacula-dir ]; then
372                 /etc/rc.d/init.d/bacula-dir stop 1>&2
373         fi
374         /sbin/chkconfig --del bacula-dir
375 fi
376
377 %post fd
378 /sbin/chkconfig --add bacula-fd
379 if [ -f /var/lock/subsys/bacula-fd ]; then
380         /etc/rc.d/init.d/bacula-fd restart 1>&2
381 else
382         echo "Run \"/etc/rc.d/init.d/bacula-fd start\" to start Bacula File daemon."
383 fi
384
385 %preun fd
386 if [ "$1" = "0" ]; then
387         if [ -f /var/lock/subsys/bacula-fd ]; then
388                 /etc/rc.d/init.d/bacula-fd stop 1>&2
389         fi
390         /sbin/chkconfig --del bacula-fd
391 fi
392
393 %post sd
394 /sbin/chkconfig --add bacula-sd
395 if [ -f /var/lock/subsys/bacula-sd ]; then
396         /etc/rc.d/init.d/bacula-sd restart 1>&2
397 else
398         echo "Run \"/etc/rc.d/init.d/bacula-sd start\" to start Bacula Storage daemon."
399 fi
400
401 %preun sd
402 if [ "$1" = "0" ]; then
403         if [ -f /var/lock/subsys/bacula-sd ]; then
404                 /etc/rc.d/init.d/bacula-sd stop 1>&2
405         fi
406         /sbin/chkconfig --del bacula-sd
407 fi
408
409 %pre console
410 if [ -e %{_sysconfdir}/console.conf -a ! -e %{_sysconfdir}/bconsole.conf ]; then
411         mv %{_sysconfdir}/console.conf %{_sysconfdir}/bconsole.conf
412 fi
413
414 %post updatedb
415 echo "The database update scripts were installed to %{_sysconfdir}/updatedb"
416
417 %clean
418 rm -rf $RPM_BUILD_ROOT
419
420 %post rescue
421 # link our current installed conf file to the rescue directory
422 ln -s %{_sysconfdir}/bacula-fd.conf %{_sysconfdir}/rescue/bacula-fd.conf
423
424 # run getdiskinfo
425 echo "Creating rescue files for this system..."
426 cd %{_sysconfdir}/rescue
427 ./getdiskinfo
428
429 %preun rescue
430 # remove the files created after the initial rpm installation
431 rm -f %{_sysconfdir}/rescue/bacula-fd.conf
432 rm -f %{_sysconfdir}/rescue/partition.*
433 rm -f %{_sysconfdir}/rescue/format.*
434 rm -f %{_sysconfdir}/rescue/mount_drives
435 rm -f %{_sysconfdir}/rescue/start_network
436 rm -f %{_sysconfdir}/rescue/sfdisk
437 rm -rf %{_sysconfdir}/rescue/diskinfo/*
438
439 %files common
440 %defattr(644,root,root,755)
441 %dir %{_sysconfdir}
442 %attr(755, root, root) %{_sbindir}/btraceback
443 %attr(755, root, root) %{_sbindir}/bsmtp
444 %dir %{_libexecdir}/%{name}
445 %{_libexecdir}/%{name}/btraceback.gdb
446 %attr(700, bacula, bacula) %dir %{_localstatedir}
447
448 %files dir
449 %defattr(644,root,root,755)
450 %doc ChangeLog CheckList ReleaseNotes kernstodo
451 %doc doc/*.pdf html-manual examples
452 %attr(600, root, root) %config(noreplace) %verify(not md5 size mtime) %{_sysconfdir}/bacula-dir.conf
453 %ghost %{_sysconfdir}/.pw.sed
454 %attr(640,root,root) %config(noreplace) /etc/logrotate.d/bacula-dir
455 %{_mandir}/man8/bacula-dir.8*
456 %{_mandir}/man1/dbcheck.1*
457 %defattr (755, root, root)
458 %attr(754,root,root) /etc/rc.d/init.d/bacula-dir
459 %attr(755,root,root) %{_sbindir}/bacula-dir
460 %attr(755,root,root) %{_sbindir}/dbcheck
461 %{_libexecdir}/%{name}/create_sqlite_database
462 %{_libexecdir}/%{name}/drop_sqlite_database
463 %{_libexecdir}/%{name}/drop_sqlite_tables
464 %{_libexecdir}/%{name}/grant_sqlite_privileges
465 %{_libexecdir}/%{name}/make_sqlite_tables
466 %{_libexecdir}/%{name}/update_sqlite_tables*
467 %{_libexecdir}/%{name}/create_bacula_database
468 %{_libexecdir}/%{name}/drop_bacula_database
469 %{_libexecdir}/%{name}/drop_bacula_tables
470 %{_libexecdir}/%{name}/grant_bacula_privileges
471 %{_libexecdir}/%{name}/make_bacula_tables
472 %{_libexecdir}/%{name}/update_bacula_tables
473 %{_libexecdir}/%{name}/make_catalog_backup
474 %{_libexecdir}/%{name}/delete_catalog_backup
475 %attr(644, root, root) %{_libexecdir}/%{name}/query.sql
476
477 %files fd
478 %defattr(644,root,root,755)
479 %attr(600, root, root) %config(noreplace) %verify(not md5 size mtime) %{_sysconfdir}/bacula-fd.conf
480 %attr(754,root,root) /etc/rc.d/init.d/bacula-fd
481 %attr(755,root,root) %{_sbindir}/bacula-fd
482 %attr(644, root, root) %{_mandir}/man8/bacula-fd.8*
483
484 %files sd
485 %defattr(644,root,root,755)
486 %dir %{_sysconfdir}
487 %attr(600, root, root) %config(noreplace) %verify(not md5 size mtime) %{_sysconfdir}/bacula-sd.conf
488 %attr(754,root,root) /etc/rc.d/init.d/bacula-sd
489 %attr(755,root,root) %{_sbindir}/bacula-sd
490 %attr(755,root,root) %{_sbindir}/bcopy
491 %attr(755,root,root) %{_sbindir}/bextract
492 %attr(755,root,root) %{_sbindir}/bls
493 %attr(755,root,root) %{_sbindir}/bscan
494 %attr(755,root,root) %{_sbindir}/btape
495 %{_libexecdir}/%{name}/mtx-changer
496 %defattr(644, root,root, 755)
497 %{_mandir}/man8/bacula-sd.8*
498 %{_mandir}/man1/bcopy.1*
499 %{_mandir}/man1/bextract.1*
500 %{_mandir}/man1/bls.1*
501 %{_mandir}/man1/bscan.1*
502 %{_mandir}/man1/btape.1*
503
504 %files console
505 %defattr(644,root,root,755)
506 %attr(600,root,root) %config(noreplace) %verify(not md5 size mtime) %{_sysconfdir}/bconsole.conf
507 %attr(755,root,root) %{_sbindir}/bconsole
508 %config(noreplace) /etc/security/console.apps/bconsole
509 %config(noreplace) /etc/pam.d/bconsole
510 %verify(link) %{_bindir}/bconsole
511 %{_mandir}/man1/bconsole.1*
512
513 %files console-wx
514 %defattr(644,root,root,755)
515 %{_pixmapsdir}/%{name}.png
516 %attr(600,root,root) %config(noreplace) %verify(not md5 size mtime) %{_sysconfdir}/wx-console.conf
517 %attr(755,root,root) %{_sbindir}/wx-console
518 %config(noreplace) /etc/security/console.apps/wx-console
519 %config(noreplace) %verify(not md5 size mtime) /etc/pam.d/wx-console
520 %verify(link) %{_bindir}/wx-console
521 %{_mandir}/man1/wx-console.1*
522
523 %files rescue
524 %defattr(644,root,root,755)
525 %{_sysconfdir}/rescue
526
527 %files updatedb
528 %defattr(644,root,root,755)
529 %{_sysconfdir}/updatedb
This page took 0.125353 seconds and 4 git commands to generate.