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