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