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