3 # Copyright (C) 2000-2009 Free Software Foundation Europe e.V.
5 # Platform Build Configuration
7 # basic defines for every build
10 %define docs_version 3.0.2
11 %define depkgs_version 18Feb09
12 %define depkgs_qt_version 28Jul09
13 %define _packager D. Scott Barninger <barninger@fairfieldcomputers.com>
16 %{?single_dir_install:%define single_dir 1}
18 # Installation Directory locations
20 %define _prefix /opt/bacula
21 %define _sbindir /opt/bacula/bin
22 %define _bindir /opt/bacula/bin
23 %define _subsysdir /opt/bacula/working
24 %define sqlite_bindir /opt/bacula/sqlite
25 %define _mandir /usr/share/man
26 %define sysconf_dir /opt/bacula/etc
27 %define script_dir /opt/bacula/scripts
28 %define working_dir /opt/bacula/working
29 %define pid_dir /opt/bacula/working
30 %define plugin_dir /opt/bacula/plugins
31 %define lib_dir /opt/bacula/lib
34 %define _sbindir %_prefix/sbin
35 %define _bindir %_prefix/bin
36 %define _subsysdir /var/lock/subsys
37 %define sqlite_bindir %_libdir/bacula/sqlite
38 %define _mandir %_prefix/share/man
39 %define sysconf_dir /etc/bacula
40 %define script_dir %_libdir/bacula
41 %define working_dir /var/lib/bacula
42 %define pid_dir /var/run
43 %define plugin_dir %_libdir/bacula/plugins
44 %define lib_dir %_libdir/bacula/lib
47 # Daemon user:group Don't change them unless you know what you are doing
48 %define director_daemon_user bacula
49 %define storage_daemon_user bacula
50 %define file_daemon_user root
51 %define daemon_group bacula
52 # group that has write access to tape devices, usually disk on Linux
53 %define storage_daemon_group disk
56 # probems with mandriva build:
57 # nothing provides libbonobo2_0-devel, nothing provides libbonoboui2_0-devel
59 # set Macros by opensuse_bs, see http://en.opensuse.org/Build_Service/cross_distribution_package_how_to
60 #openSUSE 11.1 %if 0%{?suse_version} == 1110
61 #openSUSE 11.0 %if 0%{?suse_version} == 1100
62 #openSUSE 10.3 %if 0%{?suse_version} == 1030
63 #openSUSE 10.2 %if 0%{?suse_version} == 1020
64 #SUSE Linux 10.1 %if 0%{?suse_version} == 1010
65 #SUSE Linux 10.0 %if 0%{?suse_version} == 1000
66 #SUSE Linux 9.3 %if 0%{?suse_version} == 930
67 #SLES 9 %if 0%{?sles_version} == 9 also set: %if 0%{?suse_version} == 910
68 #SLE 10 %if 0%{?sles_version} == 10 also set: %if 0%{?suse_version} == 1010
69 #SLE 11 %if 0%{?sles_version} == 11 also set: %if 0%{?suse_version} == 1110
70 #CentOS 5 %if 0%{?centos_version} == 501
71 #RHEL 4 %if 0%{?rhel_version} == 406
72 #RHEL 5 %if 0%{?rhel_version} == 501
73 #Fedora 6 with Extras %if 0%{?fedora_version} == 6
74 #Fedora 7 with Extras %if 0%{?fedora_version} == 7
75 #Fedora 8 with Extras %if 0%{?fedora_version} == 8
76 #Fedora 9 with Extras %if 0%{?fedora_version} == 9
77 #Fedora 10 with Extras %if 0%{?fedora_version} == 10
78 #Mandriva 2006 %if 0%{?mandriva_version} == 2006
79 #Mandriva 2007 %if 0%{?mandriva_version} == 2007
80 #Mandriva 2008 %if 0%{?mandriva_version} == 2008
84 # am I running in opensuse build service?
85 # TODO: seems to make problems
87 # choose database backend here
88 # postgres, mysql, sqlite
89 %define build_postgresql 1
91 # Build Service: Determine Distribution
94 %define build_x86_64 1
98 %if 0%{?fedora_version} || 0%{?rhel_version} || 0%{?centos_version}
99 BuildRequires: GConf2-devel
100 BuildRequires: freetype-devel
101 BuildRequires: libtermcap-devel
102 BuildRequires: shadow-utils
106 %if 0%{?mandriva_version} == 2007
108 %define _dist "Mandriva 2007"
111 %if 0%{?fedora_version} == 8
113 %define _dist "Fedora Core 8"
114 BuildRequires: redhat-release
117 %if 0%{?fedora_version} == 9
119 %define _dist "Fedora Core 9"
120 BuildRequires: redhat-release
124 %if 0%{?fedora_version} == 10
126 %define _dist "Fedora Core 10"
127 BuildRequires: PolicyKit-gnome
128 BuildRequires: fedora-release
131 %if 0%{?fedora_version} == 11
133 %define _dist "Fedora Core 11"
134 BuildRequires: PolicyKit-gnome
135 BuildRequires: fedora-release
138 %if 0%{?rhel_version} == 501
139 %define build_rhel5 1
140 %define _dist "Red Hat Enterprise Linux Server release 5"
141 BuildRequires: redhat-release
144 %if 0%{?rhel_version} == 406
145 %define build_rhel4 1
146 %define _dist "Red Hat Enterprise Linux Server release 4"
147 BuildRequires: redhat-release
151 %if 0%{?centos_version} == 501
152 %define build_centos5 1
153 %define _dist "CentOS 5"
154 BuildRequires: redhat-release
158 %if 0%{?suse_version} == 1020
159 %define build_su102 1
160 %define _dist "OpenSUSE 10.2"
161 BuildRequires: suse-release
165 %if 0%{?suse_version} == 1030
166 %define build_su103 1
167 %define _dist "OpenSUSE 10.3"
168 BuildRequires: suse-release
171 %if 0%{?suse_version} == 1100
172 %define build_su110 1
173 %define _dist "SUSE 11"
174 BuildRequires: suse-release
178 %if 0%{?suse_version} == 1110
179 %define build_su111 1
180 %define _dist "SUSE 11"
184 %if 0%{?sles_version} == 9
186 %define _dist "SLES 9"
190 %if 0%{?sles_version} == 10
192 %define _dist "SLE 10"
196 %if 0%{?sles_version} == 11
197 %define build_su111 1
198 %define _dist "SLES 11"
205 # any patches for this release
206 # be sure to check the setup section for patch macros
208 #--------------------------------------------------------------------------
209 # it should not be necessary to change anything below here for a release
210 # except for patch macros in the setup section
211 #--------------------------------------------------------------------------
213 %{?contrib_packager:%define _packager %{contrib_packager}}
215 Summary: Bacula - The Network Backup Solution
219 Group: System Environment/Daemons
221 BuildRoot: %{_tmppath}/%{name}-root
222 URL: http://www.bacula.org/
223 Vendor: The Bacula Team
224 Packager: %{_packager}
227 Source0: http://www.prdownloads.sourceforge.net/bacula/%{name}-%{version}.tar.gz
228 Source1: Release_Notes-%{version}-%{release}.tar.gz
229 Source2: http://www.prdownloads.sourceforge.net/bacula/%{name}-docs-%{docs_version}.tar.gz
230 Source3: http://www.prdownloads.sourceforge.net/bacula/depkgs-%{depkgs_version}.tar.gz
231 Source4: http://www.prdownloads.sourceforge.net/bacula/depkgs-qt-%{depkgs_qt_version}.tar.gz
232 Source5: bacula-2.2.7-postgresql.patch
234 # define the basic package description
235 %define blurb Bacula - It comes by night and sucks the vital essence from your computers.
236 %define blurb2 Bacula is a set of computer programs that permit you (or the system
237 %define blurb3 administrator) to manage backup, recovery, and verification of computer
238 %define blurb4 data across a network of computers of different kinds. In technical terms,
239 %define blurb5 it is a network client/server based backup program. Bacula is relatively
240 %define blurb6 easy to use and efficient, while offering many advanced storage management
241 %define blurb7 features that make it easy to find and recover lost or damaged files.
242 %define blurb8 Bacula source code has been released under the GPL version 2 license.
244 # Source directory locations
245 %define _docsrc ../%{name}-docs-%{docs_version}
246 %define depkgs ../depkgs
247 %define depkgs_qt ../depkgs-qt
249 %define user_file /etc/passwd
250 %define group_file /etc/group
253 %define useradd /usr/sbin/useradd
254 %define groupadd /usr/sbin/groupadd
255 %define usermod /usr/sbin/usermod
257 # platform defines - set one below or define the build_xxx on the command line
260 %{?build_rh7:%define rh7 1}
262 %{?build_rh8:%define rh8 1}
264 %{?build_rh9:%define rh9 1}
267 %{?build_fc1:%define fc1 1}
269 %{?build_fc3:%define fc3 1}
271 %{?build_fc4:%define fc4 1}
273 %{?build_fc5:%define fc5 1}
275 %{?build_fc6:%define fc6 1}
277 %{?build_fc7:%define fc7 1}
279 %{?build_fc8:%define fc8 1}
281 %{?build_fc9:%define fc9 1}
282 # Whitebox Enterprise build
284 %{?build_wb3:%define wb3 1}
285 # RedHat Enterprise builds
287 %{?build_rhel3:%define rhel3 1}
288 %{?build_rhel3:%define wb3 1}
290 %{?build_rhel4:%define rhel4 1}
291 %{?build_rhel4:%define fc3 1}
293 %{?build_rhel5:%define rhel5 1}
294 %{?build_rhel5:%define fc6 1}
297 %{?build_centos3:%define centos3 1}
298 %{?build_centos3:%define wb3 1}
300 %{?build_centos4:%define centos4 1}
301 %{?build_centos4:%define fc3 1}
303 %{?build_centos5:%define centos5 1}
304 %{?build_centos5:%define fc6 1}
307 %{?build_sl3:%define sl3 1}
308 %{?build_sl3:%define wb3 1}
310 %{?build_sl4:%define sl4 1}
311 %{?build_sl4:%define fc3 1}
313 %{?build_sl5:%define sl5 1}
314 %{?build_sl5:%define fc6 1}
317 %{?build_su9:%define su9 1}
319 %{?build_su10:%define su10 1}
321 %{?build_su102:%define su102 1}
323 %{?build_su103:%define su103 1}
325 %{?build_su110:%define su110 1}
327 %{?build_su111:%define su111 1}
330 %{?build_mdk:%define mdk 1}
332 %{?build_mdv:%define mdv 1}
333 %{?build_mdv:%define mdk 1}
336 %define client_only 0
337 %{?build_client_only:%define client_only 1}
339 # Setup some short cuts
341 %if %{rh7} || %{rh8} || %{rh9}
345 %if %{fc1} || %{fc3} || %{fc4} || %{fc5} || %{fc6} || %{fc7} || %{fc8} || %{fc9}
349 %if %{su9} || %{su10} || %{su102} || %{su103} || %{su110} || %{su111}
353 %if %{rhel3} || %{rhel4} || %{rhel5} || %{centos3} || %{centos4} || %{centos5}
357 %if %{sl3} || %{sl4} || %{sl5}
361 # test for a platform definition
362 %if !%{rhat} && !%{rhel} && !%{fed} && !%{wb3} && !%{suse} && !%{mdk}
363 %{error: You must specify a platform. Please examine the spec file.}
368 # set for database support desired or define the build_xxx on the command line
370 %{?build_mysql:%define mysql 1}
371 # if using mysql 4.x define this and mysql above
372 # currently: Mandrake 10.1, SuSE 9.x & 10.0, RHEL4 and Fedora Core 4
374 %{?build_mysql4:%define mysql4 1}
375 %{?build_mysql4:%define mysql 1}
376 # if using mysql 5.x define this and mysql above
377 # currently: SuSE 10.1 and Fedora Core 5
379 %{?build_mysql5:%define mysql5 1}
380 %{?build_mysql5:%define mysql 1}
382 %{?build_sqlite:%define sqlite 1}
384 %{?build_postgresql:%define postgresql 1}
386 # test for a database definition
387 %if ! %{mysql} && ! %{sqlite} && ! %{postgresql} && ! %{client_only}
388 %{error: You must specify database support. Please examine the spec file.}
393 %define db_backend mysql
396 %define db_backend sqlite3
399 %define db_backend postgresql
404 %{?build_x86_64:%define x86_64 1}
406 # check what distribution we are
407 %if %{rhat} || %{rhel}
408 %define _dist %(grep Red /etc/redhat-release)
410 %if %{fc1} || %{fc3} || %{fc4} || %{fc5} || %{fc7} || %{fc8} || %{fc9}
411 %define _dist %(grep Fedora /etc/redhat-release)
413 %if %{centos5} || %{centos4} || %{centos3}
414 %define _dist %(grep CentOS /etc/redhat-release)
416 %if %{sl5} ||%{sl4} || %{sl3}
417 %define _dist %(grep 'Scientific Linux' /etc/redhat-release)
419 %if %{wb3} && ! %{rhel3} && ! %{centos3} && ! %{sl3}
420 %define _dist %(grep White /etc/whitebox-release)
423 %define _dist %(grep -i SuSE /etc/SuSE-release)
426 %define _dist %(grep Mand /etc/mandrake-release)
428 %{?DISTNAME:%define _dist %{DISTNAME}}
429 Distribution: %{_dist}
431 # Should we build bat
434 %{?build_bat:%define bat 1}
436 # should we turn on python support
438 %{?build_python:%define python 1}
440 # specifically disallow build of mtx package if desired
442 %{?nobuild_mtx:%define mtx 0}
444 # do we need to patch for old postgresql version?
446 %{?build_old_pgsql:%define old_pgsql 1}
448 # Mandriva somehow forces the manpage file extension to bz2 rather than gz
450 %define manpage_ext bz2
452 %define manpage_ext gz
455 # for client only build
464 BuildRequires: gcc, gcc-c++, make, autoconf
465 BuildRequires: glibc, glibc-devel
466 BuildRequires: ncurses-devel, perl
467 BuildRequires: libstdc++-devel, zlib-devel
468 BuildRequires: openssl-devel
469 BuildRequires: libacl-devel
470 BuildRequires: pkgconfig
472 BuildRequires: libxml2-devel
475 BuildRequires: python, python-devel
476 %{expand: %%define pyver %(python -c 'import sys;print(sys.version[0:3])')}
480 BuildRequires: libtermcap-devel
481 BuildRequires: libxml-devel
484 BuildRequires: termcap
487 BuildRequires: libtermcap-devel
488 BuildRequires: libstdc++-static-devel
489 BuildRequires: glibc-static-devel
491 %if %{fc1} || %{fc3} || %{fc4} || %{fc5} || %{fc7} || %{fc8} || %{fc9}
492 BuildRequires: libtermcap-devel
494 %if !%{rh7} && !%{su9} && !%{su10} && !%{su102} && !%{su103} && !%{su110} && !%{su111} && !%{mdk} && !%{fc3} && !%{fc4} && !%{fc5} && !%{fc6} && !%{fc7} && !%{fc8} && !%{fc9}
495 BuildRequires: libtermcap-devel
499 BuildRequires: sqlite-devel
502 %if %{mysql} && ! %{mysql4} && ! %{mysql5}
503 BuildRequires: mysql-devel >= 3.23
506 %if %{mysql} && %{mysql4}
507 BuildRequires: mysql-devel >= 4.0
510 %if %{mysql} && %{mysql5}
511 BuildRequires: mysql-devel >= 5.0
514 %if %{postgresql} && %{wb3}
515 BuildRequires: rh-postgresql-devel >= 7
518 %if %{postgresql} && ! %{wb3}
519 BuildRequires: postgresql-devel >= 7
543 Summary: Bacula - The Network Backup Solution
544 Group: System Environment/Daemons
545 Provides: bacula-dir, bacula-sd, bacula-fd, bacula-server
546 Conflicts: bacula-client
548 Requires: ncurses, libstdc++, zlib, openssl
551 %if %{rhel} || %{rhat} || %{fed}
562 %if %{suse} || %{mdk}
563 Requires: mysql-client
565 Requires: mysql-server
569 %if %{postgresql} && %{wb3}
570 Requires: rh-postgresql >= 7
571 Requires: rh-postgresql-server >= 7
573 %if %{postgresql} && ! %{wb3}
574 Requires: postgresql >= 7
575 Requires: postgresql-server >= 7
588 %description postgresql
592 Requires: python >= %{pyver}
606 This build requires MySQL to be installed separately as the catalog database.
609 This build requires PostgreSQL to be installed separately as the catalog database.
612 This build incorporates sqlite3 as the catalog database, statically compiled.
615 This build includes python scripting support.
619 Summary: Bacula - The Network Backup Solution
620 Group: System Environment/Daemons
622 Conflicts: bacula-mysql
623 Conflicts: bacula-sqlite
624 Conflicts: bacula-postgresql
630 Requires: libstdc++, zlib, openssl
640 Requires: python >= %{pyver}
654 This is the File daemon (Client) only package. It includes the command line
657 This build includes python scripting support.
663 Summary: Bacula - The Network Backup Solution
664 Group: System Environment/Daemons
666 %description updatedb
677 This package installs scripts for updating older versions of the bacula
683 Summary: Bacula - The Network Backup Solution
684 Group: System Environment/Daemons
697 This package installs the Bacula pdf and html documentation.
701 Summary: Bacula - The Network Backup Solution
702 Group: System Environment/Daemons
735 This is the Bacula Administration Tool (bat) graphical user interface package.
736 It is an add-on to the client or server packages.
739 # Must explicitly enable debug pkg on SuSE
742 export LDFLAGS="${LDFLAGS} -L/usr/lib/termcap"
758 #export QTDIR=$(pkg-config --variable=prefix QtCore)
759 #export QTINC=$(pkg-config --variable=includedir QtCore)
760 #export QTLIB=$(pkg-config --variable=libdir QtCore)
761 #export PATH=${QTDIR}/bin/:${PATH}
767 export PATH=${qtdir}/qt4/bin:$PATH
768 export QTDIR=${qtdir}/qt4/
769 export QTINC=${qtdir}/qt4/include/
770 export QTLIB=${qtdir}/qt4/lib/
774 %if %{wb3} || %{old_pgsql}
775 patch -p3 src/cats/postgresql.c < %SOURCE5
778 # patches for the bundled sqlite scripts
780 # patch the make_sqlite_tables script for installation bindir
781 #patch src/cats/make_sqlite_tables.in src/cats/make_sqlite_tables.in.patch
782 patch src/cats/make_sqlite3_tables.in src/cats/make_sqlite3_tables.in.patch
784 # patch the create_sqlite_database script for installation bindir
785 #patch src/cats/create_sqlite_database.in src/cats/create_sqlite_database.in.patch
786 patch src/cats/create_sqlite3_database.in src/cats/create_sqlite3_database.in.patch
788 # patch the make_catalog_backup script for installation bindir
789 patch src/cats/make_catalog_backup.in src/cats/make_catalog_backup.in.patch
791 # patch the update_sqlite_tables script for installation bindir
792 #patch src/cats/update_sqlite_tables.in src/cats/update_sqlite_tables.in.patch
793 patch src/cats/update_sqlite3_tables.in src/cats/update_sqlite3_tables.in.patch
795 # patch the bacula-dir init script to remove sqlite service
796 %if %{sqlite} && %{su9}
797 patch platforms/suse/bacula-dir.in platforms/suse/bacula-dir-suse-sqlite.patch
799 %if %{sqlite} && %{su10}
800 patch platforms/suse/bacula-dir.in platforms/suse/bacula-dir-suse-sqlite.patch
802 %if %{sqlite} && %{su102}
803 patch platforms/suse/bacula-dir.in platforms/suse/bacula-dir-suse-sqlite.patch
805 %if %{sqlite} && %{su103}
806 patch platforms/suse/bacula-dir.in platforms/suse/bacula-dir-suse-sqlite.patch
808 %if %{sqlite} && %{su110}
809 patch platforms/suse/bacula-dir.in platforms/suse/bacula-dir-suse-sqlite.patch
811 %if %{sqlite} && %{su111}
812 patch platforms/suse/bacula-dir.in platforms/suse/bacula-dir-suse-sqlite.patch
815 # 64 bit lib location hacks
816 # as of 1.39.18 it should not be necessary to enable x86_64 as configure is
817 # reported to be fixed to properly detect lib locations.
819 export LDFLAGS="${LDFLAGS} -L/usr/lib64"
821 %if %{mysql} && %{x86_64}
822 export LDFLAGS="${LDFLAGS} -L/usr/lib64/mysql"
824 %if %{python} && %{x86_64}
825 export LDFLAGS="${LDFLAGS} -L/usr/lib64/python%{pyver}"
828 # Red Hat's 64 bit installation of QT4 appears to be broken so:
830 %if %{rhel5} || %{centos5} || %{sl5}
833 #%if %{bat} && %{qt_path} && %{x86_64}
834 #export PATH=/usr/lib64/qt4/bin/:$PATH
835 #export QTDIR=/usr/lib64/qt4/
836 #export QTINC=/usr/lib64/qt4/include/
837 #export QTLIB=/usr/lib64/qt4/
840 # Main Bacula configuration
842 --prefix=%{_prefix} \
843 --sbindir=%{_sbindir} \
844 --sysconfdir=%{sysconf_dir} \
845 --mandir=%{_mandir} \
846 --with-scriptdir=%{script_dir} \
847 --with-working-dir=%{working_dir} \
848 --with-plugindir=%{script_dir} \
849 --with-pid-dir=%{pid_dir} \
850 --with-subsys-dir=%{_subsysdir} \
851 --enable-smartalloc \
869 --enable-client-only \
871 %if %{rh7} || %{rh8} || %{rh9} || %{fc1} || %{fc3} || %{wb3}
872 --disable-batch-insert \
874 --with-dir-user=%{director_daemon_user} \
875 --with-dir-group=%{daemon_group} \
876 --with-sd-user=%{storage_daemon_user} \
877 --with-sd-group=%{storage_daemon_group} \
878 --with-fd-user=%{file_daemon_user} \
879 --with-fd-group=%{daemon_group} \
880 --with-dir-password="XXX_REPLACE_WITH_DIRECTOR_PASSWORD_XXX" \
881 --with-fd-password="XXX_REPLACE_WITH_CLIENT_PASSWORD_XXX" \
882 --with-sd-password="XXX_REPLACE_WITH_STORAGE_PASSWORD_XXX" \
883 --with-mon-dir-password="XXX_REPLACE_WITH_DIRECTOR_MONITOR_PASSWORD_XXX" \
884 --with-mon-fd-password="XXX_REPLACE_WITH_CLIENT_MONITOR_PASSWORD_XXX" \
885 --with-mon-sd-password="XXX_REPLACE_WITH_STORAGE_MONITOR_PASSWORD_XXX" \
893 [ "$RPM_BUILD_ROOT" != "/" ] && rm -rf "$RPM_BUILD_ROOT"
894 mkdir -p $RPM_BUILD_ROOT/etc/init.d
895 mkdir -p $RPM_BUILD_ROOT/etc/logrotate.d
896 mkdir -p $RPM_BUILD_ROOT/etc/log.d/conf/logfiles
897 mkdir -p $RPM_BUILD_ROOT/etc/log.d/conf/services
898 mkdir -p $RPM_BUILD_ROOT/etc/log.d/scripts/services
899 mkdir -p $RPM_BUILD_ROOT%{script_dir}/updatedb
902 mkdir -p $RPM_BUILD_ROOT/usr/share/applications
903 mkdir -p $RPM_BUILD_ROOT/usr/share/pixmaps
904 %define usermode_iftrick 1
906 %define usermode_iftrick 0
909 %if %{usermode_iftrick} && ! %{su9} && ! %{su10} && ! %{su102} && ! %{su103} && ! %{su110} && ! %{su111}
910 mkdir -p $RPM_BUILD_ROOT/etc/pam.d
911 mkdir -p $RPM_BUILD_ROOT/etc/security/console.apps
912 mkdir -p $RPM_BUILD_ROOT%{_sbindir}
913 #mkdir -p $RPM_BUILD_ROOT%{_bindir}
917 mkdir -p $RPM_BUILD_ROOT%{sqlite_bindir}
920 make DESTDIR=$RPM_BUILD_ROOT install
923 # make install in manpages installs _everything_ shotgun style
924 # so now delete what we will not be packaging
925 rm -f $RPM_BUILD_ROOT%{_mandir}/man1/bacula-bwxconsole.1.%{manpage_ext}
926 rm -f $RPM_BUILD_ROOT%{_mandir}/man1/bacula-bgnome-console.1.%{manpage_ext}
927 rm -f $RPM_BUILD_ROOT%{_mandir}/man1/bacula-tray-monitor.1.%{manpage_ext}
930 rm -f $RPM_BUILD_ROOT%{_mandir}/man1/bat.1.%{manpage_ext}
934 rm -f $RPM_BUILD_ROOT%{_mandir}/man1/bsmtp.1.%{manpage_ext}
935 rm -f $RPM_BUILD_ROOT%{_mandir}/man8/bacula-dir.8.%{manpage_ext}
936 rm -f $RPM_BUILD_ROOT%{_mandir}/man8/bacula-sd.8.%{manpage_ext}
937 rm -f $RPM_BUILD_ROOT%{_mandir}/man8/bcopy.8.%{manpage_ext}
938 rm -f $RPM_BUILD_ROOT%{_mandir}/man8/bextract.8.%{manpage_ext}
939 rm -f $RPM_BUILD_ROOT%{_mandir}/man8/bls.8.%{manpage_ext}
940 rm -f $RPM_BUILD_ROOT%{_mandir}/man8/bscan.8.%{manpage_ext}
941 rm -f $RPM_BUILD_ROOT%{_mandir}/man8/btape.8.%{manpage_ext}
942 rm -f $RPM_BUILD_ROOT%{_mandir}/man8/dbcheck.8.%{manpage_ext}
945 # fixme - make installs the mysql scripts for sqlite build
947 rm -f $RPM_BUILD_ROOT%{script_dir}/startmysql
948 rm -f $RPM_BUILD_ROOT%{script_dir}/stopmysql
949 rm -f $RPM_BUILD_ROOT%{script_dir}/grant_mysql_privileges
952 # fixme - make installs the mysql scripts for postgresql build
954 rm -f $RPM_BUILD_ROOT%{script_dir}/startmysql
955 rm -f $RPM_BUILD_ROOT%{script_dir}/stopmysql
958 rm -f $RPM_BUILD_ROOT%{script_dir}/gconsole
959 rm -f $RPM_BUILD_ROOT%{_sbindir}/static-bacula-fd
961 # install the init scripts
963 cp -p platforms/suse/bacula-dir $RPM_BUILD_ROOT/etc/init.d/bacula-dir
964 cp -p platforms/suse/bacula-fd $RPM_BUILD_ROOT/etc/init.d/bacula-fd
965 cp -p platforms/suse/bacula-sd $RPM_BUILD_ROOT/etc/init.d/bacula-sd
968 cp -p platforms/mandrake/bacula-dir $RPM_BUILD_ROOT/etc/init.d/bacula-dir
969 cp -p platforms/mandrake/bacula-fd $RPM_BUILD_ROOT/etc/init.d/bacula-fd
970 cp -p platforms/mandrake/bacula-sd $RPM_BUILD_ROOT/etc/init.d/bacula-sd
972 %if ! %{suse} && ! %{mdk}
973 cp -p platforms/redhat/bacula-dir $RPM_BUILD_ROOT/etc/init.d/bacula-dir
974 cp -p platforms/redhat/bacula-fd $RPM_BUILD_ROOT/etc/init.d/bacula-fd
975 cp -p platforms/redhat/bacula-sd $RPM_BUILD_ROOT/etc/init.d/bacula-sd
977 chmod 0754 $RPM_BUILD_ROOT/etc/init.d/*
979 rm -f $RPM_BUILD_ROOT/etc/init.d/bacula-dir
980 rm -f $RPM_BUILD_ROOT/etc/init.d/bacula-sd
983 # install the menu stuff
985 cp -p src/qt-console/images/bat_icon.png $RPM_BUILD_ROOT/usr/share/pixmaps/bat_icon.png
986 cp -p scripts/bat.desktop.xsu $RPM_BUILD_ROOT/usr/share/applications/bat.desktop
988 %if %{rh8} || %{rh9} || %{wb3} || %{fc1} || %{fc3} || %{fc4} || %{fc5} || %{fc6} || %{fc7} || %{fc8} || %{fc9} || %{mdk}
993 %if %{bat} && %{iftrick}
994 cp -p src/qt-console/images/bat_icon.png $RPM_BUILD_ROOT/usr/share/pixmaps/bat_icon.png
995 cp -p scripts/bat.desktop.consolehelper $RPM_BUILD_ROOT/usr/share/applications/bat.desktop
996 cp -p scripts/bat.console_apps $RPM_BUILD_ROOT/etc/security/console.apps/bat
997 cp -p scripts/bat.pamd $RPM_BUILD_ROOT/etc/pam.d/bat
998 ln -sf consolehelper $RPM_BUILD_ROOT/%{_sbindir}/bat
1003 cp -p %{depkgs}/sqlite3/sqlite3 $RPM_BUILD_ROOT%{sqlite_bindir}/sqlite3
1004 cp -p %{depkgs}/sqlite3/sqlite3.h $RPM_BUILD_ROOT%{sqlite_bindir}/sqlite3.h
1005 cp -p %{depkgs}/sqlite3/libsqlite3.a $RPM_BUILD_ROOT%{sqlite_bindir}/libsqlite3.a
1008 # install the logrotate file
1009 cp -p scripts/logrotate $RPM_BUILD_ROOT/etc/logrotate.d/bacula
1011 # install the updatedb scripts
1012 cp -p updatedb/* $RPM_BUILD_ROOT%{script_dir}/updatedb/
1014 # install the logwatch scripts
1015 %if ! %{client_only}
1016 cp -p scripts/logwatch/bacula $RPM_BUILD_ROOT/etc/log.d/scripts/services/bacula
1017 cp -p scripts/logwatch/logfile.bacula.conf $RPM_BUILD_ROOT/etc/log.d/conf/logfiles/bacula.conf
1018 cp -p scripts/logwatch/services.bacula.conf $RPM_BUILD_ROOT/etc/log.d/conf/services/bacula.conf
1019 chmod 755 $RPM_BUILD_ROOT/etc/log.d/scripts/services/bacula
1020 chmod 644 $RPM_BUILD_ROOT/etc/log.d/conf/logfiles/bacula.conf
1021 chmod 644 $RPM_BUILD_ROOT/etc/log.d/conf/services/bacula.conf
1024 # install docs for single dir installation
1025 mkdir $RPM_BUILD_ROOT%{_prefix}/doc
1026 cp COPYING $RPM_BUILD_ROOT%{_prefix}/doc/
1027 cp ChangeLog $RPM_BUILD_ROOT%{_prefix}/doc/
1028 cp ReleaseNotes $RPM_BUILD_ROOT%{_prefix}/doc/
1029 cp VERIFYING $RPM_BUILD_ROOT%{_prefix}/doc/
1030 cp LICENSE $RPM_BUILD_ROOT%{_prefix}/doc/
1031 cp kernstodo $RPM_BUILD_ROOT%{_prefix}/doc/
1032 cp -r %{_docsrc}/manuals/en/catalog/catalog $RPM_BUILD_ROOT%{_prefix}/doc/
1033 cp %{_docsrc}/manuals/en/catalog/catalog.pdf $RPM_BUILD_ROOT%{_prefix}/doc/
1034 cp -r %{_docsrc}/manuals/en/concepts/concepts $RPM_BUILD_ROOT%{_prefix}/doc/
1035 cp %{_docsrc}/manuals/en/concepts/concepts.pdf $RPM_BUILD_ROOT%{_prefix}/doc/
1036 cp -r %{_docsrc}/manuals/en/console/console $RPM_BUILD_ROOT%{_prefix}/doc/
1037 cp %{_docsrc}/manuals/en/console/console.pdf $RPM_BUILD_ROOT%{_prefix}/doc/
1038 cp -r %{_docsrc}/manuals/en/developers/developers $RPM_BUILD_ROOT%{_prefix}/doc/
1039 cp %{_docsrc}/manuals/en/developers/developers.pdf $RPM_BUILD_ROOT%{_prefix}/doc/
1040 cp -r %{_docsrc}/manuals/en/install/install $RPM_BUILD_ROOT%{_prefix}/doc/
1041 cp %{_docsrc}/manuals/en/install/install.pdf $RPM_BUILD_ROOT%{_prefix}/doc/
1042 cp -r %{_docsrc}/manuals/en/problems/problems $RPM_BUILD_ROOT%{_prefix}/doc/
1043 cp %{_docsrc}/manuals/en/problems/problems.pdf $RPM_BUILD_ROOT%{_prefix}/doc/
1044 cp -r %{_docsrc}/manuals/en/utility/utility $RPM_BUILD_ROOT%{_prefix}/doc/
1045 cp %{_docsrc}/manuals/en/utility/utility.pdf $RPM_BUILD_ROOT%{_prefix}/doc/
1046 cp ../Release_Notes-%{version}-%{release}.txt $RPM_BUILD_ROOT%{_prefix}/doc/
1048 # now clean up permissions that are left broken by the install
1049 chmod o-rwx $RPM_BUILD_ROOT%{working_dir}
1051 # fix me - building enable-client-only installs files not included in bacula-client package
1053 rm -f $RPM_BUILD_ROOT%{script_dir}/bacula
1054 rm -f $RPM_BUILD_ROOT%{script_dir}/bacula-ctl-dir
1055 rm -f $RPM_BUILD_ROOT%{script_dir}/bacula-ctl-sd
1056 rm -f $RPM_BUILD_ROOT%{script_dir}/disk-changer
1057 rm -f $RPM_BUILD_ROOT%{script_dir}/dvd-handler
1058 rm -f $RPM_BUILD_ROOT%{script_dir}/mtx-changer
1059 rm -f $RPM_BUILD_ROOT%{script_dir}/startmysql
1060 rm -f $RPM_BUILD_ROOT%{script_dir}/stopmysql
1061 rm -rf $RPM_BUILD_ROOT%{script_dir}/updatedb
1062 rm -f $RPM_BUILD_ROOT%{script_dir}/bconsole
1063 rm -f $RPM_BUILD_ROOT%{script_dir}/bpipe-fd.so
1064 rm -f $RPM_BUILD_ROOT%{script_dir}/mtx-changer.conf
1065 rm -f $RPM_BUILD_ROOT%{_sbindir}/bacula
1069 [ "$RPM_BUILD_ROOT" != "/" ] && rm -rf "$RPM_BUILD_ROOT"
1070 rm -rf $RPM_BUILD_DIR/%{name}-docs-%{docs_version}
1071 rm -rf $RPM_BUILD_DIR/depkgs
1072 rm -f $RPM_BUILD_DIR/Release_Notes-%{version}-%{release}.txt
1075 # MySQL specific files
1077 %defattr(-, root, root)
1078 %attr(-, root, %{daemon_group}) %{script_dir}/create_mysql_database
1079 %attr(-, root, %{daemon_group}) %{script_dir}/drop_mysql_database
1080 %attr(-, root, %{daemon_group}) %{script_dir}/make_mysql_tables
1081 %attr(-, root, %{daemon_group}) %{script_dir}/drop_mysql_tables
1082 %attr(-, root, %{daemon_group}) %{script_dir}/update_mysql_tables
1083 %attr(-, root, %{daemon_group}) %{script_dir}/grant_mysql_privileges
1084 %attr(-, root, %{daemon_group}) %{script_dir}/startmysql
1085 %attr(-, root, %{daemon_group}) %{script_dir}/stopmysql
1090 %defattr(-,root,root)
1091 %attr(-, root, %{daemon_group}) %{script_dir}/create_sqlite3_database
1092 %attr(-, root, %{daemon_group}) %{script_dir}/drop_sqlite3_database
1093 %attr(-, root, %{daemon_group}) %{script_dir}/grant_sqlite3_privileges
1094 %attr(-, root, %{daemon_group}) %{script_dir}/make_sqlite3_tables
1095 %attr(-, root, %{daemon_group}) %{script_dir}/drop_sqlite3_tables
1096 %attr(-, root, %{daemon_group}) %{script_dir}/update_sqlite3_tables
1097 %{sqlite_bindir}/libsqlite3.a
1098 %{sqlite_bindir}/sqlite3.h
1099 %{sqlite_bindir}/sqlite3
1104 %defattr(-,root,root)
1105 %attr(-, root, %{daemon_group}) %{script_dir}/create_postgresql_database
1106 %attr(-, root, %{daemon_group}) %{script_dir}/drop_postgresql_database
1107 %attr(-, root, %{daemon_group}) %{script_dir}/make_postgresql_tables
1108 %attr(-, root, %{daemon_group}) %{script_dir}/drop_postgresql_tables
1109 %attr(-, root, %{daemon_group}) %{script_dir}/update_postgresql_tables
1110 %attr(-, root, %{daemon_group}) %{script_dir}/grant_postgresql_privileges
1113 # The rest is DB backend independent
1114 %if ! %{client_only}
1115 %attr(-, root, %{daemon_group}) %dir %{script_dir}
1116 %attr(-, root, %{daemon_group}) %{script_dir}/bacula
1117 %attr(-, root, %{daemon_group}) %{script_dir}/bconsole
1118 %attr(-, root, %{daemon_group}) %{script_dir}/create_bacula_database
1119 %attr(-, root, %{daemon_group}) %{script_dir}/drop_bacula_database
1120 %attr(-, root, %{daemon_group}) %{script_dir}/grant_bacula_privileges
1121 %attr(-, root, %{daemon_group}) %{script_dir}/make_bacula_tables
1122 %attr(-, root, %{daemon_group}) %{script_dir}/drop_bacula_tables
1123 %attr(-, root, %{daemon_group}) %{script_dir}/update_bacula_tables
1124 %attr(-, root, %{daemon_group}) %{script_dir}/make_catalog_backup
1125 %attr(-, root, %{daemon_group}) %{script_dir}/delete_catalog_backup
1126 %attr(-, root, %{daemon_group}) %{script_dir}/btraceback.dbx
1127 %attr(-, root, %{daemon_group}) %{script_dir}/btraceback.gdb
1128 %attr(-, root, %{daemon_group}) %{script_dir}/disk-changer
1129 %attr(-, root, %{daemon_group}) %{script_dir}/bacula-ctl-dir
1130 %attr(-, root, %{daemon_group}) %{script_dir}/bacula-ctl-fd
1131 %attr(-, root, %{daemon_group}) %{script_dir}/bacula-ctl-sd
1132 %attr(-, root, %{daemon_group}) %{script_dir}/bpipe-fd.so
1133 %attr(-, root, %{daemon_group}) /etc/init.d/bacula-dir
1134 %attr(-, root, %{daemon_group}) /etc/init.d/bacula-fd
1135 %attr(-, root, %{storage_daemon_group}) %{script_dir}/dvd-handler
1136 %attr(-, root, %{storage_daemon_group}) /etc/init.d/bacula-sd
1137 %attr(-, root, %{storage_daemon_group}) %{script_dir}/mtx-changer
1138 %attr(-, root, %{storage_daemon_group}) %{script_dir}/mtx-changer.conf
1140 /etc/logrotate.d/bacula
1141 /etc/log.d/scripts/services/bacula
1142 %attr(-, root, %{daemon_group}) %config(noreplace) %{sysconf_dir}/bacula-dir.conf
1143 %attr(-, root, %{daemon_group}) %config(noreplace) %{sysconf_dir}/bacula-fd.conf
1144 %attr(-, root, %{storage_daemon_group}) %config(noreplace) %{sysconf_dir}/bacula-sd.conf
1145 %attr(-, root, %{daemon_group}) %config(noreplace) %{sysconf_dir}/bconsole.conf
1146 %attr(-, root, %{daemon_group}) %config(noreplace) /etc/log.d/conf/logfiles/bacula.conf
1147 %attr(-, root, %{daemon_group}) %config(noreplace) /etc/log.d/conf/services/bacula.conf
1148 %attr(-, root, %{daemon_group}) %config(noreplace) %{script_dir}/query.sql
1150 %attr(-, %{storage_daemon_user}, %{daemon_group}) %dir %{working_dir}
1152 %{_sbindir}/bacula-dir
1153 %{_sbindir}/bacula-fd
1154 %{_sbindir}/bacula-sd
1157 %{_sbindir}/bextract
1161 %{_sbindir}/btraceback
1162 %{_sbindir}/bconsole
1167 %{_mandir}/man8/bacula-fd.8.%{manpage_ext}
1168 %{_mandir}/man8/bacula-dir.8.%{manpage_ext}
1169 %{_mandir}/man8/bacula-sd.8.%{manpage_ext}
1170 %{_mandir}/man8/bacula.8.%{manpage_ext}
1171 %{_mandir}/man8/bconsole.8.%{manpage_ext}
1172 %{_mandir}/man8/bcopy.8.%{manpage_ext}
1173 %{_mandir}/man8/bextract.8.%{manpage_ext}
1174 %{_mandir}/man8/bls.8.%{manpage_ext}
1175 %{_mandir}/man8/bscan.8.%{manpage_ext}
1176 %{_mandir}/man8/btape.8.%{manpage_ext}
1177 %{_mandir}/man8/btraceback.8.%{manpage_ext}
1178 %{_mandir}/man8/dbcheck.8.%{manpage_ext}
1179 %{_mandir}/man1/bsmtp.1.%{manpage_ext}
1186 # test for bacula database older than version 10
1187 # note: this ASSUMES no password has been set for bacula database
1188 DB_VER=`mysql 2>/dev/null bacula -e 'select * from Version;'|tail -n 1`
1193 # are we upgrading from sqlite to sqlite3?
1194 if [ -s %{working_dir}/bacula.db ] && [ -s %{sqlite_bindir}/sqlite ];then
1195 echo "This version of bacula-sqlite involves an upgrade to sqlite3."
1196 echo "Your catalog database file is not compatible with sqlite3, thus"
1197 echo "you will need to dump the data, delete the old file, and re-run"
1198 echo "this rpm upgrade."
1200 echo "Backing up your current database..."
1201 echo ".dump" | %{sqlite_bindir}/sqlite %{working_dir}/bacula.db > %{working_dir}/bacula_backup.sql
1202 mv %{working_dir}/bacula.db %{working_dir}/bacula.db.old
1203 echo "Your catalog data has been saved in %{working_dir}/bacula_backup.sql and your"
1204 echo "catalog file has been renamed %{working_dir}/bacula.db.old."
1206 echo "Please re-run this rpm package upgrade."
1207 echo "After the upgrade is complete, restore your catalog"
1208 echo "with the following commands:"
1209 echo "%{script_dir}/drop_sqlite3_tables"
1210 echo "cd %{working_dir}"
1211 echo "%{sqlite_bindir}/sqlite3 $* bacula.db < bacula_backup.sql"
1212 echo "chown bacula.bacula bacula.db"
1215 # test for bacula database older than version 10 and sqlite3
1216 if [ -s %{working_dir}/bacula.db ] && [ -s %{sqlite_bindir}/sqlite3 ];then
1217 DB_VER=`echo "select * from Version;" | %{sqlite_bindir}/sqlite3 2>/dev/null %{working_dir}/bacula.db | tail -n 1`
1222 DB_VER=`echo 'select * from Version;' | psql bacula 2>/dev/null | tail -3 | head -1`
1225 %if ! %{client_only}
1226 if [ -n "$DB_VER" ] && [ "$DB_VER" -lt "10" ]; then
1227 echo "This bacula upgrade will update a bacula database from version 10 to 11."
1228 echo "You appear to be running database version $DB_VER. You must first update"
1229 echo "your database to version 10 and then install this upgrade. The alternative"
1230 echo "is to use %{script_dir}/drop_%{db_backend}_tables to delete all your your current"
1231 echo "catalog information, then do the upgrade. Information on updating a"
1232 echo "database older than version 10 can be found in the release notes."
1241 %if ! %{client_only}
1242 # check for and copy %{sysconf_dir}/console.conf to bconsole.conf
1243 if [ -s %{sysconf_dir}/console.conf ];then
1244 cp -p %{sysconf_dir}/console.conf %{sysconf_dir}/bconsole.conf
1247 # create the daemon users and groups
1248 # first create the groups if they don't exist
1249 HAVE_BACULA=`grep %{daemon_group} %{group_file} 2>/dev/null`
1250 if [ -z "$HAVE_BACULA" ]; then
1251 %{groupadd} -r %{daemon_group} > /dev/null 2>&1
1252 echo "The group %{daemon_group} has been added to %{group_file}."
1253 echo "See the manual chapter \"Running Bacula\" for details."
1255 HAVE_BACULA=`grep %{storage_daemon_group} %{group_file} 2>/dev/null`
1256 if [ -z "$HAVE_BACULA" ]; then
1257 %{groupadd} -r %{storage_daemon_group} > /dev/null 2>&1
1258 echo "The group %{storage_daemon_group} has been added to %{group_file}."
1259 echo "See the manual chapter \"Running Bacula\" for details."
1261 # now create the users if they do not exist
1262 # we do not use the -g option allowing the primary group to be set to system default
1263 # this will be a unique group on redhat type systems or the group users on some systems
1264 HAVE_BACULA=`grep %{storage_daemon_user} %{user_file} 2>/dev/null`
1265 if [ -z "$HAVE_BACULA" ]; then
1266 %{useradd} -r -c "Bacula" -d %{working_dir} -g %{storage_daemon_group} -M -s /sbin/nologin %{storage_daemon_user} > /dev/null 2>&1
1267 echo "The user %{storage_daemon_user} has been added to %{user_file}."
1268 echo "See the manual chapter \"Running Bacula\" for details."
1270 HAVE_BACULA=`grep %{director_daemon_user} %{user_file} 2>/dev/null`
1271 if [ -z "$HAVE_BACULA" ]; then
1272 %{useradd} -r -c "Bacula" -d %{working_dir} -g %{daemon_group} -M -s /sbin/nologin %{director_daemon_user} > /dev/null 2>&1
1273 echo "The user %{director_daemon_user} has been added to %{user_file}."
1274 echo "See the manual chapter \"Running Bacula\" for details."
1276 HAVE_BACULA=`grep %{file_daemon_user} %{user_file} 2>/dev/null`
1277 if [ -z "$HAVE_BACULA" ]; then
1278 %{useradd} -r -c "Bacula" -d %{working_dir} -g %{daemon_group} -M -s /sbin/nologin %{file_daemon_user} > /dev/null 2>&1
1279 echo "The user %{file_daemon_user} has been added to %{user_file}."
1280 echo "See the manual chapter \"Running Bacula\" for details."
1282 # now we add the supplementary groups, this is ok to call even if the users already exist
1283 # we only do this if the user is NOT root
1284 IS_ROOT=%{director_daemon_user}
1285 if [ "$IS_ROOT" != "root" ]; then
1286 %{usermod} -G %{daemon_group} %{director_daemon_user}
1288 IS_ROOT=%{storage_daemon_user}
1289 if [ "$IS_ROOT" != "root" ]; then
1290 %{usermod} -G %{daemon_group},%{storage_daemon_group} %{storage_daemon_user}
1292 IS_ROOT=%{file_daemon_user}
1293 if [ "$IS_ROOT" != "root" ]; then
1294 %{usermod} -G %{daemon_group} %{file_daemon_user}
1308 %if ! %{client_only}
1310 if [ "$1" -ge 1 ] ; then
1311 /sbin/chkconfig --add bacula-dir
1312 /sbin/chkconfig --add bacula-fd
1313 /sbin/chkconfig --add bacula-sd
1318 # test for an existing database
1319 # note: this ASSUMES no password has been set for bacula database
1320 DB_VER=`mysql 2>/dev/null bacula -e 'select * from Version;'|tail -n 1`
1322 # grant privileges and create tables if they do not exist
1323 if [ -z "$DB_VER" ]; then
1324 echo "Hmm, it doesn't look like you have an existing database."
1325 echo "Granting privileges for MySQL user bacula..."
1326 %{script_dir}/grant_mysql_privileges
1327 echo "Creating MySQL bacula database..."
1328 %{script_dir}/create_mysql_database
1329 echo "Creating bacula tables..."
1330 %{script_dir}/make_mysql_tables
1332 # check to see if we need to upgrade a 2.x database
1333 elif [ "$DB_VER" -lt "11" ]; then
1334 echo "This release requires an upgrade to your bacula database."
1335 echo "Backing up your current database..."
1336 mysqldump -f --opt bacula | bzip2 > %{working_dir}/bacula_backup.sql.bz2
1337 echo "Upgrading bacula database ..."
1338 %{script_dir}/update_mysql_tables
1339 echo "If bacula works correctly you can remove the backup file %{working_dir}/bacula_backup.sql.bz2"
1345 # test for an existing database
1346 if [ -s %{working_dir}/bacula.db ]; then
1347 DB_VER=`echo "select * from Version;" | %{sqlite_bindir}/sqlite3 2>/dev/null %{working_dir}/bacula.db | tail -n 1`
1348 # check to see if we need to upgrade a 2.x database
1349 if [ "$DB_VER" -lt "11" ] && [ "$DB_VER" -ge "10" ]; then
1350 echo "This release requires an upgrade to your bacula database."
1351 echo "Backing up your current database..."
1352 echo ".dump" | %{sqlite_bindir}/sqlite3 %{working_dir}/bacula.db | bzip2 > %{working_dir}/bacula_backup.sql.bz2
1353 echo "Upgrading bacula database ..."
1354 %{script_dir}/update_sqlite3_tables
1355 echo "If bacula works correctly you can remove the backup file %{working_dir}/bacula_backup.sql.bz2"
1358 # create the database and tables
1359 echo "Hmm, it doesn't look like you have an existing database."
1360 echo "Creating SQLite database..."
1361 %{script_dir}/create_sqlite3_database
1362 echo "Creating the SQLite tables..."
1363 %{script_dir}/make_sqlite3_tables
1364 chown %{director_daemon_user}.%{daemon_group} %{working_dir}/bacula.db
1369 # test for an existing database
1370 # note: this ASSUMES no password has been set for bacula database
1371 DB_VER=`echo 'select * from Version;' | psql bacula 2>/dev/null | tail -3 | head -1`
1373 # grant privileges and create tables if they do not exist
1374 if [ -z "$DB_VER" ]; then
1375 echo "Hmm, doesn't look like you have an existing database."
1376 echo "Creating PostgreSQL bacula database..."
1377 %{script_dir}/create_postgresql_database
1378 echo "Creating bacula tables..."
1379 %{script_dir}/make_postgresql_tables
1380 echo "Granting privileges for PostgreSQL user bacula..."
1381 %{script_dir}/grant_postgresql_privileges
1383 # check to see if we need to upgrade a 2.x database
1384 elif [ "$DB_VER" -lt "11" ]; then
1385 echo "This release requires an upgrade to your bacula database."
1386 echo "Backing up your current database..."
1387 pg_dump bacula | bzip2 > %{working_dir}/bacula_backup.sql.bz2
1388 echo "Upgrading bacula database ..."
1389 %{script_dir}/update_postgresql_tables
1390 echo "If bacula works correctly you can remove the backup file %{working_dir}/bacula_backup.sql.bz2"
1395 %if ! %{client_only}
1396 if [ -d %{sysconf_dir} ]; then
1398 for string in XXX_REPLACE_WITH_DIRECTOR_PASSWORD_XXX XXX_REPLACE_WITH_CLIENT_PASSWORD_XXX XXX_REPLACE_WITH_STORAGE_PASSWORD_XXX XXX_REPLACE_WITH_DIRECTOR_MONITOR_PASSWORD_XXX XXX_REPLACE_WITH_CLIENT_MONITOR_PASSWORD_XXX XXX_REPLACE_WITH_STORAGE_MONITOR_PASSWORD_XXX; do
1399 pass=`openssl rand -base64 33`
1400 for file in *.conf; do
1401 need_password=`grep ${string} $file 2>/dev/null`
1402 if [ -n "$need_password" ]; then
1403 sed "s@${string}@${pass}@g" $file > $file.new
1404 cp -f $file.new $file; rm -f $file.new
1408 # put actual hostname in conf file
1410 string="XXX_HOSTNAME_XXX"
1411 for file in *.conf; do
1412 need_host=`grep ${string} $file 2>/dev/null`
1413 if [ -n "$need_host" ]; then
1414 sed "s@${string}@${host}@g" $file >$file.new
1415 cp -f $file.new $file; rm -f $file.new
1432 %if ! %{client_only}
1435 /sbin/chkconfig --del bacula-dir
1436 /sbin/chkconfig --del bacula-fd
1437 /sbin/chkconfig --del bacula-sd
1455 %defattr(-,root,root)
1456 %attr(-, root, %{daemon_group}) %dir %{script_dir}
1457 %{script_dir}/bacula-ctl-fd
1458 /etc/init.d/bacula-fd
1460 /etc/logrotate.d/bacula
1462 %attr(-, root, %{daemon_group}) %config(noreplace) %{sysconf_dir}/bacula-fd.conf
1463 %attr(-, root, %{daemon_group}) %config(noreplace) %{sysconf_dir}/bconsole.conf
1464 %attr(-, root, %{daemon_group}) %dir %{working_dir}
1466 %{_sbindir}/bacula-fd
1467 %{_sbindir}/btraceback
1468 %attr(-, root, %{daemon_group}) %{script_dir}/btraceback.gdb
1469 %attr(-, root, %{daemon_group}) %{script_dir}/btraceback.dbx
1470 %{_sbindir}/bconsole
1471 %{_mandir}/man8/bacula-fd.8.%{manpage_ext}
1472 %{_mandir}/man8/bacula.8.%{manpage_ext}
1473 %{_mandir}/man8/bconsole.8.%{manpage_ext}
1474 %{_mandir}/man8/btraceback.8.%{manpage_ext}
1476 %{_libdir}/libbaccfg.*
1477 %{_libdir}/libbacfind.*
1478 %{_libdir}/libbacpy.*
1483 # create the daemon group and user
1484 HAVE_BACULA=`grep %{daemon_group} %{group_file} 2>/dev/null`
1485 if [ -z "$HAVE_BACULA" ]; then
1486 %{groupadd} -r %{daemon_group} > /dev/null 2>&1
1487 echo "The group %{daemon_group} has been added to %{group_file}."
1488 echo "See the manual chapter \"Running Bacula\" for details."
1490 # we do not use the -g option allowing the primary group to be set to system default
1491 # this will be a unique group on redhat type systems or the group users on some systems
1492 HAVE_BACULA=`grep %{file_daemon_user} %{user_file} 2>/dev/null`
1493 if [ -z "$HAVE_BACULA" ]; then
1494 %{useradd} -r -c "Bacula" -d %{working_dir} -g %{daemon_group} -M -s /sbin/nologin %{file_daemon_user} > /dev/null 2>&1
1495 echo "The user %{file_daemon_user} has been added to %{user_file}."
1496 echo "See the manual chapter \"Running Bacula\" for details."
1498 # now we add the supplementary group, this is ok to call even if the user already exists
1499 # we only do this if the user is NOT root
1500 IS_ROOT=%{file_daemon_user}
1501 if [ "$IS_ROOT" != "root" ]; then
1502 %{usermod} -G %{daemon_group} %{file_daemon_user}
1507 if [ "$1" -ge 1 ] ; then
1508 /sbin/chkconfig --add bacula-fd
1511 if [ -d %{sysconf_dir} ]; then
1513 for string in XXX_REPLACE_WITH_DIRECTOR_PASSWORD_XXX XXX_REPLACE_WITH_CLIENT_PASSWORD_XXX XXX_REPLACE_WITH_STORAGE_PASSWORD_XXX XXX_REPLACE_WITH_DIRECTOR_MONITOR_PASSWORD_XXX XXX_REPLACE_WITH_CLIENT_MONITOR_PASSWORD_XXX XXX_REPLACE_WITH_STORAGE_MONITOR_PASSWORD_XXX; do
1514 pass=`openssl rand -base64 33`
1515 for file in *.conf; do
1516 need_password=`grep ${string} $file 2>/dev/null`
1517 if [ -n "$need_password" ]; then
1518 sed "s@${string}@${pass}@g" $file > $file.new
1519 cp -f $file.new $file; rm -f $file.new
1523 # put actual hostname in conf file
1525 string="XXX_HOSTNAME_XXX"
1526 for file in *.conf; do
1527 need_host=`grep ${string} $file 2>/dev/null`
1528 if [ -n "$need_host" ]; then
1529 sed "s@${string}@${host}@g" $file >$file.new
1530 cp -f $file.new $file; rm -f $file.new
1540 /sbin/chkconfig --del bacula-fd
1546 %if ! %{client_only}
1548 %defattr(-,root,%{daemon_group})
1549 %{script_dir}/updatedb/*
1552 # create the daemon group
1553 HAVE_BACULA=`grep %{daemon_group} %{group_file} 2>/dev/null`
1554 if [ -z "$HAVE_BACULA" ]; then
1555 %{groupadd} -r %{daemon_group} > /dev/null 2>&1
1556 echo "The group %{daemon_group} has been added to %{group_file}."
1557 echo "See the manual chapter \"Running Bacula\" for details."
1561 echo "The database update scripts were installed to %{script_dir}/updatedb"
1565 %doc COPYING ChangeLog ReleaseNotes LICENSE VERIFYING kernstodo ../Release_Notes-%{version}-%{release}.txt
1566 %doc %{_docsrc}/manuals/en/catalog/catalog %{_docsrc}/manuals/en/catalog/catalog.pdf
1567 %doc %{_docsrc}/manuals/en/concepts/concepts %{_docsrc}/manuals/en/concepts/concepts.pdf
1568 %doc %{_docsrc}/manuals/en/console/console %{_docsrc}/manuals/en/console/console.pdf
1569 %doc %{_docsrc}/manuals/en/developers/developers %{_docsrc}/manuals/en/developers/developers.pdf
1570 %doc %{_docsrc}/manuals/en/install/install %{_docsrc}/manuals/en/install/install.pdf
1571 %doc %{_docsrc}/manuals/en/problems/problems %{_docsrc}/manuals/en/problems/problems.pdf
1572 %doc %{_docsrc}/manuals/en/utility/utility %{_docsrc}/manuals/en/utility/utility.pdf
1577 %defattr(-,root,root)
1579 %attr(-, root, %{daemon_group}) %dir %{sysconf_dir}
1580 %attr(-, root, %{daemon_group}) %config(noreplace) %{sysconf_dir}/bat.conf
1581 /usr/share/pixmaps/bat_icon.png
1582 /usr/share/applications/bat.desktop
1583 %{_mandir}/man1/bat.1.%{manpage_ext}
1586 %if %{bat} && ! %{su9} && ! %{su10} && ! %{su102} && ! %{su103} && ! %{su110} && ! %{su111}
1587 # add the console helper files
1588 %config(noreplace,missingok) /etc/pam.d/bat
1589 %config(noreplace,missingok) /etc/security/console.apps/bat
1594 # create the daemon group
1595 HAVE_BACULA=`grep %{daemon_group} %{group_file} 2>/dev/null`
1596 if [ -z "$HAVE_BACULA" ]; then
1597 %{groupadd} -r %{daemon_group} > /dev/null 2>&1
1598 echo "The group %{daemon_group} has been added to %{group_file}."
1599 echo "See the manual chapter \"Running Bacula\" for details."
1603 if [ -d %{sysconf_dir} ]; then
1605 for string in XXX_REPLACE_WITH_DIRECTOR_PASSWORD_XXX XXX_REPLACE_WITH_CLIENT_PASSWORD_XXX XXX_REPLACE_WITH_STORAGE_PASSWORD_XXX XXX_REPLACE_WITH_DIRECTOR_MONITOR_PASSWORD_XXX XXX_REPLACE_WITH_CLIENT_MONITOR_PASSWORD_XXX XXX_REPLACE_WITH_STORAGE_MONITOR_PASSWORD_XXX; do
1606 pass=`openssl rand -base64 33`
1607 for file in *.conf; do
1608 need_password=`grep ${string} $file 2>/dev/null`
1609 if [ -n "$need_password" ]; then
1610 sed "s@${string}@${pass}@g" $file > $file.new
1611 cp -f $file.new $file; rm -f $file.new
1615 # put actual hostname in conf file
1617 string="XXX_HOSTNAME_XXX"
1618 for file in *.conf; do
1619 need_host=`grep ${string} $file 2>/dev/null`
1620 if [ -n "$need_host" ]; then
1621 sed "s@${string}@${host}@g" $file >$file.new
1622 cp -f $file.new $file; rm -f $file.new
1630 * Sat Jun 20 2009 D. Scott Barninger <barninger@fairfieldcomputers.com>
1631 - Fix bat install which is now handled by make and uses shared libs
1632 * Sat May 16 2009 D. Scott Barninger <barninger@fairfieldcomputers.com>
1633 - fix libxml dependency for rh7 per Pasi Kärkkäinen <pasik@iki.fi>
1634 * Mon May 04 2009 D. Scott Barninger <barninger@fairfieldcomputers.com>
1635 - Fix post ldconfig problem in client only build
1636 * Sun May 03 2009 D. Scott Barninger <barninger@fairfieldcomputers.com>
1637 - remove more files installed by client-only build not needed by client package
1638 - remove libbacsql files from client package
1639 * Sat May 02 2009 D. Scott Barninger <barninger@fairfieldcomputers.com>
1641 - update for new docs configuration
1642 * Sat Apr 25 2009 D. Scott Barninger <barninger@fairfieldcomputers.com>
1643 - add switch to pass Distribution tag
1644 * Sun Apr 5 2009 D. Scott Barninger <barninger@fairfieldcomputers.com>
1646 - database update version 10 to 11
1647 - make now installs docs so we rm from buildroot
1648 - add shared libs in %_libdir and other misc new files
1649 * Wed Dec 31 2008 D. Scott Barninger <barninger@fairfieldcomputers.com>
1651 * Sat Nov 08 2008 D. Scott Barninger <barninger@fairfieldcomputers.com>
1652 - set paths for QT using pkgconfig
1653 * Sat Oct 11 2008 D. Scott Barninger <barninger@fairfieldcomputers.com>
1654 - release 2.4.3 update depkgs to 11Sep08 remove file nmshack from mtx package
1655 * Sun Sep 07 2008 D. Scott Barninger <barninger@fairfieldcomputers.com>
1656 - adjust /opt/bacula install
1657 - add build switch to supress rescue package
1658 * Sun Aug 24 2008 D. Scott Barninger <barninger@fairfieldcomputers.com>
1659 - add support for install to /opt/bacula
1660 * Sun Aug 17 2008 D. Scott Barninger <barninger@fairfieldcomputers.com>
1661 - remove libtermcap dependancy for FC9
1662 * Mon Aug 04 2008 D. Scott Barninger <barninger@fairfieldcomputers.com>
1663 - fix bat dependencies
1664 * Sat Jun 28 2008 D. Scott Barninger <barninger@fairfieldcomputers.com>
1666 * Sat May 24 2008 D. Scott Barninger <barninger@fairfieldcomputers.com>
1668 * Sun Mar 30 2008 D. Scott Barninger <barninger@fairfieldcomputers.com>
1669 - FHS compatibility changes
1670 * Sat Feb 16 2008 D. Scott Barninger <barninger@fairfieldcomputers.com>
1671 - remove fix for false buffer overflow detection with glibc >= 2.7
1672 * Sat Feb 09 2008 D. Scott Barninger <barninger@fairfieldcomputers.com>
1673 - fix for false buffer overflow detection with glibc >= 2.7