]> git.sur5r.net Git - bacula/bacula/blob - bacula/platforms/redhat/bacula.spec.in
New tree commands lsmark+estimate
[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/make_static_bacula $RPM_BUILD_ROOT/etc/bacula/rescue/
278 cp rescue/linux/restore_bacula $RPM_BUILD_ROOT/etc/bacula/rescue/
279 cp rescue/linux/restore_etc $RPM_BUILD_ROOT/etc/bacula/rescue/
280 cp rescue/linux/run_grub $RPM_BUILD_ROOT/etc/bacula/rescue/
281 cp rescue/linux/run_lilo $RPM_BUILD_ROOT/etc/bacula/rescue/
282 cp rescue/linux/sfdisk.bz2 $RPM_BUILD_ROOT/etc/bacula/rescue/
283
284 # this is the static file daemon
285 cp src/filed/static-bacula-fd $RPM_BUILD_ROOT/etc/bacula/rescue/bacula-fd
286
287 # this is the tom's root boot disk
288 cp ../%{tomsrtbt}/* $RPM_BUILD_ROOT/etc/bacula/rescue/tomsrtbt/
289
290 %clean
291 [ "$RPM_BUILD_ROOT" != "/" ] && rm -rf "$RPM_BUILD_ROOT"
292
293 %if %{mysql}
294
295 %files mysql-%{rh_version}
296 %defattr(-,root,root)
297
298 %attr(0754,root,root) /etc/bacula/bacula
299 %attr(0754,root,root) /etc/bacula/console
300 %attr(0754,root,root) /etc/bacula/fd
301 %attr(0754,root,root) /etc/bacula/gconsole
302 %attr(0754,root,root) /etc/bacula/create_mysql_database
303 %attr(0754,root,root) /etc/bacula/delete_catalog_backup
304 %attr(0754,root,root) /etc/bacula/drop_bacula_tables
305 %attr(0754,root,root) /etc/bacula/drop_mysql_tables
306 %attr(0754,root,root) /etc/bacula/make_bacula_tables
307 %attr(0754,root,root) /etc/bacula/make_catalog_backup
308 %attr(0754,root,root) /etc/bacula/make_mysql_tables
309 %attr(0754,root,root) /etc/bacula/grant_mysql_privileges
310 %attr(0754,root,root) /etc/bacula/startmysql
311 %attr(0754,root,root) /etc/bacula/stopmysql
312 %attr(0754,root,root) /etc/bacula/mtx-changer
313 %attr(0754,root,root) /etc/rc.d/init.d/bacula-dir
314 %attr(0754,root,root) /etc/rc.d/init.d/bacula-fd
315 %attr(0754,root,root) /etc/rc.d/init.d/bacula-sd
316
317 %attr(0644,root,root) %doc COPYING ChangeLog INSTALL README ReleaseNotes doc/*
318 %attr(0644,root,root) /usr/man/man1/*
319 %attr(0644,root,root) /usr/share/pixmaps/bacula.png
320 %attr(0644,root,root) /usr/share/gnome/apps/System/bacula.desktop
321 %attr(0644,root,root) /usr/share/applications/bacula.desktop
322 %attr(0644,root,root) %config(noreplace) /etc/bacula/gnome-console.conf
323 %attr(0644,root,root) /etc/logrotate.d/bacula
324
325 %attr(0640,root,root) %config(noreplace) /etc/bacula/bacula-dir.conf
326 %attr(0640,root,root) %config(noreplace) /etc/bacula/bacula-fd.conf
327 %attr(0640,root,root) %config(noreplace) /etc/bacula/bacula-sd.conf
328 %attr(0640,root,root) %config(noreplace) /etc/bacula/console.conf
329 %attr(0640,root,root) /etc/bacula/query.sql
330 %attr(0640,root,root) %dir /var/bacula
331
332 %attr(0750,root,root) /usr/sbin/*
333
334 %post mysql-%{rh_version}
335 # delete then add our links
336 /sbin/chkconfig --del bacula-dir
337 /sbin/chkconfig --del bacula-fd
338 /sbin/chkconfig --del bacula-sd
339 /sbin/chkconfig --add bacula-dir
340 /sbin/chkconfig --add bacula-fd
341 /sbin/chkconfig --add bacula-sd
342
343 # add execute permissions for console
344 chmod 0755 /usr/sbin/gnome-console
345
346 # grant privileges and create tables
347 # this will error out harmlessly if tables already exist
348 echo "Granting privileges for MySQL user bacula..."
349 /etc/bacula/grant_mysql_privileges
350 echo "Creating MySQL bacula database..."
351 /etc/bacula/create_mysql_database
352 echo "Creating bacula tables..."
353 /etc/bacula/make_mysql_tables
354
355 %preun mysql-%{rh_version}
356 # delete our links
357 /sbin/chkconfig --del bacula-dir
358 /sbin/chkconfig --del bacula-fd
359 /sbin/chkconfig --del bacula-sd
360
361 %else
362
363 %files sqlite-%{rh_version}
364 %defattr(-,root,root)
365
366 %attr(0754,root,root) /etc/bacula/bacula
367 %attr(0754,root,root) /etc/bacula/console
368 %attr(0754,root,root) /etc/bacula/fd
369 %attr(0754,root,root) /etc/bacula/gconsole
370 %attr(0754,root,root) /etc/bacula/create_sqlite_database
371 %attr(0754,root,root) /etc/bacula/delete_catalog_backup
372 %attr(0754,root,root) /etc/bacula/drop_bacula_tables
373 %attr(0754,root,root) /etc/bacula/drop_sqlite_tables
374 %attr(0754,root,root) /etc/bacula/make_bacula_tables
375 %attr(0754,root,root) /etc/bacula/make_catalog_backup
376 %attr(0754,root,root) /etc/bacula/make_sqlite_tables
377 %attr(0754,root,root) /etc/bacula/mtx-changer
378 %attr(0754,root,root) /etc/rc.d/init.d/bacula-dir
379 %attr(0754,root,root) /etc/rc.d/init.d/bacula-fd
380 %attr(0754,root,root) /etc/rc.d/init.d/bacula-sd
381
382 %attr(0644,root,root) %doc COPYING ChangeLog INSTALL README ReleaseNotes doc/*
383 %attr(0644,root,root) /usr/man/man1/*
384 %attr(0644,root,root) /usr/share/pixmaps/bacula.png
385 %attr(0644,root,root) /usr/share/gnome/apps/System/bacula.desktop
386 %attr(0644,root,root) /usr/share/applications/bacula.desktop
387 %attr(0644,root,root) %config(noreplace) /etc/bacula/gnome-console.conf
388 %attr(0644,root,root) /etc/logrotate.d/bacula
389
390 %attr(0640,root,root) %config(noreplace) /etc/bacula/bacula-dir.conf
391 %attr(0640,root,root) %config(noreplace) /etc/bacula/bacula-fd.conf
392 %attr(0640,root,root) %config(noreplace) /etc/bacula/bacula-sd.conf
393 %attr(0640,root,root) %config(noreplace) /etc/bacula/console.conf
394 %attr(0640,root,root) /etc/bacula/query.sql
395 %attr(0640,root,root) /usr/lib/sqlite/libsqlite.a
396 %attr(0640,root,root) /usr/lib/sqlite/sqlite.h
397 %attr(0640,root,root) %dir /var/bacula
398
399 %attr(0750,root,root) /usr/sbin/*
400 %attr(0750,root,root) /usr/lib/sqlite/sqlite
401
402 %post sqlite-%{rh_version}
403 # delete then add our links
404 /sbin/chkconfig --del bacula-dir
405 /sbin/chkconfig --del bacula-fd
406 /sbin/chkconfig --del bacula-sd
407 /sbin/chkconfig --add bacula-dir
408 /sbin/chkconfig --add bacula-fd
409 /sbin/chkconfig --add bacula-sd
410
411 # add execute permission for console
412 chmod 0755 /usr/sbin/gnome-console
413
414 # create the tables
415 /etc/bacula/make_sqlite_tables
416
417 %preun sqlite-%{rh_version}
418 # delete our links
419 /sbin/chkconfig --del bacula-dir
420 /sbin/chkconfig --del bacula-fd
421 /sbin/chkconfig --del bacula-sd
422
423 %endif
424
425 %files client-%{rh_version}
426 %defattr(-,root,root)
427
428 %attr(0754,root,root) /etc/bacula/fd
429 %attr(0754,root,root) /etc/rc.d/init.d/bacula-fd
430
431 %attr(0644,root,root) %doc COPYING ChangeLog INSTALL README ReleaseNotes doc/*
432 %attr(0644,root,root) /etc/logrotate.d/bacula
433
434 %attr(0640,root,root) %config(noreplace) /etc/bacula/bacula-fd.conf
435 %attr(0640,root,root) %dir /var/bacula
436
437 %attr(0750,root,root) /usr/sbin/bacula-fd
438 %attr(0750,root,root) /usr/sbin/btraceback
439 %attr(0750,root,root) /usr/sbin/btraceback.gdb
440 %attr(0750,root,root) /usr/sbin/smtp
441
442
443 %post client-%{rh_version}
444 # delete then add our links
445 /sbin/chkconfig --del bacula-fd
446 /sbin/chkconfig --add bacula-fd
447
448 %preun client-%{rh_version}
449 # delete our links
450 /sbin/chkconfig --del bacula-fd
451
452 %files rescue
453 %defattr(-,root,root)
454 %attr(0644,root,root) /etc/bacula/rescue/backup.etc.list
455 %attr(0754,root,root) /etc/bacula/rescue/format_floppy
456 %attr(0754,root,root) /etc/bacula/rescue/getdiskinfo
457 %attr(0754,root,root) /etc/bacula/rescue/make_rescue_disk
458 %attr(0754,root,root) /etc/bacula/rescue/make_static_bacula
459 %attr(0754,root,root) /etc/bacula/rescue/restore_bacula
460 %attr(0754,root,root) /etc/bacula/rescue/restore_etc
461 %attr(0754,root,root) /etc/bacula/rescue/run_grub
462 %attr(0754,root,root) /etc/bacula/rescue/run_lilo
463 %attr(0644,root,root) /etc/bacula/rescue/sfdisk.bz2
464 %attr(0754,root,root) /etc/bacula/rescue/bacula-fd
465 /etc/bacula/rescue/tomsrtbt/*
466
467 %post rescue
468 # link our current installed conf file to the rescue directory
469 ln -s /etc/bacula-fd.conf /etc/bacula/rescue/bacula-fd.conf
470
471 echo
472 echo "Ready to create the rescue files for this system."
473 echo "Press <enter> to continue..."
474 read A
475 echo
476
477 # run getdiskinfo
478 echo "Running getdiskinfo..."
479 cd /etc/bacula/rescue
480 ./getdiskinfo
481
482 echo
483 echo "Finished."
484 echo "To create a boot disk run \"./install.s\" from the /etc/bacula/rescue/tomsrtbt/"
485 echo "directory. To make the bacula rescue disk run"
486 echo "\"./make_rescue_disk --copy-static-bacula --copy-etc-files\" "
487 echo "from the /etc/bacula/rescue directory. To recreate the rescue"
488 echo "information for this system run ./getdiskinfo again."
489 echo
490
491 %preun rescue
492 # remove the files created after the initial rpm installation
493 rm -f /etc/bacula/rescue/bacula-fd.conf
494 rm -f /etc/bacula/rescue/partition.*
495 rm -f /etc/bacula/rescue/format.*
496 rm -f /etc/bacula/rescue/mount_drives
497 rm -f /etc/bacula/rescue/start_network
498 rm -f /etc/bacula/rescue/sfdisk
499 rm -rf /etc/bacula/rescue/diskinfo/*
500
501 %changelog
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