]> git.sur5r.net Git - bacula/bacula/blobdiff - bacula/platforms/rpms/redhat/bacula.spec.in
Backport from BEE
[bacula/bacula] / bacula / platforms / rpms / redhat / bacula.spec.in
index 603ac9f2abac9013909e0ee7cf09431910c58230..756e2538f0ebfd238d41d573a85821a7c723dd82 100644 (file)
@@ -1,19 +1,26 @@
 # Bacula RPM spec file
 #
-# Copyright (C) 2000-2012 Bacula Systems SA
+# Copyright (C) 2000-2014 Bacula Systems SA
+#
 
 # Platform Build Configuration
 
 # basic defines for every build
-%define _release           1
+%define _release           @RELEASE@
 %define _version           @VERSION@
 %define product            bacula
-%define _packager Kern Sibbald <kern@baculasystems.com>
-%define depkgs_version 24Dec11
+%define _packager Kern Sibbald <kern@sibbald.com>
+%define depkgs_version @DEPKGS_VERSION@
+
+# Don't strip binaries
+%define __os_install_post %{nil}
+%define __debug_install_post %{nil}
+%define debug_package %{nil}
 
 %define postgres_version 8
 %define pgre84 0
 %{?build_rhel5:%define pgre84 1}
+%{?build_el5:%define pgre84 1}
 %if %{pgre84}
 %define postgres_package postgresql84
 %define postgres_server_package postgresql84-server
 %define _subsysdir     /opt/bacula/working
 %define sqlite_bindir  /opt/bacula/sqlite
 %define _mandir        /usr/share/man
+%define docs_dir       /opt/bacula/docs
+%define archive_dir    /opt/bacula/archive
 %define sysconf_dir    /opt/bacula/etc
 %define script_dir     /opt/bacula/scripts
 %define working_dir    /opt/bacula/working
 %define pid_dir        /opt/bacula/working
 %define plugin_dir     /opt/bacula/plugins
 %define lib_dir        /opt/bacula/lib
+%define log_dir        /opt/bacula/log
 %else
 %define _prefix        /usr
 %define _sbindir       %_prefix/sbin
@@ -54,6 +64,7 @@
 %define pid_dir        /var/run
 %define plugin_dir     %_libdir/bacula/plugins
 %define lib_dir        %_libdir/bacula/lib
+%define log_dir        %_libdir/bacula/log
 %endif
 
 # Daemon user:group Don't change them unless you know what you are doing
 
 %define depkgs ../depkgs
 
-# probems with mandriva build: 
+# probems with mandriva build:
 # nothing provides libbonobo2_0-devel, nothing provides libbonoboui2_0-devel
 
-# set Macros by opensuse_bs, see http://en.opensuse.org/Build_Service/cross_distribution_package_how_to
-#openSUSE 11.1          %if 0%{?suse_version} == 1110  
-#openSUSE 11.0          %if 0%{?suse_version} == 1100   
-#openSUSE 10.3          %if 0%{?suse_version} == 1030   
-#openSUSE 10.2          %if 0%{?suse_version} == 1020   
-#SUSE Linux 10.1        %if 0%{?suse_version} == 1010   
-#SUSE Linux 10.0        %if 0%{?suse_version} == 1000   
-#SUSE Linux 9.3         %if 0%{?suse_version} == 930    
-#SLES 9                 %if 0%{?sles_version} == 9      also set: %if 0%{?suse_version} == 910
-#SLE 10                 %if 0%{?sles_version} == 10     also set: %if 0%{?suse_version} == 1010
-#SLE 11                 %if 0%{?sles_version} == 11     also set: %if 0%{?suse_version} == 1110
-#CentOS 5               %if 0%{?centos_version} == 501  
-#RHEL 4                 %if 0%{?rhel_version} == 406    
-#RHEL 5                 %if 0%{?rhel_version} == 501    
-#Fedora 6 with Extras   %if 0%{?fedora_version} == 6    
-#Fedora 7 with Extras   %if 0%{?fedora_version} == 7    
-#Fedora 8 with Extras   %if 0%{?fedora_version} == 8    
-#Fedora 9 with Extras   %if 0%{?fedora_version} == 9    
-#Fedora 10 with Extras  %if 0%{?fedora_version} == 10   
-#Mandriva 2006          %if 0%{?mandriva_version} == 2006       
-#Mandriva 2007          %if 0%{?mandriva_version} == 2007       
-#Mandriva 2008          %if 0%{?mandriva_version} == 2008       
-
-
-%if 0%{?opensuse_bs}
-# am I running in opensuse build service?
-# TODO: seems to make problems
-
-# Build Service: Determine Distribution
-
-%ifarch x86_64
- %define build_x86_64 1
-%endif
-
-
-%if 0%{?fedora_version} || 0%{?rhel_version} || 0%{?centos_version}
-BuildRequires: GConf2-devel
-BuildRequires: freetype-devel
-BuildRequires: libtermcap-devel
-BuildRequires: shadow-utils
-%endif
-
-
-%if 0%{?mandriva_version} == 2007
-%define build_mdv 1
-%define _dist "Mandriva 2007"
-%endif
-
-%if 0%{?fedora_version} == 8
-%define build_fc8 1
-%define _dist "Fedora Core 8"
-BuildRequires: redhat-release
-%endif
-
-%if 0%{?fedora_version} == 9
-%define build_fc9 1
-%define _dist "Fedora Core 9"
-BuildRequires: redhat-release
-%endif
-
-
-%if 0%{?fedora_version} == 10
-%define build_fc9 1
-%define _dist "Fedora Core 10"
-BuildRequires: PolicyKit-gnome
-BuildRequires: fedora-release
-%endif
-
-%if 0%{?fedora_version} == 11
-%define build_fc9 1
-%define _dist "Fedora Core 11"
-BuildRequires: PolicyKit-gnome
-BuildRequires: fedora-release
-%endif
-
-%if 0%{?rhel_version} == 501
-%define build_rhel5 1
-%define _dist "Red Hat Enterprise Linux Server release 5"
-BuildRequires: redhat-release
-%endif
-
-%if 0%{?rhel_version} == 406
-%define build_rhel4 1
-%define _dist "Red Hat Enterprise Linux Server release 4"
-BuildRequires: redhat-release
-%endif
-
-
-%if 0%{?centos_version} == 501
-%define build_centos5 1
-%define _dist "CentOS 5"
-BuildRequires: redhat-release
-%endif
-
-
-%if 0%{?suse_version} == 1020
-%define build_su102 1
-%define _dist "OpenSUSE 10.2"
-BuildRequires: suse-release
-%endif
-
-
-%if 0%{?suse_version} == 1030
-%define build_su103 1
-%define _dist "OpenSUSE 10.3"
-BuildRequires: suse-release
-%endif
-
-%if 0%{?suse_version} == 1100
-%define build_su110 1
-%define _dist "SUSE 11"
-BuildRequires: suse-release
-%endif
-
-
-%if 0%{?suse_version} == 1110
-%define build_su111 1
-%define _dist "SUSE 11"
-%endif
-
-%if 0%{?suse_version} == 1120
-%define build_su112 1
-%define _dist "SUSE 11"
-%endif
-
-
-%if 0%{?sles_version} == 9
-%define build_su9 1
-%define _dist "SLES 9"
-%endif
-
-
-%if 0%{?sles_version} == 10
-%define build_su10 1
-%define _dist "SLE 10"
-%endif
-
-
-%if 0%{?sles_version} == 11
-%define build_su111 1
-%define _dist "SLES 11"
-%endif
-
-%endif 
-# opensuse-bs?
-
-
-# any patches for this release
-# be sure to check the setup section for patch macros
-
 #--------------------------------------------------------------------------
 # it should not be necessary to change anything below here for a release
 # except for patch macros in the setup section
 #--------------------------------------------------------------------------
 
