]> git.sur5r.net Git - bacula/bacula/blob - bacula/platforms/redhat/bacula.spec.in
small bugfix for VSS-support (only relevant if WIN32_VSS enabled)
[bacula/bacula] / bacula / platforms / redhat / bacula.spec.in
1 # Bacula RPM spec file
2 # Copyright (C) 2004 Kern Sibbald
3
4 # Platform Build Configuration
5
6 # basic defines for every build
7 %define depkgs ../depkgs
8 %define depkgs_version 29Oct04
9 %define tomsrtbt tomsrtbt-2.0.103
10 %define sqlite_bindir /usr/lib/bacula/sqlite
11 %define working_dir /var/bacula
12 %define daemon_user root
13 %define daemon_group bacula
14 %define group_file /etc/group
15 %define groupadd /usr/sbin/groupadd
16
17 # platform defines - set one below or define the build_xxx on the command line
18 # RedHat builds
19 %define rh7 0
20 %{?build_rh7:%define rh7 1}
21 %define rh8 0
22 %{?build_rh8:%define rh8 1}
23 %define rh9 0
24 %{?build_rh9:%define rh9 1}
25 # Fedora Core build
26 %define fc1 0
27 %{?build_fc1:%define fc1 1}
28 %define fc3 0
29 %{?build_fc3:%define fc3 1}
30 # Whitebox Enterprise build
31 %define wb3 0
32 %{?build_wb3:%define wb3 1}
33 # RedHat Enterprise builds
34 %define rhel3 0
35 %{?build_rhel3:%define rhel3 1}
36 %{?build_rhel3:%define wb3 1}
37 %define rhel4 0
38 %{?build_rhel4:%define rhel4 1}
39 %{?build_rhel4:%define fc3 1}
40 # CentOS build
41 %define centos4 0
42 %{?build_centos4:%define centos4 1}
43 %{?build_centos4:%define fc3 1}
44 # SuSE build
45 %define su9 0
46 %{?build_su9:%define su9 1}
47 # Mandrake build
48 %define mdk 0
49 %{?build_mdk:%define mdk 1}
50
51 # test for a platform definition
52 %if ! %{rh7} && ! %{rh8} && ! %{rh9} && ! %{fc1} && ! %{fc3} && ! %{wb3} && ! %{su9} && ! %{mdk}
53 %{error: You must specify a platform. Please examine the spec file.}
54 exit 1
55 %endif
56
57 # database defines
58 # set for database support desired or define the build_xxx on the command line
59 %define mysql 0
60 %{?build_mysql:%define mysql 1}
61 # if using mysql 4.x define this and mysql above
62 # currently: Mandrake 10.1, SuSE 9.2, RHEL4
63 %define mysql4 0
64 %{?build_mysql4:%define mysql4 1}
65 %define sqlite 0
66 %{?build_sqlite:%define sqlite 1}
67 %define postgresql 0
68 %{?build_postgresql:%define postgresql 1}
69
70 # test for a database definition
71 %if ! %{mysql} && ! %{sqlite} && ! %{postgresql}
72 %{error: You must specify database support. Please examine the spec file.}
73 exit 1
74 %endif
75
76 # 64 bit support
77 %define x86_64 0
78 %{?build_x86_64:%define x86_64 1}
79
80 # check what distribution we are
81 %if %{rh7} || %{rh8} || %{rh9} || %{rhel3} || %{rhel4}
82 %define _dist %(grep Red /etc/redhat-release)
83 %endif
84 %if %{fc1}
85 %define _dist %(grep Fedora /etc/redhat-release)
86 %endif
87 %if %{centos4}
88 %define _dist %(grep CentOS /etc/redhat-release)
89 %endif
90 %if %{fc3} && ! %{rhel4} && ! %{centos4}
91 %define _dist %(grep Fedora /etc/redhat-release)
92 %endif
93 %if %{wb3} && ! %{rhel3}
94 %define _dist %(grep White /etc/whitebox-release)
95 %endif
96 %if %{su9}
97 %define _dist %(grep SuSE /etc/SuSE-release)
98 %endif
99 %if %{mdk}
100 %define _dist %(grep Mandrake /etc/mandrake-release)
101 %endif
102
103 Summary: Bacula - The Network Backup Solution
104 Name: bacula
105 Version: @VERSION@
106 Release: 1
107 Group: System Environment/Daemons
108 Copyright: GPL v2
109 Source0:http://www.prdownloads.sourceforge.net/bacula/%{name}-%{version}.tar.gz
110 Source1:http://www.prdownloads.sourceforge.net/bacula/depkgs-%{depkgs_version}.tar.gz
111 Source2:http://www.tux.org/pub/distributions/tinylinux/tomsrtbt/%{tomsrtbt}.tar.gz
112 Source3: Release_Notes-%{version}-%{release}.tar.gz
113 BuildRoot: %{_tmppath}/%{name}-root
114 URL: http://www.bacula.org/
115 Vendor: The Bacula Team
116 Distribution: %{_dist}
117 Packager: D. Scott Barninger <barninger@fairfieldcomputers.com>
118 BuildRequires: atk-devel, ncurses-devel, pango-devel, perl
119 BuildRequires: libstdc++-devel, libxml2-devel, zlib-devel, pkgconfig
120 %if %{rh7}
121 BuildRequires: libtermcap-devel
122 BuildRequires: gtk+-devel >= 1.2
123 BuildRequires: gnome-libs-devel >= 1.4
124 BuildRequires: glibc-devel >= 2.2
125 BuildRequires: ORBit-devel
126 BuildRequires: bonobo-devel
127 BuildRequires: GConf-devel
128 BuildRequires: freetype-devel
129 BuildRequires: tetex
130 BuildRequires: tetex-latex
131 %endif
132 %if %{su9}
133 BuildRequires: termcap
134 BuildRequires: libgnome >= 2.0
135 BuildRequires: gtk2-devel >= 2.0
136 BuildRequires: libgnomeui-devel >= 2.0
137 BuildRequires: glibc-devel >= 2.3
138 BuildRequires: ORBit2-devel
139 BuildRequires: libart_lgpl-devel >= 2.0
140 BuildRequires: libbonobo-devel >= 2.0
141 BuildRequires: libbonoboui-devel >= 2.0
142 BuildRequires: bonobo-activation-devel
143 BuildRequires: gconf2-devel
144 BuildRequires: linc-devel
145 BuildRequires: freetype2-devel
146 BuildRequires: tetex
147 BuildRequires: latex2html
148 %endif
149 %if %{mdk}
150 BuildRequires: libtermcap-devel
151 BuildRequires: gtk2-devel >= 2.0
152 BuildRequires: libgnomeui2-devel >= 2.0
153 BuildRequires: glibc-devel >= 2.3
154 BuildRequires: libORBit2-devel
155 BuildRequires: libart_lgpl-devel >= 2.0
156 BuildRequires: libbonobo2_0-devel
157 BuildRequires: libbonoboui2_0-devel
158 BuildRequires: libbonobo-activation-devel
159 BuildRequires: libGConf2-devel
160 BuildRequires: libstdc++-static-devel
161 BuildRequires: glibc-static-devel
162 BuildRequires: freetype2-devel
163 BuildRequires: tetex
164 BuildRequires: latex2html
165 %endif
166 %if %{fc3}
167 BuildRequires: libtermcap-devel
168 BuildRequires: gtk2-devel >= 2.4
169 BuildRequires: libgnomeui-devel >= 2.8
170 BuildRequires: glibc-devel >= 2.3
171 BuildRequires: ORBit2-devel
172 BuildRequires: libart_lgpl-devel >= 2.3
173 BuildRequires: libbonobo-devel >= 2.8
174 BuildRequires: libbonoboui-devel >= 2.8
175 BuildRequires: bonobo-activation-devel
176 BuildRequires: GConf2-devel
177 BuildRequires: freetype-devel
178 BuildRequires: tetex
179 BuildRequires: tetex-latex
180 %endif
181 %if ! %{rh7} && ! %{su9} && ! %{mdk} && ! %{fc3}
182 BuildRequires: libtermcap-devel
183 BuildRequires: gtk2-devel >= 2.0
184 BuildRequires: libgnomeui-devel >= 2.0
185 BuildRequires: glibc-devel >= 2.3
186 BuildRequires: ORBit2-devel
187 BuildRequires: libart_lgpl-devel >= 2.0
188 BuildRequires: libbonobo-devel >= 2.0
189 BuildRequires: libbonoboui-devel >= 2.0
190 BuildRequires: bonobo-activation-devel
191 BuildRequires: GConf2-devel
192 BuildRequires: linc-devel
193 BuildRequires: freetype-devel
194 BuildRequires: tetex
195 BuildRequires: tetex-latex
196 %endif
197
198 %if %{mysql} && ! %{mysql4}
199 BuildRequires: mysql-devel >= 3.23
200 %endif
201
202 %if %{mysql} && %{mysql4}
203 BuildRequires: mysql-devel >= 4.0
204 %endif
205
206 %if %{postgresql} && %{wb3}
207 BuildRequires: rh-postgresql-devel >= 7
208 %endif
209
210 %if %{postgresql} && ! %{wb3}
211 BuildRequires: postgresql-devel >= 7
212 %endif
213
214 %description
215 Bacula - It comes by night and sucks the vital essence from your computers.
216
217 Bacula is a set of computer programs that permit you (or the system 
218 administrator) to manage backup, recovery, and verification of computer 
219 data across a network of computers of different kinds. In technical terms, 
220 it is a network client/server based backup program. Bacula is relatively 
221 easy to use and efficient, while offering many advanced storage management 
222 features that make it easy to find and recover lost or damaged files. 
223 Bacula source code has been released under the GPL version 2 license.
224
225 %if %{mysql}
226 %package mysql
227 %endif
228 %if %{sqlite}
229 %package sqlite
230 %endif
231 %if %{postgresql}
232 %package postgresql
233 %endif
234
235 Summary: Bacula - The Network Backup Solution
236 Group: System Environment/Daemons
237 Provides: bacula-dir, bacula-sd, bacula-fd, bacula-server
238 Conflicts: bacula-client
239 Requires: ncurses, libstdc++, zlib
240 # sqlite binary now installed to /usr/lib/bacula/sqlite
241 #%if %{sqlite}
242 #Conflicts: sqlite, sqlite-tools
243 #%endif
244
245 %if %{rh7}
246 Requires: glibc >= 2.2
247 Requires: libtermcap
248 %endif
249 %if %{su9}
250 Requires: glibc >= 2.3
251 Requires: termcap
252 %endif
253 %if ! %{rh7} && ! %{su9}
254 Requires: glibc >= 2.3
255 Requires: libtermcap
256 %endif
257
258 %if %{mysql} && ! %{su9} && ! %{mdk} && ! %{mysql4}
259 Requires: mysql >= 3.23
260 Requires: mysql-server >= 3.23
261 %endif
262 %if %{mysql} && ! %{su9} && ! %{mdk} && %{mysql4}
263 Requires: mysql >= 4.0
264 Requires: mysql-server >= 4.0
265 %endif
266
267 %if %{mysql} && %{su9} && ! %{mysql4}
268 Requires: mysql >= 3.23
269 Requires: mysql-client >= 3.23
270 %endif
271 %if %{mysql} && %{su9} && %{mysql4}
272 Requires: mysql >= 4.0
273 Requires: mysql-client >= 4.0
274 %endif
275
276 %if %{mysql} && %{mdk} && ! %{mysql4}
277 Requires: mysql >= 3.23
278 Requires: mysql-client >= 3.23
279 %endif
280 %if %{mysql} && %{mdk} && %{mysql4}
281 Requires: mysql >= 4.0
282 Requires: mysql-client >= 4.0
283 %endif
284
285 %if %{postgresql} && %{wb3}
286 Requires: rh-postgresql >= 7
287 Requires: rh-postgresql-server >= 7
288 %endif
289 %if %{postgresql} && ! %{wb3}
290 Requires: postgresql >= 7
291 Requires: postgresql-server >= 7
292 %endif
293
294 %if %{mysql}
295 %description mysql
296 %endif
297 %if %{sqlite}
298 %description sqlite
299 %endif
300 %if %{postgresql}
301 %description postgresql
302 %endif
303
304 Bacula - It comes by night and sucks the vital essence from your computers.
305
306 Bacula is a set of computer programs that permit you (or the system 
307 administrator) to manage backup, recovery, and verification of computer 
308 data across a network of computers of different kinds. In technical terms, 
309 it is a network client/server based backup program. Bacula is relatively 
310 easy to use and efficient, while offering many advanced storage management 
311 features that make it easy to find and recover lost or damaged files. 
312 Bacula source code has been released under the GPL version 2 license.
313
314 %if %{mysql}
315 This build requires MySQL to be installed separately as the catalog database.
316 %endif
317 %if %{postgresql}
318 This build requires PostgreSQL to be installed separately as the catalog database.
319 %endif
320 %if %{sqlite}
321 This build incorporates sqlite as the catalog database, statically compiled.
322 %endif
323
324 %package client
325 Summary: Bacula - The Network Backup Solution
326 Group: System Environment/Daemons
327 Provides: bacula-fd
328 Requires: libstdc++, zlib
329
330 %if %{rh7}
331 Requires: glibc >= 2.2
332 Requires: libtermcap
333 %endif
334 %if %{su9}
335 Requires: glibc >= 2.3
336 Requires: termcap
337 %endif
338 %if ! %{rh7} && ! %{su9}
339 Requires: glibc >= 2.3
340 Requires: libtermcap
341 %endif
342
343 %description client
344 Bacula - It comes by night and sucks the vital essence from your computers.
345
346 Bacula is a set of computer programs that permit you (or the system 
347 administrator) to manage backup, recovery, and verification of computer 
348 data across a network of computers of different kinds. In technical terms, 
349 it is a network client/server based backup program. Bacula is relatively 
350 easy to use and efficient, while offering many advanced storage management 
351 features that make it easy to find and recover lost or damaged files. 
352 Bacula source code has been released under the GPL version 2 license.
353
354 This is the File daemon (Client) only package. It includes the command line 
355 console program.
356
357 %package rescue
358
359 Summary: Bacula - The Network Backup Solution
360 Group: System Environment/Daemons
361 Requires: coreutils, util-linux, bacula-fd, cdrecord, mkisofs, make
362
363 %description rescue
364 Bacula - It comes by night and sucks the vital essence from your computers.
365
366 Bacula is a set of computer programs that permit you (or the system 
367 administrator) to manage backup, recovery, and verification of computer 
368 data across a network of computers of different kinds. In technical terms, 
369 it is a network client/server based backup program. Bacula is relatively 
370 easy to use and efficient, while offering many advanced storage management 
371 features that make it easy to find and recover lost or damaged files. 
372 Bacula source code has been released under the GPL version 2 license.
373
374 This package installs scripts for disaster recovery and builds rescue 
375 floppy disks and cdroms for bare metal recovery. This package includes tomsrtbt
376 (http://www.toms.net/rb/, by Tom Oehser, Tom@Toms.NET) to provide a tool
377 to build a boot floppy disk.
378
379 You need to have the bacula-sqlite, bacula-mysql, bacula-postgresql or 
380 bacula-client package for your platform installed and configured before 
381 installing this package.
382
383 To create a floppy boot disk run "./getdiskinfo" from the /etc/bacula/rescue/floppy
384 directory (this is done when the package is first installed), 
385 then run "./install.s" from the /etc/bacula/rescue/floppy/tomsrtbt/
386 directory. To make the bacula rescue disk run
387 "./make_rescue_disk --copy-static-bacula --copy-etc-files"
388 from the /etc/bacula/rescue/floppy directory. To recreate the rescue
389 information for this system run ./getdiskinfo again.
390
391 To create a rescue cdrom run "make all" from the /etc/bacula/rescue/cdrom
392 directory which will create an iso image file. You can burn that image with your
393 favorite cd burning utility or run "make burn" after examining and possibly
394 adjusting /etc/bacula/rescue/cdrom/Makefile.  To recreate the rescue
395 information for this system run /etc/bacula/rescue/cdrom/bacula/getdiskinfo again.
396
397 %package updatedb
398
399 Summary: Bacula - The Network Backup Solution
400 Group: System Environment/Daemons
401
402 %description updatedb
403 Bacula - It comes by night and sucks the vital essence from your computers.
404
405 Bacula is a set of computer programs that permit you (or the system 
406 administrator) to manage backup, recovery, and verification of computer 
407 data across a network of computers of different kinds. In technical terms, 
408 it is a network client/server based backup program. Bacula is relatively 
409 easy to use and efficient, while offering many advanced storage management 
410 features that make it easy to find and recover lost or damaged files. 
411 Bacula source code has been released under the GPL version 2 license.
412
413 This package installs scripts for updating older versions of the bacula
414 database.
415
416 %package gconsole
417 Summary: Bacula - The Network Backup Solution
418 Group: System Environment/Daemons
419 Requires: atk, libstdc++, zlib, pango, libxml2, bacula-fd
420
421 %if %{rh7}
422 Requires: gtk+ >= 1.2
423 Requires: gnome-libs >= 1.4
424 Requires: glibc >= 2.2
425 Requires: ORBit
426 Requires: bonobo
427 Requires: GConf
428 Requires: freetype
429 %endif
430 %if %{su9}
431 Requires: gtk2 >= 2.0
432 Requires: libgnome >= 2.0
433 Requires: libgnomeui >= 2.0
434 Requires: glibc >= 2.3
435 Requires: ORBit2
436 Requires: libart_lgpl >= 2.0
437 Requires: libbonobo >= 2.0
438 Requires: libbonoboui >= 2.0
439 Requires: bonobo-activation
440 Requires: gconf2
441 Requires: linc
442 Requires: freetype2
443 %endif
444 %if %{mdk}
445 Requires: gtk2 >= 2.0
446 Requires: libgnomeui2
447 Requires: glibc >= 2.3
448 Requires: ORBit2
449 Requires: libart_lgpl >= 2.0
450 Requires: libbonobo >= 2.0
451 Requires: libbonoboui >= 2.0
452 Requires: GConf2
453 Requires: freetype2
454 %endif
455 %if %{fc3}
456 Requires: gtk2 >= 2.4
457 Requires: libgnomeui >= 2.8
458 Requires: glibc >= 2.3
459 Requires: ORBit2
460 Requires: libart_lgpl >= 2.3
461 Requires: libbonobo >= 2.8
462 Requires: libbonoboui >= 2.8
463 Requires: bonobo-activation
464 Requires: GConf2
465 Requires: freetype
466 %endif
467 %if ! %{rh7} && ! %{su9} && ! %{mdk} && ! %{fc3}
468 Requires: gtk2 >= 2.0
469 Requires: libgnomeui >= 2.0
470 Requires: glibc >= 2.3
471 Requires: ORBit2
472 Requires: libart_lgpl >= 2.0
473 Requires: libbonobo >= 2.0
474 Requires: libbonoboui >= 2.0
475 Requires: bonobo-activation
476 Requires: GConf2
477 Requires: linc
478 Requires: freetype
479 %endif
480 %if %{su9}
481 Requires: xsu
482 %else
483 Requires: usermode
484 %endif
485
486 %description gconsole
487 Bacula - It comes by night and sucks the vital essence from your computers.
488
489 Bacula is a set of computer programs that permit you (or the system 
490 administrator) to manage backup, recovery, and verification of computer 
491 data across a network of computers of different kinds. In technical terms, 
492 it is a network client/server based backup program. Bacula is relatively 
493 easy to use and efficient, while offering many advanced storage management 
494 features that make it easy to find and recover lost or damaged files. 
495 Bacula source code has been released under the GPL version 2 license.
496
497 This is the Gnome Console package. It is an add-on to the client or
498 server packages.
499
500 %prep
501
502 %setup
503 %setup -T -D -b 1
504 %setup -T -D -b 2
505 %setup -T -D -b 3
506
507 %build
508
509 %if %{su9}
510 export LDFLAGS="-L/usr/lib/termcap"
511 %endif
512
513 cwd=${PWD}
514 cd %{depkgs}
515 %if %{sqlite}
516 make sqlite
517 %endif
518 make mtx
519 cd ${cwd}
520
521 # patches for the bundled sqlite scripts
522
523 # patch the make_sqlite_tables script for installation bindir
524 patch src/cats/make_sqlite_tables.in src/cats/make_sqlite_tables.in.patch
525
526 # patch the create_sqlite_database script for installation bindir
527 patch src/cats/create_sqlite_database.in src/cats/create_sqlite_database.in.patch
528
529 # patch the make_catalog_backup script for installation bindir
530 patch src/cats/make_catalog_backup.in src/cats/make_catalog_backup.in.patch
531
532 # patch the update_sqlite_tables script for installation bindir
533 patch src/cats/update_sqlite_tables.in src/cats/update_sqlite_tables.in.patch
534
535 # patch the bacula-dir init script to remove sqlite service
536 %if %{sqlite} && %{su9}
537 patch platforms/suse/bacula-dir.in platforms/suse/bacula-dir-suse-sqlite.patch
538 %endif
539
540 # 64 bit lib location hacks
541 # this is the location on redhat type platforms, don't know about others yet
542 %if %{x86_64}
543 export LDFLAGS=-L/usr/lib64
544 %endif
545 %if %{mysql} && %{x86_64}
546 export LDFLAGS=-L/usr/lib64/mysql
547 %endif
548
549 %configure \
550         --prefix=/usr \
551         --sbindir=/usr/sbin \
552         --sysconfdir=/etc/bacula \
553         --with-scriptdir=/etc/bacula \
554         --enable-smartalloc \
555         --enable-gnome \
556         --enable-static-fd \
557 %if ! %{rh7} && ! %{rh8}
558         --enable-tray-monitor \
559 %endif
560 %if %{mysql}
561         --with-mysql \
562 %endif
563 %if %{sqlite}
564         --with-sqlite=${cwd}/%{depkgs}/sqlite \
565 %endif
566 %if %{postgresql}
567         --with-postgresql \
568 %endif
569         --with-working-dir=%{working_dir} \
570         --with-pid-dir=/var/run \
571         --with-subsys-dir=/var/lock/subsys \
572         --with-dir-user=%{daemon_user} \
573         --with-dir-group=%{daemon_group} \
574         --with-sd-user=%{daemon_user} \
575         --with-sd-group=%{daemon_group} \
576         --with-fd-user=%{daemon_user} \
577         --with-fd-group=%{daemon_group}
578 make
579
580 cd src/filed
581 strip static-bacula-fd
582 cd ../../
583
584 cd doc/latex
585 make
586 cd ../../
587
588 %install
589  
590 cwd=${PWD}
591 [ "$RPM_BUILD_ROOT" != "/" ] && rm -rf "$RPM_BUILD_ROOT"
592 mkdir -p $RPM_BUILD_ROOT/etc/init.d
593 mkdir -p $RPM_BUILD_ROOT/etc/logrotate.d
594 mkdir -p $RPM_BUILD_ROOT/etc/log.d/conf/logfiles
595 mkdir -p $RPM_BUILD_ROOT/etc/log.d/conf/services
596 mkdir -p $RPM_BUILD_ROOT/etc/log.d/scripts/services
597 mkdir -p $RPM_BUILD_ROOT/usr/share/pixmaps
598 %if %{rh7}
599 mkdir -p $RPM_BUILD_ROOT/usr/share/gnome/apps/System
600 %else
601 mkdir -p $RPM_BUILD_ROOT/usr/share/applications
602 %endif
603 mkdir -p $RPM_BUILD_ROOT/etc/bacula/rescue/floppy
604 mkdir -p $RPM_BUILD_ROOT/etc/bacula/rescue/floppy/tomsrtbt
605 mkdir -p $RPM_BUILD_ROOT/etc/bacula/rescue/cdrom
606 mkdir -p $RPM_BUILD_ROOT/etc/bacula/updatedb
607 %if ! %{su9}
608 mkdir -p $RPM_BUILD_ROOT/etc/pam.d
609 mkdir -p $RPM_BUILD_ROOT/etc/security/console.apps
610 mkdir -p $RPM_BUILD_ROOT/usr/bin
611 %endif
612
613 %if %{sqlite}
614 mkdir -p $RPM_BUILD_ROOT%{sqlite_bindir}
615 %endif
616
617 make \
618         prefix=$RPM_BUILD_ROOT/usr \
619         sbindir=$RPM_BUILD_ROOT/usr/sbin \
620         sysconfdir=$RPM_BUILD_ROOT/etc/bacula \
621         scriptdir=$RPM_BUILD_ROOT/etc/bacula \
622         working_dir=$RPM_BUILD_ROOT%{working_dir} \
623         install
624
625 cd %{depkgs}
626 make \
627         prefix=$RPM_BUILD_ROOT/usr \
628         sbindir=$RPM_BUILD_ROOT/usr/sbin \
629         sysconfdir=$RPM_BUILD_ROOT/etc/bacula \
630         working_dir=$RPM_BUILD_ROOT%{working_dir} \
631         mandir=$RPM_BUILD_ROOT/usr/man \
632         mtx-install
633 cd ${cwd}
634
635 # setup the manual for the doc dir
636 mkdir html-manual
637 cp -p doc/latex/bacula/*.html html-manual/
638 cp -p doc/latex/bacula/*.png html-manual/
639 cp -p doc/latex/bacula/*.css html-manual/
640
641 # fixme - make installs the mysql scripts for sqlite build
642 %if %{sqlite}
643 rm -f $RPM_BUILD_ROOT/etc/bacula/startmysql
644 rm -f $RPM_BUILD_ROOT/etc/bacula/stopmysql
645 rm -f $RPM_BUILD_ROOT/etc/bacula/grant_mysql_privileges
646 %endif
647
648 # fixme - make installs the mysql scripts for postgresql build
649 %if %{postgresql}
650 rm -f $RPM_BUILD_ROOT/etc/bacula/startmysql
651 rm -f $RPM_BUILD_ROOT/etc/bacula/stopmysql
652 %endif
653
654 # install the init scripts
655 %if %{su9}
656 cp -p platforms/suse/bacula-dir $RPM_BUILD_ROOT/etc/init.d/bacula-dir
657 cp -p platforms/suse/bacula-fd $RPM_BUILD_ROOT/etc/init.d/bacula-fd
658 cp -p platforms/suse/bacula-sd $RPM_BUILD_ROOT/etc/init.d/bacula-sd
659 %endif
660 %if %{mdk}
661 cp -p platforms/mandrake/bacula-dir $RPM_BUILD_ROOT/etc/init.d/bacula-dir
662 cp -p platforms/mandrake/bacula-fd $RPM_BUILD_ROOT/etc/init.d/bacula-fd
663 cp -p platforms/mandrake/bacula-sd $RPM_BUILD_ROOT/etc/init.d/bacula-sd
664 %endif
665 %if ! %{su9} && ! %{mdk}
666 cp -p platforms/redhat/bacula-dir $RPM_BUILD_ROOT/etc/init.d/bacula-dir
667 cp -p platforms/redhat/bacula-fd $RPM_BUILD_ROOT/etc/init.d/bacula-fd
668 cp -p platforms/redhat/bacula-sd $RPM_BUILD_ROOT/etc/init.d/bacula-sd
669 %endif
670 chmod 0754 $RPM_BUILD_ROOT/etc/init.d/*
671
672 # install the menu stuff
673 %if %{su9}
674 cp -p scripts/bacula.png $RPM_BUILD_ROOT/usr/share/pixmaps/bacula.png
675 cp -p scripts/bacula.desktop.gnome2.xsu $RPM_BUILD_ROOT/usr/share/applications/bacula.desktop
676 cp -p src/tray-monitor/generic.xpm $RPM_BUILD_ROOT/usr/share/pixmaps/bacula-tray-monitor.xpm
677 cp -p scripts/bacula-tray-monitor.desktop $RPM_BUILD_ROOT/usr/share/applications/bacula-tray-monitor.desktop
678 %endif
679 %if %{rh7}
680 cp -p scripts/bacula.png $RPM_BUILD_ROOT/usr/share/pixmaps/bacula.png
681 cp -p scripts/bacula.desktop.gnome1.consolehelper $RPM_BUILD_ROOT/usr/share/gnome/apps/System/bacula.desktop
682 cp -p scripts/gnome-console.console_apps $RPM_BUILD_ROOT/etc/security/console.apps/gnome-console
683 cp -p scripts/gnome-console.pamd $RPM_BUILD_ROOT/etc/pam.d/gnome-console
684 ln -sf consolehelper $RPM_BUILD_ROOT/usr/bin/gnome-console
685 %endif
686 %if %{rh8} || %{rh9} || %{wb3} || %{fc1} || %{fc3} || %{mdk}
687 cp -p scripts/bacula.png $RPM_BUILD_ROOT/usr/share/pixmaps/bacula.png
688 cp -p scripts/bacula.desktop.gnome2.consolehelper $RPM_BUILD_ROOT/usr/share/applications/bacula.desktop
689 cp -p scripts/gnome-console.console_apps $RPM_BUILD_ROOT/etc/security/console.apps/gnome-console
690 cp -p scripts/gnome-console.pamd $RPM_BUILD_ROOT/etc/pam.d/gnome-console
691 ln -sf consolehelper $RPM_BUILD_ROOT/usr/bin/gnome-console
692 %endif
693 %if ! %{rh7} && ! %{rh8}
694 cp -p src/tray-monitor/generic.xpm $RPM_BUILD_ROOT/usr/share/pixmaps/bacula-tray-monitor.xpm
695 cp -p scripts/bacula-tray-monitor.desktop $RPM_BUILD_ROOT/usr/share/applications/bacula-tray-monitor.desktop
696 %endif
697
698 # install sqlite
699 %if %{sqlite}
700 cp -p %{depkgs}/sqlite/sqlite $RPM_BUILD_ROOT%{sqlite_bindir}/sqlite
701 cp -p %{depkgs}/sqlite/sqlite.h $RPM_BUILD_ROOT%{sqlite_bindir}/sqlite.h
702 cp -p %{depkgs}/sqlite/libsqlite.a $RPM_BUILD_ROOT%{sqlite_bindir}/libsqlite.a
703 %endif
704
705 # install the logrotate file
706 cp -p scripts/logrotate $RPM_BUILD_ROOT/etc/logrotate.d/bacula
707
708 # install the rescue stuff
709 # these are the floppy rescue scripts
710 cp -p rescue/linux/floppy/backup.etc.list $RPM_BUILD_ROOT/etc/bacula/rescue/floppy/
711 cp -p rescue/linux/floppy/format_floppy $RPM_BUILD_ROOT/etc/bacula/rescue/floppy/
712 cp -p rescue/linux/floppy/getdiskinfo $RPM_BUILD_ROOT/etc/bacula/rescue/floppy/
713 cp -p rescue/linux/floppy/make_rescue_disk $RPM_BUILD_ROOT/etc/bacula/rescue/floppy/
714 cp -p rescue/linux/floppy/restore_bacula $RPM_BUILD_ROOT/etc/bacula/rescue/floppy/
715 cp -p rescue/linux/floppy/restore_etc $RPM_BUILD_ROOT/etc/bacula/rescue/floppy/
716 cp -p rescue/linux/floppy/run_grub $RPM_BUILD_ROOT/etc/bacula/rescue/floppy/
717 cp -p rescue/linux/floppy/run_lilo $RPM_BUILD_ROOT/etc/bacula/rescue/floppy/
718 cp -p rescue/linux/floppy/sfdisk.bz2 $RPM_BUILD_ROOT/etc/bacula/rescue/floppy/
719
720 # this is the cdrom rescue stuff
721 cp -r -p rescue/linux/cdrom/* $RPM_BUILD_ROOT/etc/bacula/rescue/cdrom/
722 mkdir -p $RPM_BUILD_ROOT/etc/bacula/rescue/cdrom/bin/
723 rm -f $RPM_BUILD_ROOT/etc/bacula/rescue/cdrom/Makefile.in
724 rm -f $RPM_BUILD_ROOT/etc/bacula/rescue/cdrom/bacula/Makefile.in
725 touch $RPM_BUILD_ROOT/etc/bacula/rescue/cdrom/rpm_release
726
727 # this is the static file daemon
728 cp -p src/filed/static-bacula-fd $RPM_BUILD_ROOT/etc/bacula/rescue/floppy/bacula-fd
729 cp -p src/filed/static-bacula-fd $RPM_BUILD_ROOT/etc/bacula/rescue/cdrom/bin/bacula-fd
730
731 # this is the tom's root boot disk
732 cp -p ../%{tomsrtbt}/* $RPM_BUILD_ROOT/etc/bacula/rescue/floppy/tomsrtbt/
733
734 # install the updatedb scripts
735 cp -p updatedb/* $RPM_BUILD_ROOT/etc/bacula/updatedb/
736
737 # install the logwatch scripts
738 cp -p scripts/logwatch/bacula $RPM_BUILD_ROOT/etc/log.d/scripts/services/bacula
739 cp -p scripts/logwatch/logfile.bacula.conf $RPM_BUILD_ROOT/etc/log.d/conf/logfiles/bacula.conf
740 cp -p scripts/logwatch/services.bacula.conf $RPM_BUILD_ROOT/etc/log.d/conf/services/bacula.conf
741 chmod 755 $RPM_BUILD_ROOT/etc/log.d/scripts/services/bacula
742 chmod 644 $RPM_BUILD_ROOT/etc/log.d/conf/logfiles/bacula.conf
743 chmod 644 $RPM_BUILD_ROOT/etc/log.d/conf/services/bacula.conf
744
745 # now clean up permissions that are left broken by the install
746 chmod o-r $RPM_BUILD_ROOT/etc/bacula/query.sql
747 chmod o-rwx $RPM_BUILD_ROOT/var/bacula
748 %if ! %{rh7} && ! %{rh8}
749 chmod 755 $RPM_BUILD_ROOT/usr/sbin/bacula-tray-monitor
750 chmod 644 $RPM_BUILD_ROOT/etc/bacula/tray-monitor.conf
751 %endif
752
753 %clean
754 [ "$RPM_BUILD_ROOT" != "/" ] && rm -rf "$RPM_BUILD_ROOT"
755
756 %if %{mysql}
757
758 %files mysql
759 %defattr(-,root,root)
760
761 /etc/bacula/bacula
762 /etc/bacula/bconsole
763 /etc/bacula/create_mysql_database
764 /etc/bacula/drop_mysql_database
765 /etc/bacula/make_mysql_tables
766 /etc/bacula/drop_mysql_tables
767 /etc/bacula/update_mysql_tables
768 /etc/bacula/grant_mysql_privileges
769 /etc/bacula/create_bacula_database
770 /etc/bacula/drop_bacula_database
771 /etc/bacula/grant_bacula_privileges
772 /etc/bacula/make_bacula_tables
773 /etc/bacula/drop_bacula_tables
774 /etc/bacula/update_bacula_tables
775 /etc/bacula/make_catalog_backup
776 /etc/bacula/delete_catalog_backup
777 /etc/bacula/startmysql
778 /etc/bacula/stopmysql
779 /etc/bacula/mtx-changer
780 /etc/bacula/btraceback.dbx
781 /etc/bacula/btraceback.gdb
782 #/etc/bacula/dvd-freespace
783 #/etc/bacula/dvd-writepart
784 /etc/init.d/bacula-dir
785 /etc/init.d/bacula-fd
786 /etc/init.d/bacula-sd
787
788 %doc COPYING ChangeLog ReleaseNotes VERIFYING kernstodo 
789 %doc doc/latex/bacula.pdf doc/latex/developers.pdf html-manual ../Release_Notes-%{version}-%{release}.txt
790 /usr/man/man1/*
791
792 /etc/logrotate.d/bacula
793 /etc/log.d/scripts/services/bacula
794 %config(noreplace) /etc/bacula/bacula-dir.conf
795 %config(noreplace) /etc/bacula/bacula-fd.conf
796 %config(noreplace) /etc/bacula/bacula-sd.conf
797 %config(noreplace) /etc/bacula/bconsole.conf
798 %config(noreplace) /etc/log.d/conf/logfiles/bacula.conf
799 %config(noreplace) /etc/log.d/conf/services/bacula.conf
800 /etc/bacula/query.sql
801 %dir %{working_dir}
802
803 /usr/sbin/bacula-dir
804 /usr/sbin/bacula-fd
805 /usr/sbin/bacula-sd
806 /usr/sbin/bcopy
807 /usr/sbin/bextract
808 /usr/sbin/bls
809 /usr/sbin/bscan
810 /usr/sbin/btape
811 /usr/sbin/btraceback
812 /usr/sbin/bconsole
813 /usr/sbin/dbcheck
814 /usr/sbin/loaderinfo
815 /usr/sbin/mtx
816 /usr/sbin/scsitape
817 /usr/sbin/bsmtp
818 /usr/sbin/tapeinfo
819 /usr/sbin/static-bacula-fd
820
821 %pre mysql
822 # test for bacula database older than version 7
823 # note: this ASSUMES no password has been set for bacula database
824 DB_VER=`mysql 2>/dev/null bacula -e 'select * from Version;'|tail -n 1`
825
826 if [ -n "$DB_VER" ] && [ "$DB_VER" -lt "7" ]; then
827         echo "This bacula upgrade will update a bacula database from version 7 to 8."
828         echo "You appear to be running database version $DB_VER. You must first update"
829         echo "your database to version 7 and then install this upgrade. The alternative"
830         echo "is to use /etc/bacula/drop_mysql_tables to delete all your your current"
831         echo "catalog information, then do the upgrade. Information on updating a"
832         echo "database older than version 7 can be found in the release notes."
833         exit 1
834 fi
835 # check for and copy /etc/bacula/console.conf to bconsole.conf
836 if [ -s /etc/bacula/console.conf ];then
837         cp -p /etc/bacula/console.conf /etc/bacula/bconsole.conf
838 fi
839
840 %post mysql
841
842 # add our links
843 if [ "$1" -ge 1 ] ; then
844 /sbin/chkconfig --add bacula-dir
845 /sbin/chkconfig --add bacula-fd
846 /sbin/chkconfig --add bacula-sd
847 fi
848
849 # test for an existing database
850 # note: this ASSUMES no password has been set for bacula database
851 DB_VER=`mysql 2>/dev/null bacula -e 'select * from Version;'|tail -n 1`
852
853 # grant privileges and create tables if they do not exist
854 if [ -z "$DB_VER" ]; then
855         echo "Hmm, doesn't look like you have an existing database."
856         echo "Granting privileges for MySQL user bacula..."
857         /etc/bacula/grant_mysql_privileges
858         echo "Creating MySQL bacula database..."
859         /etc/bacula/create_mysql_database
860         echo "Creating bacula tables..."
861         /etc/bacula/make_mysql_tables
862
863 # check to see if we need to upgrade a 1.34 or lower database
864 elif [ "$DB_VER" -lt "8" ]; then
865         echo "This release requires an upgrade to your bacula database."
866         echo "Backing up your current database..."
867         mysqldump -f --opt bacula | bzip2 > %{working_dir}/bacula_backup.sql.bz2
868         echo "Upgrading bacula database ..."
869         /etc/bacula/update_mysql_tables
870         echo "If bacula works correctly you can remove the backup file %{working_dir}/bacula_backup.sql.bz2"
871
872 fi
873
874 # create the daemon group
875 HAVE_BACULA=`grep %{daemon_group} %{group_file} 2>/dev/null`
876 if [ -z $HAVE_BACULA ]; then
877         %{groupadd} -r %{daemon_group} > /dev/null 2>&1
878         echo "The group %{daemon_group} has been added to %{group_file}."
879         echo "See the manual chapter Running Bacula for details."
880 fi
881
882 %preun mysql
883 # delete our links
884 if [ $1 = 0 ]; then
885 /sbin/chkconfig --del bacula-dir
886 /sbin/chkconfig --del bacula-fd
887 /sbin/chkconfig --del bacula-sd
888 fi
889
890 %endif
891
892 %if %{sqlite}
893
894 %files sqlite
895 %defattr(-,root,root)
896
897 /etc/bacula/bacula
898 /etc/bacula/bconsole
899 /etc/bacula/create_bacula_database
900 /etc/bacula/drop_bacula_database
901 /etc/bacula/grant_bacula_privileges
902 /etc/bacula/make_bacula_tables
903 /etc/bacula/drop_bacula_tables
904 /etc/bacula/update_bacula_tables
905 /etc/bacula/create_sqlite_database
906 /etc/bacula/drop_sqlite_database
907 /etc/bacula/grant_sqlite_privileges
908 /etc/bacula/make_sqlite_tables
909 /etc/bacula/drop_sqlite_tables
910 /etc/bacula/update_sqlite_tables
911 /etc/bacula/make_catalog_backup
912 /etc/bacula/delete_catalog_backup
913 /etc/bacula/mtx-changer
914 /etc/bacula/btraceback.dbx
915 /etc/bacula/btraceback.gdb
916 #/etc/bacula/dvd-freespace
917 #/etc/bacula/dvd-writepart
918 /etc/init.d/bacula-dir
919 /etc/init.d/bacula-fd
920 /etc/init.d/bacula-sd
921
922 %doc COPYING ChangeLog ReleaseNotes VERIFYING kernstodo 
923 %doc doc/latex/bacula.pdf doc/latex/developers.pdf html-manual ../Release_Notes-%{version}-%{release}.txt
924 /usr/man/man1/*
925
926 /etc/logrotate.d/bacula
927 /etc/log.d/scripts/services/bacula
928 %config(noreplace) /etc/bacula/bacula-dir.conf
929 %config(noreplace) /etc/bacula/bacula-fd.conf
930 %config(noreplace) /etc/bacula/bacula-sd.conf
931 %config(noreplace) /etc/bacula/bconsole.conf
932 %config(noreplace) /etc/log.d/conf/logfiles/bacula.conf
933 %config(noreplace) /etc/log.d/conf/services/bacula.conf
934 /etc/bacula/query.sql
935 %{sqlite_bindir}/libsqlite.a
936 %{sqlite_bindir}/sqlite.h
937 %dir %{working_dir}
938
939 /usr/sbin/bacula-dir
940 /usr/sbin/bacula-fd
941 /usr/sbin/bacula-sd
942 /usr/sbin/bcopy
943 /usr/sbin/bextract
944 /usr/sbin/bls
945 /usr/sbin/bscan
946 /usr/sbin/btape
947 /usr/sbin/btraceback
948 /usr/sbin/bconsole
949 /usr/sbin/dbcheck
950 /usr/sbin/loaderinfo
951 /usr/sbin/mtx
952 /usr/sbin/scsitape
953 /usr/sbin/bsmtp
954 /usr/sbin/tapeinfo
955 /usr/sbin/static-bacula-fd
956 %{sqlite_bindir}/sqlite
957
958
959 %pre sqlite
960 # test for bacula database older than version 7
961 if [ -s %{working_dir}/bacula.db ] && [ -s %{sqlite_bindir}/sqlite ];then
962         DB_VER=`echo "select * from Version;" | %{sqlite_bindir}/sqlite 2>/dev/null %{working_dir}/bacula.db | tail -n 1`
963         if [ -n "$DB_VER" ] && [ "$DB_VER" -lt "7" ]; then
964                 echo "This bacula upgrade will update a bacula database from version 7 to 8."
965                 echo "You appear to be running database version $DB_VER. You must first update"
966                 echo "your database to version 7 and then install this upgrade. The alternative"
967                 echo "is to use /etc/bacula/drop_sqlite_tables to delete all your your current"
968                 echo "catalog information, then do the upgrade. Information on updating a"
969                 echo "database older than version 7 can be found in the release notes."
970                 exit 1
971         fi
972 fi
973 # check for and copy /etc/bacula/console.conf to bconsole.conf
974 if [ -s /etc/bacula/console.conf ];then
975         cp -p /etc/bacula/console.conf /etc/bacula/bconsole.conf
976 fi
977
978 %post sqlite
979 # add our links
980 if [ "$1" -ge 1 ] ; then
981 /sbin/chkconfig --add bacula-dir
982 /sbin/chkconfig --add bacula-fd
983 /sbin/chkconfig --add bacula-sd
984 fi
985
986 # test for an existing database
987 if [ -s %{working_dir}/bacula.db ]; then
988         DB_VER=`echo "select * from Version;" | %{sqlite_bindir}/sqlite 2>/dev/null %{working_dir}/bacula.db | tail -n 1`
989         # check to see if we need to upgrade a 1.34 or lower database
990         if [ "$DB_VER" -lt "7" ]; then
991                 echo "This bacula upgrade requires a database update to version 8. You appear to"
992                 echo "be running database version $DB_VER. You must update your database using the"
993                 echo "upgrade scripts in the bacula-updatedb package. The alternative"
994                 echo "is to use /etc/bacula/drop_sqlite_tables to delete all your your current"
995                 echo "catalog information, then /etc/bacula/make_sqlite_tables. Information on updating a"
996                 echo "database older than version 7 can be found in the release notes."
997         fi      
998         
999         if [ "$DB_VER" -lt "8" ] && [ "$DB_VER" -ge "7" ]; then
1000                 echo "This release requires an upgrade to your bacula database."
1001                 echo "Backing up your current database..."
1002                 echo ".dump" | %{sqlite_bindir}/sqlite %{working_dir}/bacula.db | bzip2 > %{working_dir}/bacula_backup.sql.bz2
1003                 echo "Upgrading bacula database ..."
1004                 /etc/bacula/update_sqlite_tables
1005                 echo "If bacula works correctly you can remove the backup file %{working_dir}/bacula_backup.sql.bz2"
1006         fi
1007 else
1008         # create the database and tables
1009         echo "Hmm, doesn't look like you have an existing database."
1010         echo "Creating SQLite database..."
1011         /etc/bacula/create_sqlite_database
1012         echo "Creating the SQLite tables..."
1013         /etc/bacula/make_sqlite_tables
1014 fi
1015
1016 # create the daemon group
1017 HAVE_BACULA=`grep %{daemon_group} %{group_file} 2>/dev/null`
1018 if [ -z $HAVE_BACULA ]; then
1019         %{groupadd} -r %{daemon_group} > /dev/null 2>&1
1020         echo "The group %{daemon_group} has been added to %{group_file}."
1021         echo "See the manual chapter Running Bacula for details."
1022 fi
1023
1024 %preun sqlite
1025 # delete our links
1026 if [ $1 = 0 ]; then
1027 /sbin/chkconfig --del bacula-dir
1028 /sbin/chkconfig --del bacula-fd
1029 /sbin/chkconfig --del bacula-sd
1030 fi
1031
1032 %endif
1033
1034 %if %{postgresql}
1035
1036 %files postgresql
1037 %defattr(-,root,root)
1038
1039 /etc/bacula/bacula
1040 /etc/bacula/bconsole
1041 /etc/bacula/create_postgresql_database
1042 /etc/bacula/drop_postgresql_database
1043 /etc/bacula/make_postgresql_tables
1044 /etc/bacula/drop_postgresql_tables
1045 /etc/bacula/update_postgresql_tables
1046 /etc/bacula/grant_postgresql_privileges
1047 /etc/bacula/create_bacula_database
1048 /etc/bacula/drop_bacula_database
1049 /etc/bacula/grant_bacula_privileges
1050 /etc/bacula/make_bacula_tables
1051 /etc/bacula/drop_bacula_tables
1052 /etc/bacula/update_bacula_tables
1053 /etc/bacula/make_catalog_backup
1054 /etc/bacula/delete_catalog_backup
1055 /etc/bacula/mtx-changer
1056 /etc/bacula/btraceback.dbx
1057 /etc/bacula/btraceback.gdb
1058 #/etc/bacula/dvd-freespace
1059 #/etc/bacula/dvd-writepart
1060 /etc/init.d/bacula-dir
1061 /etc/init.d/bacula-fd
1062 /etc/init.d/bacula-sd
1063
1064 %doc COPYING ChangeLog ReleaseNotes VERIFYING kernstodo 
1065 %doc doc/latex/bacula.pdf doc/latex/developers.pdf html-manual ../Release_Notes-%{version}-%{release}.txt
1066 /usr/man/man1/*
1067
1068 /etc/logrotate.d/bacula
1069 /etc/log.d/scripts/services/bacula
1070 %config(noreplace) /etc/bacula/bacula-dir.conf
1071 %config(noreplace) /etc/bacula/bacula-fd.conf
1072 %config(noreplace) /etc/bacula/bacula-sd.conf
1073 %config(noreplace) /etc/bacula/bconsole.conf
1074 %config(noreplace) /etc/log.d/conf/logfiles/bacula.conf
1075 %config(noreplace) /etc/log.d/conf/services/bacula.conf
1076 /etc/bacula/query.sql
1077 %dir %{working_dir}
1078
1079 /usr/sbin/bacula-dir
1080 /usr/sbin/bacula-fd
1081 /usr/sbin/bacula-sd
1082 /usr/sbin/bcopy
1083 /usr/sbin/bextract
1084 /usr/sbin/bls
1085 /usr/sbin/bscan
1086 /usr/sbin/btape
1087 /usr/sbin/btraceback
1088 /usr/sbin/bconsole
1089 /usr/sbin/dbcheck
1090 /usr/sbin/loaderinfo
1091 /usr/sbin/mtx
1092 /usr/sbin/scsitape
1093 /usr/sbin/bsmtp
1094 /usr/sbin/tapeinfo
1095 /usr/sbin/static-bacula-fd
1096
1097 %pre postgresql
1098 # test for bacula database older than version 7
1099 # note: this ASSUMES no password has been set for bacula database
1100 DB_VER=`echo 'select * from Version;' | psql bacula 2>/dev/null | tail -3 | head -1`
1101
1102 if [ -n "$DB_VER" ] && [ "$DB_VER" -lt "7" ]; then
1103         echo "This bacula upgrade will update a bacula database from version 7 to 8."
1104         echo "You appear to be running database version $DB_VER. You must first update"
1105         echo "your database to version 7 and then install this upgrade. The alternative"
1106         echo "is to use /etc/bacula/drop_postgresql_tables to delete all your your current"
1107         echo "catalog information, then do the upgrade. Information on updating a"
1108         echo "database older than version 7 can be found in the release notes."
1109         exit 1
1110 fi
1111
1112 %post postgresql
1113 # add our links
1114 if [ "$1" -ge 1 ] ; then
1115 /sbin/chkconfig --add bacula-dir
1116 /sbin/chkconfig --add bacula-fd
1117 /sbin/chkconfig --add bacula-sd
1118 fi
1119
1120 # test for an existing database
1121 # note: this ASSUMES no password has been set for bacula database
1122 DB_VER=`echo 'select * from Version;' | psql bacula 2>/dev/null | tail -3 | head -1`
1123
1124 # grant privileges and create tables if they do not exist
1125 if [ -z "$DB_VER" ]; then
1126         echo "Hmm, doesn't look like you have an existing database."
1127         echo "Creating PostgreSQL bacula database..."
1128         /etc/bacula/create_postgresql_database
1129         echo "Creating bacula tables..."
1130         /etc/bacula/make_postgresql_tables
1131         echo "Granting privileges for PostgreSQL user bacula..."
1132         /etc/bacula/grant_postgresql_privileges
1133
1134 # check to see if we need to upgrade a 1.34 or lower database
1135 elif [ "$DB_VER" -lt "8" ]; then
1136         echo "This release requires an upgrade to your bacula database."
1137         echo "Backing up your current database..."
1138         pg_dump bacula | bzip2 > %{working_dir}/bacula_backup.sql.bz2
1139         echo "Upgrading bacula database ..."
1140         /etc/bacula/update_postgresql_tables
1141         echo "If bacula works correctly you can remove the backup file %{working_dir}/bacula_backup.sql.bz2"
1142         
1143 fi
1144
1145 # create the daemon group
1146 HAVE_BACULA=`grep %{daemon_group} %{group_file} 2>/dev/null`
1147 if [ -z $HAVE_BACULA ]; then
1148         %{groupadd} -r %{daemon_group} > /dev/null 2>&1
1149         echo "The group %{daemon_group} has been added to %{groupfile}."
1150         echo "See the manual chapter Running Bacula for details."
1151 fi
1152         
1153
1154 %preun postgresql
1155 # delete our links
1156 if [ $1 = 0 ]; then
1157 /sbin/chkconfig --del bacula-dir
1158 /sbin/chkconfig --del bacula-fd
1159 /sbin/chkconfig --del bacula-sd
1160 fi
1161
1162 %endif
1163
1164 %files client
1165 %defattr(-,root,root)
1166
1167 /etc/bacula/bconsole
1168 /etc/init.d/bacula-fd
1169
1170 %doc COPYING ChangeLog ReleaseNotes VERIFYING kernstodo 
1171 %doc doc/latex/bacula.pdf doc/latex/developers.pdf html-manual ../Release_Notes-%{version}-%{release}.txt
1172 /etc/logrotate.d/bacula
1173
1174 %config(noreplace) /etc/bacula/bacula-fd.conf
1175 %config(noreplace) /etc/bacula/bconsole.conf
1176 %dir %{working_dir}
1177
1178 /usr/sbin/bacula-fd
1179 /usr/sbin/btraceback
1180 /etc/bacula/btraceback.gdb
1181 /etc/bacula/btraceback.dbx
1182 /usr/sbin/bsmtp
1183 /usr/sbin/bconsole
1184
1185
1186 %post client
1187 # add our link
1188 if [ "$1" -ge 1 ] ; then
1189 /sbin/chkconfig --add bacula-fd
1190 fi
1191
1192 # create the daemon group
1193 HAVE_BACULA=`cat %{group_file} | grep %{daemon_group} 2>/dev/null`
1194 if [ -z $HAVE_BACULA ]; then
1195         %{groupadd} -r %{daemon_group} > /dev/null 2>&1
1196         echo "The group %{daemon_group} has been added to %{group_file}."
1197         echo "See the manual chapter Running Bacula for details."
1198 fi
1199
1200 %preun client
1201 # delete our link
1202 if [ $1 = 0 ]; then
1203 /sbin/chkconfig --del bacula-fd
1204 fi
1205
1206 %files rescue
1207 %defattr(-,root,root)
1208 /etc/bacula/rescue/floppy/*
1209 /etc/bacula/rescue/cdrom/*
1210
1211 %post rescue
1212 # link our current installed conf file to the rescue directory
1213 ln -s /etc/bacula/bacula-fd.conf /etc/bacula/rescue/floppy/bacula-fd.conf
1214 ln -s /etc/bacula/bacula-fd.conf /etc/bacula/rescue/cdrom/bin/bacula-fd.conf
1215
1216 # run getdiskinfo
1217 echo "Creating rescue files for this system..."
1218 cd /etc/bacula/rescue/floppy
1219 ./getdiskinfo
1220 cd /etc/bacula/rescue/cdrom/bacula
1221 ./getdiskinfo
1222
1223 %preun rescue
1224 # remove the files created after the initial rpm installation
1225 rm -f /etc/bacula/rescue/floppy/bacula-fd.conf
1226 rm -f /etc/bacula/rescue/floppy/partition.*
1227 rm -f /etc/bacula/rescue/floppy/format.*
1228 rm -f /etc/bacula/rescue/floppy/mount_drives
1229 rm -f /etc/bacula/rescue/floppy/start_network
1230 rm -f /etc/bacula/rescue/floppy/sfdisk
1231 rm -rf /etc/bacula/rescue/floppy/diskinfo/*
1232
1233 rm -f /etc/bacula/rescue/cdrom/bacula/bacula-fd.conf
1234 rm -f /etc/bacula/rescue/cdrom/bacula/partition.*
1235 rm -f /etc/bacula/rescue/cdrom/bacula/format.*
1236 rm -f /etc/bacula/rescue/cdrom/bacula/mount_drives
1237 rm -f /etc/bacula/rescue/cdrom/bacula/start_network
1238 rm -rf /etc/bacula/rescue/cdrom/bacula/diskinfo/*
1239
1240 %files updatedb
1241 %defattr(-,root,root)
1242 /etc/bacula/updatedb/*
1243
1244 %post updatedb
1245 echo "The database update scripts were installed to /etc/bacula/updatedb"
1246
1247 %files gconsole
1248 %defattr(-,root,root)
1249 /usr/sbin/gnome-console
1250 /etc/bacula/gconsole
1251 %config(noreplace) /etc/bacula/gnome-console.conf
1252 /usr/share/pixmaps/bacula.png
1253
1254 %if %{rh7}
1255 /usr/share/gnome/apps/System/bacula.desktop
1256 %else
1257 /usr/share/applications/bacula.desktop
1258 %endif
1259
1260 %if ! %{rh7} && ! %{rh8}
1261 /usr/sbin/bacula-tray-monitor
1262 %config(noreplace) /etc/bacula/tray-monitor.conf
1263 /usr/share/pixmaps/bacula-tray-monitor.xpm
1264 /usr/share/applications/bacula-tray-monitor.desktop
1265 %endif
1266
1267 %if ! %{su9} 
1268 # add the console helper files
1269 %config(noreplace,missingok) /etc/pam.d/gnome-console
1270 %config(noreplace,missingok) /etc/security/console.apps/gnome-console
1271 /usr/bin/gnome-console
1272 %endif
1273
1274
1275 %changelog
1276 * Sat May 07 2005 D. Scott Barninger <barninger@fairfieldcomputers.com>
1277 - move sqlite installation bindir to /usr/lib/bacula/sqlite and remove
1278 - conflict with sqlite packages. remove readline dependency.
1279 * Sun Apr 17 2005 D. Scott Barninger <barninger@fairfieldcomputers.com>
1280 - release 1.36.3 update docs
1281 * Tue Apr 05 2005 D. Scott Barninger <barninger@fairfieldcomputers.com>
1282 - add centos4 build tag
1283 - add x86_64 build tag
1284 * Sun Apr 03 2005 D. Scott Barninger <barninger@fairfieldcomputers.com>
1285 - add rhel4 build tag
1286 - clean up for mysql4 which is now mdk-10.1, suse-9.2 and rhel4
1287 * Sun Mar 06 2005 D. Scott Barninger <barninger@fairfieldcomputers.com>
1288 - add rhel3 build tag
1289 * Tue Mar 01 2005 D. Scott Barninger <barninger@fairfieldcomputers.com>
1290 - fix tray-monitor.conf for noreplace
1291 * Mon Feb 28 2005 D. Scott Barninger <barninger@fairfieldcomputers.com>
1292 - fix distribution check for Fedora and Whitebox
1293 * Sun Feb 06 2005 D. Scott Barninger <barninger@fairfieldcomputers.com>
1294 - add logwatch script
1295 - add dvd scripts
1296 * Sat Jan 15 2005 D. Scott Barninger <barninger@fairfieldcomputers.com>
1297 - add build for Fedora Core 3 (linc now included in ORDit2)
1298 - add mysql4 define for Mandrake 10.1
1299 * Fri Jan 14 2005 D. Scott Barninger <barninger@fairfieldcomputers.com>
1300 - fix {group_file} variable in post scripts
1301 * Thu Dec 30 2004 D. Scott Barninger <barninger@fairfieldcomputers.com>
1302 - add distribution checking and custom Distribution tag
1303 * Thu Dec 09 2004 D. Scott Barninger <barninger at fairfieldcomputers.com>
1304 - ASSIGNMENT OF COPYRIGHT
1305 - FOR VALUE RECEIVED, D. Scott Barninger hereby sells, transfers and 
1306 - assigns unto Kern Sibbald, his successors, assigns and personal representatives, 
1307 - all right, title and interest in and to the copyright in this software RPM
1308 - spec file. D. Scott Barninger warrants good title to said copyright, that it is 
1309 - free of all liens, encumbrances or any known claims against said copyright.
1310 * Sat Dec 04 2004 D. Scott Barninger <barninger at fairfieldcomputers.com>
1311 - bug 183 fixes
1312 - thanks to Daniel Widyono
1313 - update description for rescue package to describe cdrom creation
1314 * Thu Nov 18 2004 D. Scott Barninger <barninger at fairfieldcomputers.com>
1315 - update depkgs to 29Oct04
1316 * Fri Nov 12 2004 D. Scott Barninger <barninger at fairfieldcomputers.com>
1317 - add cdrom rescue to bacula-rescue package
1318 * Sun Oct 31 2004 D. Scott Barninger <barninger at fairfieldcomputers.com>
1319 - misc fixes from 1.36.0 suse feedback
1320 - fix situation where sqlite database exists but sqlite has been removed.
1321 * Fri Oct 22 2004 D. Scott Barninger <barninger at fairfieldcomputers.com>
1322 - remove tray-monitor from RH8 build
1323 - fix permissions on tray-monitor files
1324 * Wed Oct 13 2004 D. Scott Barninger <barninger at fairfieldcomputers.com>
1325 - add Mandrake support and tray-monitor, misc changes for 1.35.8/1.36.0,
1326 - change database update to 7 to 8 upgrade,
1327 - revert depkgs to 08Mar04 as there seems to be a bug in the sqlite
1328 - build in 30Jul04, add freetype dependancy to gnome package.
1329 * Sun Sep 12 2004 D. Scott Barninger <barninger at fairfieldcomputers.com>
1330 - add documentation to console for groupadd
1331 * Sat Sep 04 2004 D. Scott Barninger <barninger at fairfieldcomputers.com>
1332 - add support for running daemons as root.bacula
1333 - correct for change in location of floppy rescue files in 1.35.2
1334 - removed /etc/bacula/fd script from all packages as it has disappeared from 1.35.2
1335 - updated depgkgs to 30Jul04
1336 * Thu Jun 24 2004 D. Scott Barninger <barninger at fairfieldcomputers.com>
1337 - really, really fix symlink creation for gconsole
1338 * Thu Jun 17 2004 D. Scott Barninger <barninger at fairfieldcomputers.com>
1339 - fix symlink creation in gconsole post install
1340 * Sat Jun 12 2004 D. Scott Barninger <barninger at fairfieldcomputers.com>
1341 - fixed error in gconsole post script
1342 * Fri Apr 30 2004 D. Scott Barninger <barninger at fairfieldcomputers.com>
1343 - add check for gconsole symlink before trying to create it
1344 * Sun Apr 11 2004 D. Scott Barninger <barninger at fairfieldcomputers.com>
1345 - fix some minor permissions issues on doc files that CVS won't let us fix
1346 * Sun Apr 04 2004 D. Scott Barninger <barninger at fairfieldcomputers.com>
1347 - add pkgconfig to BuildRequires
1348 - clean up gnome1/2 menu entries for appropriate packages
1349 * Fri Apr 02 2004 D. Scott Barninger <barninger at fairfieldcomputers.com>
1350 - tightened up doc distribution
1351 * Tue Mar 30 2004 D. Scott Barninger <barninger at fairfieldcomputers.com>
1352 - added usermode (Redhat) and xsu (SuSE) support for gnome-console;
1353 - rpm's horrible bug that prevents nested conditional macros prevents me
1354 - from implementing these 2 separate approaches within the conditionals which
1355 - create the separate server packages.
1356 - the solution adopted is to remove the gnome-console files from the server packages
1357 - so bacula-gconsole is now an add on for both client and server packages.
1358 - this also now allows the server packages to be install on machines without
1359 - an X-server and we can still maintain a single spec file.
1360 - added tests to make sure we have defined platform and database macros.
1361 * Sat Mar 13 2004 D. Scott Barninger <barninger at fairfieldcomputers.com>
1362 - corrected mysql prerequisites for suse
1363 * Mon Mar 1 2004 D. Scott Barninger <barninger at fairfieldcomputers.com>
1364 - replaced all cp commands with cp -p
1365 - removed addition of a+x permissions on gnome-console
1366 - corrected permissions on init scripts
1367 * Sat Feb 28 2004 D. Scott Barninger <barninger at fairfieldcomputers.com>
1368 - corrected creation of sqlite_bindir in install from !mysql to sqlite
1369 -
1370 - various cleanup patches from Michael K. Johnson:
1371 - corrected post install routines for nicer chkconfig
1372 - removed chmod changes in post routines and moved to install section
1373 - removed interactive nature of post routine for rescue package
1374 - added description of building rescue disks to the description of rescue package
1375 - added clean of build root to beginning of install
1376 - removed specifying attr in all file lists
1377 * Fri Feb 20 2004 D. Scott Barninger <barninger at fairfieldcomputers.com>
1378 - added bconsole to client package
1379 - added gconsole package as add-on to client
1380 - removed spurious dependancies on updatedb package (!cut/paste)
1381 * Thu Feb 19 2004 D. Scott Barninger <barninger at fairfieldcomputers.com>
1382 - added updatedb package
1383 * Thu Feb 12 2004 D. Scott Barninger <barninger at fairfieldcomputers.com>
1384 - added postgresql package
1385 * Wed Feb 11 2004 D. Scott Barninger <barninger at fairfieldcomputers.com>
1386 - corrected the if else logic in the dependancy sections
1387 - changes for 1.34 release
1388 - /etc/bacula/console is now /etc/bacula/bconsole
1389 - /etc/bacula/console.conf is now /etc/bacula/bconsole.conf
1390 - /usr/sbin/btraceback.gdb is now /etc/bacula/btraceback.gdb
1391 - /usr/sbin/smtp is now /usr/sbin/bsmtp
1392 - added new /etc/bacula/drop_mysql_database
1393 - added new /etc/bacula/drop_sqlite_database
1394 - added new /etc/bacula/grant_sqlite_privileges
1395 - added new generic bacula database scripts in /etc/bacula
1396 - added pre-install sections to check for database versions older than 6
1397 - added check for /etc/bacula/console.conf and copy to bconsole.conf
1398 * Sun Feb 08 2004 D. Scott Barninger <barninger at fairfieldcomputers.com>
1399 - added /etc/bacula/update_sqlite_tables and /etc/bacula/update_mysql_tables for 1.34 release
1400 - added testing for existing databases before executing any of the database creation scripts
1401 - added defines working_dir and sqlite_bindir in place of hard coded paths
1402 * Sat Jan 31 2004 D. Scott Barninger <barninger at fairfieldcomputers.com>
1403 - added build configuration for SuSE.
1404 - Thanks to Matt Vollmar <matt at panamschool.edu.sv> for his input
1405 * Sat Jan 24 2004 D. Scott Barninger <barninger at fairfieldcomputers.com>
1406 - added patch for create_sqlite_database to fix the installed bindir
1407 - added execute of create_sqlite_database to post of sqlite package
1408 * Sat Jan 10 2004 D. Scott Barninger <barninger at fairfieldcomputers.com>
1409 - added virtual package Provides bacula-dir, bacula-sd, bacula-fd
1410 - added bacula-fd as Requires for rescue package
1411 - added build tag for Fedora Core 1
1412 - cleaned up dependancies for all builds
1413 * Thu Jan 1 2004 D. Scott Barninger <barninger at fairfieldcomputers.com>
1414 - removed rh_version from package names
1415 - added platform build configuration section to beginning of file
1416 * Tue Nov 25 2003 D. Scott Barninger <barninger at fairfieldcomputers.com>
1417 - removed make_static_bacula script from rescue package install
1418 * Sun Nov 23 2003 D. Scott Barninger <barninger at fairfieldcomputers.com>
1419 - Added define at top of file for depkgs version
1420 - Added rescue sub-package
1421 - Moved requires statements into proper sub-package locations
1422 * Mon Oct 27 2003 D. Scott Barninger <barninger at fairfieldcomputers.com>
1423 - Corrected Requires for Gnome 1.4/2.0 builds
1424 * Fri Oct 24 2003 D. Scott Barninger <barninger at fairfieldcomputers.com>
1425 - Added separate source declaration for depkgs
1426 - added patch for make_catalog_backup script
1427 * Mon May 11 2003 D. Scott Barninger <barninger at fairfieldcomputers.com>
1428 - Misc changes to mysql/sqlite build and rh7/8 menu differences
1429 - Added rh_version to sub-package names
1430 - Added installed but missing file /etc/bacula/gconsole
1431 - rm'd /etc/bacula/grant_mysql_privileges on sqlite builds
1432 * Thu May 08 2003 Kern Sibbald <kern at sibbald.com>
1433 - Update spec for version 1.31 and combine client
1434 * Sun Mar 30 2003 D. Scott Barninger <barninger at fairfieldcomputers.com>
1435 - Initial spec file