From 900706a53080f57dee1dd501db35ba4e55d074c8 Mon Sep 17 00:00:00 2001
From: Simone Caronni <negativo17@gmail.com>
Date: Fri, 2 Dec 2011 18:35:52 +0100
Subject: [PATCH] Various build fixes and changes. Still has problems with
 libbaccats-%{version}.so symlink

---
 bacula-5.0.1-dsolink.patch                    |  11 --
 bacula-5.0.2-python27.patch                   |  22 ---
 bacula-5.0.3-dsolink.patch                    | 165 ------------------
 bacula-5.0.3-maxvalue.patch                   |  78 ---------
 bacula-5.0.3-mysql55.patch                    |  11 --
 bacula-5.0.3-tray-dir.patch                   |  13 --
 ...-config.patch => bacula-5.2.2-config.patch |   0
 bacula-bwxconsole.desktop                     |  11 --
 bacula-dir.init                               |  15 +-
 bacula-fd.init                                |  15 +-
 bacula-fd.sysconfig                           |   3 +-
 bacula-gconsole.desktop                       |  12 --
 bacula-pamd.patch                             |  23 ---
 bacula-sd.init                                |  15 +-
 bacula-traymonitor.console_apps               |   3 -
 bacula-traymonitor.desktop                    |  11 --
 bacula-wxconsole.console_apps                 |   3 -
 bacula-wxconsole.desktop                      |  11 --
 bacula-wxconsole.patch                        |  10 --
 bacula.spec                                   | 111 +++++++-----
 20 files changed, 70 insertions(+), 473 deletions(-)
 delete mode 100644 bacula-5.0.1-dsolink.patch
 delete mode 100644 bacula-5.0.2-python27.patch
 delete mode 100644 bacula-5.0.3-dsolink.patch
 delete mode 100644 bacula-5.0.3-maxvalue.patch
 delete mode 100644 bacula-5.0.3-mysql55.patch
 delete mode 100644 bacula-5.0.3-tray-dir.patch
 rename bacula-config.patch => bacula-5.2.2-config.patch (100%)
 delete mode 100644 bacula-bwxconsole.desktop
 delete mode 100644 bacula-gconsole.desktop
 delete mode 100644 bacula-pamd.patch
 delete mode 100644 bacula-traymonitor.console_apps
 delete mode 100644 bacula-traymonitor.desktop
 delete mode 100644 bacula-wxconsole.console_apps
 delete mode 100644 bacula-wxconsole.desktop
 delete mode 100644 bacula-wxconsole.patch

