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