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