]> git.sur5r.net Git - bacula/bacula/blob - bacula/platforms/redhat/bacula.spec.in
Implement saving last 10 jobs run
[bacula/bacula] / bacula / platforms / redhat / bacula.spec.in
1
2 # basic defines for every build
3 %define depkgs ../depkgs
4 %define depkgs_version 24Jul03
5 %define tomsrtbt tomsrtbt-2.0.103
6
7
8 # You must build the package with at least one define parameter
9 #  e.g.  rpmbuild -ba --define "build_rh7 1" bacula.spec
10 #
11 # If you want the MySQL version, use:
12 #        rpmbuild -ba --define "build_mysql 1" --define "build_rh7 1" bacula.spec
13 #
14
15 %define rh7 0
16 %{?build_rh7:%define rh7 1}
17
18 %define rh8 0
19 %{?build_rh8:%define rh8 1}
20
21 %define rh9 0
22 %{?build_rh9:%define rh9 1}
23
24 %define mysql 0
25 %{?build_mysql:%define mysql 1}
26
27
28 %if %{rh7}
29 %define rh_version rh7
30 %endif
31 %if %{rh8}
32 %define rh_version rh8
33 %endif
34 %if %{rh9}
35 %define rh_version rh9
36 %endif
37
38 Summary: Bacula - The Network Backup Solution
39 Name: bacula
40 Version: @VERSION@
41 Release: 1
42 Group: System Environment/Daemons
43 Copyright: GPL v2
44 Source0:http://www.prdownloads.sourceforge.net/bacula/%{name}-%{version}.tar.gz
45 Source1:http://www.prdownloads.sourceforge.net/bacula/depkgs-%{depkgs_version}.tar.gz
46 Source2:http://www.tux.org/pub/distributions/tinylinux/tomsrtbt/%{tomsrtbt}.tar.gz
47 BuildRoot: %{_tmppath}/%{name}-root
48 URL: http://www.bacula.org/
49 Vendor: The Bacula Team
50 Distribution: The Bacula Team
51 Packager: D. Scott Barninger <barninger@fairfieldcomputers.com>
52 BuildRequires: readline-devel
53 %if %{rh7}
54 BuildRequires: gtk+-devel >= 1.2
55 BuildRequires: gnome-libs-devel >= 1.4
56 %else
57 BuildRequires: gtk2-devel >= 2.0
58 BuildRequires: libgnomeui-devel >= 2.0
59 %endif
60 %if %{mysql}
61 BuildRequires: mysql-devel >= 3.23
62 %endif
63
64 %description
65 Bacula - It comes by night and sucks the vital essence from your computers.
66
67 Bacula is a set of computer programs that permit you (or the system 
68 administrator) to manage backup, recovery, and verification of computer 
69 data across a network of computers of different kinds. In technical terms, 
70 it is a network client/server based backup program. Bacula is relatively 
71 easy to use and efficient, while offering many advanced storage management 
72 features that make it easy to find and recover lost or damaged files. 
73 Bacula source code has been released under the GPL version 2 license.
74
75 %if %{mysql}
76 %package mysql-%{rh_version}
77 %else
78 %package sqlite-%{rh_version}
79 %endif
80
81 Summary: Bacula - The Network Backup Solution
82 Group: System Environment/Daemons
83 Requires: readline
84 %if %{rh7}
85 Requires: gtk+ >= 1.2
86 Requires: gnome-libs >= 1.4
87 %else
88 Requires: gtk2 >= 2.0
89 Requires: libgnomeui >= 2.0
90 %endif
91 %if %{mysql}
92 Requires: mysql >= 3.23
93 Requires: mysql-server >= 3.23
94 %endif
95
96 %if %{mysql}
97 %description mysql-%{rh_version}
98 %else
99 %description sqlite-%{rh_version}
100 %endif
101
102 Bacula - It comes by night and sucks the vital essence from your computers.
103
104 Bacula is a set of computer programs that permit you (or the system 
105 administrator) to manage backup, recovery, and verification of computer 
106 data across a network of computers of different kinds. In technical terms, 
107 it is a network client/server based backup program. Bacula is relatively 
108 easy to use and efficient, while offering many advanced storage management 
109 features that make it easy to find and recover lost or damaged files. 
110 Bacula source code has been released under the GPL version 2 license.
111
112 %if %{mysql}
113 This build requires MySQL to be installed separately as the catalog database.
114 %else
115 This build incorporates sqlite as the catalog database, statically compiled.
116 %endif
117
118 %package client-%{rh_version}
119 Summary: Bacula - The Network Backup Solution
120 Group: System Environment/Daemons
121 Requires: readline
122 %if %{rh7}
123 Requires: gtk+ >= 1.2
124 Requires: gnome-libs >= 1.4
125 %else
126 Requires: gtk2 >= 2.0
127 Requires: libgnomeui >= 2.0
128 %endif
129
130 %description client-%{rh_version}
131 Bacula - It comes by night and sucks the vital essence from your computers.
132
133 Bacula is a set of computer programs that permit you (or the system 
134 administrator) to manage backup, recovery, and verification of computer 
135 data across a network of computers of different kinds. In technical terms, 
136 it is a network client/server based backup program. Bacula is relatively 
137 easy to use and efficient, while offering many advanced storage management 
138 features that make it easy to find and recover lost or damaged files. 
139 Bacula source code has been released under the GPL version 2 license.
140
141 This is the File daemon (Client) only package.
142
143 %package rescue
144
145 Summary: Bacula - The Network Backup Solution
146 Group: System Environment/Daemons
147 Requires: coreutils, util-linux, libc5
148
149 %description rescue
150 Bacula - It comes by night and sucks the vital essence from your computers.
151
152 Bacula is a set of computer programs that permit you (or the system 
153 administrator) to manage backup, recovery, and verification of computer 
154 data across a network of computers of different kinds. In technical terms, 
155 it is a network client/server based backup program. Bacula is relatively 
156 easy to use and efficient, while offering many advanced storage management 
157 features that make it easy to find and recover lost or damaged files. 
158 Bacula source code has been released under the GPL version 2 license.
159
160 This package installs scripts for disaster recovery and builds rescue 
161 floppy disks for bare metal recovery. This package includes tomsrtbt
162 (http://www.toms.net/rb/, by Tom Oehser, Tom@Toms.NET) to provide a tool
163 to build a boot floppy disk.
164
165 You need to have the bacula-sqlite, bacula-mysql or bacula-client package for 
166 your platform installed and configured before installing this package.
167
168 %prep
169
170 %setup -b 1
171 %setup -b 2
172
173 %build
174
175 cwd=${PWD}
176 cd %{depkgs}
177 %if ! %{mysql}
178 make sqlite
179 %endif
180 make mtx
181 cd ${cwd}
182
183 # patch the make_sqlite_tables script for installation bindir
184 patch src/cats/make_sqlite_tables.in src/cats/make_sqlite_tables.in.patch
185
186 # patch the make_catalog_backup script for installation bindir
187 patch src/cats/make_catalog_backup.in src/cats/make_catalog_backup.in.patch
188
189 %configure \
190         --prefix=/usr \
191         --sbindir=/usr/sbin \
192         --sysconfdir=/etc/bacula \
193         --with-scriptdir=/etc/bacula \
194         --enable-smartalloc \
195         --enable-gnome \
196         --enable-static-fd \
197 %if %{mysql}
198         --with-mysql \
199 %else
200         --with-sqlite=${cwd}/../depkgs/sqlite \
201 %endif
202         --with-working-dir=/var/bacula \
203         --with-pid-dir=/var/run \
204         --with-subsys-dir=/var/lock/subsys
205 make
206
207 cd src/filed
208 strip static-bacula-fd
209 cd ../../
210
211 %install
212  
213 cwd=${PWD}
214 mkdir -p $RPM_BUILD_ROOT/etc/rc.d/init.d
215 mkdir -p $RPM_BUILD_ROOT/etc/logrotate.d
216 mkdir -p $RPM_BUILD_ROOT/usr/share/pixmaps
217 mkdir -p $RPM_BUILD_ROOT/usr/share/gnome/apps/System
218 mkdir -p $RPM_BUILD_ROOT/usr/share/applications
219 mkdir -p $RPM_BUILD_ROOT/etc/bacula/rescue
220 mkdir -p $RPM_BUILD_ROOT/etc/bacula/rescue/tomsrtbt
221
222 %if ! %{mysql}
223 mkdir -p $RPM_BUILD_ROOT/usr/lib/sqlite
224 %endif
225
226 make \
227         prefix=$RPM_BUILD_ROOT/usr \
228         sbindir=$RPM_BUILD_ROOT/usr/sbin \
229         sysconfdir=$RPM_BUILD_ROOT/etc/bacula \
230         scriptdir=$RPM_BUILD_ROOT/etc/bacula \
231         working_dir=$RPM_BUILD_ROOT/var/bacula \
232         install
233
234 cd %{depkgs}
235 make \
236         prefix=$RPM_BUILD_ROOT/usr \
237         sbindir=$RPM_BUILD_ROOT/usr/sbin \
238         sysconfdir=$RPM_BUILD_ROOT/etc/bacula \
239         working_dir=$RPM_BUILD_ROOT/var/bacula \
240         mandir=$RPM_BUILD_ROOT/usr/man \
241         mtx-install
242 cd ${cwd}
243
244 %if ! %{mysql}
245 # fixme - make installs the mysql scripts for sqlite build
246 rm -f $RPM_BUILD_ROOT/etc/bacula/startmysql
247 rm -f $RPM_BUILD_ROOT/etc/bacula/stopmysql
248 rm -f $RPM_BUILD_ROOT/etc/bacula/grant_mysql_privileges
249 %endif
250
251 # install the init scripts
252 cp platforms/redhat/bacula-dir $RPM_BUILD_ROOT/etc/rc.d/init.d/bacula-dir
253 cp platforms/redhat/bacula-fd $RPM_BUILD_ROOT/etc/rc.d/init.d/bacula-fd
254 cp platforms/redhat/bacula-sd $RPM_BUILD_ROOT/etc/rc.d/init.d/bacula-sd
255
256 # install the menu stuff
257 cp scripts/bacula.png $RPM_BUILD_ROOT/usr/share/pixmaps/bacula.png
258 cp scripts/bacula.desktop.gnome1 $RPM_BUILD_ROOT/usr/share/gnome/apps/System/bacula.desktop
259 cp scripts/bacula.desktop.gnome2 $RPM_BUILD_ROOT/usr/share/applications/bacula.desktop
260
261 # install sqlite
262 %if ! %{mysql}
263 cp ../depkgs/sqlite/sqlite $RPM_BUILD_ROOT/usr/lib/sqlite/sqlite
264 cp ../depkgs/sqlite/sqlite.h $RPM_BUILD_ROOT/usr/lib/sqlite/sqlite.h
265 cp ../depkgs/sqlite/libsqlite.a $RPM_BUILD_ROOT/usr/lib/sqlite/libsqlite.a
266 %endif
267
268 # install the logrotate file
269 cp scripts/logrotate $RPM_BUILD_ROOT/etc/logrotate.d/bacula
270
271 # install the rescue stuff
272 # these are the rescue scripts
273 cp rescue/linux/backup.etc.list $RPM_BUILD_ROOT/etc/bacula/rescue/
274 cp rescue/linux/format_floppy $RPM_BUILD_ROOT/etc/bacula/rescue/
275 cp rescue/linux/getdiskinfo $RPM_BUILD_ROOT/etc/bacula/rescue/
276 cp rescue/linux/make_rescue_disk $RPM_BUILD_ROOT/etc/bacula/rescue/
277 cp rescue/linux/restore_bacula $RPM_BUILD_ROOT/etc/bacula/rescue/
278 cp rescue/linux/restore_etc $RPM_BUILD_ROOT/etc/bacula/rescue/
279 cp rescue/linux/run_grub $RPM_BUILD_ROOT/etc/bacula/rescue/
280 cp rescue/linux/run_lilo $RPM_BUILD_ROOT/etc/bacula/rescue/
281 cp rescue/linux/sfdisk.bz2 $RPM_BUILD_ROOT/etc/bacula/rescue/
282
283 # this is the static file daemon
284 cp src/filed/static-bacula-fd $RPM_BUILD_ROOT/etc/bacula/rescue/bacula-fd
285
286 # this is the tom's root boot disk
287 cp ../%{tomsrtbt}/* $RPM_BUILD_ROOT/etc/bacula/rescue/tomsrtbt/
288
289 %clean
290 [ "$RPM_BUILD_ROOT" != "/" ] && rm -rf "$RPM_BUILD_ROOT"
291
292 %if %{mysql}
293
294 %files mysql-%{rh_version}
295 %defattr(-,root,root)
296
297 %attr(0754,root,root) /etc/bacula/bacula
298 %attr(0754,root,root) /etc/bacula/console
299 %attr(0754,root,root) /etc/bacula/fd
300 %attr(0754,root,root) /etc/bacula/gconsole
301 %attr(0754,root,root) /etc/bacula/create_mysql_database
302 %attr(0754,root,root) /etc/bacula/delete_catalog_backup
303 %attr(0754,root,root) /etc/bacula/drop_bacula_tables
304 %attr(0754,root,root) /etc/bacula/drop_mysql_tables
305 %attr(0754,root,root) /etc/bacula/make_bacula_tables
306 %attr(0754,root,root) /etc/bacula/make_catalog_backup
307 %attr(0754,root,root) /etc/bacula/make_mysql_tables
308 %attr(0754,root,root) /etc/bacula/grant_mysql_privileges
309 %attr(0754,root,root) /etc/bacula/startmysql
310 %attr(0754,root,root) /etc/bacula/stopmysql
311 %attr(0754,root,root) /etc/bacula/mtx-changer
312 %attr(0754,root,root) /etc/rc.d/init.d/bacula-dir
313 %attr(0754,root,root) /etc/rc.d/init.d/bacula-fd
314 %attr(0754,root,root) /etc/rc.d/init.d/bacula-sd
315
316 %attr(0644,root,root) %doc COPYING ChangeLog INSTALL README ReleaseNotes doc/*
317 %attr(0644,root,root) /usr/man/man1/*
318 %attr(0644,root,root) /usr/share/pixmaps/bacula.png
319 %attr(0644,root,root) /usr/share/gnome/apps/System/bacula.desktop
320 %attr(0644,root,root) /usr/share/applications/bacula.desktop
321 %attr(0644,root,root) %config(noreplace) /etc/bacula/gnome-console.conf
322 %attr(0644,root,root) /etc/logrotate.d/bacula
323
324 %attr(0640,root,root) %config(noreplace) /etc/bacula/bacula-dir.conf
325 %attr(0640,root,root) %config(noreplace) /etc/bacula/bacula-fd.conf
326 %attr(0640,root,root) %config(noreplace) /etc/bacula/bacula-sd.conf
327 %attr(0640,root,root) %config(noreplace) /etc/bacula/console.conf
328 %attr(0640,root,root) /etc/bacula/query.sql
329 %attr(0640,root,root) %dir /var/bacula
330
331 %attr(0750,root,root) /usr/sbin/*
332
333 %post mysql-%{rh_version}
334 # delete then add our links
335 /sbin/chkconfig --del bacula-dir
336 /sbin/chkconfig --del bacula-fd
337 /sbin/chkconfig --del bacula-sd
338 /sbin/chkconfig --add bacula-dir
339 /sbin/chkconfig --add bacula-fd
340 /sbin/chkconfig --add bacula-sd
341
342 # add execute permissions for console
343 chmod 0755 /usr/sbin/gnome-console
344
345 # grant privileges and create tables
346 # this will error out harmlessly if tables already exist
347 echo "Granting privileges for MySQL user bacula..."
348 /etc/bacula/grant_mysql_privileges
349 echo "Creating MySQL bacula database..."
350 /etc/bacula/create_mysql_database
351 echo "Creating bacula tables..."
352 /etc/bacula/make_mysql_tables
353
354 %preun mysql-%{rh_version}
355 # delete our links
356 /sbin/chkconfig --del bacula-dir
357 /sbin/chkconfig --del bacula-fd
358 /sbin/chkconfig --del bacula-sd
359
360 %else
361
362 %files sqlite-%{rh_version}
363 %defattr(-,root,root)
364
365 %attr(0754,root,root) /etc/bacula/bacula
366 %attr(0754,root,root) /etc/bacula/console
367 %attr(0754,root,root) /etc/bacula/fd
368 %attr(0754,root,root) /etc/bacula/gconsole
369 %attr(0754,root,root) /etc/bacula/create_sqlite_database
370 %attr(0754,root,root) /etc/bacula/delete_catalog_backup
371 %attr(0754,root,root) /etc/bacula/drop_bacula_tables
372 %attr(0754,root,root) /etc/bacula/drop_sqlite_tables
373 %attr(0754,root,root) /etc/bacula/make_bacula_tables
374 %attr(0754,root,root) /etc/bacula/make_catalog_backup
375 %attr(0754,root,root) /etc/bacula/make_sqlite_tables
376 %attr(0754,root,root) /etc/bacula/mtx-changer
377 %attr(0754,root,root) /etc/rc.d/init.d/bacula-dir
378 %attr(0754,root,root) /etc/rc.d/init.d/bacula-fd
379 %attr(0754,root,root) /etc/rc.d/init.d/bacula-sd
380
381 %attr(0644,root,root) %doc COPYING ChangeLog INSTALL README ReleaseNotes doc/*
382 %attr(0644,root,root) /usr/man/man1/*
383 %attr(0644,root,root) /usr/share/pixmaps/bacula.png
384 %attr(0644,root,root) /usr/share/gnome/apps/System/bacula.desktop
385 %attr(0644,root,root) /usr/share/applications/bacula.desktop
386 %attr(0644,root,root) %config(noreplace) /etc/bacula/gnome-console.conf
387 %attr(0644,root,root) /etc/logrotate.d/bacula
388
389 %attr(0640,root,root) %config(noreplace) /etc/bacula/bacula-dir.conf
390 %attr(0640,root,root) %config(noreplace) /etc/bacula/bacula-fd.conf
391 %attr(0640,root,root) %config(noreplace) /etc/bacula/bacula-sd.conf
392 %attr(0640,root,root) %config(noreplace) /etc/bacula/console.conf
393 %attr(0640,root,root) /etc/bacula/query.sql
394 %attr(0640,root,root) /usr/lib/sqlite/libsqlite.a
395 %attr(0640,root,root) /usr/lib/sqlite/sqlite.h
396 %attr(0640,root,root) %dir /var/bacula
397
398 %attr(0750,root,root) /usr/sbin/*
399 %attr(0750,root,root) /usr/lib/sqlite/sqlite
400
401 %post sqlite-%{rh_version}
402 # delete then add our links
403 /sbin/chkconfig --del bacula-dir
404 /sbin/chkconfig --del bacula-fd
405 /sbin/chkconfig --del bacula-sd
406 /sbin/chkconfig --add bacula-dir
407 /sbin/chkconfig --add bacula-fd
408 /sbin/chkconfig --add bacula-sd
409
410 # add execute permission for console
411 chmod 0755 /usr/sbin/gnome-console
412
413 # create the tables
414 /etc/bacula/make_sqlite_tables
415
416 %preun sqlite-%{rh_version}
417 # delete our links
418 /sbin/chkconfig --del bacula-dir
419 /sbin/chkconfig --del bacula-fd
420 /sbin/chkconfig --del bacula-sd
421
422 %endif
423
424 %files client-%{rh_version}
425 %defattr(-,root,root)
426
427 %attr(0754,root,root) /etc/bacula/fd
428 %attr(0754,root,root) /etc/rc.d/init.d/bacula-fd
429
430 %attr(0644,root,root) %doc COPYING ChangeLog INSTALL README ReleaseNotes doc/*
431 %attr(0644,root,root) /etc/logrotate.d/bacula
432
433 %attr(0640,root,root) %config(noreplace) /etc/bacula/bacula-fd.conf
434 %attr(0640,root,root) %dir /var/bacula
435
436 %attr(0750,root,root) /usr/sbin/bacula-fd
437 %attr(0750,root,root) /usr/sbin/btraceback
438 %attr(0750,root,root) /usr/sbin/btraceback.gdb
439 %attr(0750,root,root) /usr/sbin/smtp
440
441
442 %post client-%{rh_version}
443 # delete then add our links
444 /sbin/chkconfig --del bacula-fd
445 /sbin/chkconfig --add bacula-fd
446
447 %preun client-%{rh_version}
448 # delete our links
449 /sbin/chkconfig --del bacula-fd
450
451 %files rescue
452 %defattr(-,root,root)
453 %attr(0644,root,root) /etc/bacula/rescue/backup.etc.list
454 %attr(0754,root,root) /etc/bacula/rescue/format_floppy
455 %attr(0754,root,root) /etc/bacula/rescue/getdiskinfo
456 %attr(0754,root,root) /etc/bacula/rescue/make_rescue_disk
457 %attr(0754,root,root) /etc/bacula/rescue/restore_bacula
458 %attr(0754,root,root) /etc/bacula/rescue/restore_etc
459 %attr(0754,root,root) /etc/bacula/rescue/run_grub
460 %attr(0754,root,root) /etc/bacula/rescue/run_lilo
461 %attr(0644,root,root) /etc/bacula/rescue/sfdisk.bz2
462 %attr(0754,root,root) /etc/bacula/rescue/bacula-fd
463 /etc/bacula/rescue/tomsrtbt/*
464
465 %post rescue
466 # link our current installed conf file to the rescue directory
467 ln -s /etc/bacula-fd.conf /etc/bacula/rescue/bacula-fd.conf
468
469 echo
470 echo "Ready to create the rescue files for this system."
471 echo "Press <enter> to continue..."
472 read A
473 echo
474
475 # run getdiskinfo
476 echo "Running getdiskinfo..."
477 cd /etc/bacula/rescue
478 ./getdiskinfo
479
480 echo
481 echo "Finished."
482 echo "To create a boot disk run \"./install.s\" from the /etc/bacula/rescue/tomsrtbt/"
483 echo "directory. To make the bacula rescue disk run"
484 echo "\"./make_rescue_disk --copy-static-bacula --copy-etc-files\" "
485 echo "from the /etc/bacula/rescue directory. To recreate the rescue"
486 echo "information for this system run ./getdiskinfo again."
487 echo
488
489 %preun rescue
490 # remove the files created after the initial rpm installation
491 rm -f /etc/bacula/rescue/bacula-fd.conf
492 rm -f /etc/bacula/rescue/partition.*
493 rm -f /etc/bacula/rescue/format.*
494 rm -f /etc/bacula/rescue/mount_drives
495 rm -f /etc/bacula/rescue/start_network
496 rm -f /etc/bacula/rescue/sfdisk
497 rm -rf /etc/bacula/rescue/diskinfo/*
498
499 %changelog
500 * Tue Nov 25 2003 D. Scott Barninger <barninger at fairfieldcomputers.com>
501 - removed make_static_bacula script from rescue package install
502 * Sun Nov 23 2003 D. Scott Barninger <barninger at fairfieldcomputers.com>
503 - Added define at top of file for depkgs version
504 - Added rescue sub-package
505 - Moved requires statements into proper sub-package locations
506 * Mon Oct 27 2003 D. Scott Barninger <barninger at fairfieldcomputers.com>
507 - Corrected Requires for Gnome 1.4/2.0 builds
508 * Fri Oct 24 2003 D. Scott Barninger <barninger at fairfieldcomputers.com>
509 - Added separate Source declaration for depkgs
510 - added patch for make_catalog_backup script
511 * Mon May 11 2003 D. Scott Barninger <barninger at fairfieldcomputers.com>
512 - Misc changes to mysql/sqlite build and rh7/8 menu differences
513 - Added rh_version to sub-package names
514 - Added installed but missing file /etc/bacula/gconsole
515 - rm'd /etc/bacula/grant_mysql_privileges on sqlite builds
516 * Thu May 08 2003 Kern Sibbald <kern at sibbald.com>
517 - Update spec for version 1.31 and combine client
518 * Sun Mar 30 2003 D. Scott Barninger <barninger at fairfieldcomputers.com>
519 - Initial spec file