+%define base_package_name %{product}
+
 %{?contrib_packager:%define _packager %{contrib_packager}}
 
 Summary: Bacula - The Network Backup Solution
-Name: %{product}
+Name: %{base_package_name}
 Version: %{_version}
 Release: %{_release}
 Group: System Environment/Daemons
@@ -238,15 +101,15 @@ Vendor: The Bacula Team
 Packager: %{_packager}
 Prefix: %{_prefix}
 
-Source0: http://www.prdownloads.sourceforge.net/bacula/%{name}-%{version}.tar.gz
 # opensuse build service changes the release itself
 # what happens if the release is not 1? DSB
+Source0: http://www.prdownloads.sourceforge.net/bacula/depkgs-%{depkgs_version}.tar.gz
+Source1: http://www.prdownloads.sourceforge.net/bacula/%{product}-%{version}.tar.gz
 %if 0%{?opensuse_bs}
-Source1: Release_Notes-%{version}-1.tar.gz
+Source2: Release_Notes-%{version}-1.tar.gz
 %else
-Source1: Release_Notes-%{version}-%{release}.tar.gz
+Source2: Release_Notes-%{version}-%{release}.tar.gz
 %endif
-Source2: http://www.prdownloads.sourceforge.net/bacula/depkgs-%{depkgs_version}.tar.gz
 
 # define the basic package description
 %define blurb Bacula - The Leading Open Source Backup Solution.
@@ -275,28 +138,12 @@ Source2: http://www.prdownloads.sourceforge.net/bacula/depkgs-%{depkgs_version}.
 %define rh9 0
 %{?build_rh9:%define rh9 1}
 # Fedora Core build
-%define fc1 0
-%{?build_fc1:%define fc1 1}
-%define fc3 0
-%{?build_fc3:%define fc3 1}
-%define fc4 0
-%{?build_fc4:%define fc4 1}
-%define fc5 0
-%{?build_fc5:%define fc5 1}
-%define fc6 0
-%{?build_fc6:%define fc6 1}
-%define fc7 0
-%{?build_fc7:%define fc7 1}
-%define fc8 0
-%{?build_fc8:%define fc8 1}
-%define fc9 0
-%{?build_fc9:%define fc9 1}
-%define fc10 0
-%{?build_fc10:%define fc10 1}
-%define fc11 0
-%{?build_fc11:%define fc11 1}
-%define fc12 0
-%{?build_fc12:%define fc12 1}
+%define fc16 0
+%{?build_fc16:%define fc16 1}
+%define fc17 0
+%{?build_fc17:%define fc17 1}
+%define fc18 0
+%{?build_fc18:%define fc18 1}
 # Whitebox Enterprise build
 %define wb3 0
 %{?build_wb3:%define wb3 1}
@@ -307,11 +154,16 @@ Source2: http://www.prdownloads.sourceforge.net/bacula/depkgs-%{depkgs_version}.
 %define rhel4 0
 %{?build_rhel4:%define rhel4 1}
 %{?build_rhel4:%define fc3 1}
+%{?build_el4:%define rhel4 1}
+%{?build_el4:%define fc3 1}
 %define rhel5 0
 %{?build_rhel5:%define rhel5 1}
 %{?build_rhel5:%define fc6 1}
+%{?build_el5:%define rhel5 1}
+%{?build_el5:%define fc6 1}
 %define rhel6 0
 %{?build_rhel6:%define rhel6 1}
+%{?build_el6:%define rhel6 1}
 # CentOS build
 %define centos3 0
 %{?build_centos3:%define centos3 1}
@@ -366,7 +218,7 @@ Source2: http://www.prdownloads.sourceforge.net/bacula/depkgs-%{depkgs_version}.
 %define rhat 1
 %endif
 %define fed 0
-%if %{fc1} || %{fc3} || %{fc4} || %{fc5} || %{fc6} || %{fc7} || %{fc8} || %{fc9} || %{fc10} || %{fc11} || %{fc12}
+%if %{fc16} || %{fc17} || %{fc18}
 %define fed 1
 %endif
 %define suse 0
