]> git.sur5r.net Git - bacula/bacula/blob - bacula/platforms/redhat/bacula.spec.in
Added postgresql package suppport to rpm spec file.
[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 %define sqlite_bindir /usr/lib/sqlite
8 %define working_dir /var/bacula
9
10 # platform defines - set one below or define the build_xxx on the command line
11 # RedHat builds
12 %define rh7 0
13 %{?build_rh7:%define rh7 1}
14 %define rh8 0
15 %{?build_rh8:%define rh8 1}
16 %define rh9 0
17 %{?build_rh9:%define rh9 1}
18 # Fedora Core 1 build
19 %define fc1 0
20 %{?build_fc1:%define fc1 1}
21 # Whitebox Enterprise build
22 %define wb3 0
23 %{?build_wb3:%define wb3 1}
24 # SuSE 9.0 build
25 %define su9 0
26 %{?build_su9:%define su9 1}
27
28 # database defines
29 # set for database support desired
30 %define mysql 0
31 %{?build_mysql:%define mysql 1}
32 %define sqlite 0
33 %{?build_sqlite:%define sqlite 1}
34 %define postgresql 0
35 %{?build_postgresql:%define postgresql 1}
36
37 Summary: Bacula - The Network Backup Solution
38 Name: bacula
39 Version: @VERSION@
40 Release: 1
41 Group: System Environment/Daemons
42 Copyright: GPL v2
43 Source0:http://www.prdownloads.sourceforge.net/bacula/%{name}-%{version}.tar.gz
44 Source1:http://www.prdownloads.sourceforge.net/bacula/depkgs-%{depkgs_version}.tar.gz
45 Source2:http://www.tux.org/pub/distributions/tinylinux/tomsrtbt/%{tomsrtbt}.tar.gz
46 BuildRoot: %{_tmppath}/%{name}-root
47 URL: http://www.bacula.org/
48 Vendor: The Bacula Team
49 Distribution: The Bacula Team
50 Packager: D. Scott Barninger <barninger@fairfieldcomputers.com>
51 BuildRequires: readline-devel, atk-devel, ncurses-devel, pango-devel
52 BuildRequires: libstdc++-devel, libxml2-devel, zlib-devel
53 %if %{rh7}
54 BuildRequires: libtermcap-devel
55 BuildRequires: gtk+-devel >= 1.2
56 BuildRequires: gnome-libs-devel >= 1.4
57 BuildRequires: glibc-devel >= 2.2
58 BuildRequires: ORBit-devel
59 BuildRequires: bonobo-devel
60 BuildRequires: GConf-devel
61 %endif
62 %if %{su9}
63 BuildRequires: termcap
64 BuildRequires: gtk2-devel >= 2.0
65 BuildRequires: libgnomeui-devel >= 2.0
66 BuildRequires: glibc-devel >= 2.3
67 BuildRequires: ORBit2-devel
68 BuildRequires: libart_lgpl-devel >= 2.0
69 BuildRequires: libbonobo-devel >= 2.0
70 BuildRequires: libbonoboui-devel >= 2.0
71 BuildRequires: bonobo-activation-devel
72 BuildRequires: gconf2-devel
73 BuildRequires: linc-devel
74 %endif
75 %if ! %{rh7} && ! %{su9}
76 BuildRequires: libtermcap-devel
77 BuildRequires: gtk2-devel >= 2.0
78 BuildRequires: libgnomeui-devel >= 2.0
79 BuildRequires: glibc-devel >= 2.3
80 BuildRequires: ORBit2-devel
81 BuildRequires: libart_lgpl-devel >= 2.0
82 BuildRequires: libbonobo-devel >= 2.0
83 BuildRequires: libbonoboui-devel >= 2.0
84 BuildRequires: bonobo-activation-devel
85 BuildRequires: GConf2-devel
86 BuildRequires: linc-devel
87 %endif
88
89 %if %{mysql}
90 BuildRequires: mysql-devel >= 3.23
91 %endif
92
93 %if %{postgresql} && %{wb3}
94 BuildRequires: rh-postgresql-devel >= 7
95 %endif
96
97 %if %{postgresql} && ! %{wb3}
98 BuildRequires: postgresql-devel >= 7
99 %endif
100
101 %description
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 %package mysql
114 %endif
115 %if %{sqlite}
116 %package sqlite
117 %endif
118 %if %{postgresql}
119 %package postgresql
120 %endif
121
122 Summary: Bacula - The Network Backup Solution
123 Group: System Environment/Daemons
124 Provides: bacula-dir, bacula-sd, bacula-fd
125 Requires: readline, perl, atk, ncurses, pango, libstdc++
126 Requires: libxml2, zlib
127 %if %{rh7}
128 Requires: gtk+ >= 1.2
129 Requires: gnome-libs >= 1.4
130 Requires: glibc >= 2.2
131 Requires: ORBit
132 Requires: bonobo
133 Requires: GConf
134 Requires: libtermcap
135 %endif
136 %if %{su9}
137 Requires: gtk2 >= 2.0
138 Requires: libgnomeui >= 2.0
139 Requires: glibc >= 2.3
140 Requires: ORBit2
141 Requires: libart_lgpl >= 2.0
142 Requires: libbonobo >= 2.0
143 Requires: libbonoboui >= 2.0
144 Requires: bonobo-activation
145 Requires: gconf2
146 Requires: linc
147 Requires: termcap
148 %endif
149 %if ! %{rh7} && ! %{su9}
150 Requires: gtk2 >= 2.0
151 Requires: libgnomeui >= 2.0
152 Requires: glibc >= 2.3
153 Requires: ORBit2
154 Requires: libart_lgpl >= 2.0
155 Requires: libbonobo >= 2.0
156 Requires: libbonoboui >= 2.0
157 Requires: bonobo-activation
158 Requires: GConf2
159 Requires: linc
160 Requires: libtermcap
161 %endif
162 %if %{mysql}
163 Requires: mysql >= 3.23
164 Requires: mysql-server >= 3.23
165 %endif
166 %if %{postgresql} && %{wb3}
167 Requires: rh-postgresql >= 7
168 Requires: rh-postgresql-server >= 7
169 %endif
170 %if %{postgresql} && ! %{wb3}
171 Requires: postgresql >= 7
172 Requires: postgresql-server >= 7
173 %endif
174
175 %if %{mysql}
176 %description mysql
177 %endif
178 %if %{sqlite}
179 %description sqlite
180 %endif
181 %if %{postgresql}
182 %description postgresql
183 %endif
184
185 Bacula - It comes by night and sucks the vital essence from your computers.
186
187 Bacula is a set of computer programs that permit you (or the system 
188 administrator) to manage backup, recovery, and verification of computer 
189 data across a network of computers of different kinds. In technical terms, 
190 it is a network client/server based backup program. Bacula is relatively 
191 easy to use and efficient, while offering many advanced storage management 
192 features that make it easy to find and recover lost or damaged files. 
193 Bacula source code has been released under the GPL version 2 license.
194
195 %if %{mysql}
196 This build requires MySQL to be installed separately as the catalog database.
197 %endif
198 %if %{postgresql}
199 This build requires PostgreSQL to be installed separately as the catalog database.
200 %endif
201 %if %{sqlite}
202 This build incorporates sqlite as the catalog database, statically compiled.
203 %endif
204
205 %package client
206 Summary: Bacula - The Network Backup Solution
207 Group: System Environment/Daemons
208 Provides: bacula-fd
209 Requires: readline, perl, libstdc++, zlib
210 %if %{rh7}
211 Requires: gtk+ >= 1.2
212 Requires: gnome-libs >= 1.4
213 Requires: glibc >= 2.2
214 %else
215 Requires: gtk2 >= 2.0
216 Requires: libgnomeui >= 2.0
217 Requires: glibc >= 2.3
218 %endif
219
220 %description client
221 Bacula - It comes by night and sucks the vital essence from your computers.
222
223 Bacula is a set of computer programs that permit you (or the system 
224 administrator) to manage backup, recovery, and verification of computer 
225 data across a network of computers of different kinds. In technical terms, 
226 it is a network client/server based backup program. Bacula is relatively 
227 easy to use and efficient, while offering many advanced storage management 
228 features that make it easy to find and recover lost or damaged files. 
229 Bacula source code has been released under the GPL version 2 license.
230
231 This is the File daemon (Client) only package.
232
233 %package rescue
234
235 Summary: Bacula - The Network Backup Solution
236 Group: System Environment/Daemons
237 Requires: coreutils, util-linux, libc5, bacula-fd
238
239 %description rescue
240 Bacula - It comes by night and sucks the vital essence from your computers.
241
242 Bacula is a set of computer programs that permit you (or the system 
243 administrator) to manage backup, recovery, and verification of computer 
244 data across a network of computers of different kinds. In technical terms, 
245 it is a network client/server based backup program. Bacula is relatively 
246 easy to use and efficient, while offering many advanced storage management 
247 features that make it easy to find and recover lost or damaged files. 
248 Bacula source code has been released under the GPL version 2 license.
249
250 This package installs scripts for disaster recovery and builds rescue 
251 floppy disks for bare metal recovery. This package includes tomsrtbt
252 (http://www.toms.net/rb/, by Tom Oehser, Tom@Toms.NET) to provide a tool
253 to build a boot floppy disk.
254
255 You need to have the bacula-sqlite, bacula-mysql or bacula-client package for 
256 your platform installed and configured before installing this package.
257
258 %prep
259
260 %setup -b 1
261 %setup -b 2
262
263 %build
264
265 %if %{su9}
266 export LDFLAGS="-L/usr/lib/termcap"
267 %endif
268
269 cwd=${PWD}
270 cd %{depkgs}
271 %if %{sqlite}
272 make sqlite
273 %endif
274 make mtx
275 cd ${cwd}
276
277 # patches for the bundled sqlite scripts
278
279 # patch the make_sqlite_tables script for installation bindir
280 patch src/cats/make_sqlite_tables.in src/cats/make_sqlite_tables.in.patch
281
282 # patch the create_sqlite_database script for installation bindir
283 patch src/cats/create_sqlite_database.in src/cats/create_sqlite_database.in.patch
284
285 # patch the make_catalog_backup script for installation bindir
286 patch src/cats/make_catalog_backup.in src/cats/make_catalog_backup.in.patch
287
288 # patch the update_sqlite_tables script for installation bindir
289 patch src/cats/update_sqlite_tables.in src/cats/update_sqlite_tables.in.patch
290
291 %configure \
292         --prefix=/usr \
293         --sbindir=/usr/sbin \
294         --sysconfdir=/etc/bacula \
295         --with-scriptdir=/etc/bacula \
296         --enable-smartalloc \
297         --enable-gnome \
298            --enable-static-fd \
299 %if %{mysql}
300         --with-mysql \
301 %endif
302 %if %{sqlite}
303         --with-sqlite=${cwd}/../depkgs/sqlite \
304 %endif
305 %if %{postgresql}
306         --with-postgresql \
307 %endif
308         --with-working-dir=%{working_dir} \
309         --with-pid-dir=/var/run \
310         --with-subsys-dir=/var/lock/subsys
311 make
312
313 cd src/filed
314 strip static-bacula-fd
315 cd ../../
316
317 %install
318  
319 cwd=${PWD}
320 mkdir -p $RPM_BUILD_ROOT/etc/init.d
321 mkdir -p $RPM_BUILD_ROOT/etc/logrotate.d
322 mkdir -p $RPM_BUILD_ROOT/usr/share/pixmaps
323 mkdir -p $RPM_BUILD_ROOT/usr/share/gnome/apps/System
324 mkdir -p $RPM_BUILD_ROOT/usr/share/applications
325 mkdir -p $RPM_BUILD_ROOT/etc/bacula/rescue
326 mkdir -p $RPM_BUILD_ROOT/etc/bacula/rescue/tomsrtbt
327
328 %if ! %{mysql}
329 mkdir -p $RPM_BUILD_ROOT%{sqlite_bindir}
330 %endif
331
332 make \
333         prefix=$RPM_BUILD_ROOT/usr \
334         sbindir=$RPM_BUILD_ROOT/usr/sbin \
335         sysconfdir=$RPM_BUILD_ROOT/etc/bacula \
336         scriptdir=$RPM_BUILD_ROOT/etc/bacula \
337         working_dir=$RPM_BUILD_ROOT%{working_dir} \
338         install
339
340 cd %{depkgs}
341 make \
342         prefix=$RPM_BUILD_ROOT/usr \
343         sbindir=$RPM_BUILD_ROOT/usr/sbin \
344         sysconfdir=$RPM_BUILD_ROOT/etc/bacula \
345         working_dir=$RPM_BUILD_ROOT%{working_dir} \
346         mandir=$RPM_BUILD_ROOT/usr/man \
347         mtx-install
348 cd ${cwd}
349
350 # fixme - make installs the mysql scripts for sqlite build
351 %if %{sqlite}
352 rm -f $RPM_BUILD_ROOT/etc/bacula/startmysql
353 rm -f $RPM_BUILD_ROOT/etc/bacula/stopmysql
354 rm -f $RPM_BUILD_ROOT/etc/bacula/grant_mysql_privileges
355 %endif
356
357 # fixme - make installs the mysql scripts for postgresql build
358 %if %{postgresql}
359 rm -f $RPM_BUILD_ROOT/etc/bacula/startmysql
360 rm -f $RPM_BUILD_ROOT/etc/bacula/stopmysql
361 %endif
362
363 # install the init scripts
364 %if %{su9}
365 cp platforms/suse/bacula-dir $RPM_BUILD_ROOT/etc/init.d/bacula-dir
366 cp platforms/suse/bacula-fd $RPM_BUILD_ROOT/etc/init.d/bacula-fd
367 cp platforms/suse/bacula-sd $RPM_BUILD_ROOT/etc/init.d/bacula-sd
368 %else
369 cp platforms/redhat/bacula-dir $RPM_BUILD_ROOT/etc/init.d/bacula-dir
370 cp platforms/redhat/bacula-fd $RPM_BUILD_ROOT/etc/init.d/bacula-fd
371 cp platforms/redhat/bacula-sd $RPM_BUILD_ROOT/etc/init.d/bacula-sd
372 %endif
373
374 # install the menu stuff
375 cp scripts/bacula.png $RPM_BUILD_ROOT/usr/share/pixmaps/bacula.png
376 cp scripts/bacula.desktop.gnome1 $RPM_BUILD_ROOT/usr/share/gnome/apps/System/bacula.desktop
377 cp scripts/bacula.desktop.gnome2 $RPM_BUILD_ROOT/usr/share/applications/bacula.desktop
378
379 # install sqlite
380 %if %{sqlite}
381 cp ../depkgs/sqlite/sqlite $RPM_BUILD_ROOT%{sqlite_bindir}/sqlite
382 cp ../depkgs/sqlite/sqlite.h $RPM_BUILD_ROOT%{sqlite_bindir}/sqlite.h
383 cp ../depkgs/sqlite/libsqlite.a $RPM_BUILD_ROOT%{sqlite_bindir}/libsqlite.a
384 %endif
385
386 # install the logrotate file
387 cp scripts/logrotate $RPM_BUILD_ROOT/etc/logrotate.d/bacula
388
389 # install the rescue stuff
390 # these are the rescue scripts
391 cp rescue/linux/backup.etc.list $RPM_BUILD_ROOT/etc/bacula/rescue/
392 cp rescue/linux/format_floppy $RPM_BUILD_ROOT/etc/bacula/rescue/
393 cp rescue/linux/getdiskinfo $RPM_BUILD_ROOT/etc/bacula/rescue/
394 cp rescue/linux/make_rescue_disk $RPM_BUILD_ROOT/etc/bacula/rescue/
395 cp rescue/linux/restore_bacula $RPM_BUILD_ROOT/etc/bacula/rescue/
396 cp rescue/linux/restore_etc $RPM_BUILD_ROOT/etc/bacula/rescue/
397 cp rescue/linux/run_grub $RPM_BUILD_ROOT/etc/bacula/rescue/
398 cp rescue/linux/run_lilo $RPM_BUILD_ROOT/etc/bacula/rescue/
399 cp rescue/linux/sfdisk.bz2 $RPM_BUILD_ROOT/etc/bacula/rescue/
400
401 # this is the static file daemon
402 cp src/filed/static-bacula-fd $RPM_BUILD_ROOT/etc/bacula/rescue/bacula-fd
403
404 # this is the tom's root boot disk
405 cp ../%{tomsrtbt}/* $RPM_BUILD_ROOT/etc/bacula/rescue/tomsrtbt/
406
407 %clean
408 [ "$RPM_BUILD_ROOT" != "/" ] && rm -rf "$RPM_BUILD_ROOT"
409
410 %if %{mysql}
411
412 %files mysql
413 %defattr(-,root,root)
414
415 %attr(0754,root,root) /etc/bacula/bacula
416 %attr(0754,root,root) /etc/bacula/bconsole
417 %attr(0754,root,root) /etc/bacula/fd
418 %attr(0754,root,root) /etc/bacula/gconsole
419 %attr(0754,root,root) /etc/bacula/create_mysql_database
420 %attr(0754,root,root) /etc/bacula/drop_mysql_database
421 %attr(0754,root,root) /etc/bacula/make_mysql_tables
422 %attr(0754,root,root) /etc/bacula/drop_mysql_tables
423 %attr(0754,root,root) /etc/bacula/update_mysql_tables
424 %attr(0754,root,root) /etc/bacula/grant_mysql_privileges
425 %attr(0754,root,root) /etc/bacula/create_bacula_database
426 %attr(0754,root,root) /etc/bacula/drop_bacula_database
427 %attr(0754,root,root) /etc/bacula/grant_bacula_privileges
428 %attr(0754,root,root) /etc/bacula/make_bacula_tables
429 %attr(0754,root,root) /etc/bacula/drop_bacula_tables
430 %attr(0754,root,root) /etc/bacula/update_bacula_tables
431 %attr(0754,root,root) /etc/bacula/make_catalog_backup
432 %attr(0754,root,root) /etc/bacula/delete_catalog_backup
433 %attr(0754,root,root) /etc/bacula/startmysql
434 %attr(0754,root,root) /etc/bacula/stopmysql
435 %attr(0754,root,root) /etc/bacula/mtx-changer
436 %attr(0754,root,root) /etc/init.d/bacula-dir
437 %attr(0754,root,root) /etc/init.d/bacula-fd
438 %attr(0754,root,root) /etc/init.d/bacula-sd
439
440 %attr(0644,root,root) %doc COPYING ChangeLog INSTALL README ReleaseNotes doc/*
441 %attr(0644,root,root) /usr/man/man1/*
442 %attr(0644,root,root) /usr/share/pixmaps/bacula.png
443 %attr(0644,root,root) /usr/share/gnome/apps/System/bacula.desktop
444 %attr(0644,root,root) /usr/share/applications/bacula.desktop
445 %attr(0644,root,root) %config(noreplace) /etc/bacula/gnome-console.conf
446 %attr(0644,root,root) /etc/logrotate.d/bacula
447
448 %attr(0640,root,root) %config(noreplace) /etc/bacula/bacula-dir.conf
449 %attr(0640,root,root) %config(noreplace) /etc/bacula/bacula-fd.conf
450 %attr(0640,root,root) %config(noreplace) /etc/bacula/bacula-sd.conf
451 %attr(0640,root,root) %config(noreplace) /etc/bacula/bconsole.conf
452 %attr(0640,root,root) /etc/bacula/query.sql
453 %attr(0640,root,root) %dir %{working_dir}
454
455 %attr(0750,root,root) /usr/sbin/*
456 %attr(0750,root,root) /etc/bacula/btraceback.gdb
457
458 %pre mysql
459 # test for bacula database older than version 6
460 # note: this ASSUMES no password has been set for bacula database
461 DB_VER=`mysql bacula -e 'select * from Version;'|tail -n 1 2>/dev/null`
462
463 if [ -n "$DB_VER" ] && [ "$DB_VER" -lt "6" ]; then
464         echo "This bacula upgrade will update a bacula database from version 6 to 7."
465         echo "You appear to be running database version $DB_VER. You must first update"
466         echo "your database to version 6 and then install this upgrade. The alternative"
467         echo "is to use /etc/bacula/drop_mysql_tables to delete all your your current"
468         echo "catalog information, then do the upgrade. Information on updating a"
469         echo "database older than version 6 can be found in the release notes."
470         exit 1
471 fi
472 # check for and copy /etc/bacula/console.conf to bconsole.conf
473 if [ -s /etc/bacula/console.conf ];then
474         cp /etc/bacula/console.conf /etc/bacula/bconsole.conf
475 fi
476
477 %post mysql
478 # delete then add our links
479 /sbin/chkconfig --del bacula-dir
480 /sbin/chkconfig --del bacula-fd
481 /sbin/chkconfig --del bacula-sd
482 /sbin/chkconfig --add bacula-dir
483 /sbin/chkconfig --add bacula-fd
484 /sbin/chkconfig --add bacula-sd
485
486 # add execute permissions for console
487 chmod 0755 /usr/sbin/gnome-console
488
489 # test for an existing database
490 # note: this ASSUMES no password has been set for bacula database
491 DB_VER=`mysql bacula -e 'select * from Version;'|tail -n 1 2>/dev/null`
492
493 # grant privileges and create tables if they do not exist
494 if [ -z "$DB_VER" ]; then
495         echo "Hmm, doesn't look like you have an existing database."
496         echo "Granting privileges for MySQL user bacula..."
497         /etc/bacula/grant_mysql_privileges
498         echo "Creating MySQL bacula database..."
499         /etc/bacula/create_mysql_database
500         echo "Creating bacula tables..."
501         /etc/bacula/make_mysql_tables
502
503 # check to see if we need to upgrade a 1.32 or lower database
504 elif [ "$DB_VER" -lt "7" ]; then
505         echo "This release requires an upgrade to your bacula database."
506         echo "Backing up your current database..."
507         mysqldump -f --opt bacula | bzip2 > %{working_dir}/bacula_backup.sql.bz2
508         echo "Upgrading bacula database ..."
509         /etc/bacula/update_mysql_tables
510         echo "If bacula works correctly you can remove the backup file %{working_dir}/bacula_backup.sql.bz2"
511
512 fi
513
514 %preun mysql
515 # delete our links
516 /sbin/chkconfig --del bacula-dir
517 /sbin/chkconfig --del bacula-fd
518 /sbin/chkconfig --del bacula-sd
519
520 %endif
521
522 %if %{sqlite}
523
524 %files sqlite
525 %defattr(-,root,root)
526
527 %attr(0754,root,root) /etc/bacula/bacula
528 %attr(0754,root,root) /etc/bacula/bconsole
529 %attr(0754,root,root) /etc/bacula/fd
530 %attr(0754,root,root) /etc/bacula/gconsole
531 %attr(0754,root,root) /etc/bacula/create_bacula_database
532 %attr(0754,root,root) /etc/bacula/drop_bacula_database
533 %attr(0754,root,root) /etc/bacula/grant_bacula_privileges
534 %attr(0754,root,root) /etc/bacula/make_bacula_tables
535 %attr(0754,root,root) /etc/bacula/drop_bacula_tables
536 %attr(0754,root,root) /etc/bacula/update_bacula_tables
537 %attr(0754,root,root) /etc/bacula/create_sqlite_database
538 %attr(0754,root,root) /etc/bacula/drop_sqlite_database
539 %attr(0754,root,root) /etc/bacula/grant_sqlite_privileges
540 %attr(0754,root,root) /etc/bacula/make_sqlite_tables
541 %attr(0754,root,root) /etc/bacula/drop_sqlite_tables
542 %attr(0754,root,root) /etc/bacula/update_sqlite_tables
543 %attr(0754,root,root) /etc/bacula/make_catalog_backup
544 %attr(0754,root,root) /etc/bacula/delete_catalog_backup
545 %attr(0754,root,root) /etc/bacula/mtx-changer
546 %attr(0754,root,root) /etc/init.d/bacula-dir
547 %attr(0754,root,root) /etc/init.d/bacula-fd
548 %attr(0754,root,root) /etc/init.d/bacula-sd
549
550 %attr(0644,root,root) %doc COPYING ChangeLog INSTALL README ReleaseNotes doc/*
551 %attr(0644,root,root) /usr/man/man1/*
552 %attr(0644,root,root) /usr/share/pixmaps/bacula.png
553 %attr(0644,root,root) /usr/share/gnome/apps/System/bacula.desktop
554 %attr(0644,root,root) /usr/share/applications/bacula.desktop
555 %attr(0644,root,root) %config(noreplace) /etc/bacula/gnome-console.conf
556 %attr(0644,root,root) /etc/logrotate.d/bacula
557
558 %attr(0640,root,root) %config(noreplace) /etc/bacula/bacula-dir.conf
559 %attr(0640,root,root) %config(noreplace) /etc/bacula/bacula-fd.conf
560 %attr(0640,root,root) %config(noreplace) /etc/bacula/bacula-sd.conf
561 %attr(0640,root,root) %config(noreplace) /etc/bacula/bconsole.conf
562 %attr(0640,root,root) /etc/bacula/query.sql
563 %attr(0640,root,root) %{sqlite_bindir}/libsqlite.a
564 %attr(0640,root,root) %{sqlite_bindir}/sqlite.h
565 %attr(0640,root,root) %dir %{working_dir}
566
567 %attr(0750,root,root) /usr/sbin/*
568 %attr(0750,root,root) %{sqlite_bindir}/sqlite
569 %attr(0750,root,root) /etc/bacula/btraceback.gdb
570
571 %pre sqlite
572 # test for bacula database older than version 6
573 if [ -s %{working_dir}/bacula.db ];then
574         DB_VER=`echo "select * from Version;" | %{sqlite_bindir}/sqlite %{working_dir}/bacula.db | tail -n 1 2>/dev/null`
575         if [ -n "$DB_VER" ] && [ "$DB_VER" -lt "6" ]; then
576                 echo "This bacula upgrade will update a bacula database from version 6 to 7."
577                 echo "You appear to be running database version $DB_VER. You must first update"
578                 echo "your database to version 6 and then install this upgrade. The alternative"
579                 echo "is to use /etc/bacula/drop_sqlite_tables to delete all your your current"
580                 echo "catalog information, then do the upgrade. Information on updating a"
581                 echo "database older than version 6 can be found in the release notes."
582                 exit 1
583         fi
584 fi
585 # check for and copy /etc/bacula/console.conf to bconsole.conf
586 if [ -s /etc/bacula/console.conf ];then
587         cp /etc/bacula/console.conf /etc/bacula/bconsole.conf
588 fi
589
590 %post sqlite
591 # delete then add our links
592 /sbin/chkconfig --del bacula-dir
593 /sbin/chkconfig --del bacula-fd
594 /sbin/chkconfig --del bacula-sd
595 /sbin/chkconfig --add bacula-dir
596 /sbin/chkconfig --add bacula-fd
597 /sbin/chkconfig --add bacula-sd
598
599 # add execute permission for console
600 chmod 0755 /usr/sbin/gnome-console
601
602 # test for an existing database
603 if [ -s %{working_dir}/bacula.db ]; then
604         DB_VER=`echo "select * from Version;" | %{sqlite_bindir}/sqlite %{working_dir}/bacula.db | tail -n 1 2>/dev/null`
605         # check to see if we need to upgrade a 1.32 or lower database
606         if [ "$DB_VER" -lt "7" ]; then
607                 echo "This release requires an upgrade to your bacula database."
608                 echo "Backing up your current database..."
609                 echo ".dump" | %{sqlite_bindir}/sqlite %{working_dir}/bacula.db | bzip2 > %{working_dir}/bacula_backup.sql.bz2
610                 echo "Upgrading bacula database ..."
611                 /etc/bacula/update_sqlite_tables
612                 echo "If bacula works correctly you can remove the backup file %{working_dir}/bacula_backup.sql.bz2"
613         fi
614 else
615         # create the database and tables
616         echo "Hmm, doesn't look like you have an existing database."
617         echo "Creating SQLite database..."
618         /etc/bacula/create_sqlite_database
619         echo "Creating the SQLite tables..."
620         /etc/bacula/make_sqlite_tables
621 fi
622
623 %preun sqlite
624 # delete our links
625 /sbin/chkconfig --del bacula-dir
626 /sbin/chkconfig --del bacula-fd
627 /sbin/chkconfig --del bacula-sd
628
629 %endif
630
631 %if %{postgresql}
632
633 %files postgresql
634 %defattr(-,root,root)
635
636 %attr(0754,root,root) /etc/bacula/bacula
637 %attr(0754,root,root) /etc/bacula/bconsole
638 %attr(0754,root,root) /etc/bacula/fd
639 %attr(0754,root,root) /etc/bacula/gconsole
640 %attr(0754,root,root) /etc/bacula/create_postgresql_database
641 %attr(0754,root,root) /etc/bacula/drop_postgresql_database
642 %attr(0754,root,root) /etc/bacula/make_postgresql_tables
643 %attr(0754,root,root) /etc/bacula/drop_postgresql_tables
644 %attr(0754,root,root) /etc/bacula/update_postgresql_tables
645 %attr(0754,root,root) /etc/bacula/grant_postgresql_privileges
646 %attr(0754,root,root) /etc/bacula/create_bacula_database
647 %attr(0754,root,root) /etc/bacula/drop_bacula_database
648 %attr(0754,root,root) /etc/bacula/grant_bacula_privileges
649 %attr(0754,root,root) /etc/bacula/make_bacula_tables
650 %attr(0754,root,root) /etc/bacula/drop_bacula_tables
651 %attr(0754,root,root) /etc/bacula/update_bacula_tables
652 %attr(0754,root,root) /etc/bacula/make_catalog_backup
653 %attr(0754,root,root) /etc/bacula/delete_catalog_backup
654 %attr(0754,root,root) /etc/bacula/mtx-changer
655 %attr(0754,root,root) /etc/init.d/bacula-dir
656 %attr(0754,root,root) /etc/init.d/bacula-fd
657 %attr(0754,root,root) /etc/init.d/bacula-sd
658
659 %attr(0644,root,root) %doc COPYING ChangeLog INSTALL README ReleaseNotes doc/*
660 %attr(0644,root,root) /usr/man/man1/*
661 %attr(0644,root,root) /usr/share/pixmaps/bacula.png
662 %attr(0644,root,root) /usr/share/gnome/apps/System/bacula.desktop
663 %attr(0644,root,root) /usr/share/applications/bacula.desktop
664 %attr(0644,root,root) %config(noreplace) /etc/bacula/gnome-console.conf
665 %attr(0644,root,root) /etc/logrotate.d/bacula
666
667 %attr(0640,root,root) %config(noreplace) /etc/bacula/bacula-dir.conf
668 %attr(0640,root,root) %config(noreplace) /etc/bacula/bacula-fd.conf
669 %attr(0640,root,root) %config(noreplace) /etc/bacula/bacula-sd.conf
670 %attr(0640,root,root) %config(noreplace) /etc/bacula/bconsole.conf
671 %attr(0640,root,root) /etc/bacula/query.sql
672 %attr(0640,root,root) %dir %{working_dir}
673
674 %attr(0750,root,root) /usr/sbin/*
675 %attr(0750,root,root) /etc/bacula/btraceback.gdb
676
677 %post postgresql
678 # delete then add our links
679 /sbin/chkconfig --del bacula-dir
680 /sbin/chkconfig --del bacula-fd
681 /sbin/chkconfig --del bacula-sd
682 /sbin/chkconfig --add bacula-dir
683 /sbin/chkconfig --add bacula-fd
684 /sbin/chkconfig --add bacula-sd
685
686 # add execute permissions for console
687 chmod 0755 /usr/sbin/gnome-console
688
689 # test for an existing database
690 # note: this ASSUMES no password has been set for bacula database
691 DB_VER=`echo 'select * from Version;' | psql bacula | tail -3 | head -1 2>/dev/null`
692
693 # grant privileges and create tables if they do not exist
694 if [ -z "$DB_VER" ]; then
695         echo "Hmm, doesn't look like you have an existing database."
696         echo "Granting privileges for PostgreSQL user bacula..."
697         /etc/bacula/grant_postgresql_privileges
698         echo "Creating PostgreSQL bacula database..."
699         /etc/bacula/create_postgresql_database
700         echo "Creating bacula tables..."
701         /etc/bacula/make_postgresql_tables
702
703 %preun postgresql
704 # delete our links
705 /sbin/chkconfig --del bacula-dir
706 /sbin/chkconfig --del bacula-fd
707 /sbin/chkconfig --del bacula-sd
708
709 %endif
710
711 %files client
712 %defattr(-,root,root)
713
714 %attr(0754,root,root) /etc/bacula/fd
715 %attr(0754,root,root) /etc/init.d/bacula-fd
716
717 %attr(0644,root,root) %doc COPYING ChangeLog INSTALL README ReleaseNotes doc/*
718 %attr(0644,root,root) /etc/logrotate.d/bacula
719
720 %attr(0640,root,root) %config(noreplace) /etc/bacula/bacula-fd.conf
721 %attr(0640,root,root) %dir %{working_dir}
722
723 %attr(0750,root,root) /usr/sbin/bacula-fd
724 %attr(0750,root,root) /usr/sbin/btraceback
725 %attr(0750,root,root) /etc/bacula/btraceback.gdb
726 %attr(0750,root,root) /usr/sbin/bsmtp
727
728
729 %post client
730 # delete then add our links
731 /sbin/chkconfig --del bacula-fd
732 /sbin/chkconfig --add bacula-fd
733
734 %preun client
735 # delete our links
736 /sbin/chkconfig --del bacula-fd
737
738 %files rescue
739 %defattr(-,root,root)
740 %attr(0644,root,root) /etc/bacula/rescue/backup.etc.list
741 %attr(0754,root,root) /etc/bacula/rescue/format_floppy
742 %attr(0754,root,root) /etc/bacula/rescue/getdiskinfo
743 %attr(0754,root,root) /etc/bacula/rescue/make_rescue_disk
744 %attr(0754,root,root) /etc/bacula/rescue/restore_bacula
745 %attr(0754,root,root) /etc/bacula/rescue/restore_etc
746 %attr(0754,root,root) /etc/bacula/rescue/run_grub
747 %attr(0754,root,root) /etc/bacula/rescue/run_lilo
748 %attr(0644,root,root) /etc/bacula/rescue/sfdisk.bz2
749 %attr(0754,root,root) /etc/bacula/rescue/bacula-fd
750 /etc/bacula/rescue/tomsrtbt/*
751
752 %post rescue
753 # link our current installed conf file to the rescue directory
754 ln -s /etc/bacula-fd.conf /etc/bacula/rescue/bacula-fd.conf
755
756 echo
757 echo "Ready to create the rescue files for this system."
758 echo "Press <enter> to continue..."
759 read A
760 echo
761
762 # run getdiskinfo
763 echo "Running getdiskinfo..."
764 cd /etc/bacula/rescue
765 ./getdiskinfo
766
767 echo
768 echo "Finished."
769 echo "To create a boot disk run \"./install.s\" from the /etc/bacula/rescue/tomsrtbt/"
770 echo "directory. To make the bacula rescue disk run"
771 echo "\"./make_rescue_disk --copy-static-bacula --copy-etc-files\" "
772 echo "from the /etc/bacula/rescue directory. To recreate the rescue"
773 echo "information for this system run ./getdiskinfo again."
774 echo
775
776 %preun rescue
777 # remove the files created after the initial rpm installation
778 rm -f /etc/bacula/rescue/bacula-fd.conf
779 rm -f /etc/bacula/rescue/partition.*
780 rm -f /etc/bacula/rescue/format.*
781 rm -f /etc/bacula/rescue/mount_drives
782 rm -f /etc/bacula/rescue/start_network
783 rm -f /etc/bacula/rescue/sfdisk
784 rm -rf /etc/bacula/rescue/diskinfo/*
785
786 %changelog
787 * Thu Feb 12 2004 D. Scott Barninger <barninger at fairfieldcomputers.com>
788 - added postgresql package
789 * Wed Feb 11 2004 D. Scott Barninger <barninger at fairfieldcomputers.com>
790 - corrected the if else logic in the dependancy sections
791 - changes for 1.34 release
792 - /etc/bacula/console is now /etc/bacula/bconsole
793 - /etc/bacula/console.conf is now /etc/bacula/bconsole.conf
794 - /usr/sbin/btraceback.gdb is now /etc/bacula/btraceback.gdb
795 - /usr/sbin/smtp is now /usr/sbin/bsmtp
796 - added new /etc/bacula/drop_mysql_database
797 - added new /etc/bacula/drop_sqlite_database
798 - added new /etc/bacula/grant_sqlite_privileges
799 - added new generic bacula database scripts in /etc/bacula
800 - added pre-install sections to check for database versions older than 6
801 - added check for /etc/bacula/console.conf and copy to bconsole.conf
802 * Sun Feb 08 2004 D. Scott Barninger <barninger at fairfieldcomputers.com>
803 - added /etc/bacula/update_sqlite_tables and /etc/bacula/update_mysql_tables for 1.34 release
804 - added testing for existing databases before executing any of the database creation scripts
805 - added defines working_dir and sqlite_bindir in place of hard coded paths
806 * Sat Jan 31 2004 D. Scott Barninger <barninger at fairfieldcomputers.com>
807 - added build configuration for SuSE.
808 - Thanks to Matt Vollmar <matt at panamschool.edu.sv> for his input
809 * Sat Jan 24 2004 D. Scott Barninger <barninger at fairfieldcomputers.com>
810 - added patch for create_sqlite_database to fix the installed bindir
811 - added execute of create_sqlite_database to post of sqlite package
812 * Sat Jan 10 2004 D. Scott Barninger <barninger at fairfieldcomputers.com>
813 - added virtual package Provides bacula-dir, bacula-sd, bacula-fd
814 - added bacula-fd as Requires for rescue package
815 - added build tag for Fedora Core 1
816 - cleaned up dependancies for all builds
817 * Thu Jan 1 2004 D. Scott Barninger <barninger at fairfieldcomputers.com>
818 - removed rh_version from package names
819 - added platform build configuration section to beginning of file
820 * Tue Nov 25 2003 D. Scott Barninger <barninger at fairfieldcomputers.com>
821 - removed make_static_bacula script from rescue package install
822 * Sun Nov 23 2003 D. Scott Barninger <barninger at fairfieldcomputers.com>
823 - Added define at top of file for depkgs version
824 - Added rescue sub-package
825 - Moved requires statements into proper sub-package locations
826 * Mon Oct 27 2003 D. Scott Barninger <barninger at fairfieldcomputers.com>
827 - Corrected Requires for Gnome 1.4/2.0 builds
828 * Fri Oct 24 2003 D. Scott Barninger <barninger at fairfieldcomputers.com>
829 - Added separate Source declaration for depkgs
830 - added patch for make_catalog_backup script
831 * Mon May 11 2003 D. Scott Barninger <barninger at fairfieldcomputers.com>
832 - Misc changes to mysql/sqlite build and rh7/8 menu differences
833 - Added rh_version to sub-package names
834 - Added installed but missing file /etc/bacula/gconsole
835 - rm'd /etc/bacula/grant_mysql_privileges on sqlite builds
836 * Thu May 08 2003 Kern Sibbald <kern at sibbald.com>
837 - Update spec for version 1.31 and combine client
838 * Sun Mar 30 2003 D. Scott Barninger <barninger at fairfieldcomputers.com>
839 - Initial spec file