]> git.sur5r.net Git - bacula/bacula/blob - bacula/platforms/suse/bacula.spec.in
Add rpm spec file support for usermode (Redhat) and xsu (SuSE) for gnome-console...
[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 # this should also work for RHEL
23 %define wb3 0
24 %{?build_wb3:%define wb3 1}
25 # SuSE build
26 # this is known to build on SuSE 8.2 and 9.0
27 %define su9 0
28 %{?build_su9:%define su9 1}
29
30 # test for a platform definition
31 %if ! %{rh7} && ! %{rh8} && ! %{rh9} && ! %{fc1} && ! %{wb3} && ! %{su9}
32 %{error: You must specify a platform. Please examine the spec file.}
33 exit 1
34 %endif
35
36 # database defines
37 # set for database support desired or define the build_xxx on the command line
38 %define mysql 0
39 %{?build_mysql:%define mysql 1}
40 %define sqlite 0
41 %{?build_sqlite:%define sqlite 1}
42 %define postgresql 0
43 %{?build_postgresql:%define postgresql 1}
44
45 # test for a database definition
46 %if ! %{mysql} && ! %{sqlite} && ! %{postgresql}
47 %{error: You must specify database support. Please examine the spec file.}
48 exit 1
49 %endif
50
51 Summary: Bacula - The Network Backup Solution
52 Name: bacula
53 Version: @VERSION@
54 Release: 1
55 Group: System Environment/Daemons
56 Copyright: GPL v2
57 Source0:http://www.prdownloads.sourceforge.net/bacula/%{name}-%{version}.tar.gz
58 Source1:http://www.prdownloads.sourceforge.net/bacula/depkgs-%{depkgs_version}.tar.gz
59 Source2:http://www.tux.org/pub/distributions/tinylinux/tomsrtbt/%{tomsrtbt}.tar.gz
60 BuildRoot: %{_tmppath}/%{name}-root
61 URL: http://www.bacula.org/
62 Vendor: The Bacula Team
63 Distribution: The Bacula Team
64 Packager: D. Scott Barninger <barninger@fairfieldcomputers.com>
65 BuildRequires: readline-devel, atk-devel, ncurses-devel, pango-devel
66 BuildRequires: libstdc++-devel, libxml2-devel, zlib-devel
67 %if %{rh7}
68 BuildRequires: libtermcap-devel
69 BuildRequires: gtk+-devel >= 1.2
70 BuildRequires: gnome-libs-devel >= 1.4
71 BuildRequires: glibc-devel >= 2.2
72 BuildRequires: ORBit-devel
73 BuildRequires: bonobo-devel
74 BuildRequires: GConf-devel
75 %endif
76 %if %{su9}
77 BuildRequires: termcap
78 BuildRequires: gtk2-devel >= 2.0
79 BuildRequires: libgnomeui-devel >= 2.0
80 BuildRequires: glibc-devel >= 2.3
81 BuildRequires: ORBit2-devel
82 BuildRequires: libart_lgpl-devel >= 2.0
83 BuildRequires: libbonobo-devel >= 2.0
84 BuildRequires: libbonoboui-devel >= 2.0
85 BuildRequires: bonobo-activation-devel
86 BuildRequires: gconf2-devel
87 BuildRequires: linc-devel
88 %endif
89 %if ! %{rh7} && ! %{su9}
90 BuildRequires: libtermcap-devel
91 BuildRequires: gtk2-devel >= 2.0
92 BuildRequires: libgnomeui-devel >= 2.0
93 BuildRequires: glibc-devel >= 2.3
94 BuildRequires: ORBit2-devel
95 BuildRequires: libart_lgpl-devel >= 2.0
96 BuildRequires: libbonobo-devel >= 2.0
97 BuildRequires: libbonoboui-devel >= 2.0
98 BuildRequires: bonobo-activation-devel
99 BuildRequires: GConf2-devel
100 BuildRequires: linc-devel
101 %endif
102
103 %if %{mysql}
104 BuildRequires: mysql-devel >= 3.23
105 %endif
106
107 %if %{postgresql} && %{wb3}
108 BuildRequires: rh-postgresql-devel >= 7
109 %endif
110
111 %if %{postgresql} && ! %{wb3}
112 BuildRequires: postgresql-devel >= 7
113 %endif
114
115 %description
116 Bacula - It comes by night and sucks the vital essence from your computers.
117
118 Bacula is a set of computer programs that permit you (or the system 
119 administrator) to manage backup, recovery, and verification of computer 
120 data across a network of computers of different kinds. In technical terms, 
121 it is a network client/server based backup program. Bacula is relatively 
122 easy to use and efficient, while offering many advanced storage management 
123 features that make it easy to find and recover lost or damaged files. 
124 Bacula source code has been released under the GPL version 2 license.
125
126 %if %{mysql}
127 %package mysql
128 %endif
129 %if %{sqlite}
130 %package sqlite
131 %endif
132 %if %{postgresql}
133 %package postgresql
134 %endif
135
136 Summary: Bacula - The Network Backup Solution
137 Group: System Environment/Daemons
138 Provides: bacula-dir, bacula-sd, bacula-fd, bacula-server
139 Conflicts: bacula-client
140 Requires: readline, perl, ncurses, libstdc++, zlib
141 %if %{rh7}
142 Requires: glibc >= 2.2
143 Requires: libtermcap
144 %endif
145 %if %{su9}
146 Requires: glibc >= 2.3
147 Requires: termcap
148 %endif
149 %if ! %{rh7} && ! %{su9}
150 Requires: glibc >= 2.3
151 Requires: libtermcap
152 %endif
153 %if %{mysql} && ! %{su9}
154 Requires: mysql >= 3.23
155 Requires: mysql-server >= 3.23
156 %endif
157 %if %{mysql} && %{su9}
158 Requires: mysql >= 3.23
159 Requires: mysql-client >= 3.23
160 %endif
161 %if %{postgresql} && %{wb3}
162 Requires: rh-postgresql >= 7
163 Requires: rh-postgresql-server >= 7
164 %endif
165 %if %{postgresql} && ! %{wb3}
166 Requires: postgresql >= 7
167 Requires: postgresql-server >= 7
168 %endif
169
170 %if %{mysql}
171 %description mysql
172 %endif
173 %if %{sqlite}
174 %description sqlite
175 %endif
176 %if %{postgresql}
177 %description postgresql
178 %endif
179
180 Bacula - It comes by night and sucks the vital essence from your computers.
181
182 Bacula is a set of computer programs that permit you (or the system 
183 administrator) to manage backup, recovery, and verification of computer 
184 data across a network of computers of different kinds. In technical terms, 
185 it is a network client/server based backup program. Bacula is relatively 
186 easy to use and efficient, while offering many advanced storage management 
187 features that make it easy to find and recover lost or damaged files. 
188 Bacula source code has been released under the GPL version 2 license.
189
190 %if %{mysql}
191 This build requires MySQL to be installed separately as the catalog database.
192 %endif
193 %if %{postgresql}
194 This build requires PostgreSQL to be installed separately as the catalog database.
195 %endif
196 %if %{sqlite}
197 This build incorporates sqlite as the catalog database, statically compiled.
198 %endif
199
200 %package client
201 Summary: Bacula - The Network Backup Solution
202 Group: System Environment/Daemons
203 Provides: bacula-fd
204 Requires: readline, perl, libstdc++, zlib
205
206 %if %{rh7}
207 Requires: glibc >= 2.2
208 Requires: libtermcap
209 %endif
210 %if %{su9}
211 Requires: glibc >= 2.3
212 Requires: termcap
213 %endif
214 %if ! %{rh7} && ! %{su9}
215 Requires: glibc >= 2.3
216 Requires: libtermcap
217 %endif
218
219 %description client
220 Bacula - It comes by night and sucks the vital essence from your computers.
221
222 Bacula is a set of computer programs that permit you (or the system 
223 administrator) to manage backup, recovery, and verification of computer 
224 data across a network of computers of different kinds. In technical terms, 
225 it is a network client/server based backup program. Bacula is relatively 
226 easy to use and efficient, while offering many advanced storage management 
227 features that make it easy to find and recover lost or damaged files. 
228 Bacula source code has been released under the GPL version 2 license.
229
230 This is the File daemon (Client) only package. It includes the command line 
231 console program.
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, bacula-postgresql or 
256 bacula-client package for your platform installed and configured before 
257 installing this package.
258
259 To create a boot disk run "./getdiskinfo" from the /etc/bacula/rescue
260 directory (this is done when the package is first installed), 
261 then run "./install.s" from the /etc/bacula/rescue/tomsrtbt/
262 directory. To make the bacula rescue disk run
263 "./make_rescue_disk --copy-static-bacula --copy-etc-files"
264 from the /etc/bacula/rescue directory. To recreate the rescue
265 information for this system run ./getdiskinfo again.
266
267 %package updatedb
268
269 Summary: Bacula - The Network Backup Solution
270 Group: System Environment/Daemons
271
272 %description updatedb
273 Bacula - It comes by night and sucks the vital essence from your computers.
274
275 Bacula is a set of computer programs that permit you (or the system 
276 administrator) to manage backup, recovery, and verification of computer 
277 data across a network of computers of different kinds. In technical terms, 
278 it is a network client/server based backup program. Bacula is relatively 
279 easy to use and efficient, while offering many advanced storage management 
280 features that make it easy to find and recover lost or damaged files. 
281 Bacula source code has been released under the GPL version 2 license.
282
283 This package installs scripts for updating older versions of the bacula
284 database.
285
286 %package gconsole
287 Summary: Bacula - The Network Backup Solution
288 Group: System Environment/Daemons
289 Requires: readline, atk, libstdc++, zlib, pango, libxml2, bacula-fd
290
291 %if %{rh7}
292 Requires: gtk+ >= 1.2
293 Requires: gnome-libs >= 1.4
294 Requires: glibc >= 2.2
295 Requires: ORBit
296 Requires: bonobo
297 Requires: GConf
298 %endif
299 %if %{su9}
300 Requires: gtk2 >= 2.0
301 Requires: libgnomeui >= 2.0
302 Requires: glibc >= 2.3
303 Requires: ORBit2
304 Requires: libart_lgpl >= 2.0
305 Requires: libbonobo >= 2.0
306 Requires: libbonoboui >= 2.0
307 Requires: bonobo-activation
308 Requires: gconf2
309 Requires: linc
310 %endif
311 %if ! %{rh7} && ! %{su9}
312 Requires: gtk2 >= 2.0
313 Requires: libgnomeui >= 2.0
314 Requires: glibc >= 2.3
315 Requires: ORBit2
316 Requires: libart_lgpl >= 2.0
317 Requires: libbonobo >= 2.0
318 Requires: libbonoboui >= 2.0
319 Requires: bonobo-activation
320 Requires: GConf2
321 Requires: linc
322 %endif
323 %if %{su9}
324 Requires: xsu
325 %else
326 Requires: usermode
327 %endif
328
329 %description gconsole
330 Bacula - It comes by night and sucks the vital essence from your computers.
331
332 Bacula is a set of computer programs that permit you (or the system 
333 administrator) to manage backup, recovery, and verification of computer 
334 data across a network of computers of different kinds. In technical terms, 
335 it is a network client/server based backup program. Bacula is relatively 
336 easy to use and efficient, while offering many advanced storage management 
337 features that make it easy to find and recover lost or damaged files. 
338 Bacula source code has been released under the GPL version 2 license.
339
340 This is the Gnome Console package. It is an add-on to the client or
341 server packages.
342
343 %prep
344
345 %setup -b 1
346 %setup -b 2
347
348 %build
349
350 %if %{su9}
351 export LDFLAGS="-L/usr/lib/termcap"
352 %endif
353
354 cwd=${PWD}
355 cd %{depkgs}
356 %if %{sqlite}
357 make sqlite
358 %endif
359 make mtx
360 cd ${cwd}
361
362 # patches for the bundled sqlite scripts
363
364 # patch the make_sqlite_tables script for installation bindir
365 patch src/cats/make_sqlite_tables.in src/cats/make_sqlite_tables.in.patch
366
367 # patch the create_sqlite_database script for installation bindir
368 patch src/cats/create_sqlite_database.in src/cats/create_sqlite_database.in.patch
369
370 # patch the make_catalog_backup script for installation bindir
371 patch src/cats/make_catalog_backup.in src/cats/make_catalog_backup.in.patch
372
373 # patch the update_sqlite_tables script for installation bindir
374 patch src/cats/update_sqlite_tables.in src/cats/update_sqlite_tables.in.patch
375
376 %configure \
377         --prefix=/usr \
378         --sbindir=/usr/sbin \
379         --sysconfdir=/etc/bacula \
380         --with-scriptdir=/etc/bacula \
381         --enable-smartalloc \
382         --enable-gnome \
383         --enable-static-fd \
384 %if %{mysql}
385         --with-mysql \
386 %endif
387 %if %{sqlite}
388         --with-sqlite=${cwd}/../depkgs/sqlite \
389 %endif
390 %if %{postgresql}
391         --with-postgresql \
392 %endif
393         --with-working-dir=%{working_dir} \
394         --with-pid-dir=/var/run \
395         --with-subsys-dir=/var/lock/subsys
396 make
397
398 cd src/filed
399 strip static-bacula-fd
400 cd ../../
401
402 %install
403  
404 cwd=${PWD}
405 [ "$RPM_BUILD_ROOT" != "/" ] && rm -rf "$RPM_BUILD_ROOT"
406 mkdir -p $RPM_BUILD_ROOT/etc/init.d
407 mkdir -p $RPM_BUILD_ROOT/etc/logrotate.d
408 mkdir -p $RPM_BUILD_ROOT/usr/share/pixmaps
409 mkdir -p $RPM_BUILD_ROOT/usr/share/gnome/apps/System
410 mkdir -p $RPM_BUILD_ROOT/usr/share/applications
411 mkdir -p $RPM_BUILD_ROOT/etc/bacula/rescue
412 mkdir -p $RPM_BUILD_ROOT/etc/bacula/rescue/tomsrtbt
413 mkdir -p $RPM_BUILD_ROOT/etc/bacula/updatedb
414 %if ! %{su9}
415 mkdir -p $RPM_BUILD_ROOT/etc/pam.d
416 mkdir -p $RPM_BUILD_ROOT/etc/security/console.apps
417 %endif
418
419 %if %{sqlite}
420 mkdir -p $RPM_BUILD_ROOT%{sqlite_bindir}
421 %endif
422
423 make \
424         prefix=$RPM_BUILD_ROOT/usr \
425         sbindir=$RPM_BUILD_ROOT/usr/sbin \
426         sysconfdir=$RPM_BUILD_ROOT/etc/bacula \
427         scriptdir=$RPM_BUILD_ROOT/etc/bacula \
428         working_dir=$RPM_BUILD_ROOT%{working_dir} \
429         install
430
431 cd %{depkgs}
432 make \
433         prefix=$RPM_BUILD_ROOT/usr \
434         sbindir=$RPM_BUILD_ROOT/usr/sbin \
435         sysconfdir=$RPM_BUILD_ROOT/etc/bacula \
436         working_dir=$RPM_BUILD_ROOT%{working_dir} \
437         mandir=$RPM_BUILD_ROOT/usr/man \
438         mtx-install
439 cd ${cwd}
440
441 # fixme - make installs the mysql scripts for sqlite build
442 %if %{sqlite}
443 rm -f $RPM_BUILD_ROOT/etc/bacula/startmysql
444 rm -f $RPM_BUILD_ROOT/etc/bacula/stopmysql
445 rm -f $RPM_BUILD_ROOT/etc/bacula/grant_mysql_privileges
446 %endif
447
448 # fixme - make installs the mysql scripts for postgresql build
449 %if %{postgresql}
450 rm -f $RPM_BUILD_ROOT/etc/bacula/startmysql
451 rm -f $RPM_BUILD_ROOT/etc/bacula/stopmysql
452 %endif
453
454 # install the init scripts
455 %if %{su9}
456 cp -p platforms/suse/bacula-dir $RPM_BUILD_ROOT/etc/init.d/bacula-dir
457 cp -p platforms/suse/bacula-fd $RPM_BUILD_ROOT/etc/init.d/bacula-fd
458 cp -p platforms/suse/bacula-sd $RPM_BUILD_ROOT/etc/init.d/bacula-sd
459 %else
460 cp -p platforms/redhat/bacula-dir $RPM_BUILD_ROOT/etc/init.d/bacula-dir
461 cp -p platforms/redhat/bacula-fd $RPM_BUILD_ROOT/etc/init.d/bacula-fd
462 cp -p platforms/redhat/bacula-sd $RPM_BUILD_ROOT/etc/init.d/bacula-sd
463 %endif
464 chmod 0754 $RPM_BUILD_ROOT/etc/init.d/*
465
466 # install the menu stuff
467 %if %{su9}
468 cp -p scripts/bacula.png $RPM_BUILD_ROOT/usr/share/pixmaps/bacula.png
469 cp -p scripts/bacula.desktop.gnome1.xsu $RPM_BUILD_ROOT/usr/share/gnome/apps/System/bacula.desktop
470 cp -p scripts/bacula.desktop.gnome2.xsu $RPM_BUILD_ROOT/usr/share/applications/bacula.desktop
471 %else
472 cp -p scripts/bacula.png $RPM_BUILD_ROOT/usr/share/pixmaps/bacula.png
473 cp -p scripts/bacula.desktop.gnome1.consolehelper $RPM_BUILD_ROOT/usr/share/gnome/apps/System/bacula.desktop
474 cp -p scripts/bacula.desktop.gnome2.consolehelper $RPM_BUILD_ROOT/usr/share/applications/bacula.desktop
475 cp -p scripts/gnome-console.console_apps $RPM_BUILD_ROOT/etc/security/console.apps/gnome-console
476 cp -p scripts/gnome-console.pamd $RPM_BUILD_ROOT/etc/pam.d/gnome-console
477 %endif
478
479 # install sqlite
480 %if %{sqlite}
481 cp -p ../depkgs/sqlite/sqlite $RPM_BUILD_ROOT%{sqlite_bindir}/sqlite
482 cp -p ../depkgs/sqlite/sqlite.h $RPM_BUILD_ROOT%{sqlite_bindir}/sqlite.h
483 cp -p ../depkgs/sqlite/libsqlite.a $RPM_BUILD_ROOT%{sqlite_bindir}/libsqlite.a
484 %endif
485
486 # install the logrotate file
487 cp -p scripts/logrotate $RPM_BUILD_ROOT/etc/logrotate.d/bacula
488
489 # install the rescue stuff
490 # these are the rescue scripts
491 cp -p rescue/linux/backup.etc.list $RPM_BUILD_ROOT/etc/bacula/rescue/
492 cp -p rescue/linux/format_floppy $RPM_BUILD_ROOT/etc/bacula/rescue/
493 cp -p rescue/linux/getdiskinfo $RPM_BUILD_ROOT/etc/bacula/rescue/
494 cp -p rescue/linux/make_rescue_disk $RPM_BUILD_ROOT/etc/bacula/rescue/
495 cp -p rescue/linux/restore_bacula $RPM_BUILD_ROOT/etc/bacula/rescue/
496 cp -p rescue/linux/restore_etc $RPM_BUILD_ROOT/etc/bacula/rescue/
497 cp -p rescue/linux/run_grub $RPM_BUILD_ROOT/etc/bacula/rescue/
498 cp -p rescue/linux/run_lilo $RPM_BUILD_ROOT/etc/bacula/rescue/
499 cp -p rescue/linux/sfdisk.bz2 $RPM_BUILD_ROOT/etc/bacula/rescue/
500
501 # this is the static file daemon
502 cp -p src/filed/static-bacula-fd $RPM_BUILD_ROOT/etc/bacula/rescue/bacula-fd
503
504 # this is the tom's root boot disk
505 cp -p ../%{tomsrtbt}/* $RPM_BUILD_ROOT/etc/bacula/rescue/tomsrtbt/
506
507 # install the updatedb scripts
508 cp -p updatedb/* $RPM_BUILD_ROOT/etc/bacula/updatedb/
509
510 # now clean up permissions that are left broken by the install
511 chmod o-r $RPM_BUILD_ROOT/etc/bacula/query.sql
512 chmod o-rwx $RPM_BUILD_ROOT/var/bacula
513
514 %clean
515 [ "$RPM_BUILD_ROOT" != "/" ] && rm -rf "$RPM_BUILD_ROOT"
516
517 %if %{mysql}
518
519 %files mysql
520 %defattr(-,root,root)
521
522 /etc/bacula/bacula
523 /etc/bacula/bconsole
524 /etc/bacula/fd
525 /etc/bacula/create_mysql_database
526 /etc/bacula/drop_mysql_database
527 /etc/bacula/make_mysql_tables
528 /etc/bacula/drop_mysql_tables
529 /etc/bacula/update_mysql_tables
530 /etc/bacula/grant_mysql_privileges
531 /etc/bacula/create_bacula_database
532 /etc/bacula/drop_bacula_database
533 /etc/bacula/grant_bacula_privileges
534 /etc/bacula/make_bacula_tables
535 /etc/bacula/drop_bacula_tables
536 /etc/bacula/update_bacula_tables
537 /etc/bacula/make_catalog_backup
538 /etc/bacula/delete_catalog_backup
539 /etc/bacula/startmysql
540 /etc/bacula/stopmysql
541 /etc/bacula/mtx-changer
542 /etc/init.d/bacula-dir
543 /etc/init.d/bacula-fd
544 /etc/init.d/bacula-sd
545
546 %doc COPYING ChangeLog INSTALL README ReleaseNotes doc/*
547 /usr/man/man1/*
548
549 /etc/logrotate.d/bacula
550
551 %config(noreplace) /etc/bacula/bacula-dir.conf
552 %config(noreplace) /etc/bacula/bacula-fd.conf
553 %config(noreplace) /etc/bacula/bacula-sd.conf
554 %config(noreplace) /etc/bacula/bconsole.conf
555 /etc/bacula/query.sql
556 %dir %{working_dir}
557
558 /usr/sbin/bacula-dir
559 /usr/sbin/bacula-fd
560 /usr/sbin/bacula-sd
561 /usr/sbin/bcopy
562 /usr/sbin/bextract
563 /usr/sbin/bls
564 /usr/sbin/bscan
565 /usr/sbin/btape
566 /usr/sbin/btraceback
567 /usr/sbin/bconsole
568 /usr/sbin/dbcheck
569 /usr/sbin/loaderinfo
570 /usr/sbin/mtx
571 /usr/sbin/scsitape
572 /usr/sbin/bsmtp
573 /usr/sbin/tapeinfo
574 /usr/sbin/static-bacula-fd
575 /etc/bacula/btraceback.gdb
576
577 %pre mysql
578 # test for bacula database older than version 6
579 # note: this ASSUMES no password has been set for bacula database
580 DB_VER=`mysql bacula -e 'select * from Version;'|tail -n 1 2>/dev/null`
581
582 if [ -n "$DB_VER" ] && [ "$DB_VER" -lt "6" ]; then
583         echo "This bacula upgrade will update a bacula database from version 6 to 7."
584         echo "You appear to be running database version $DB_VER. You must first update"
585         echo "your database to version 6 and then install this upgrade. The alternative"
586         echo "is to use /etc/bacula/drop_mysql_tables to delete all your your current"
587         echo "catalog information, then do the upgrade. Information on updating a"
588         echo "database older than version 6 can be found in the release notes."
589         exit 1
590 fi
591 # check for and copy /etc/bacula/console.conf to bconsole.conf
592 if [ -s /etc/bacula/console.conf ];then
593         cp -p /etc/bacula/console.conf /etc/bacula/bconsole.conf
594 fi
595
596 %post mysql
597
598 # add our links
599 if [ "$1" -ge 1 ] ; then
600 /sbin/chkconfig --add bacula-dir
601 /sbin/chkconfig --add bacula-fd
602 /sbin/chkconfig --add bacula-sd
603 fi
604
605 # test for an existing database
606 # note: this ASSUMES no password has been set for bacula database
607 DB_VER=`mysql bacula -e 'select * from Version;'|tail -n 1 2>/dev/null`
608
609 # grant privileges and create tables if they do not exist
610 if [ -z "$DB_VER" ]; then
611         echo "Hmm, doesn't look like you have an existing database."
612         echo "Granting privileges for MySQL user bacula..."
613         /etc/bacula/grant_mysql_privileges
614         echo "Creating MySQL bacula database..."
615         /etc/bacula/create_mysql_database
616         echo "Creating bacula tables..."
617         /etc/bacula/make_mysql_tables
618
619 # check to see if we need to upgrade a 1.32 or lower database
620 elif [ "$DB_VER" -lt "7" ]; then
621         echo "This release requires an upgrade to your bacula database."
622         echo "Backing up your current database..."
623         mysqldump -f --opt bacula | bzip2 > %{working_dir}/bacula_backup.sql.bz2
624         echo "Upgrading bacula database ..."
625         /etc/bacula/update_mysql_tables
626         echo "If bacula works correctly you can remove the backup file %{working_dir}/bacula_backup.sql.bz2"
627
628 fi
629
630 %preun mysql
631 # delete our links
632 if [ $1 = 0 ]; then
633 /sbin/chkconfig --del bacula-dir
634 /sbin/chkconfig --del bacula-fd
635 /sbin/chkconfig --del bacula-sd
636 fi
637
638 %endif
639
640 %if %{sqlite}
641
642 %files sqlite
643 %defattr(-,root,root)
644
645 /etc/bacula/bacula
646 /etc/bacula/bconsole
647 /etc/bacula/fd
648 /etc/bacula/create_bacula_database
649 /etc/bacula/drop_bacula_database
650 /etc/bacula/grant_bacula_privileges
651 /etc/bacula/make_bacula_tables
652 /etc/bacula/drop_bacula_tables
653 /etc/bacula/update_bacula_tables
654 /etc/bacula/create_sqlite_database
655 /etc/bacula/drop_sqlite_database
656 /etc/bacula/grant_sqlite_privileges
657 /etc/bacula/make_sqlite_tables
658 /etc/bacula/drop_sqlite_tables
659 /etc/bacula/update_sqlite_tables
660 /etc/bacula/make_catalog_backup
661 /etc/bacula/delete_catalog_backup
662 /etc/bacula/mtx-changer
663 /etc/init.d/bacula-dir
664 /etc/init.d/bacula-fd
665 /etc/init.d/bacula-sd
666
667 %doc COPYING ChangeLog INSTALL README ReleaseNotes doc/*
668 /usr/man/man1/*
669
670 /etc/logrotate.d/bacula
671
672 %config(noreplace) /etc/bacula/bacula-dir.conf
673 %config(noreplace) /etc/bacula/bacula-fd.conf
674 %config(noreplace) /etc/bacula/bacula-sd.conf
675 %config(noreplace) /etc/bacula/bconsole.conf
676 /etc/bacula/query.sql
677 %{sqlite_bindir}/libsqlite.a
678 %{sqlite_bindir}/sqlite.h
679 %dir %{working_dir}
680
681 /usr/sbin/bacula-dir
682 /usr/sbin/bacula-fd
683 /usr/sbin/bacula-sd
684 /usr/sbin/bcopy
685 /usr/sbin/bextract
686 /usr/sbin/bls
687 /usr/sbin/bscan
688 /usr/sbin/btape
689 /usr/sbin/btraceback
690 /usr/sbin/bconsole
691 /usr/sbin/dbcheck
692 /usr/sbin/loaderinfo
693 /usr/sbin/mtx
694 /usr/sbin/scsitape
695 /usr/sbin/bsmtp
696 /usr/sbin/tapeinfo
697 /usr/sbin/static-bacula-fd
698 %{sqlite_bindir}/sqlite
699 /etc/bacula/btraceback.gdb
700
701 %pre sqlite
702 # test for bacula database older than version 6
703 if [ -s %{working_dir}/bacula.db ];then
704         DB_VER=`echo "select * from Version;" | %{sqlite_bindir}/sqlite %{working_dir}/bacula.db | tail -n 1 2>/dev/null`
705         if [ -n "$DB_VER" ] && [ "$DB_VER" -lt "6" ]; then
706                 echo "This bacula upgrade will update a bacula database from version 6 to 7."
707                 echo "You appear to be running database version $DB_VER. You must first update"
708                 echo "your database to version 6 and then install this upgrade. The alternative"
709                 echo "is to use /etc/bacula/drop_sqlite_tables to delete all your your current"
710                 echo "catalog information, then do the upgrade. Information on updating a"
711                 echo "database older than version 6 can be found in the release notes."
712                 exit 1
713         fi
714 fi
715 # check for and copy /etc/bacula/console.conf to bconsole.conf
716 if [ -s /etc/bacula/console.conf ];then
717         cp -p /etc/bacula/console.conf /etc/bacula/bconsole.conf
718 fi
719
720 %post sqlite
721 # add our links
722 if [ "$1" -ge 1 ] ; then
723 /sbin/chkconfig --add bacula-dir
724 /sbin/chkconfig --add bacula-fd
725 /sbin/chkconfig --add bacula-sd
726 fi
727
728 # test for an existing database
729 if [ -s %{working_dir}/bacula.db ]; then
730         DB_VER=`echo "select * from Version;" | %{sqlite_bindir}/sqlite %{working_dir}/bacula.db | tail -n 1 2>/dev/null`
731         # check to see if we need to upgrade a 1.32 or lower database
732         if [ "$DB_VER" -lt "7" ]; then
733                 echo "This release requires an upgrade to your bacula database."
734                 echo "Backing up your current database..."
735                 echo ".dump" | %{sqlite_bindir}/sqlite %{working_dir}/bacula.db | bzip2 > %{working_dir}/bacula_backup.sql.bz2
736                 echo "Upgrading bacula database ..."
737                 /etc/bacula/update_sqlite_tables
738                 echo "If bacula works correctly you can remove the backup file %{working_dir}/bacula_backup.sql.bz2"
739         fi
740 else
741         # create the database and tables
742         echo "Hmm, doesn't look like you have an existing database."
743         echo "Creating SQLite database..."
744         /etc/bacula/create_sqlite_database
745         echo "Creating the SQLite tables..."
746         /etc/bacula/make_sqlite_tables
747 fi
748
749 %preun sqlite
750 # delete our links
751 if [ $1 = 0 ]; then
752 /sbin/chkconfig --del bacula-dir
753 /sbin/chkconfig --del bacula-fd
754 /sbin/chkconfig --del bacula-sd
755 fi
756
757 %endif
758
759 %if %{postgresql}
760
761 %files postgresql
762 %defattr(-,root,root)
763
764 /etc/bacula/bacula
765 /etc/bacula/bconsole
766 /etc/bacula/fd
767 /etc/bacula/create_postgresql_database
768 /etc/bacula/drop_postgresql_database
769 /etc/bacula/make_postgresql_tables
770 /etc/bacula/drop_postgresql_tables
771 /etc/bacula/update_postgresql_tables
772 /etc/bacula/grant_postgresql_privileges
773 /etc/bacula/create_bacula_database
774 /etc/bacula/drop_bacula_database
775 /etc/bacula/grant_bacula_privileges
776 /etc/bacula/make_bacula_tables
777 /etc/bacula/drop_bacula_tables
778 /etc/bacula/update_bacula_tables
779 /etc/bacula/make_catalog_backup
780 /etc/bacula/delete_catalog_backup
781 /etc/bacula/mtx-changer
782 /etc/init.d/bacula-dir
783 /etc/init.d/bacula-fd
784 /etc/init.d/bacula-sd
785
786 %doc COPYING ChangeLog INSTALL README ReleaseNotes doc/*
787 /usr/man/man1/*
788
789 /etc/logrotate.d/bacula
790
791 %config(noreplace) /etc/bacula/bacula-dir.conf
792 %config(noreplace) /etc/bacula/bacula-fd.conf
793 %config(noreplace) /etc/bacula/bacula-sd.conf
794 %config(noreplace) /etc/bacula/bconsole.conf
795 /etc/bacula/query.sql
796 %dir %{working_dir}
797
798 /usr/sbin/bacula-dir
799 /usr/sbin/bacula-fd
800 /usr/sbin/bacula-sd
801 /usr/sbin/bcopy
802 /usr/sbin/bextract
803 /usr/sbin/bls
804 /usr/sbin/bscan
805 /usr/sbin/btape
806 /usr/sbin/btraceback
807 /usr/sbin/bconsole
808 /usr/sbin/dbcheck
809 /usr/sbin/loaderinfo
810 /usr/sbin/mtx
811 /usr/sbin/scsitape
812 /usr/sbin/bsmtp
813 /usr/sbin/tapeinfo
814 /usr/sbin/static-bacula-fd
815 /etc/bacula/btraceback.gdb
816
817 %post postgresql
818 # add our links
819 if [ "$1" -ge 1 ] ; then
820 /sbin/chkconfig --add bacula-dir
821 /sbin/chkconfig --add bacula-fd
822 /sbin/chkconfig --add bacula-sd
823 fi
824
825 # test for an existing database
826 # note: this ASSUMES no password has been set for bacula database
827 DB_VER=`echo 'select * from Version;' | psql bacula | tail -3 | head -1 2>/dev/null`
828
829 # grant privileges and create tables if they do not exist
830 if [ -z "$DB_VER" ]; then
831         echo "Hmm, doesn't look like you have an existing database."
832         echo "Granting privileges for PostgreSQL user bacula..."
833         /etc/bacula/grant_postgresql_privileges
834         echo "Creating PostgreSQL bacula database..."
835         /etc/bacula/create_postgresql_database
836         echo "Creating bacula tables..."
837         /etc/bacula/make_postgresql_tables
838         
839
840 %preun postgresql
841 # delete our links
842 if [ $1 = 0 ]; then
843 /sbin/chkconfig --del bacula-dir
844 /sbin/chkconfig --del bacula-fd
845 /sbin/chkconfig --del bacula-sd
846 fi
847
848 %endif
849
850 %files client
851 %defattr(-,root,root)
852
853 /etc/bacula/fd
854 /etc/bacula/bconsole
855 /etc/init.d/bacula-fd
856
857 %doc COPYING ChangeLog INSTALL README ReleaseNotes doc/*
858 /etc/logrotate.d/bacula
859
860 %config(noreplace) /etc/bacula/bacula-fd.conf
861 %config(noreplace) /etc/bacula/bconsole.conf
862 %dir %{working_dir}
863
864 /usr/sbin/bacula-fd
865 /usr/sbin/btraceback
866 /etc/bacula/btraceback.gdb
867 /usr/sbin/bsmtp
868 /usr/sbin/bconsole
869
870
871 %post client
872 # add our link
873 if [ "$1" -ge 1 ] ; then
874 /sbin/chkconfig --add bacula-fd
875 fi
876
877 %preun client
878 # delete our link
879 if [ $1 = 0 ]; then
880 /sbin/chkconfig --del bacula-fd
881 fi
882
883 %files rescue
884 %defattr(-,root,root)
885 /etc/bacula/rescue/backup.etc.list
886 /etc/bacula/rescue/format_floppy
887 /etc/bacula/rescue/getdiskinfo
888 /etc/bacula/rescue/make_rescue_disk
889 /etc/bacula/rescue/restore_bacula
890 /etc/bacula/rescue/restore_etc
891 /etc/bacula/rescue/run_grub
892 /etc/bacula/rescue/run_lilo
893 /etc/bacula/rescue/sfdisk.bz2
894 /etc/bacula/rescue/bacula-fd
895 /etc/bacula/rescue/tomsrtbt/*
896
897 %post rescue
898 # link our current installed conf file to the rescue directory
899 ln -s /etc/bacula-fd.conf /etc/bacula/rescue/bacula-fd.conf
900
901 # run getdiskinfo
902 echo "Creating rescue files for this system..."
903 cd /etc/bacula/rescue
904 ./getdiskinfo
905
906 %preun rescue
907 # remove the files created after the initial rpm installation
908 rm -f /etc/bacula/rescue/bacula-fd.conf
909 rm -f /etc/bacula/rescue/partition.*
910 rm -f /etc/bacula/rescue/format.*
911 rm -f /etc/bacula/rescue/mount_drives
912 rm -f /etc/bacula/rescue/start_network
913 rm -f /etc/bacula/rescue/sfdisk
914 rm -rf /etc/bacula/rescue/diskinfo/*
915
916 %files updatedb
917 %defattr(-,root,root)
918 /etc/bacula/updatedb/*
919
920 %post updatedb
921 echo "The database update scripts were installed to /etc/bacula/updatedb"
922
923 %files gconsole
924 %defattr(-,root,root)
925 /usr/sbin/gnome-console
926 /etc/bacula/gconsole
927 %config(noreplace) /etc/bacula/gnome-console.conf
928 /usr/share/pixmaps/bacula.png
929 /usr/share/gnome/apps/System/bacula.desktop
930 /usr/share/applications/bacula.desktop
931
932 %if ! %{su9} 
933 # add the console helper files
934 %config(noreplace,missingok) /etc/pam.d/gnome-console
935 %config(noreplace,missingok) /etc/security/console.apps/gnome-console
936
937 %post gconsole
938 # add gnome-console consolehelper link
939 ln -s /usr/bin/consolehelper /usr/bin/gnome-console
940
941 %postun gconsole
942 # remove gnome-console consolehelper link
943 rm -f /usr/bin/gnome-console
944 %endif
945
946 %changelog
947 * Tue Mar 30 2004 D. Scott Barninger <barninger at fairfieldcomputers.com>
948 - added usermode (Redhat) and xsu (SuSE) support for gnome-console;
949 - rpm's horrible bug that prevents nested conditional macros prevents me
950 - from implementing these 2 separate approaches within the conditionals which
951 - create the separate server packages.
952 - the solution adopted is to remove the gnome-console files from the server packages
953 - so bacula-gconsole is now an add on for both client and server packages.
954 - this also now allows the server packages to be install on machines without
955 - an X-server and we can still maintain a single spec file.
956 - added tests to make sure we have defined platform and database macros.
957 * Sat Mar 13 2004 D. Scott Barninger <barninger at fairfieldcomputers.com>
958 - corrected mysql prerequisites for suse
959 * Mon Mar 1 2004 D. Scott Barninger <barninger at fairfieldcomputers.com>
960 - replaced all cp commands with cp -p
961 - removed addition of a+x permissions on gnome-console
962 - corrected permissions on init scripts
963 * Sat Feb 28 2004 D. Scott Barninger <barninger at fairfieldcomputers.com>
964 - corrected creation of sqlite_bindir in install from !mysql to sqlite
965 -
966 - various cleanup patches from Michael K. Johnson:
967 - corrected post install routines for nicer chkconfig
968 - removed chmod changes in post routines and moved to install section
969 - removed interactive nature of post routine for rescue package
970 - added description of building rescue disks to the description of rescue package
971 - added clean of build root to beginning of install
972 - removed specifying attr in all file lists
973 * Fri Feb 20 2004 D. Scott Barninger <barninger at fairfieldcomputers.com>
974 - added bconsole to client package
975 - added gconsole package as add-on to client
976 - removed spurious dependancies on updatedb package (!cut/paste)
977 * Thu Feb 19 2004 D. Scott Barninger <barninger at fairfieldcomputers.com>
978 - added updatedb package
979 * Thu Feb 12 2004 D. Scott Barninger <barninger at fairfieldcomputers.com>
980 - added postgresql package
981 * Wed Feb 11 2004 D. Scott Barninger <barninger at fairfieldcomputers.com>
982 - corrected the if else logic in the dependancy sections
983 - changes for 1.34 release
984 - /etc/bacula/console is now /etc/bacula/bconsole
985 - /etc/bacula/console.conf is now /etc/bacula/bconsole.conf
986 - /usr/sbin/btraceback.gdb is now /etc/bacula/btraceback.gdb
987 - /usr/sbin/smtp is now /usr/sbin/bsmtp
988 - added new /etc/bacula/drop_mysql_database
989 - added new /etc/bacula/drop_sqlite_database
990 - added new /etc/bacula/grant_sqlite_privileges
991 - added new generic bacula database scripts in /etc/bacula
992 - added pre-install sections to check for database versions older than 6
993 - added check for /etc/bacula/console.conf and copy to bconsole.conf
994 * Sun Feb 08 2004 D. Scott Barninger <barninger at fairfieldcomputers.com>
995 - added /etc/bacula/update_sqlite_tables and /etc/bacula/update_mysql_tables for 1.34 release
996 - added testing for existing databases before executing any of the database creation scripts
997 - added defines working_dir and sqlite_bindir in place of hard coded paths
998 * Sat Jan 31 2004 D. Scott Barninger <barninger at fairfieldcomputers.com>
999 - added build configuration for SuSE.
1000 - Thanks to Matt Vollmar <matt at panamschool.edu.sv> for his input
1001 * Sat Jan 24 2004 D. Scott Barninger <barninger at fairfieldcomputers.com>
1002 - added patch for create_sqlite_database to fix the installed bindir
1003 - added execute of create_sqlite_database to post of sqlite package
1004 * Sat Jan 10 2004 D. Scott Barninger <barninger at fairfieldcomputers.com>
1005 - added virtual package Provides bacula-dir, bacula-sd, bacula-fd
1006 - added bacula-fd as Requires for rescue package
1007 - added build tag for Fedora Core 1
1008 - cleaned up dependancies for all builds
1009 * Thu Jan 1 2004 D. Scott Barninger <barninger at fairfieldcomputers.com>
1010 - removed rh_version from package names
1011 - added platform build configuration section to beginning of file
1012 * Tue Nov 25 2003 D. Scott Barninger <barninger at fairfieldcomputers.com>
1013 - removed make_static_bacula script from rescue package install
1014 * Sun Nov 23 2003 D. Scott Barninger <barninger at fairfieldcomputers.com>
1015 - Added define at top of file for depkgs version
1016 - Added rescue sub-package
1017 - Moved requires statements into proper sub-package locations
1018 * Mon Oct 27 2003 D. Scott Barninger <barninger at fairfieldcomputers.com>
1019 - Corrected Requires for Gnome 1.4/2.0 builds
1020 * Fri Oct 24 2003 D. Scott Barninger <barninger at fairfieldcomputers.com>
1021 - Added separate source declaration for depkgs
1022 - added patch for make_catalog_backup script
1023 * Mon May 11 2003 D. Scott Barninger <barninger at fairfieldcomputers.com>
1024 - Misc changes to mysql/sqlite build and rh7/8 menu differences
1025 - Added rh_version to sub-package names
1026 - Added installed but missing file /etc/bacula/gconsole
1027 - rm'd /etc/bacula/grant_mysql_privileges on sqlite builds
1028 * Thu May 08 2003 Kern Sibbald <kern at sibbald.com>
1029 - Update spec for version 1.31 and combine client
1030 * Sun Mar 30 2003 D. Scott Barninger <barninger at fairfieldcomputers.com>
1031 - Initial spec file