@@ -390,7 +242,7 @@ exit 1
 %endif
 
 # distribution-specific directory for logwatch
-%if %{wb3} || %{rh7} || %{rh8} || %{rh9} || %{fc1} || %{fc3} || %{fc4}
+%if %{wb3} || %{rh7} || %{rh8} || %{rh9}
 %define logwatch_dir /etc/log.d
 %else
 %define logwatch_dir /etc/logwatch
@@ -429,7 +281,7 @@ exit 1
 %{?build_x86_64:%define x86_64 1}
 
 # check what distribution we are
-%if %{fc1} || %{fc3} || %{fc4} || %{fc5} || %{fc7} || %{fc8} || %{fc9} || %{fc10} || %{fc11} || %{fc12}
+%if %{fc16} || %{fc17} || %{fc18}
 %define _dist %(grep Fedora /etc/redhat-release)
 %endif
 %if %{centos5} || %{centos4} || %{centos3}
@@ -502,7 +354,7 @@ BuildRequires: sysconfig
 
 BuildRequires: gcc, gcc-c++, make, autoconf
 BuildRequires: glibc, glibc-devel
-BuildRequires: ncurses-devel, perl, readline-devel
+BuildRequires: ncurses-devel, readline-devel
 BuildRequires: libstdc++-devel, zlib-devel
 BuildRequires: openssl-devel
 BuildRequires: libacl-devel
@@ -523,12 +375,6 @@ BuildRequires: libstdc++-static-devel
 BuildRequires: glibc-static-devel
 %endif
 
-%if %{suse}
-BuildRequires: termcap
-%else
-BuildRequires: libtermcap-devel
-%endif
-
 %if %{mysql} && ! %{suse}
 BuildRequires: mysql-devel
 %endif
@@ -572,9 +418,6 @@ Requires: glibc, readline, %{name}-libs
 
 %if %{suse}
 Conflicts: bacula
-Requires: termcap
-%else
-Requires: libtermcap
 %endif
 
 %if %{mysql}
@@ -644,12 +487,6 @@ Provides: %{product}-libs
 Requires: libstdc++, zlib, openssl
 Requires: glibc, readline, %{name}-libs
 
-%if %{suse}
-Requires: termcap
-%else
-Requires: libtermcap
-%endif
-
 %if %{python}
 Requires: python >= %{pyver}
 %endif
@@ -665,7 +502,7 @@ Requires: python >= %{pyver}
 %{blurb7}
 %{blurb8}
 
-This is the File daemon (Client) only package. It includes the command line 
+This is the File daemon (Client) only package. It includes the command line
 console program.
 %if %{python}
 This build includes python scripting support.
@@ -713,9 +550,6 @@ Group: System Environment/Daemons
 
 This package installs the shared libraries used by many bacula programs.
 
-# Don't strip symbols
-%define debug_package %{nil} 
-
 # Must explicitly enable debug pkg on SuSE
 # but not in opensuse_bs
 #%if %{suse} && ! 0%{?opensuse_bs}
@@ -723,19 +557,28 @@ This package installs the shared libraries used by many bacula programs.
 #%endif
 
 %prep
-%setup
-%setup -T -D -b 1
+%setup -T    -b 0 -n depkgs
+%setup -T    -b 1 -n %{product}-%{version}
+%setup -T -D -b 2 -n %{product}-%{version}
 # extract depkgs
-%if %{sqlite}
-%setup -T -D -b 2
-%endif
+
 
 %build
 
 %if %{suse}
-export LDFLAGS="${LDFLAGS} -L/usr/lib/termcap -L/usr/lib64/termcap"
+#export LDFLAGS="${LDFLAGS} -L/usr/lib/termcap -L/usr/lib64/termcap"
 %endif
 
+# You can use a cache for depkgs
+# tar xfz depkgs*gz -C ~/
+# cd ~/depkgs
+# touch %{depkgs_version}       # depkgs version
+
+if [ -f $HOME/depkgs/%{depkgs_version} ]; then
+   rm -rf %{depkgs}
+   ln -s $HOME/depkgs %{depkgs}
+fi
+
 cwd=${PWD}
 %if %{sqlite}
 cd %{depkgs}
@@ -743,12 +586,18 @@ make sqlite3
 cd ${cwd}
 %endif
 
+cd %{depkgs}
+make lzo
+export LDFLAGS="${LDFLAGS} -L${PWD}/lzo/lib"
+export CPPFLAGS="${CPPFLAGS} -I${PWD}/lzo/include"
+cd ${cwd}
+
 # hostname is the build hostname, so use XXX_HOSTNAME_XXX for Address parameter
-sed -i s/hostname/basename/ src/console/bconsole.conf.in src/dird/bacula-dir.conf.in src/qt-console/bat.conf.in src/tray-monitor/tray-monitor.conf.in 
+sed -i s/hostname/basename/ src/console/bconsole.conf.in src/dird/bacula-dir.conf.in src/qt-console/bat.conf.in
 
 %if %{sqlite}
 # patches for the bundled sqlite scripts