diff --git a/bacula-5.0.1-dsolink.patch b/bacula-5.0.1-dsolink.patch
deleted file mode 100644
index 51ec8b4..0000000
--- a/bacula-5.0.1-dsolink.patch
+++ /dev/null
@@ -1,11 +0,0 @@
---- bacula-5.0.1/bacula-5.0.1/src/qt-console/bat.pro.in~	2010-02-24 09:33:48.000000000 -0600
-+++ bacula-5.0.1/bacula-5.0.1/src/qt-console/bat.pro.in	2010-03-11 17:12:44.645296544 -0600
-@@ -20,7 +20,7 @@
- TARGET       = bat
- DEPENDPATH  += .
- INCLUDEPATH += .. . ./console ./restore ./select
--LIBS        += -L../lib -lbaccfg -lbac @OPENSSL_LIBS@
-+LIBS        += -L../lib -lbaccfg -lbac -ldl @OPENSSL_LIBS@
- LIBTOOL_LINK = @QMAKE_LIBTOOL@ --silent --tag=CXX --mode=link
- LIBTOOL_INSTALL = @QMAKE_LIBTOOL@ --silent --mode=install
- QMAKE_LINK   = $${LIBTOOL_LINK} $(CXX)
diff --git a/bacula-5.0.2-python27.patch b/bacula-5.0.2-python27.patch
deleted file mode 100644
index a36bf5d..0000000
--- a/bacula-5.0.2-python27.patch
+++ /dev/null
@@ -1,22 +0,0 @@
---- configure~	2010-04-27 14:58:29.000000000 -0500
-+++ configure	2010-07-30 11:28:47.494178663 -0500
-@@ -26255,7 +26255,7 @@
- 		PYTHON_LIBS=`/usr/bin/python-config --libs`
- 	     else
- 		for python_root in /usr /usr/local /usr/sfw; do
--		   for ver in python2.2 python2.3 python2.4 python2.5 python2.6 python3; do
-+		   for ver in python2.2 python2.3 python2.4 python2.5 python2.6 python2.7 python3; do
- 		      if test -f $python_root/include/${ver}/Python.h; then
- 			 PYTHON_INCDIR=-I$python_root/include/${ver}
- 			 if test -d $python_root/lib64/${ver}/config; then
---- autoconf/configure.in~	2010-04-27 14:58:29.000000000 -0500
-+++ autoconf/configure.in	2010-07-30 11:30:22.837182092 -0500
-@@ -963,7 +963,7 @@
- 		PYTHON_LIBS=`/usr/bin/python-config --libs`
- 	     else
- 		for python_root in /usr /usr/local /usr/sfw; do
--		   for ver in python2.2 python2.3 python2.4 python2.5 python2.6 python3; do
-+		   for ver in python2.2 python2.3 python2.4 python2.5 python2.6 python2.7 python3; do
- 		      if test -f $python_root/include/${ver}/Python.h; then
- 			 PYTHON_INCDIR=-I$python_root/include/${ver}
- 			 if test -d $python_root/lib64/${ver}/config; then
diff --git a/bacula-5.0.3-dsolink.patch b/bacula-5.0.3-dsolink.patch
deleted file mode 100644
index e6a5f16..0000000
--- a/bacula-5.0.3-dsolink.patch
+++ /dev/null
@@ -1,165 +0,0 @@
---- bacula-5.0.3/bacula-5.0.3/src/qt-console/bat.pro.in~	2010-08-10 11:27:17.000000000 -0500
-+++ bacula-5.0.3/bacula-5.0.3/src/qt-console/bat.pro.in	2010-08-10 12:32:00.312182153 -0500
-@@ -20,7 +20,7 @@
- TARGET       = bat
- DEPENDPATH  += .
- INCLUDEPATH += .. . ./console ./restore ./select
--LIBS        += -L../lib -lbaccfg -lbac -ldl @OPENSSL_LIBS@
-+LIBS        += -L../lib -lbaccfg -lbac -ldl -lz @OPENSSL_LIBS@
- LIBTOOL_LINK = @QMAKE_LIBTOOL@ --silent --tag=CXX --mode=link
- LIBTOOL_INSTALL = @QMAKE_LIBTOOL@ --silent --mode=install
- QMAKE_LINK   = $${LIBTOOL_LINK} $(CXX)
---- bacula-5.0.3/bacula-5.0.3/src/tools/Makefile.in~	2010-08-05 09:29:51.000000000 -0500
-+++ bacula-5.0.3/bacula-5.0.3/src/tools/Makefile.in	2010-08-11 12:54:02.028450916 -0500
-@@ -57,7 +57,7 @@
- 	@echo " "
- 
- bsmtp: Makefile bsmtp.o ../lib/libbac$(DEFAULT_ARCHIVE_TYPE)	    
--	$(LIBTOOL_LINK) $(CXX) $(LDFLAGS) -L../lib -o $@ bsmtp.o -lbac -lm $(DLIB) $(LIBS) $(GETTEXT_LIBS) $(OPENSSL_LIBS)
-+	$(LIBTOOL_LINK) $(CXX) $(LDFLAGS) -L../lib -o $@ bsmtp.o -lbac -lm -lz $(DLIB) $(LIBS) $(GETTEXT_LIBS) $(OPENSSL_LIBS)
- 
- bregtest: Makefile bregtest.o ../lib/libbac$(DEFAULT_ARCHIVE_TYPE)	   
- 	$(LIBTOOL_LINK) $(CXX) $(LDFLAGS) -L../lib -o $@ bregtest.o -lbac -lm $(DLIB) $(LIBS) $(GETTEXT_LIBS) $(OPENSSL_LIBS)
---- bacula-5.0.3/bacula-5.0.3/src/tools/Makefile.in~	2010-08-11 12:57:29.000000000 -0500
-+++ bacula-5.0.3/bacula-5.0.3/src/tools/Makefile.in	2010-08-11 14:10:52.998447849 -0500
-@@ -64,7 +64,7 @@
- 
- dbcheck: Makefile dbcheck.o ../lib/libbac$(DEFAULT_ARCHIVE_TYPE) ../lib/libbaccfg$(DEFAULT_ARCHIVE_TYPE) ../cats/libbacsql$(DEFAULT_ARCHIVE_TYPE) $(DIRCONFOBJS)
- 	$(LIBTOOL_LINK) $(CXX) $(LDFLAGS) -L../lib -L../cats -o $@ dbcheck.o $(DIRCONFOBJS) \
--	  -lbacsql -lbaccfg -lbac -lm $(DB_LIBS) $(LIBS) $(GETTEXT_LIBS) $(OPENSSL_LIBS)
-+	  -lbacsql -lbaccfg -lbac -lm -lz $(DB_LIBS) $(LIBS) $(GETTEXT_LIBS) $(OPENSSL_LIBS)
- 
- fstype: Makefile fstype.o ../lib/libbac$(DEFAULT_ARCHIVE_TYPE) ../findlib/libbacfind$(DEFAULT_ARCHIVE_TYPE)
- 	$(LIBTOOL_LINK) $(CXX) $(LDFLAGS) -L../lib -L../findlib -o $@ fstype.o -lbacfind -lbac -lm \
---- bacula-5.0.3/bacula-5.0.3/src/tools/Makefile.in~	2010-08-11 14:13:51.000000000 -0500
-+++ bacula-5.0.3/bacula-5.0.3/src/tools/Makefile.in	2010-08-11 15:11:00.309447155 -0500
-@@ -97,7 +97,7 @@
- 
- bwild:	Makefile ../lib/libbac$(DEFAULT_ARCHIVE_TYPE) bwild.o
- 	$(LIBTOOL_LINK) $(CXX) -g $(LDFLAGS) -L. -L../lib -o $@ bwild.o \
--	  $(DLIB) -lbac -lm $(LIBS) $(GETTEXT_LIBS) $(OPENSSL_LIBS)
-+	  $(DLIB) -lbac -lm -lz $(LIBS) $(GETTEXT_LIBS) $(OPENSSL_LIBS)
- 
- bbatch: Makefile ../lib/libbac$(DEFAULT_ARCHIVE_TYPE) ../cats/libbacsql$(DEFAULT_ARCHIVE_TYPE) bbatch.o
- 	$(LIBTOOL_LINK) $(CXX) -g $(LDFLAGS) -L../cats -L. -L../lib -o $@ bbatch.o \
---- bacula-5.0.3/bacula-5.0.3/src/tools/Makefile.in~	2010-08-12 06:57:25.000000000 -0500
-+++ bacula-5.0.3/bacula-5.0.3/src/tools/Makefile.in	2010-08-12 07:58:13.545781384 -0500
-@@ -93,7 +93,7 @@
- 
- bregex: Makefile ../findlib/libbacfind$(DEFAULT_ARCHIVE_TYPE) ../lib/libbac$(DEFAULT_ARCHIVE_TYPE) bregex.o
- 	$(LIBTOOL_LINK) $(CXX) -g $(LDFLAGS) -L. -L../lib -o $@ bregex.o \
--	  $(DLIB) -lbac -lm $(LIBS) $(GETTEXT_LIBS) $(OPENSSL_LIBS)
-+	  $(DLIB) -lbac -lm -lz $(LIBS) $(GETTEXT_LIBS) $(OPENSSL_LIBS)
- 
- bwild:	Makefile ../lib/libbac$(DEFAULT_ARCHIVE_TYPE) bwild.o
- 	$(LIBTOOL_LINK) $(CXX) -g $(LDFLAGS) -L. -L../lib -o $@ bwild.o \
---- bacula-5.0.3/bacula-5.0.3/src/stored/Makefile.in~	2010-08-05 09:29:51.000000000 -0500
-+++ bacula-5.0.3/bacula-5.0.3/src/stored/Makefile.in	2010-08-12 08:56:11.053777811 -0500
-@@ -91,7 +91,7 @@
- bacula-sd: Makefile $(SDOBJS) ../lib/libbacpy$(DEFAULT_ARCHIVE_TYPE) ../lib/libbaccfg$(DEFAULT_ARCHIVE_TYPE) ../lib/libbac$(DEFAULT_ARCHIVE_TYPE)
- 	@echo "Linking $@ ..."
- 	$(LIBTOOL_LINK) $(CXX) $(WLDFLAGS) $(LDFLAGS) -L../lib -o $@ $(SDOBJS) $(FDLIBS) \
--	   -lbacpy -lbaccfg -lbac -lm $(PYTHON_LIBS) $(DLIB) $(LIBS) $(WRAPLIBS) \
-+	   -lbacpy -lbaccfg -lbac -lm -lz $(PYTHON_LIBS) $(DLIB) $(LIBS) $(WRAPLIBS) \
- 	$(GETTEXT_LIBS) $(OPENSSL_LIBS) $(CAP_LIBS)
- 
- static-bacula-sd: Makefile $(SDOBJS) ../lib/libbacpy$(DEFAULT_ARCHIVE_TYPE) ../lib/libbaccfg$(DEFAULT_ARCHIVE_TYPE) ../lib/libbac$(DEFAULT_ARCHIVE_TYPE)
---- bacula-5.0.3/bacula-5.0.3/src/stored/Makefile.in~	2010-08-12 08:59:17.000000000 -0500
-+++ bacula-5.0.3/bacula-5.0.3/src/stored/Makefile.in	2010-08-12 10:24:42.478529732 -0500
-@@ -117,7 +117,7 @@
- bls:	Makefile $(BLSOBJS) ../findlib/libbacfind$(DEFAULT_ARCHIVE_TYPE) ../lib/libbaccfg$(DEFAULT_ARCHIVE_TYPE) ../lib/libbac$(DEFAULT_ARCHIVE_TYPE)
- 	@echo "Compiling $<"
- 	$(LIBTOOL_LINK) $(CXX) $(TTOOL_LDFLAGS) $(LDFLAGS) -L../lib -L../findlib -o $@ $(BLSOBJS) $(DLIB) \
--	   -lbacfind -lbaccfg -lbac -lm $(LIBS) $(GETTEXT_LIBS) $(OPENSSL_LIBS)
-+	   -lbacfind -lbaccfg -lbac -lm -lz $(LIBS) $(GETTEXT_LIBS) $(OPENSSL_LIBS)
- 
- bextract.o: bextract.c
- 	@echo "Compiling $<"
---- bacula-5.0.3/bacula-5.0.3/src/stored/Makefile.in~	2010-08-12 10:27:36.000000000 -0500
-+++ bacula-5.0.3/bacula-5.0.3/src/stored/Makefile.in	2010-08-12 11:45:39.904529074 -0500
-@@ -127,7 +127,7 @@
- bextract: Makefile $(BEXTOBJS) ../findlib/libbacfind$(DEFAULT_ARCHIVE_TYPE) ../lib/libbaccfg$(DEFAULT_ARCHIVE_TYPE) ../lib/libbac$(DEFAULT_ARCHIVE_TYPE)
- 	@echo "Compiling $<"
- 	$(LIBTOOL_LINK) $(CXX) $(TTOOL_LDFLAGS) $(LDFLAGS) -L../lib -L../findlib -o $@ $(BEXTOBJS) $(DLIB) $(FDLIBS) \
--	   -lbacfind -lbaccfg -lbac -lm $(LIBS) $(GETTEXT_LIBS) $(OPENSSL_LIBS)
-+	   -lbacfind -lbaccfg -lbac -lm -lz $(LIBS) $(GETTEXT_LIBS) $(OPENSSL_LIBS)
- 
- bscan.o: bscan.c
- 	@echo "Compiling $<"
---- bacula-5.0.3/bacula-5.0.3/src/stored/Makefile.in~	2010-08-12 11:48:22.000000000 -0500
-+++ bacula-5.0.3/bacula-5.0.3/src/stored/Makefile.in	2010-08-12 13:21:02.246528324 -0500
-@@ -136,7 +136,7 @@
- 
- bscan:	Makefile $(SCNOBJS) ../findlib/libbacfind$(DEFAULT_ARCHIVE_TYPE) ../lib/libbaccfg$(DEFAULT_ARCHIVE_TYPE) ../cats/libbacsql$(DEFAULT_ARCHIVE_TYPE)
- 	$(LIBTOOL_LINK) $(CXX) $(TTOOL_LDFLAGS) $(LDFLAGS) -L../lib -L../cats -L../findlib -o $@ $(SCNOBJS) \
--	   -lbacsql $(DB_LIBS) $(FDLIBS) -lbacfind -lbaccfg -lbac -lm $(LIBS) $(GETTEXT_LIBS) $(OPENSSL_LIBS)
-+	   -lbacsql $(DB_LIBS) $(FDLIBS) -lbacfind -lbaccfg -lbac -lm -lz $(LIBS) $(GETTEXT_LIBS) $(OPENSSL_LIBS)
- 
- bcopy.o: bcopy.c
- 	@echo "Compiling $<"
---- bacula-5.0.3/bacula-5.0.3/src/stored/Makefile.in~	2010-08-12 13:23:58.000000000 -0500
-+++ bacula-5.0.3/bacula-5.0.3/src/stored/Makefile.in	2010-08-12 14:31:11.204777284 -0500
-@@ -107,7 +107,7 @@
- 
- btape: Makefile  $(TAPEOBJS) ../lib/libbac$(DEFAULT_ARCHIVE_TYPE) ../lib/libbaccfg$(DEFAULT_ARCHIVE_TYPE) ../cats/libbacsql$(DEFAULT_ARCHIVE_TYPE)
- 	$(LIBTOOL_LINK) $(CXX) $(TTOOL_LDFLAGS) $(LDFLAGS) -L../lib -L../cats  -o $@ $(TAPEOBJS) \
--	   -lbacsql -lbaccfg -lbac $(DLIB) -lm $(LIBS) $(GETTEXT_LIBS) $(OPENSSL_LIBS)
-+	   -lbacsql -lbaccfg -lbac $(DLIB) -lm -lz $(LIBS) $(GETTEXT_LIBS) $(OPENSSL_LIBS)
- 
- bls.o:	bls.c
- 	@echo "Compiling $<"
---- bacula-5.0.3/bacula-5.0.3/src/stored/Makefile.in~	2010-08-13 07:02:47.000000000 -0500
-+++ bacula-5.0.3/bacula-5.0.3/src/stored/Makefile.in	2010-08-13 08:25:50.830920608 -0500
-@@ -145,7 +145,7 @@
- 
- bcopy:	Makefile $(COPYOBJS) ../findlib/libbacfind$(DEFAULT_ARCHIVE_TYPE) ../lib/libbaccfg$(DEFAULT_ARCHIVE_TYPE) ../lib/libbac$(DEFAULT_ARCHIVE_TYPE)
- 	$(LIBTOOL_LINK) $(CXX) $(TTOOL_LDFLAGS) $(LDFLAGS) -L../lib -o $@ $(COPYOBJS) \
--	   -lbaccfg -lbac -lm $(LIBS) $(GETTEXT_LIBS) $(OPENSSL_LIBS)
-+	   -lbaccfg -lbac -lm -lz $(LIBS) $(GETTEXT_LIBS) $(OPENSSL_LIBS)
- 
- Makefile: $(srcdir)/Makefile.in $(topdir)/config.status
- 	cd $(topdir) \
---- bacula-5.0.3/bacula-5.0.3/src/dird/Makefile.in~	2010-08-05 09:29:51.000000000 -0500
-+++ bacula-5.0.3/bacula-5.0.3/src/dird/Makefile.in	2010-08-13 09:25:38.855168511 -0500
-@@ -64,7 +64,7 @@
- bacula-dir: Makefile $(SVROBJS) ../lib/libbac$(DEFAULT_ARCHIVE_TYPE) ../lib/libbaccfg$(DEFAULT_ARCHIVE_TYPE) ../lib/libbacpy$(DEFAULT_ARCHIVE_TYPE) ../cats/libbacsql$(DEFAULT_ARCHIVE_TYPE) ../findlib/libbacfind$(DEFAULT_ARCHIVE_TYPE)
- 	@echo "Linking $@ ..."
- 	$(LIBTOOL_LINK) $(CXX) $(WLDFLAGS) $(LDFLAGS) -L../lib -L../cats -L../findlib -o $@ $(SVROBJS) \
--	      -lbacfind -lbacsql -lbacpy -lbaccfg -lbac -lm $(PYTHON_LIBS) $(DLIB) $(DB_LIBS) $(LIBS) \
-+	      -lbacfind -lbacsql -lbacpy -lbaccfg -lbac -lm -lz $(PYTHON_LIBS) $(DLIB) $(DB_LIBS) $(LIBS) \
- 	      $(WRAPLIBS) $(GETTEXT_LIBS) $(OPENSSL_LIBS) $(CAP_LIBS)
- 
- static-bacula-dir:  Makefile $(SVROBJS) ../lib/libbac$(DEFAULT_ARCHIVE_TYPE) ../lib/libbaccfg$(DEFAULT_ARCHIVE_TYPE) ../lib/libbacpy$(DEFAULT_ARCHIVE_TYPE) ../cats/libbacsql$(DEFAULT_ARCHIVE_TYPE) ../findlib/libbacfind$(DEFAULT_ARCHIVE_TYPE)
---- bacula-5.0.3/bacula-5.0.3/src/console/Makefile.in~	2010-08-05 09:29:51.000000000 -0500
-+++ bacula-5.0.3/bacula-5.0.3/src/console/Makefile.in	2010-08-13 10:26:18.001169569 -0500
-@@ -48,7 +48,7 @@
- 
- bconsole: Makefile $(CONSOBJS) ../lib/libbac$(DEFAULT_ARCHIVE_TYPE) ../lib/libbaccfg$(DEFAULT_ARCHIVE_TYPE)
- 	$(LIBTOOL_LINK) $(CXX) $(LDFLAGS) $(CONS_LDFLAGS) -L../lib -L../cats -o $@ $(CONSOBJS) \
--	      $(DLIB) $(CONS_LIBS) -lbaccfg -lbac -lm $(LIBS) $(GETTEXT_LIBS) \
-+	      $(DLIB) $(CONS_LIBS) -lbaccfg -lbac -lm -lz $(LIBS) $(GETTEXT_LIBS) \
- 	      $(OPENSSL_LIBS)
- 
- static-bconsole: Makefile $(CONSOBJS) ../lib/libbac.a ../lib/libbaccfg$(DEFAULT_ARCHIVE_TYPE)
---- bacula-5.0.3/bacula-5.0.3/src/wx-console/Makefile.in~	2010-08-05 09:29:51.000000000 -0500
-+++ bacula-5.0.3/bacula-5.0.3/src/wx-console/Makefile.in	2010-08-13 11:28:43.829917394 -0500
-@@ -83,7 +83,7 @@
- 
- bwx-console: Makefile $(CONSOBJS) @WIN32@ ../lib/libbaccfg$(DEFAULT_ARCHIVE_TYPE) ../lib/libbac$(DEFAULT_ARCHIVE_TYPE)
- 	$(LIBTOOL_LINK) $(CXX) $(CONSOBJS) $(WIN32RES) -o $@ -L../lib $(CONS_LDFLAGS) \
--	  -lbaccfg -lbac $(LIBS) $(OPENSSL_LIBS)
-+	  -lbaccfg -lbac -lz $(LIBS) $(OPENSSL_LIBS)
- 
- win32: bwx-console_private.res
- 	
---- bacula-5.0.3/bacula-5.0.3/src/tray-monitor/Makefile.in~	2010-08-05 09:29:51.000000000 -0500
-+++ bacula-5.0.3/bacula-5.0.3/src/tray-monitor/Makefile.in	2010-08-13 12:34:18.573918720 -0500
-@@ -45,7 +45,7 @@
- 
- bacula-tray-monitor: Makefile $(MONITOROBJS) ../lib/libbaccfg$(DEFAULT_ARCHIVE_TYPE) ../lib/libbac$(DEFAULT_ARCHIVE_TYPE)
- 	$(LIBTOOL_LINK) $(CXX) $(LDFLAGS) $(MONITOR_LDFLAGS) -L../lib -o $@ \
--	  $(MONITOROBJS) $(DLIB) -lbaccfg -lbac -lm $(LIBS) $(OPENSSL_LIBS)
-+	  $(MONITOROBJS) $(DLIB) -lbaccfg -lbac -lm -lz $(LIBS) $(OPENSSL_LIBS)
- 
- Makefile: $(srcdir)/Makefile.in $(topdir)/config.status
- 	cd $(topdir) \
diff --git a/bacula-5.0.3-maxvalue.patch b/bacula-5.0.3-maxvalue.patch
deleted file mode 100644
index f671749..0000000
--- a/bacula-5.0.3-maxvalue.patch
+++ /dev/null
@@ -1,78 +0,0 @@
-diff -up ./src/cats/make_mysql_tables.in.old ./src/cats/make_mysql_tables.in
---- ./src/cats/make_mysql_tables.in.old	2011-11-03 12:57:05.237131261 +0100
-+++ ./src/cats/make_mysql_tables.in	2011-11-03 12:57:16.639988706 +0100
-@@ -324,8 +324,8 @@ CREATE TABLE UnsavedFiles (
- 
- CREATE TABLE Counters (
-    Counter TINYBLOB NOT NULL,
--   MinValue INTEGER DEFAULT 0,
--   MaxValue INTEGER DEFAULT 0,
-+   \`MinValue\` INTEGER DEFAULT 0,
-+   \`MaxValue\` INTEGER DEFAULT 0,
-    CurrentValue INTEGER DEFAULT 0,
-    WrapCounter TINYBLOB NOT NULL,
-    PRIMARY KEY (Counter(128))
-diff -up ./src/cats/sql_create.c.old ./src/cats/sql_create.c
---- ./src/cats/sql_create.c.old	2011-11-03 12:57:05.238131249 +0100
-+++ ./src/cats/sql_create.c	2011-11-03 12:57:16.641988682 +0100
-@@ -627,7 +627,7 @@ int db_create_counter_record(JCR *jcr, B
-    }
- 
-    /* Must create it */
--   Mmsg(mdb->cmd, "INSERT INTO Counters (Counter,MinValue,MaxValue,CurrentValue,"
-+   Mmsg(mdb->cmd, "INSERT INTO Counters (Counter,\"MinValue\",\"MaxValue\",CurrentValue,"
-       "WrapCounter) VALUES ('%s','%d','%d','%d','%s')",
-       cr->Counter, cr->MinValue, cr->MaxValue, cr->CurrentValue,
-       cr->WrapCounter);
-diff -up ./src/cats/sql_get.c.old ./src/cats/sql_get.c
---- ./src/cats/sql_get.c.old	2011-11-03 12:57:05.239131237 +0100
-+++ ./src/cats/sql_get.c	2011-11-03 12:57:16.645988630 +0100
-@@ -730,7 +730,7 @@ int db_get_counter_record(JCR *jcr, B_DB
-    SQL_ROW row;
- 
-    db_lock(mdb);
--   Mmsg(mdb->cmd, "SELECT MinValue,MaxValue,CurrentValue,WrapCounter "
-+   Mmsg(mdb->cmd, "SELECT \"MinValue\",\"MaxValue\",CurrentValue,WrapCounter "
-       "FROM Counters WHERE Counter='%s'", cr->Counter);
- 
-    if (QUERY_DB(jcr, mdb, mdb->cmd)) {
-diff -up ./src/cats/sql_update.c.old ./src/cats/sql_update.c
---- ./src/cats/sql_update.c.old	2011-11-03 12:57:05.240131225 +0100
-+++ ./src/cats/sql_update.c	2011-11-03 12:57:16.646988618 +0100
-@@ -243,7 +243,7 @@ int db_update_counter_record(JCR *jcr, B
-    db_lock(mdb);
- 
-    Mmsg(mdb->cmd,
--"UPDATE Counters SET MinValue=%d,MaxValue=%d,CurrentValue=%d,"
-+"UPDATE Counters SET \"MinValue\"=%d,\"MaxValue\"=%d,CurrentValue=%d,"
- "WrapCounter='%s' WHERE Counter='%s'",
-       cr->MinValue, cr->MaxValue, cr->CurrentValue,
-       cr->WrapCounter, cr->Counter);
-diff -up ./src/win32/cats/make_mysql_tables.sql.old ./src/win32/cats/make_mysql_tables.sql
---- ./src/win32/cats/make_mysql_tables.sql.old	2011-11-03 13:09:26.311866553 +0100
-+++ ./src/win32/cats/make_mysql_tables.sql	2011-11-03 13:11:13.281529248 +0100
-@@ -306,8 +306,8 @@ CREATE TABLE UnsavedFiles (
- 
- CREATE TABLE Counters (
-    Counter TINYBLOB NOT NULL,
--   MinValue INTEGER DEFAULT 0,
--   MaxValue INTEGER DEFAULT 0,
-+   `MinValue` INTEGER DEFAULT 0,
-+   `MaxValue` INTEGER DEFAULT 0,
-    CurrentValue INTEGER DEFAULT 0,
-    WrapCounter TINYBLOB NOT NULL,
-    PRIMARY KEY (Counter(128))
-diff -up ./updatedb/update_mysql_tables_5_to_6.old ./updatedb/update_mysql_tables_5_to_6
---- ./updatedb/update_mysql_tables_5_to_6.old	2011-11-03 13:09:37.497726710 +0100
-+++ ./updatedb/update_mysql_tables_5_to_6	2011-11-03 13:11:13.282529236 +0100
-@@ -79,8 +79,8 @@ DROP TABLE Counters;
- 
- CREATE TABLE Counters (
-    Counter TINYBLOB NOT NULL,
--   MinValue INTEGER,
--   MaxValue INTEGER,
-+   \`MinValue\` INTEGER DEFAULT 0,
-+   \`MaxValue\` INTEGER DEFAULT 0,
-    CurrentValue INTEGER,
-    WrapCounter TINYBLOB NOT NULL,
-    PRIMARY KEY (Counter(128))
diff --git a/bacula-5.0.3-mysql55.patch b/bacula-5.0.3-mysql55.patch
deleted file mode 100644
index ea459c2..0000000
--- a/bacula-5.0.3-mysql55.patch
+++ /dev/null
@@ -1,11 +0,0 @@
---- src/cats/mysql.c~	2010-08-05 09:29:51.000000000 -0500
-+++ src/cats/mysql.c	2011-01-06 11:28:59.907306001 -0600
-@@ -292,7 +292,7 @@
- void db_thread_cleanup()
- { 
- #ifndef HAVE_WIN32
--   my_thread_end();
-+   mysql_thread_end();
- #endif
- }
- 
diff --git a/bacula-5.0.3-tray-dir.patch b/bacula-5.0.3-tray-dir.patch
deleted file mode 100644
index acf8652..0000000
--- a/bacula-5.0.3-tray-dir.patch
+++ /dev/null
@@ -1,13 +0,0 @@
-diff --git a/bacula/src/tray-monitor/tray_conf.c b/bacula/src/tray-monitor/tray_conf.c
-index 2c2f0ec..32d207c 100644
---- a/bacula/src/tray-monitor/tray_conf.c
-+++ b/bacula/src/tray-monitor/tray_conf.c
-@@ -95,7 +95,7 @@ static RES_ITEM dir_items[] = {
-    {"name",        store_name,     ITEM(res_dir.hdr.name), 0, ITEM_REQUIRED, 0},
-    {"description", store_str,      ITEM(res_dir.hdr.desc), 0, 0, 0},
-    {"dirport",     store_pint32,   ITEM(res_dir.DIRport),  0, ITEM_DEFAULT, 9101},
--   {"address",     store_str,      ITEM(res_dir.address),  0, 0, 0},
-+   {"address",     store_str,      ITEM(res_dir.address),  0, ITEM_REQUIRED, 0},
-    {"enablessl",   store_bool,     ITEM(res_dir.enable_ssl), 1, ITEM_DEFAULT, 0},
-    {NULL, NULL, {0}, 0, 0, 0}
- };
diff --git a/bacula-config.patch b/bacula-5.2.2-config.patch
similarity index 100%
rename from bacula-config.patch
rename to bacula-5.2.2-config.patch
diff --git a/bacula-bwxconsole.desktop b/bacula-bwxconsole.desktop
deleted file mode 100644
index 6c103de..0000000
--- a/bacula-bwxconsole.desktop
+++ /dev/null
@@ -1,11 +0,0 @@
-[Desktop Entry]
-Version=1.0
-Encoding=UTF-8
-Name=Bacula WX Console
-GenericName=Backup Management Console
-Comment=Control your Bacula Server
-Exec=/usr/bin/bwxconsole -c /etc/bacula/bwxconsole.conf
-Icon=wxwin16x16
-Terminal=false
-Type=Application
-Categories=System;Application;Utility
diff --git a/bacula-dir.init b/bacula-dir.init
index 75ea041..02376ac 100644
--- a/bacula-dir.init
+++ b/bacula-dir.init
@@ -33,19 +33,6 @@ if [ "$DIR_GROUP" != '' ]; then
 	OPTS="$OPTS -g $DIR_GROUP"
 fi
 
-checkconf() {
-	# Check if we still have our @@PLACEHOLDERS@@ in the config.
-	# If yes, refuse to start, the user has never touched the config.
-	grep -q '^[^#].*_PASSWORD@@' $CONFIG
-	if [ $? -eq 0 ]; then
-		echo -n "Error: Default password in config"
-		echo_failure
-		echo
-		exit 6
-	fi
-}
-
-
 checkdatabase() {
 	# First, get the currently selected database backend from the
 	# alternatives system.
@@ -87,7 +74,7 @@ start() {
 	[ "$EUID" != "0" ] && exit 4
 
 	echo -n "Starting $prog: "
-	checkconf
+	bacula-checkconf $CONFIG
 #	Removed for now, as the db might not be on localhost
 #	checkdatabase
 	daemon $prog $OPTS
diff --git a/bacula-fd.init b/bacula-fd.init
index 044eb19..60f257f 100644
--- a/bacula-fd.init
+++ b/bacula-fd.init
@@ -33,24 +33,11 @@ if [ "$FD_GROUP" != '' ]; then
 	OPTS="$OPTS -g $FD_GROUP"
 fi
 
-checkconf() {
-	# Check if we still have our @@PLACEHOLDERS@@ in the config.
-	# If yes, refuse to start, the user has never touched the config.
-	grep -q '_PASSWORD@@' $CONFIG
-	if [ $? -eq 0 ]; then
-		echo -n "Error: Default password in config"
-		echo_failure
-		echo
-		exit 6
-	fi
-}
-
-
 start() {
 	[ "$EUID" != "0" ] && exit 4
 
 	echo -n "Starting $prog: "
-	checkconf
+	bacula-checkconf $CONFIG
 	daemon $prog $OPTS
 	RETVAL=$?
 	echo
diff --git a/bacula-fd.sysconfig b/bacula-fd.sysconfig
index 796ad1a..2476fec 100644
--- a/bacula-fd.sysconfig
+++ b/bacula-fd.sysconfig
@@ -2,4 +2,5 @@
 # If no user is set bacula will run as root
 
 FD_USER=root
-FD_GROUP=root
\ No newline at end of file
+FD_GROUP=root
+
diff --git a/bacula-gconsole.desktop b/bacula-gconsole.desktop
deleted file mode 100644
index f21e4a7..0000000
--- a/bacula-gconsole.desktop
+++ /dev/null
@@ -1,12 +0,0 @@
-[Desktop Entry]
-Version=1.0
-Encoding=UTF-8
-Name=Bacula Console
-GenericName=Backup Management Console
-Comment=Control your Bacula Server
-Exec=/usr/sbin/bgnome-console -c /etc/bacula/bgnome-console.conf
-Icon=bacula.png
-Terminal=false
-Type=Application
-Categories=System;Application;Utility
-
diff --git a/bacula-pamd.patch b/bacula-pamd.patch
deleted file mode 100644
index 469335a..0000000
--- a/bacula-pamd.patch
+++ /dev/null
@@ -1,23 +0,0 @@
---- bacula-2.0.3/scripts/wxconsole.pamd.orig    2007-07-11 18:43:10.000000000 +0200
-+++ bacula-2.0.3/scripts/wxconsole.pamd 2007-07-11 18:43:23.000000000 +0200
-@@ -1,7 +1,7 @@
- #%PAM-1.0
- auth       sufficient   pam_rootok.so
- auth       sufficient   pam_timestamp.so
--auth       required     pam_stack.so service=system-auth
-+auth       include      system-auth
- session    optional     pam_xauth.so
- session    optional     pam_timestamp.so
- account    required     pam_permit.so
---- bacula-2.0.3/scripts/bgnome-console.pamd.orig        2007-07-11 18:42:33.000000000 +0200
-+++ bacula-2.0.3/scripts/bgnome-console.pamd     2007-07-11 18:42:57.000000000 +0200
-@@ -1,7 +1,7 @@
- #%PAM-1.0
- auth       sufficient   pam_rootok.so
- auth       sufficient   pam_timestamp.so
--auth       required     pam_stack.so service=system-auth
-+auth       include      system-auth
- session    optional     pam_xauth.so
- session    optional     pam_timestamp.so
- account    required     pam_permit.so
-
diff --git a/bacula-sd.init b/bacula-sd.init
index 98bb972..6fb5e8d 100644
--- a/bacula-sd.init
+++ b/bacula-sd.init
@@ -32,19 +32,6 @@ if [ "$SD_GROUP" != '' ]; then
 	OPTS="$OPTS -g $SD_GROUP"
 fi
 
-checkconf() {
-	# Check if we still have our @@PLACEHOLDERS@@ in the config.
-	# If yes, refuse to start, the user has never touched the config.
-	grep -q '^[^#].*_PASSWORD@@' $CONFIG
-	if [ $? -eq 0 ]; then
-		echo -n "Error: Default password in config"
-		echo_failure
-		echo
-		exit 6
-	fi
-}
-
-
 checkdatabase() {
 	# First, get the currently selected database backend from the
 	# alternatives system.
@@ -86,7 +73,7 @@ start() {
 	[ "$EUID" != "0" ] && exit 4
 
 	echo -n "Starting $prog: "
-	checkconf
+	bacula-checkconf $CONFIG
 # Disabled, the DB does not necessarily run on the same machine
 #	checkdatabase
 	daemon $prog $OPTS
diff --git a/bacula-traymonitor.console_apps b/bacula-traymonitor.console_apps
deleted file mode 100644
index 45447b8..0000000
--- a/bacula-traymonitor.console_apps
+++ /dev/null
@@ -1,3 +0,0 @@
-USER=root
-PROGRAM=/usr/sbin/bacula-tray-monitor
-SESSION=true
diff --git a/bacula-traymonitor.desktop b/bacula-traymonitor.desktop
deleted file mode 100644
index 1e20abc..0000000
--- a/bacula-traymonitor.desktop
+++ /dev/null
@@ -1,11 +0,0 @@
-[Desktop Entry]
-Version=1.0
-Encoding=UTF-8
-Name=Bacula Monitor
-GenericName=Bacula Tray Monitor
-Comment=Monitor your Bacula Backup server
-Exec=/usr/bin/bacula-tray-monitor -c /etc/bacula/tray-monitor.conf
-Icon=bacula-tray-monitor.xpm
-Terminal=false
-Type=Application
-Categories=System;Application;Utility
diff --git a/bacula-wxconsole.console_apps b/bacula-wxconsole.console_apps
deleted file mode 100644
index 405795d..0000000
--- a/bacula-wxconsole.console_apps
+++ /dev/null
@@ -1,3 +0,0 @@
-USER=root
-PROGRAM=/usr/sbin/bwxconsole
-SESSION=true
\ No newline at end of file
diff --git a/bacula-wxconsole.desktop b/bacula-wxconsole.desktop
deleted file mode 100644
index 186abcb..0000000
--- a/bacula-wxconsole.desktop
+++ /dev/null
@@ -1,11 +0,0 @@
-[Desktop Entry]
-Version=1.0
-Encoding=UTF-8
-Name=Bacula WX Console
-GenericName=Backup Management Console
-Comment=Control your Bacula Server
-Exec=/usr/bin/bwxconsole -c /etc/bacula/bwxconsole.conf
-Icon=wxwin16x16
-Terminal=false
-Type=Application
-Categories=System;Application;
diff --git a/bacula-wxconsole.patch b/bacula-wxconsole.patch
deleted file mode 100644
index ece6386..0000000
--- a/bacula-wxconsole.patch
+++ /dev/null
@@ -1,10 +0,0 @@
---- bacula-2.0.2/src/wx-console/wxbrestorepanel.cpp.orig	2007-02-06 21:32:02.000000000 +0100
-+++ bacula-2.0.2/src/wx-console/wxbrestorepanel.cpp	2007-02-06 21:32:20.000000000 +0100
-@@ -80,6 +80,7 @@
- #include "unmarked.xpm"
- #include "marked.xpm"
- #include "partmarked.xpm"
-+#include <wx/imaglist.h>
- #include <wx/listimpl.cpp>
- 
- /* A macro named Yield is defined under MinGW */
diff --git a/bacula.spec b/bacula.spec
index f82c782..2dd82d4 100644
--- a/bacula.spec
+++ b/bacula.spec
@@ -1,12 +1,13 @@
 Name:			bacula
 Version:		5.2.2
-Release:		2%{?dist}
+Release:		4%{?dist}
 Summary:		Cross platform network backup for Linux, Unix, Mac and Windows
 # See LICENSE for details
 License:		GPLv2 with exceptions
 Group:			System Environment/Daemons
 URL:			http://www.bacula.org
 BuildRoot:		%{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
+
 Source0:		http://www.bacula.org/downloads/Bacula-%{version}/%{name}-%{version}.tar.gz
 Source1:		http://www.bacula.org/downloads/Bacula-%{version}/%{name}-docs-%{version}.tar.bz2
 Source6:		bacula.logrotate
@@ -21,7 +22,7 @@ Source15:		bacula-fd.sysconfig
 Source16:		bacula-dir.sysconfig
 Source17:		bacula-sd.sysconfig
 Source18:		bacula-checkconf
-Patch1:			bacula-config.patch
+Patch1:			bacula-5.2.2-config.patch
 Patch2:			bacula-5.0.2-openssl.patch
 Patch3:			bacula-5.0.2-config.patch
 Patch4:			bacula-5.2.2-dsolink.patch
@@ -29,6 +30,7 @@ Patch5:			bacula-5.0.3-log-path.patch
 Patch6:			bacula-5.0.3-sqlite-priv.patch
 Patch7:			bacula-5.2.1-bat-pamd.patch
 Patch8:			bacula-5.2.2-qt-console-optflags.patch
+
 BuildRequires:		openssl-devel, ncurses-devel, perl, glibc-devel
 BuildRequires:		libstdc++-devel, libxml2-devel, zlib-devel
 BuildRequires:		mysql-devel, postgresql-devel
@@ -37,7 +39,7 @@ BuildRequires:		libacl-devel, latex2html, tetex-latex, tetex, ghostscript
 BuildRequires:		readline-devel
 
 %if 0%{?fedora} >= 12 || 0%{?rhel} >= 6
-BuildRequires:		qt-devel >= 4.6
+BuildRequires:		qt4-devel >= 4.6.2
 %endif
 
 %if 0%{?fedora} >= 7 || 0%{?rhel} >= 6
@@ -120,8 +122,6 @@ Group:			System Environment/Daemons
 Requires:		bacula-director = %{version}-%{release}
 Requires:		bacula-common%{?_isa} = %{version}-%{release}
 Requires:		logwatch
-Requires(pre):		fedora-usermgmt
-Requires(postun): 	fedora-usermgmt
 %if 0%{?fedora} >= 15 || 0%{?rhel} > 6
 Requires(post):		systemd-sysv
 Requires(post):		systemd-units
@@ -134,7 +134,6 @@ Requires(preun):	/sbin/service
 Requires(postun):	/sbin/service
 %endif
 
-
 %description director-common
 Bacula is a set of programs that allow you to manage the backup,
 recovery, and verification of computer data across a network of
@@ -172,12 +171,13 @@ This package contains the bacula client, the daemon running on the
 system to be backed up.
 
 
-%package storage-common
-Summary: 		Common Bacula storage daemon files
+%package storage
+Summary:		Bacula storage daemon files
 Group:			System Environment/Daemons
 Requires:		bacula-common%{?_isa} = %{version}-%{release}
 # Storage backends merged into core.
-Provides:		bacula-storage = %{version}-%{release}
+Provides:		bacula-storage-common = %{version}-%{release}
+Obsoletes:		bacula-storage-common < 5.2.2-2
 Provides:		bacula-storage-mysql = %{version}-%{release}
 Obsoletes:		bacula-storage-mysql < 5.2.0
 Provides:		bacula-storage-sqlite = %{version}-%{release}
@@ -196,8 +196,7 @@ Requires(preun):	/sbin/service
 Requires(postun):	/sbin/service
 %endif
 
-
-%description storage-common
+%description storage
 Bacula is a set of programs that allow you to manage the backup,
 recovery, and verification of computer data across a network of
 different computers. It is based on a client/server architecture.
@@ -212,7 +211,7 @@ Summary:		Common Bacula utilities
 Group:			System Environment/Daemons
 Requires(pre):		fedora-usermgmt
 Obsoletes:		bacula-console-gnome <= 2.4, bacula-traymonitor <= 2.4
-Obsoletes:		bacula-sysconfdir <= 2.4
+Obsoletes:		bacula-sysconfdir <= 2.4, bacula-console-wxwidgets
 
 %description common
 Bacula is a set of programs that allow you to manage the backup,
@@ -221,9 +220,9 @@ different computers. It is based on a client/server architecture.
 
 
 %package console
-Summary: Bacula management console
-Group: System Environment/Daemons
-Requires: bacula-common = %{version}-%{release}
+Summary:		Bacula management console
+Group:			System Environment/Daemons
+Requires:		bacula-common%{?_isa} = %{version}-%{release}
 
 %description console
 Bacula is a set of programs that allow you to manage the backup,
@@ -253,6 +252,9 @@ This package contains the bat version of the bacula management console
 %package docs
 Summary:		Bacula documentation
 Group:			Documentation
+%if 0%{?fedora} >= 11 || 0%{?rhel} >= 6
+BuildArch:		noarch
+%endif
 
 %description docs
 Bacula is a set of programs that allow you to manage the backup,
@@ -263,7 +265,7 @@ This package contains the documentation for most of the bacula-packages.
 
 
 %package -n nagios-plugins-bacula
-Summary:		Nagios Plugin - check_oracle
+Summary:		Nagios Plugin - check_bacula
 Group:			Applications/System
 
 %description -n nagios-plugins-bacula
@@ -294,9 +296,9 @@ find -type f -name '*.c' | xargs chmod -x
 find -type f -name '*.h' | xargs chmod -x 
 
 %build
+build() {
 export CFLAGS="$RPM_OPT_FLAGS -I%{_includedir}/ncurses"
 export CPPFLAGS="$RPM_OPT_FLAGS -I%{_includedir}/ncurses"
-export QMAKE=/usr/bin/qmake-qt4
 %configure \
 	--sysconfdir=%{_sysconfdir}/bacula \
 	--with-dir-user=bacula \
@@ -331,7 +333,15 @@ export QMAKE=/usr/bin/qmake-qt4
 	--with-sqlite3 \
 	--with-mysql \
 	--with-postgresql \
-	--enable-bat
+	$*
+}
+
+%if 0%{?fedora} >= 11 || 0%{?rhel} >= 6
+export QMAKE=/usr/bin/qmake-qt4
+build --enable-bat
+%else
+build
+%endif
 
 if test $? != 0; then 
   tail -500 config.log
@@ -343,7 +353,6 @@ fi
 sed -i 's|^hardcode_libdir_flag_spec=.*|hardcode_libdir_flag_spec=""|g' libtool
 sed -i 's|^runpath_var=LD_RUN_PATH|runpath_var=DIE_RPATH_DIE|g' libtool
 
-#%{__make} %{?_smp_mflags} NO_ECHO=
 %{__make} %{?_smp_mflags}
 
 pushd examples/nagios/check_bacula
@@ -352,7 +361,7 @@ popd
 %if 0%{?fedora} >= 12 || 0%{?rhel} >= 6
 pushd src/qt-console/tray-monitor
 	/usr/bin/qmake-qt4
-        %{__make} %{?_smp_mflags}
+	%{__make} %{?_smp_mflags}
 popd
 %endif
 
@@ -369,19 +378,19 @@ make install DESTDIR=%{buildroot}
 
 # install the nagios plugin
 %{__mkdir_p} %{buildroot}%{_libdir}/nagios/plugins
-%{__install} -m0755 examples/nagios/check_bacula/check_bacula %{buildroot}%{_libdir}/nagios/plugins/
+%{__install} -m0755 examples/nagios/check_bacula/.libs/check_bacula %{buildroot}%{_libdir}/nagios/plugins/
 
 # Remove unused stuff
 rm -f %{buildroot}%{_libexecdir}/bacula/bconsole
 rm -f %{buildroot}%{_mandir}/man1/bacula-bwxconsole.1*
 rm -f %{buildroot}%{_mandir}/man1/bacula-tray-monitor.1*
-# rm -f %{buildroot}%{_libdir}/libbaccats-%{version}.so
+rm -f %{buildroot}%{_libdir}/libbaccats-%{version}.so
 
 mkdir -p %{buildroot}%{_bindir}
 
 # Bat
 %if 0%{?fedora} >= 12 || 0%{?rhel} >= 6
-install -m 755 -D src/qt-console/bat %{buildroot}%{_sbindir}
+install -m 755 -D src/qt-console/.libs/bat %{buildroot}%{_sbindir}
 install -m 644 -D src/qt-console/bat.conf %{buildroot}%{_sysconfdir}/bacula/bat.conf
 install -m 644 -D src/qt-console/images/bat_icon.png %{buildroot}%{_datadir}/pixmaps/bat_icon.png
 install -m 644 -D scripts/bat.pamd %{buildroot}%{_sysconfdir}/pam.d/bat
@@ -402,13 +411,13 @@ install -m 755 -D scripts/logwatch/applybaculadate %{buildroot}%{_sysconfdir}/lo
 install -m 644 -D scripts/logwatch/logfile.bacula.conf %{buildroot}%{_sysconfdir}/logwatch/conf/logfiles/bacula.conf
 install -m 644 -D scripts/logwatch/services.bacula.conf %{buildroot}%{_sysconfdir}/logwatch/conf/services/bacula.conf
 
+install -m 755 -D %{SOURCE18}  %{buildroot}%{_sbindir}/bacula-checkconf
 %if 0%{?fedora} >= 15 || 0%{?rhel} > 6
 # Systemd unit files
 mkdir -p ${buildroot}%{_unitdir}
 install -m 755 -D %{SOURCE10}  %{buildroot}%{_unitdir}/bacula-fd.service
 install -m 755 -D %{SOURCE11}  %{buildroot}%{_unitdir}/bacula-dir.service
 install -m 755 -D %{SOURCE12}  %{buildroot}%{_unitdir}/bacula-sd.service
-install -m 755 -D %{SOURCE18}  %{buildroot}%{_sbindir}/bacula-checkconf
 %else
 # Initscripts
 install -m 755 -D %{SOURCE7}  %{buildroot}%{_initrddir}/bacula-fd
@@ -421,16 +430,9 @@ install -m 644 -D %{SOURCE15}  %{buildroot}%{_sysconfdir}/sysconfig/bacula-fd
 install -m 644 -D %{SOURCE16}  %{buildroot}%{_sysconfdir}/sysconfig/bacula-dir
 install -m 644 -D %{SOURCE17}  %{buildroot}%{_sysconfdir}/sysconfig/bacula-sd
 
-# Wipe backup files from the multiple make install calls
-rm -vf %{buildroot}%{_sysconfdir}/bacula/*.{new,old}
-rm -vf %{buildroot}%{_libexecdir}/bacula/*.{new,old}
-
 # Create the spooling
 mkdir -p %{buildroot}%{_localstatedir}/spool/bacula
 
-# Move some files around
-#mv %{buildroot}%{_libexecdir}/bacula/query.sql %{buildroot}%{_sysconfdir}/bacula/query.sql
-
 # Nuke the scripts we do not need
 rm -vf %{buildroot}%{_libexecdir}/bacula/{bacula,bacula-ctl-*,startmysql,stopmysql} 
 
@@ -548,27 +550,27 @@ fi
 /bin/systemctl try-restart bacula-dir.service >/dev/null 2>&1 || :
 
 
-%post storage-common
+%post storage
 if [ $1 -eq 1 ] ; then
     # Initial installation
     /bin/systemctl daemon-reload >/dev/null 2>&1 || :
 fi
 
-%preun storage-common
+%preun storage
 if [ $1 -eq 0 ] ; then
     # Package removal, not upgrade
     /bin/systemctl --no-reload disable bacula-sd.service > /dev/null 2>&1 || :
     /bin/systemctl stop bacula-sd.service > /dev/null 2>&1 || :
 fi
 
-%postun storage-common
+%postun storage
 /bin/systemctl daemon-reload >/dev/null 2>&1 || :
 if [ $1 -ge 1 ] ; then
     # Package upgrade, not uninstall
     /bin/systemctl try-restart bacula-sd.service >/dev/null 2>&1 || :
 fi
 
-%triggerun storage-common -- bacula-storage-common < 5.0.3-10
+%triggerun storage -- bacula-storage-common < 5.0.3-10
 # Save the current service runlevel info
 # User must manually run systemd-sysv-convert --apply bacula-sd
 # to migrate them to systemd targets
@@ -614,18 +616,18 @@ if [ "$1" -ge "1" ]; then
 fi
 
 
-%post storage-common
+%post storage
 /sbin/chkconfig --add bacula-sd
 
 
-%preun storage-common
+%preun storage
 if [ "$1" = 0 ]; then
 	/sbin/service bacula-sd stop >/dev/null 2>&1 || :
 	/sbin/chkconfig --del bacula-sd
 fi
 
 
-%postun storage-common
+%postun storage
 if [ "$1" -ge "1" ]; then
 	/sbin/service bacula-sd condrestart >/dev/null 2>&1 || :
 fi
@@ -635,7 +637,7 @@ fi
 
 %files common
 %defattr(-,root,root,-)
-%doc AUTHORS ChangeLog COPYING LICENSE README SUPPORT VERIFYING examples/
+%doc AUTHORS ChangeLog COPYING LICENSE README SUPPORT VERIFYING
 %config(noreplace) %{_sysconfdir}/logrotate.d/bacula
 %dir %{_sysconfdir}/%{name}
 %dir %{_libexecdir}/%{name}
@@ -649,24 +651,22 @@ fi
 %{_libexecdir}/%{name}/btraceback.mdb
 %{_libdir}/libbac-%{version}.so
 %{_libdir}/libbac.so
-%{_libdir}/libbaccats-%{version}.so
 %{_libdir}/libbaccats.so
+%{_libdir}/libbaccats-%{version}.so
 %{_libdir}/libbaccfg-%{version}.so
 %{_libdir}/libbaccfg.so
 %{_libdir}/libbacfind-%{version}.so
 %{_libdir}/libbacfind.so
 %{_libdir}/libbacpy-%{version}.so
 %{_libdir}/libbacpy.so
-%{_libdir}/libbacsql-%{version}.so
 %{_libdir}/libbacsql.so
+%{_libdir}/libbacsql-%{version}.so
 %{_mandir}/man1/bsmtp.1.gz
 %{_mandir}/man8/bacula.8.gz
 %{_mandir}/man8/btraceback.8.gz
 %dir %attr(750, bacula, bacula) %{_localstatedir}/log/bacula
 %dir %attr(750, bacula, bacula) %{_localstatedir}/spool/bacula
-%if 0%{?fedora} >= 15 || 0%{?rhel} > 6
 %{_sbindir}/bacula-checkconf
-%endif
 
 %files client
 %defattr(-,root,root,-)
@@ -704,7 +704,6 @@ fi
 %defattr(-,root,root,-)
 %doc updatedb
 %attr(640,root,bacula) %config(noreplace) %{_sysconfdir}/bacula/bacula-dir.conf
-#%config(noreplace) %{_sysconfdir}/bacula/query.sql
 %config(noreplace) %{_sysconfdir}/logwatch/conf/logfiles/bacula.conf
 %config(noreplace) %{_sysconfdir}/logwatch/conf/services/bacula.conf
 %config(noreplace) %{_sysconfdir}/sysconfig/bacula-dir
@@ -719,10 +718,10 @@ fi
 %{_sbindir}/bregex
 %{_sbindir}/bwild
 %{_sbindir}/dbcheck
-%{_mandir}/man8/dbcheck.8.gz
 %{_mandir}/man8/bacula-dir.8.gz
 %{_mandir}/man8/bregex.8.gz
 %{_mandir}/man8/bwild.8.gz
+%{_mandir}/man8/dbcheck.8.gz
 %{_libexecdir}/%{name}/create_bacula_database
 %{_libexecdir}/%{name}/delete_catalog_backup
 %{_libexecdir}/%{name}/disk-changer
@@ -770,7 +769,7 @@ fi
 %{_libexecdir}/%{name}/make_postgresql_tables
 %{_libexecdir}/%{name}/update_postgresql_tables
 
-%files storage-common
+%files storage
 %defattr(-,root,root,-)
 %{_sbindir}/bacula-sd
 %{_sbindir}/bcopy
@@ -810,6 +809,26 @@ fi
 
 
 %changelog
+* Thu Dec 02 2011 Simone Caronni <negativo17@gmail.com> - 5.2.2-4
+- Rename storage-common to storage and make it provide storage-common.
+
+* Thu Dec 01 2011 Simone Caronni <negativo17@gmail.com> - 5.2.2-3
+- Add missing conditional for bat in the build section.
+- Make bat require qt4-devel on build (rhel 5 fix).
+- Bumped requirement for qt >= 4.6.2 for 5.2.2.
+- Renamed bacula-config.patch to bacula-5.2.2-config.patch as it
+  always changes.
+- Fix installation of bat and check_bacula binaries. Enabling
+  libtool for bpipe-fd.so produces binaries under .libs.
+- Removed fedora-usermgmt requirement for director-common.
+- Removed examples from docs and make them "noarch".
+- Fix bacula-console requirements.
+- Fix nagios plugin summary.
+- Removed checkconf functions from SysV init files and replace
+  the call with the script used in systemd service files. Make
+  the script available in all builds.
+- Make docs NoArch where supported.
+
 * Thu Dec  1 2011 Tom Callaway <spot@fedoraproject.org> - 5.2.2-2
 - resolve broken dependency issues