-sed -i s:.SQL_BINDIR.:/opt/bacula/sqlite: src/cats/*_sqlite3_*.in
+sed -i s:.SQLITE_BINDIR.:/opt/bacula/sqlite: src/cats/*_sqlite3_*.in
 
 # patch the bacula-dir init script to remove sqlite service
 %if %{suse}
@@ -769,6 +618,8 @@ export LDFLAGS="${LDFLAGS} -L/usr/lib64/mysql"
 export LDFLAGS="${LDFLAGS} -L/usr/lib64/python%{pyver}"
 %endif
 
+export BACULA="Bacula"
+
 # Main Bacula configuration
 %configure \
         --prefix=%{_prefix} \
@@ -777,13 +628,11 @@ export LDFLAGS="${LDFLAGS} -L/usr/lib64/python%{pyver}"
         --mandir=%{_mandir} \
         --with-scriptdir=%{script_dir} \
         --with-working-dir=%{working_dir} \
-        --with-plugindir=%{script_dir} \
+        --with-plugindir=%{plugin_dir} \
+        --with-logdir=%{log_dir} \
         --with-pid-dir=%{pid_dir} \
         --with-subsys-dir=%{_subsysdir} \
         --enable-smartalloc \
-        --disable-gnome \
-        --disable-bwx-console \
-        --disable-tray-monitor \
         --disable-conio \
         --enable-readline \
 %if %{mysql}
@@ -802,7 +651,7 @@ export LDFLAGS="${LDFLAGS} -L/usr/lib64/python%{pyver}"
 %if %{client_only}
         --enable-client-only \
 %endif
-%if %{rh7} || %{rh8} || %{rh9} || %{fc1} || %{fc3} || %{wb3} 
+%if %{rh7} || %{rh8} || %{rh9}
         --disable-batch-insert \
 %endif
         --with-tcp-wrappers  \
@@ -825,7 +674,7 @@ export LDFLAGS="${LDFLAGS} -L/usr/lib64/python%{pyver}"
 make -j3
 
 %install
+
 cwd=${PWD}
 [ "$RPM_BUILD_ROOT" != "/" ] && rm -rf "$RPM_BUILD_ROOT"
 mkdir -p $RPM_BUILD_ROOT/etc/init.d
@@ -848,8 +697,10 @@ make DESTDIR=$RPM_BUILD_ROOT install
 # Remove docs for programs that are depreciated
 rm -f $RPM_BUILD_ROOT%{_mandir}/man1/bacula-bgnome-console.1.%{manpage_ext}
 rm -f $RPM_BUILD_ROOT%{_mandir}/man1/bacula-bwxconsole.1.%{manpage_ext}
-rm -f $RPM_BUILD_ROOT%{_mandir}/man1/bacula-tray-monitor.1.%{manpage_ext}
 rm -f $RPM_BUILD_ROOT%{script_dir}/gconsole
+# Storage-ctl packaged in shstore rpm
+rm -f $RPM_BUILD_ROOT%{script_dir}/storage-ctl
+rm -f $RPM_BUILD_ROOT%{script_dir}/storage-ctl.conf
 
 # fixme - make installs the mysql scripts for sqlite build
 %if %{sqlite}
@@ -900,6 +751,10 @@ cp -p scripts/logrotate $RPM_BUILD_ROOT/etc/logrotate.d/bacula
 # install the updatedb scripts
 cp -p updatedb/* $RPM_BUILD_ROOT%{script_dir}/updatedb/
 
+# install specific scripts
+
+# install special upgrade script, except for sqlite3
+
 %if ! %{client_only}
 # install the sample-query.sql file
 cp -p examples/sample-query.sql $RPM_BUILD_ROOT%{script_dir}/sample-query.sql
@@ -929,6 +784,8 @@ rm -f $RPM_BUILD_ROOT%{_mandir}/man8/bls.8.%{manpage_ext}
 rm -f $RPM_BUILD_ROOT%{_mandir}/man8/bscan.8.%{manpage_ext}
 rm -f $RPM_BUILD_ROOT%{_mandir}/man8/btape.8.%{manpage_ext}
 rm -f $RPM_BUILD_ROOT%{_mandir}/man8/dbcheck.8.%{manpage_ext}
+rm -f $RPM_BUILD_ROOT%{_mandir}/man8/bregex.8.%{manpage_ext}
+rm -f $RPM_BUILD_ROOT%{_mandir}/man8/bwild.8.%{manpage_ext}
 rm -f $RPM_BUILD_ROOT%{_mandir}/man1/bsmtp.1.%{manpage_ext}
 
 rm -f $RPM_BUILD_ROOT%{script_dir}/bacula
@@ -942,7 +799,6 @@ rm -f $RPM_BUILD_ROOT%{script_dir}/startmysql
 rm -f $RPM_BUILD_ROOT%{script_dir}/stopmysql
 rm -rf $RPM_BUILD_ROOT%{script_dir}/updatedb
 rm -f $RPM_BUILD_ROOT%{script_dir}/bconsole
-rm -f $RPM_BUILD_ROOT%{script_dir}/bpipe-fd.so
 rm -f $RPM_BUILD_ROOT%{script_dir}/mtx-changer.conf
 rm -f $RPM_BUILD_ROOT%{_sbindir}/bacula
 %endif
@@ -966,8 +822,7 @@ rm -f $RPM_BUILD_DIR/Release_Notes-%{version}-%{release}.txt
 %attr(-, root, %{daemon_group}) %{script_dir}/drop_mysql_tables
 %attr(-, root, %{daemon_group}) %{script_dir}/update_mysql_tables
 %attr(-, root, %{daemon_group}) %{script_dir}/grant_mysql_privileges
-%attr(-, root, %{daemon_group}) %{script_dir}/startmysql
-%attr(-, root, %{daemon_group}) %{script_dir}/stopmysql
+%{_libdir}/libbaccats*
 %{_libdir}/libbacsql*
 %endif
 
@@ -983,6 +838,7 @@ rm -f $RPM_BUILD_DIR/Release_Notes-%{version}-%{release}.txt
 %{sqlite_bindir}/libsqlite3.a
 %{sqlite_bindir}/sqlite3.h
 %{sqlite_bindir}/sqlite3
+%{_libdir}/libbaccats*
 %{_libdir}/libbacsql*
 %endif
 
@@ -991,12 +847,13 @@ rm -f $RPM_BUILD_DIR/Release_Notes-%{version}-%{release}.txt
 %if %{postgresql}
 %files postgresql
 %defattr(-,root,root)
-%attr(-, root, %{daemon_group}) %{script_dir}/create_postgresql_database
-%attr(-, root, %{daemon_group}) %{script_dir}/drop_postgresql_database
-%attr(-, root, %{daemon_group}) %{script_dir}/make_postgresql_tables
-%attr(-, root, %{daemon_group}) %{script_dir}/drop_postgresql_tables
-%attr(-, root, %{daemon_group}) %{script_dir}/update_postgresql_tables
-%attr(-, root, %{daemon_group}) %{script_dir}/grant_postgresql_privileges
+%attr(755, root, %{daemon_group}) %{script_dir}/create_postgresql_database
+%attr(755, root, %{daemon_group}) %{script_dir}/drop_postgresql_database
+%attr(755, root, %{daemon_group}) %{script_dir}/make_postgresql_tables
+%attr(755, root, %{daemon_group}) %{script_dir}/drop_postgresql_tables
+%attr(755, root, %{daemon_group}) %{script_dir}/update_postgresql_tables
+%attr(755, root, %{daemon_group}) %{script_dir}/grant_postgresql_privileges
+%{_libdir}/libbaccats*
 %{_libdir}/libbacsql*
 %endif
 
@@ -1005,15 +862,16 @@ rm -f $RPM_BUILD_DIR/Release_Notes-%{version}-%{release}.txt
 %if ! %{client_only}
 %attr(-, root, %{daemon_group}) %dir %{script_dir}
 %attr(-, root, %{daemon_group}) %dir %{sysconf_dir}
+#%attr(-, %{director_daemon_user}, %{daemon_group}) %dir %{log_dir}
 %attr(-, root, %{daemon_group}) %{script_dir}/bacula
 %attr(-, root, %{daemon_group}) %{script_dir}/bacula_config
 %attr(-, root, %{daemon_group}) %{script_dir}/bconsole
-%attr(-, root, %{daemon_group}) %{script_dir}/create_bacula_database
-%attr(-, root, %{daemon_group}) %{script_dir}/drop_bacula_database
-%attr(-, root, %{daemon_group}) %{script_dir}/grant_bacula_privileges
-%attr(-, root, %{daemon_group}) %{script_dir}/make_bacula_tables
-%attr(-, root, %{daemon_group}) %{script_dir}/drop_bacula_tables
-%attr(-, root, %{daemon_group}) %{script_dir}/update_bacula_tables
+%attr(755, root, %{daemon_group}) %{script_dir}/create_bacula_database
+%attr(755, root, %{daemon_group}) %{script_dir}/drop_bacula_database
+%attr(755, root, %{daemon_group}) %{script_dir}/grant_bacula_privileges
+%attr(755, root, %{daemon_group}) %{script_dir}/make_bacula_tables
+%attr(755, root, %{daemon_group}) %{script_dir}/drop_bacula_tables
+%attr(755, root, %{daemon_group}) %{script_dir}/update_bacula_tables
 %attr(-, root, %{daemon_group}) %{script_dir}/make_catalog_backup
 %attr(-, root, %{daemon_group}) %{script_dir}/make_catalog_backup.pl
 %attr(-, root, %{daemon_group}) %{script_dir}/delete_catalog_backup
@@ -1024,7 +882,7 @@ rm -f $RPM_BUILD_DIR/Release_Notes-%{version}-%{release}.txt
 %attr(-, root, %{daemon_group}) %{script_dir}/bacula-ctl-dir
 %attr(-, root, %{daemon_group}) %{script_dir}/bacula-ctl-fd
 %attr(-, root, %{daemon_group}) %{script_dir}/bacula-ctl-sd
-%attr(-, root, %{daemon_group}) %{script_dir}/bpipe-fd.so
+%attr(-, root, %{daemon_group}) %{plugin_dir}/bpipe-fd.so
 %attr(-, root, %{daemon_group}) /etc/init.d/bacula-dir
 %attr(-, root, %{daemon_group}) /etc/init.d/bacula-fd
 %attr(-, root, %{daemon_group}) %{_sbindir}/dbcheck
@@ -1042,23 +900,23 @@ rm -f $RPM_BUILD_DIR/Release_Notes-%{version}-%{release}.txt
 %attr(-, root, %{daemon_group}) %config(noreplace) %{sysconf_dir}/bconsole.conf
 %attr(-, root, %{daemon_group}) %config(noreplace) %{logwatch_dir}/conf/logfiles/bacula.conf
 %attr(-, root, %{daemon_group}) %config(noreplace) %{logwatch_dir}/conf/services/bacula.conf
-%attr(-, root, %{daemon_group}) %config(noreplace) %{script_dir}/query.sql
 %attr(-, root, %{daemon_group}) %{script_dir}/sample-query.sql
 
 %attr(-, %{storage_daemon_user}, %{daemon_group}) %dir %{working_dir}
 
-%{_sbindir}/bacula-dir
+%attr(-, root, %{daemon_group}) %{_sbindir}/bacula-dir
+%attr(-, root, %{daemon_group}) %{_sbindir}/bacula-sd
+%attr(-, root, %{daemon_group}) %{_sbindir}/btraceback
+%attr(-, root, %{daemon_group}) %{_sbindir}/bconsole
+%attr(-, root, %{daemon_group}) %{_sbindir}/bsmtp
+%attr(-, root, %{daemon_group}) %{_sbindir}/bscan
+%attr(-, root, %{daemon_group}) %{_sbindir}/btape
+
 %{_sbindir}/bacula-fd
-%{_sbindir}/bacula-sd
 %{_sbindir}/bacula
 %{_sbindir}/bcopy
 %{_sbindir}/bextract
 %{_sbindir}/bls
-%{_sbindir}/bscan
-%{_sbindir}/btape
-%{_sbindir}/btraceback
-%{_sbindir}/bconsole
-%{_sbindir}/bsmtp
 %{_sbindir}/bregex
 %{_sbindir}/bwild
 %{_mandir}/man8/bacula-fd.8.%{manpage_ext}
@@ -1073,6 +931,8 @@ rm -f $RPM_BUILD_DIR/Release_Notes-%{version}-%{release}.txt
 %{_mandir}/man8/btape.8.%{manpage_ext}
 %{_mandir}/man8/btraceback.8.%{manpage_ext}
 %{_mandir}/man8/dbcheck.8.%{manpage_ext}
+%{_mandir}/man8/bregex.8.%{manpage_ext}
+%{_mandir}/man8/bwild.8.%{manpage_ext}
 %{_mandir}/man1/bsmtp.1.%{manpage_ext}
 %{_mandir}/man1/bat.1.%{manpage_ext}
 %_prefix/share/doc/*
@@ -1123,12 +983,12 @@ if [ -s %{working_dir}/bacula.db ] && [ -s %{sqlite_bindir}/sqlite3 ];then
 
 %if %{postgresql}
 %pre postgresql
-DB_VER=`echo 'select * from Version;' | psql bacula 2>/dev/null | tail -3 | head -1`
+DB_VER=`echo 'SELECT * FROM Version LIMIT 1;' | su - postgres -c 'psql bacula' 2>/dev/null | tail -3 | head -1`
 %endif
 
 %if ! %{client_only}
 if [ -n "$DB_VER" ] && [ "$DB_VER" -lt "12" ]; then
-    echo "This bacula upgrade will update a bacula database from version 12 to 13."
+    echo "This bacula upgrade will update a bacula database from version 12 to 1014."
     echo "You appear to be running database version $DB_VER. You must first update"
     echo "your database to version 12 and then install this upgrade. The alternative"
     echo "is to use %{script_dir}/drop_%{db_backend}_tables to delete all your your current"
@@ -1225,19 +1085,21 @@ fi
 
 if [ -d %{sysconf_dir} ]; then
    cd %{sysconf_dir}
-   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
-      pass=`openssl rand -base64 33`
-      for file in *.conf; do
-         sed "s@${string}@${pass}@g" $file > $file.new
-         cp -f $file.new $file; rm -f $file.new
-      done
-   done
-# put actual hostname in conf file
-   host=`hostname`
-   string="XXX_HOSTNAME_XXX"
+   if [ ! -f .rpm.sed ]; then
+       (umask 0177
+        echo "# This file is used to ensure that all passwords will" > .rpm.sed
+        echo "# match between configuration files"                  >> .rpm.sed
+       )
+       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
+           pass=`openssl rand -base64 33`
+           echo "s@${string}@${pass}@g" >> .rpm.sed
+       done
+   fi
+   host=`hostname -s`
    for file in *.conf; do
-      sed "s@${string}@${host}@g" $file >$file.new
-      cp -f $file.new $file; rm -f $file.new
+      sed -f .rpm.sed $file > $file.new
+      sed "s@XXX_HOSTNAME_XXX@${host}@g" $file.new > $file
+      rm -f $file.new
    done
 fi
 
@@ -1247,30 +1109,29 @@ fi
 #check, if mysql can be called successfully at all
 if mysql 2>/dev/null bacula -e 'select * from Version;' ; then
 
-# test for an existing database
-# note: this ASSUMES no password has been set for bacula database
-DB_VER=`mysql 2>/dev/null bacula -e 'select * from Version;'|tail -n 1`
-
-# grant privileges and create tables if they do not exist
-if [ -z "$DB_VER" ]; then
-    echo "Hmm, it doesn't look like you have an existing database."
-    echo "Granting privileges for MySQL user bacula..."
-    %{script_dir}/grant_mysql_privileges
-    echo "Creating MySQL bacula database..."
-    %{script_dir}/create_mysql_database
-    echo "Creating bacula tables..."
-    %{script_dir}/make_mysql_tables
-
-# check to see if we need to upgrade a 3.x database
-elif [ "$DB_VER" -lt "13" ]; then
-    echo "This release requires an upgrade to your bacula database."
-    echo "Backing up your current database..."
-    mysqldump -f --opt bacula | bzip2 > %{working_dir}/bacula_backup.sql.bz2
-    echo "Upgrading bacula database ..."
-    %{script_dir}/update_mysql_tables
-    echo "If bacula works correctly you can remove the backup file %{working_dir}/bacula_backup.sql.bz2"
-
-fi
+  # test for an existing database
+  # note: this ASSUMES no password has been set for bacula database
+  DB_VER=`mysql 2>/dev/null bacula -e 'select * from Version;'|tail -n 1`
+
+  # grant privileges and create tables if they do not exist
+  if [ -z "$DB_VER" ]; then
+      echo "Hmm, it doesn't look like you have an existing database."
+      echo "Granting privileges for MySQL user bacula..."
+      %{script_dir}/grant_mysql_privileges
+      echo "Creating MySQL bacula database..."
+      %{script_dir}/create_mysql_database
+      echo "Creating bacula tables..."
+      %{script_dir}/make_mysql_tables
+
+  elif [ "$DB_VER" -ge "12" -a "$DB_VER" -lt "1015" ]; then
+      echo "This release requires an upgrade to your bacula database."
+      echo "Backing up your current database..."
+      mysqldump -f --opt bacula | bzip2 > %{working_dir}/bacula_backup.sql.bz2
+      echo "Upgrading bacula database ..."
+      %{script_dir}/update_mysql_tables
+      echo "If bacula works correctly you can remove the backup file %{working_dir}/bacula_backup.sql.bz2"
+
+  fi
 fi
 %endif
 
@@ -1279,7 +1140,7 @@ fi
 if [ -s %{working_dir}/bacula.db ]; then
         DB_VER=`echo "select * from Version;" | %{sqlite_bindir}/sqlite3 2>/dev/null %{working_dir}/bacula.db | tail -n 1`
         # check to see if we need to upgrade a 3.x database
-        if [ "$DB_VER" -lt "13" ] && [ "$DB_VER" -ge "12" ]; then
+        if [ "$DB_VER" -le "13" ] && [ "$DB_VER" -ge "12" ]; then
                 echo "This release requires an upgrade to your bacula database."
                 echo "Backing up your current database..."
                 echo ".dump" | %{sqlite_bindir}/sqlite3 %{working_dir}/bacula.db | bzip2 > %{working_dir}/bacula_backup.sql.bz2
@@ -1300,51 +1161,54 @@ fi
 
 %if %{postgresql}
 # check if psql can be called successfully at all
-if echo 'select * from Version;' | psql bacula 2>/dev/null; then
-
-# test for an existing database
-# note: this ASSUMES no password has been set for bacula database
-DB_VER=`echo 'select * from Version;' | psql bacula 2>/dev/null | tail -3 | head -1`
-
-# grant privileges and create tables if they do not exist
-if [ -z "$DB_VER" ]; then
-    echo "Hmm, doesn't look like you have an existing database."
-    echo "Creating PostgreSQL bacula database..."
-    %{script_dir}/create_postgresql_database
-    echo "Creating bacula tables..."
-    %{script_dir}/make_postgresql_tables
-    echo "Granting privileges for PostgreSQL user bacula..."
-    %{script_dir}/grant_postgresql_privileges
-
-# check to see if we need to upgrade a 5.0.x database
-elif [ "$DB_VER" -lt "13" ]; then
-    echo "This release requires an upgrade to your bacula database."
-    echo "Backing up your current database..."
-    pg_dump bacula | bzip2 > %{working_dir}/bacula_backup.sql.bz2
-    echo "Upgrading bacula database ..."
-    %{script_dir}/update_postgresql_tables
-    echo "If bacula works correctly you can remove the backup file %{working_dir}/bacula_backup.sql.bz2"
-        
-fi
+if echo 'select * from Version;' | su - postgres -c 'psql bacula' 2>/dev/null; then
+
+  # test for an existing database
+  # note: this ASSUMES no password has been set for bacula database
+  DB_VER=`echo 'SELECT * FROM Version LIMIT 1;' | su - postgres -c 'psql bacula' 2>/dev/null | tail -3 | head -1`
+
+  # grant privileges and create tables if they do not exist
+  if [ -z "$DB_VER" ]; then
+      echo "Hmm, doesn't look like you have an existing database."
+      echo "Creating PostgreSQL bacula database..."
+      su - postgres -c %{script_dir}/create_postgresql_database
+      echo "Creating bacula tables..."
+      su - postgres -c %{script_dir}/make_postgresql_tables
+      echo "Granting privileges for PostgreSQL user bacula..."
+      su - postgres -c %{script_dir}/grant_postgresql_privileges
+
+  elif [ "$DB_VER" -ge "12" -a "$DB_VER" -lt "1015" ]; then
+      echo "This release requires an upgrade to your bacula database."
+      echo "Backing up your current database..."
+      su - postgres -c 'pg_dump bacula' | bzip2 > %{working_dir}/bacula_backup.sql.bz2
+      echo "Upgrading bacula database ..."
+      su - postgres -c %{script_dir}/update_postgresql_tables
+      echo "If bacula works correctly you can remove the backup file %{working_dir}/bacula_backup.sql.bz2"
+      echo "Granting privileges for PostgreSQL user bacula..."
+      su - postgres -c %{script_dir}/grant_postgresql_privileges
+
+  fi
 fi
 %endif
 
 %if ! %{client_only}
 if [ -d %{sysconf_dir} ]; then
    cd %{sysconf_dir}
-   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
-      pass=`openssl rand -base64 33`
-      for file in *.conf; do
-         sed "s@${string}@${pass}@g" $file > $file.new
-         cp -f $file.new $file; rm -f $file.new
-      done
-   done
-# put actual hostname in conf file
-   host=`hostname`
-   string="XXX_HOSTNAME_XXX"
+   if [ ! -f .rpm.sed ]; then
+       (umask 0177
+        echo "# This file is used to ensure that all passwords will" > .rpm.sed
+        echo "# match between configuration files"                  >> .rpm.sed
+       )
+       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
+           pass=`openssl rand -base64 33`
+           echo "s@${string}@${pass}@g" >> .rpm.sed
+       done
+   fi
+   host=`hostname -s`
    for file in *.conf; do
-      sed "s@${string}@${host}@g" $file >$file.new
-      cp -f $file.new $file; rm -f $file.new
+      sed -f .rpm.sed $file > $file.new
+      sed "s@XXX_HOSTNAME_XXX@${host}@g" $file.new > $file
+      rm -f $file.new
    done
 fi
 %endif
@@ -1372,6 +1236,8 @@ fi
 %files client
 %defattr(-,root,root)
 %attr(-, root, %{daemon_group}) %dir %{script_dir}
+%attr(-, root, %{daemon_group}) %dir %{plugin_dir}
+#%attr(-, root, %{daemon_group}) %dir %{log_dir}
 %attr(-, root, %{daemon_group}) %dir %{sysconf_dir}
 %{script_dir}/bacula-ctl-fd
 /etc/init.d/bacula-fd
@@ -1387,6 +1253,7 @@ fi
 %attr(-, root, %{daemon_group}) %{script_dir}/btraceback.gdb
 %attr(-, root, %{daemon_group}) %{script_dir}/btraceback.dbx
 %attr(-, root, %{daemon_group}) %{script_dir}/btraceback.mdb
+%attr(-, root, %{daemon_group}) %{plugin_dir}/bpipe-fd.so
 %{_sbindir}/bconsole
 %{_mandir}/man8/bacula-fd.8.%{manpage_ext}
 %{_mandir}/man8/bacula.8.%{manpage_ext}
@@ -1426,19 +1293,21 @@ fi
 
 if [ -d %{sysconf_dir} ]; then
    cd %{sysconf_dir}
-   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
-      pass=`openssl rand -base64 33`
-      for file in *.conf; do
-         sed "s@${string}@${pass}@g" $file > $file.new
-         cp -f $file.new $file; rm -f $file.new
-      done
-   done
-# put actual hostname in conf file
-   host=`hostname`
-   string="XXX_HOSTNAME_XXX"
+   if [ ! -f .rpm.sed ]; then
+       (umask 0177
+        echo "# This file is used to ensure that all passwords will" > .rpm.sed
+        echo "# match between configuration files"                  >> .rpm.sed
+       )
+       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
+           pass=`openssl rand -base64 33`
+           echo "s@${string}@${pass}@g" >> .rpm.sed
+       done
+   fi
+   host=`hostname -s`
    for file in *.conf; do
-      sed "s@${string}@${host}@g" $file >$file.new
-      cp -f $file.new $file; rm -f $file.new
+      sed -f .rpm.sed $file > $file.new
+      sed "s@XXX_HOSTNAME_XXX@${host}@g" $file.new > $file
+      rm -f $file.new
    done
 fi
 
@@ -1485,81 +1354,3 @@ echo "The database update scripts were installed to %{script_dir}/updatedb"
 %endif
 
 %changelog
-* Sun Mar 07 2010 D. Scott Barninger <barninger@fairfieldcomputers.com>
-- remove --without-qwt from configure statement
-* Sat Feb 27 2010 D. Scott Barninger <barninger@fairfieldcomputers.com>
-- move shared libraries into bacula-libs package
-* Sat Feb 20 2010 D. Scott Barninger <barninger@fairfieldcomputers.com>
-- remove deprecated mysql4 and mysql5 build defines
-- add build support for tcpwrappers
-- remove bacula_config file for client only build
-- remove requirements for database server packages
-- enable readline support
-- add fc11 and fc12
-* Sat Feb 13 2010 D. Scott Barninger <barninger@fairfieldcomputers.com>
-- 5.0.1
-- fix client only build
-- clean up requirements for termcap
-- query.sql now empty by default so we install sample-query.sql along side it
-- remove old nobuild_mtx switch
-* Sun Feb 07 2010 D. Scott Barninger <barninger@fairfieldcomputers.com>
-- fix mysql database upgrade
-* Fri Feb 05 2010 D. Scott Barninger <barninger@fairfieldcomputers.com>
-- fix permissions of dbcheck
-- misc. cleanup
-* Sat Jan 30 2010 D. Scott Barninger <barninger@fairfieldcomputers.com>
-- 5.0.0
-- add su112 and fc10 builds, remove doc package declaration.
-- fix source path for logwatch files.
-- restore static bundled build of sqlite (who took that out?) and remove use
-- of system sqlite. we don't support use of sqlite2.
-- upgrade database from version 11 to 12.
-* Mon Aug 10 2009 Philipp Storz <philipp.storz@dass-it.de>
-- changes to work with opensuse build service
-* Sat Aug 1 2009 Kern Sibbald <kern@sibbald.com>
-- Split docs into separate bacula-docs.spec, bacula-bat.spec and bacula-mtx.spec
-- removed build of rescue, gnome console and wxconsole
-* Sat Jun 20 2009 D. Scott Barninger <barninger@fairfieldcomputers.com>
-- Fix bat install which is now handled by make and uses shared libs
-* Sat May 16 2009 D. Scott Barninger <barninger@fairfieldcomputers.com>
-- fix libxml dependency for rh7 per Pasi Kärkkäinen <pasik@iki.fi>
-* Mon May 04 2009 D. Scott Barninger <barninger@fairfieldcomputers.com>
-- Fix post ldconfig problem in client only build
-* Sun May 03 2009 D. Scott Barninger <barninger@fairfieldcomputers.com>
-- remove more files installed by client-only build not needed by client package
-- remove libbacsql files from client package
-* Sat May 02 2009 D. Scott Barninger <barninger@fairfieldcomputers.com>
-- 3.0.1
-- update for new docs configuration
-* Sat Apr 25 2009 D. Scott Barninger <barninger@fairfieldcomputers.com>
-- add switch to pass Distribution tag
-* Sun Apr 5 2009 D. Scott Barninger <barninger@fairfieldcomputers.com>
-- 3.0.0 release
-- database update version 10 to 11
-- make now installs docs so we rm from buildroot
-- add shared libs in %_libdir and other misc new files
-* Wed Dec 31 2008 D. Scott Barninger <barninger@fairfieldcomputers.com>
-- add su111 target
-* Sat Nov 08 2008 D. Scott Barninger <barninger@fairfieldcomputers.com>
-- set paths for QT using pkgconfig
-* Sat Oct 11 2008 D. Scott Barninger <barninger@fairfieldcomputers.com>
-- release 2.4.3 update depkgs to 11Sep08 remove file nmshack from mtx package
-* Sun Sep 07 2008 D. Scott Barninger <barninger@fairfieldcomputers.com>
-- adjust /opt/bacula install
-- add build switch to supress rescue package
-* Sun Aug 24 2008 D. Scott Barninger <barninger@fairfieldcomputers.com>
-- add support for install to /opt/bacula
-* Sun Aug 17 2008 D. Scott Barninger <barninger@fairfieldcomputers.com>
-- remove libtermcap dependancy for FC9
-* Mon Aug 04 2008 D. Scott Barninger <barninger@fairfieldcomputers.com>
-- fix bat dependencies
-* Sat Jun 28 2008 D. Scott Barninger <barninger@fairfieldcomputers.com>
-- add su110 target
-* Sat May 24 2008 D. Scott Barninger <barninger@fairfieldcomputers.com>
-- add fc9 target
-* Sun Mar 30 2008 D. Scott Barninger <barninger@fairfieldcomputers.com>
-- FHS compatibility changes
-* Sat Feb 16 2008 D. Scott Barninger <barninger@fairfieldcomputers.com>
-- remove fix for false buffer overflow detection with glibc >= 2.7
-* Sat Feb 09 2008 D. Scott Barninger <barninger@fairfieldcomputers.com>
-- fix for false buffer overflow detection with glibc >= 2.7