diff -Nru bacula-2.2.8/debian/bacula-director-mysql.config bacula-2.2.8/debian/bacula-director-mysql.config
--- bacula-2.2.8/debian/bacula-director-mysql.config	2008-03-13 04:58:10.000000000 +0100
+++ bacula-2.2.8/debian/bacula-director-mysql.config	2008-03-13 04:58:11.000000000 +0100
@@ -1,33 +1,122 @@
-#!/bin/sh
-# config script for bacula-dir ( MySQL flavor )
+#!/bin/sh -e
 
+# Source debconf library.
 . /usr/share/debconf/confmodule
-db_version 2.0
-
-# source dbconfig-common shell library, and call the hook function
-if [ -f /usr/share/dbconfig-common/dpkg/config.mysql ]; then
-  dbc_first_version=1.38.9-3
-  dbc_dbuser=bacula
-  dbc_dbname=bacula
-  . /usr/share/dbconfig-common/dpkg/config.mysql
-  dbc_go bacula-director-mysql $@
-fi
-
-db_title "Bacula Director"
 
-set -e
-
-case "$1" in
-        configure)
-        ;;
-
-	reconfigure)
-        ;;
+db_version 2.0
+db_capb backup
 
-        *)
-                echo "config called with unknown argument \$1'" >&2
-                exit 0
-        ;;
-esac
+db_input high bacula/sgbd || true
 
-exit 0
+STATE=1
+while [ "$STATE"  != 0 -a "$STATE" -lt 10 ]
+  do
+  case "$STATE" in
+      1)
+          db_input critical bacula/db_host || true
+          if db_go; then
+              db_get bacula/db_host || true
+              if [ ! -z "$RET" ]; then
+                  STATE=2
+              fi
+          else
+              STATE=1
+          fi
+          ;;
+
+      2)
+          db_input critical bacula/dba_name || true
+          if db_go; then
+              db_get bacula/dba_name || true
+              if [ ! -z "$RET" ]; then
+                  STATE=3
+              fi
+          else
+              STATE=2
+          fi
+          ;;
+
+      3)
+          db_input critical bacula/dba_password || true
+          if db_go; then
+              db_get bacula/dba_password || true
+              STATE=4
+          else
+              STATE=3
+          fi
+          ;;
+
+      4)
+          db_input critical bacula/dba_confirm || true
+          if db_go; then
+              db_get bacula/dba_confirm || true
+              CONFIRM="$RET"
+              db_get bacula/dba_password || true
+              if [ "$RET" != "$CONFIRM" ]; then
+                  STATE=5
+              else
+                  STATE=6
+              fi
+          else
+              STATE=3
+          fi
+          ;;
+
+      5)
+          db_input critical bacula/mismatch || true
+          db_go
+          STATE=3
+          ;;
+
+      6)
+          db_input critical bacula/dbu_name || true
+          if db_go; then
+              db_get bacula/dbu_name || true
+              if [ ! -z "$RET" ]; then
+                  STATE=7
+              fi
+          else
+              STATE=6
+          fi
+          ;;
+
+      7)
+          db_input critical bacula/dbu_password || true
+          if db_go; then
+              db_get bacula/dbu_password || true
+              STATE=8
+          else
+              STATE=7
+          fi
+          ;;
+
+      8)
+          db_input critical bacula/dbu_confirm || true
+          if db_go; then
+              db_get bacula/dbu_confirm || true
+              CONFIRM="$RET"
+              db_get bacula/dbu_password || true
+              if [ "$RET" != "$CONFIRM" ]; then
+                  STATE=9
+              else
+                  STATE=10
+              fi
+          else
+              STATE=7
+          fi
+          ;;
+
+      9)
+          db_input critical bacula/mismatch || true
+          db_go
+          STATE=7
+          ;;
+
+  esac
+done
+
+if [ "$STATE" = 0 ]; then
+    db_input critical bacula/notconfigured || true
+    db_go
+    exit 1
+fi
diff -Nru /tmp/wVw41Ximu9/bacula-2.2.8/debian/bacula-director-mysql.dirs /tmp/BkSB3yG08Z/bacula-2.2.8/debian/bacula-director-mysql.dirs
--- bacula-2.2.8/debian/bacula-director-mysql.dirs	2008-03-13 04:58:10.000000000 +0100
+++ bacula-2.2.8/debian/bacula-director-mysql.dirs	2008-03-13 04:58:11.000000000 +0100
@@ -1,5 +1,3 @@
 usr/sbin
 usr/lib/bacula
 etc/bacula
-usr/share/dbconfig-common/data/bacula-director-mysql/upgrade/mysql
-usr/share/dbconfig-common/data/bacula-director-mysql/install
diff -Nru /tmp/wVw41Ximu9/bacula-2.2.8/debian/bacula-director-mysql.postinst /tmp/BkSB3yG08Z/bacula-2.2.8/debian/bacula-director-mysql.postinst
--- bacula-2.2.8/debian/bacula-director-mysql.postinst	2008-03-13 04:58:10.000000000 +0100
+++ bacula-2.2.8/debian/bacula-director-mysql.postinst	2008-03-13 04:58:11.000000000 +0100
@@ -25,32 +25,112 @@
 #     installation fails and the `postinst' is called with `abort-upgrade',
 #     `abort-remove' or `abort-deconfigure'.
 
+# DoMySQL from moodle and mythtv Ubuntu packages
+
+escape_quotes() {
+    cat <<EOF | sed -e "s/'/\\\\'/g"
+$1
+EOF
+}
+
+create_tables() {
+touch /var/lib/bacula/.my.install.cf
+chmod 600 /var/lib/bacula/.my.install.cf
+cat << EOF > /var/lib/bacula/.my.install.cf
+[client]
+host=$db_host
+user=$dbu_name
+password=$dbu_password
+EOF
+
+/usr/share/bacula-director/make_mysql_tables --defaults-file=/var/lib/bacula/.my.install.cf
+rm -rf /var/lib/bacula/.my.install.cf
+}
+
+DoMySQL() {
+    local dbtype="$1"
+    local host="$2"
+    local admin_username="$3"
+    local admin_password="$4"
+    local database="$5"
+    local statement="`escape_quotes \"$6\"`"
+    local tmp=`tempfile -m 600`
+        cat <<EOF >$tmp
+$admin_password
+EOF
+    perl -e "
+use DBI;
+chomp(\$password=<>);
+@statements=split(/;/, '$statement');
+\$db = DBI->connect('dbi:mysql:host=$host;database=$database',
+                    '$admin_username', \$password,
+                    { PrintError => 0 }) || die 'Failed to connect to database: ' . \$DBI::errstr;
+for \$s (@statements) { \$db->do(\$s) || die 'Failed to execute SQL: ' . \$s . '\n' . \$DBI::errstr; }
+" < $tmp
+    ret=$?
+    rm -f $tmp
+    return $ret
+}
+
+get_config() {
+    db_get bacula/db_host
+    db_host="$RET"
+
+    db_get bacula/dba_name
+    dba_name="$RET"
+
+    db_get bacula/dba_password
+    dba_password="$RET"
+
+    db_get bacula/dbu_name
+    dbu_name="$RET"
+
+    db_get bacula/dbu_password
+    dbu_password="$RET"
+
+    db_name='bacula'
+}
+
 LOGDIR=/var/log/bacula
 POSTINST_COMMON=/usr/share/bacula-director/postinst-common
 DEFCONFIG=/usr/share/bacula-common/defconfig
 CFGFILE=/etc/bacula/bacula-dir.conf
 
-. /usr/share/debconf/confmodule
-dbc_first_version=1.38.9-3
-dbc_dbuser=bacula
-dbc_dbname=bacula
-
-# source dbconfig-common shell library, and call the hook function
-if [ -f /usr/share/dbconfig-common/dpkg/config.mysql ]; then
-  . /usr/share/dbconfig-common/dpkg/postinst.mysql
-  dbc_go bacula-director-mysql $@
-fi
 
 case "$1" in
 configure)
 	
 	# PreProcess configuration
 	echo -n "Processing configuration ..."
-        . /etc/dbconfig-common/bacula-director-mysql.conf
 	TARGET=$CFGFILE.dpkg-tmp
 
-	sed -e "s/dbname = bacula;/dbname = $dbc_dbname; DB Address = \"$dbc_dbserver\";/" \
-	-e "s/@db_user@/$dbc_dbuser/" -e "s/@db_pswd@/$dbc_dbpass/" \
+	get_config
+        db_stop
+        exec 0<&1
+
+	if ! DoMySQL "$db_server" "$db_host" "$dba_name" "$dba_password" "$db_name" "SELECT NULL" 2>/dev/null; then
+                        if ! DoMySQL "$db_server" "$db_host" "$dba_name" "$dba_password" "" \
+                             "CREATE DATABASE $db_name"; then
+                                echo "Failed to create database (incorrect admin username/password?)" >&2
+                                echo "It's also possible that mysql-server wasn't running.  After install" >&2
+                                echo "is completed, you will need to make sure mysql-server is running" >&2
+                                echo "and that you supplied correct information. Try:" >&2
+                                echo "sudo dpkg-reconfigure bacula-director-mysql" >&2
+                                # silently exit, instead pop up a notification for user indicating this
+                                #unud=/var/lib/update-notifier/user.d
+                                #if test -d $uund; then
+                                #    cp -f /usr/share/bacula-director/bacula-reconfigure-required.update-notifier \
+                                #          /var/lib/update-notifier/user.d/bacula-reconfigure-required
+                                #fi
+                                exit 0
+                        fi
+                fi
+                DoMySQL "$db_server" "$db_host" "$dba_name" "$dba_password" "$db_name" \
+                    "GRANT ALL PRIVILEGES ON $db_name.* TO $dbu_name@localhost IDENTIFIED BY '$dbu_password'"
+	create_tables
+
+	sed -e "s/dbname = bacula;/dbname = $db_name; DB Address = \"$db_host\";/" \
+	-e "s/@db_user@/$dbu_name/" -e "s/@db_pswd@/$dbu_password/" \
 		$DEFCONFIG/bacula-dir.conf > $TARGET
 
 	/bin/bash $POSTINST_COMMON
diff -Nru /tmp/wVw41Ximu9/bacula-2.2.8/debian/bacula-director-mysql.postrm /tmp/BkSB3yG08Z/bacula-2.2.8/debian/bacula-director-mysql.postrm
--- bacula-2.2.8/debian/bacula-director-mysql.postrm	2008-03-13 04:58:10.000000000 +0100
+++ bacula-2.2.8/debian/bacula-director-mysql.postrm	2008-03-13 04:58:11.000000000 +0100
@@ -3,20 +3,8 @@
 #
 # see: dh_installdeb(1)
 
-if [ -f /usr/share/debconf/confmodule ]; then
-    . /usr/share/debconf/confmodule
-    db_version 2.0
-
-    dbc_first_version=1.38.9-3
-    dbc_dbuser=bacula
-    dbc_dbname=bacula
-fi
-
-if [ -f /usr/share/dbconfig-common/dpkg/postrm.mysql ]; then
-    . /usr/share/dbconfig-common/dpkg/postrm.mysql
-    dbc_go bacula-director-mysql $@
-fi
-
+. /usr/share/debconf/confmodule
+db_version 2.0
 
 set -e
 
diff -Nru /tmp/wVw41Ximu9/bacula-2.2.8/debian/bacula-director-mysql.prerm /tmp/BkSB3yG08Z/bacula-2.2.8/debian/bacula-director-mysql.prerm
--- bacula-2.2.8/debian/bacula-director-mysql.prerm	2008-03-13 04:58:10.000000000 +0100
+++ bacula-2.2.8/debian/bacula-director-mysql.prerm	2008-03-13 04:58:11.000000000 +0100
@@ -5,16 +5,6 @@
 
 . /usr/share/debconf/confmodule
 
-dbc_first_version=1.38.9-3
-dbc_dbuser=bacula
-dbc_dbname=bacula
-
-# source dbconfig-common shell library, and call the hook function
-if [ -f /usr/share/dbconfig-common/dpkg/config.mysql ]; then
-  . /usr/share/dbconfig-common/dpkg/prerm.mysql
-  dbc_go bacula-director-mysql $@
-fi
-
 
 set -e
 
diff -Nru /tmp/wVw41Ximu9/bacula-2.2.8/debian/bacula-director-mysql.templates /tmp/BkSB3yG08Z/bacula-2.2.8/debian/bacula-director-mysql.templates
--- bacula-2.2.8/debian/bacula-director-mysql.templates	1970-01-01 01:00:00.000000000 +0100
+++ bacula-2.2.8/debian/bacula-director-mysql.templates	2008-03-13 04:58:11.000000000 +0100
@@ -0,0 +1,52 @@
+Template: bacula/db_host
+Type: string
+Default: localhost
+_Description: Database server hostname:
+ Please enter the hostname of the database server host.
+
+Template: bacula/dba_name
+Type: string
+Default: bacula
+_Description: Database administrator username:
+ Please enter the MySQL administrator username, needed for
+ the database creation.
+
+Template: bacula/dba_password
+Type: password
+_Description: Database administrator password:
+ Please enter the MySQL administrator password, needed for
+ the database creation.
+
+Template: bacula/dba_confirm
+Type: password
+_Description: DBA password confirmation:
+ Please confirm the password in order to continue the process.
+
+Template: bacula/mismatch
+Type: note
+_Description: Password mismatch
+ The password and its confirmation do not match. Please
+ reenter the passwords.
+
+Template: bacula/dbu_name
+Type: string
+Default: bacula
+_Description: Database owner username:
+ Please enter the username of the Bacula database owner.
+
+Template: bacula/dbu_password
+Type: password
+_Description: Database owner password:
+ Please enter the password of the Bacula database owner.
+
+Template: bacula/dbu_confirm
+Type: password
+_Description: Database user password confirmation:
+ Please confirm the password of the Bacula database owner.
+
+Template: bacula/notconfigured
+Type: note
+_Description: Warning - Bacula is not configured
+ Please note that you have not completed the Bacula configuration. For
+ completing it, please use "dpkg-reconfigure bacula-director-mysql" later.
+
diff -Nru /tmp/wVw41Ximu9/bacula-2.2.8/debian/bacula-director-pgsql.config /tmp/BkSB3yG08Z/bacula-2.2.8/debian/bacula-director-pgsql.config
--- bacula-2.2.8/debian/bacula-director-pgsql.config	2008-03-13 04:58:10.000000000 +0100
+++ bacula-2.2.8/debian/bacula-director-pgsql.config	2008-03-13 04:58:11.000000000 +0100
@@ -1,38 +1,78 @@
-#!/bin/sh
-# config script for bacula-dir ( PostgreSQL flavor )
+#!/bin/sh -e
 
+# Source debconf library.
 . /usr/share/debconf/confmodule
-db_version 2.0
-
-dbc_first_version=1.38.9-2
-dbc_dbuser=bacula
-dbc_dbname=bacula
-
-# source dbconfig-common shell library, and call the hook function
-if [ -f /usr/share/dbconfig-common/dpkg/config.pgsql ]; then
-  . /usr/share/dbconfig-common/dpkg/config.pgsql
-  dbc_go bacula-director-pgsql $@
-fi
-
-db_title "Bacula Director"
-
-set -e
-
 
-case "$1" in
-        configure)
-
-        ;;
-
-	reconfigure)
-
-	;;
-
-        *)
-                echo "config called with unknown argument \$1'" >&2
-                exit 0
-        ;;
-esac
+db_version 2.0
+db_capb backup
 
-exit 0
+db_input high bacula/sgbd || true
 
+STATE=1
+while [ "$STATE"  != 0 -a "$STATE" -lt 6 ]
+  do
+  case "$STATE" in
+      1)
+          db_input critical bacula/db_host || true
+          if db_go; then
+              db_get bacula/db_host || true
+              if [ ! -z "$RET" ]; then
+                  STATE=2
+              fi
+          else
+              STATE=1
+          fi
+          ;;
+
+      2)
+          db_input critical bacula/dbu_name || true
+          if db_go; then
+              db_get bacula/dbu_name || true
+              if [ ! -z "$RET" ]; then
+                  STATE=3
+              fi
+          else
+              STATE=2
+          fi
+          ;;
+
+      3)
+          db_input critical bacula/dbu_password || true
+          if db_go; then
+              db_get bacula/dbu_password || true
+              STATE=4
+          else
+              STATE=3
+          fi
+          ;;
+
+      4)
+          db_input critical bacula/dbu_confirm || true
+          if db_go; then
+              db_get bacula/dbu_confirm || true
+              CONFIRM="$RET"
+              db_get bacula/dbu_password || true
+              if [ "$RET" != "$CONFIRM" ]; then
+                  STATE=5
+              else
+                  STATE=6
+              fi
+          else
+              STATE=3
+          fi
+          ;;
+
+      5)
+          db_input critical bacula/mismatch || true
+          db_go
+          STATE=3
+          ;;
+
+  esac
+done
+
+if [ "$STATE" = 0 ]; then
+    db_input critical bacula/notconfigured || true
+    db_go
+    exit 1
+fi
diff -Nru /tmp/wVw41Ximu9/bacula-2.2.8/debian/bacula-director-pgsql.dirs /tmp/BkSB3yG08Z/bacula-2.2.8/debian/bacula-director-pgsql.dirs
--- bacula-2.2.8/debian/bacula-director-pgsql.dirs	2008-03-13 04:58:10.000000000 +0100
+++ bacula-2.2.8/debian/bacula-director-pgsql.dirs	2008-03-13 04:58:11.000000000 +0100
@@ -1,6 +1,3 @@
 usr/sbin
 usr/lib/bacula
 etc/bacula
-usr/share/dbconfig-common/data/bacula-director-pgsql/upgrade/pgsql
-usr/share/dbconfig-common/data/bacula-director-pgsql/install
-usr/share/dbconfig-common/data/bacula-director-pgsql/install-dbadmin
diff -Nru /tmp/wVw41Ximu9/bacula-2.2.8/debian/bacula-director-pgsql.postinst /tmp/BkSB3yG08Z/bacula-2.2.8/debian/bacula-director-pgsql.postinst
--- bacula-2.2.8/debian/bacula-director-pgsql.postinst	2008-03-13 04:58:10.000000000 +0100
+++ bacula-2.2.8/debian/bacula-director-pgsql.postinst	2008-03-13 04:58:11.000000000 +0100
@@ -9,18 +9,6 @@
 . /usr/share/debconf/confmodule
 db_version 2.0
 
-dbc_first_version=1.38.9-2
-dbc_dbuser=bacula
-dbc_dbname=bacula
-
-# source dbconfig-common shell library, and call the hook function
-if [ -f /usr/share/dbconfig-common/dpkg/postinst.pgsql ]; then
-  . /usr/share/dbconfig-common/dpkg/postinst.pgsql
-  dbc_pgsql_createdb_encoding="SQL_ASCII"
-  dbc_sql_substitutions="1"
-  dbc_go bacula-director-pgsql $@
-fi
-
 set -e
 
 # summary of how this script can be called:
@@ -42,29 +30,76 @@
 #     `abort-remove' or `abort-deconfigure'.
 
 ## Globals
-CATALOG=bacula
-PGSQL=/usr/bin/psql
 LOGDIR="/var/log/bacula"
 GRANT_SQL_PRIVS="/usr/share/bacula-director/grant_pgsql_privileges"
 POSTINST_COMMON="/usr/share/bacula-director/postinst-common"
 DEFCONFIG="/usr/share/bacula-common/defconfig"
 CFGFILE="/etc/bacula/bacula-dir.conf"
-AUTHFILE=`getent passwd bacula | cut -d ':' -f 6`/.pgpass
+
+get_config() {
+    db_get bacula/db_host
+    db_host="$RET"
+
+    db_get bacula/dbu_name
+    dbu_name="$RET"
+
+    db_get bacula/dbu_password
+    dbu_password="$RET"
+
+    db_name='bacula'
+}
+
+
+check_pgsafe() {
+    dbname="$1"
+
+    [ -z "`type -p pg_lsclusters`" ] && { echo 'pg_lsclusters is not in my $PATH.'; return 1; }
+    o=$(pg_lsclusters -h) || { echo "pg_lsclusters failed."; return 1; }
+
+    if [ $(echo "$o" | wc -l) != 1 ]; then
+        echo "You have configured more than one PostgreSQL cluster."
+        return 1
+    fi
+
+    echo "$o" | if read VERSION CLUSTER trash; then
+        cf="/etc/postgresql/$VERSION/$CLUSTER/pg_hba.conf"
+        grep -q '^local.*all.*all.*ident.*sameuser$' "$cf" || {
+            echo "Your settings in $cf do not allow me to continue."
+            return 1;
+    }
+    fi
+
+    su -c 'psql -Atl' postgres | grep "^$dbname|" && {
+        echo "There is already a database named $dbname."
+        return 1;
+    }
+
+    return 0
+}
 
 case "$1" in
 configure)
-	
+
+	get_config
+	db_stop
+	exec 0<&1	
 
 	echo -n "Processing configuration ..."
-        . /etc/dbconfig-common/bacula-director-pgsql.conf
 	TARGET=$CFGFILE.dpkg-tmp
 
-        if [ "$dbc_install" = "true" ] ; then
-            sed -e "s/make_catalog_backup bacula bacula/make_catalog_backup -h '$dbc_dbserver' -U $dbc_dbuser/" \
-		-e "s/dbname = bacula;/dbname = $dbc_dbname; DB Address = \"$dbc_dbserver\";/" \
-		-e "s/@db_user@/$dbc_dbuser/" -e "s/@db_pswd@/$dbc_dbpass/" \
+	if ! check_pgsafe "$db_name"; then
+		echo "You must create your PostgreSQL database manually."
+        else
+		id "$dbu_name" 2> /dev/null || adduser --system --no-create-home --disabled-login "$dbu_name"
+		su -c "psql --command \"CREATE ROLE $dbu_name PASSWORD '$dbu_password' NOSUPERUSER CREATEDB NOCREATEROLE INHERIT LOGIN;\"" postgres
+		su -c "createdb -E UTF8 -O \"$dbu_name\" \"$db_name\"" postgres
+	fi
+
+	sed -e "s/dbname = bacula;/dbname = $db_name; DB Address = \"$db_host\";/" \
+	-e "s/@db_user@/$dbu_name/" -e "s/@db_pswd@/$dbu_password/" \
 		$DEFCONFIG/bacula-dir.conf > $TARGET
-        fi
+
+	su -c /usr/share/bacula-director/make_postgresql_tables postgres 1> /dev/null
 
 	/bin/sh $POSTINST_COMMON
 	echo "Ok."
diff -Nru /tmp/wVw41Ximu9/bacula-2.2.8/debian/bacula-director-pgsql.postrm /tmp/BkSB3yG08Z/bacula-2.2.8/debian/bacula-director-pgsql.postrm
--- bacula-2.2.8/debian/bacula-director-pgsql.postrm	2008-03-13 04:58:10.000000000 +0100
+++ bacula-2.2.8/debian/bacula-director-pgsql.postrm	2008-03-13 04:58:11.000000000 +0100
@@ -3,22 +3,12 @@
 #
 # see: dh_installdeb(1)
 
-if [ -f /usr/share/debconf/confmodule ]; then
-	. /usr/share/debconf/confmodule
-        db_version 2.0
-
-        dbc_first_version=1.38.9-2
-        dbc_dbuser=bacula
-        dbc_dbname=bacula
-fi
-
-if [ -f /usr/share/dbconfig-common/dpkg/postrm.pgsql  ]; then
-	. /usr/share/dbconfig-common/dpkg/postrm.pgsql 
-        dbc_go bacula-director-pgsql $@
-fi
 
 set -e
 
+. /usr/share/debconf/confmodule
+db_version 2.0
+
 # summary of how this script can be called:
 #        * <postrm> `remove'
 #        * <postrm> `purge'
diff -Nru /tmp/wVw41Ximu9/bacula-2.2.8/debian/bacula-director-pgsql.prerm /tmp/BkSB3yG08Z/bacula-2.2.8/debian/bacula-director-pgsql.prerm
--- bacula-2.2.8/debian/bacula-director-pgsql.prerm	2008-03-13 04:58:10.000000000 +0100
+++ bacula-2.2.8/debian/bacula-director-pgsql.prerm	2008-03-13 04:58:11.000000000 +0100
@@ -7,16 +7,6 @@
 
 . /usr/share/debconf/confmodule
 
-dbc_first_version=1.38.9-2
-dbc_dbuser=bacula
-dbc_dbname=bacula
-
-# source dbconfig-common shell library, and call the hook function
-if [ -f /usr/share/dbconfig-common/dpkg/prerm.pgsql ]; then
-  . /usr/share/dbconfig-common/dpkg/prerm.pgsql
-  dbc_go bacula-director-pgsql $@
-fi
-
 # summary of how this script can be called:
 #        * <prerm> `remove'
 #        * <old-prerm> `upgrade' <new-version>
diff -Nru /tmp/wVw41Ximu9/bacula-2.2.8/debian/bacula-director-pgsql.templates /tmp/BkSB3yG08Z/bacula-2.2.8/debian/bacula-director-pgsql.templates
--- bacula-2.2.8/debian/bacula-director-pgsql.templates	1970-01-01 01:00:00.000000000 +0100
+++ bacula-2.2.8/debian/bacula-director-pgsql.templates	2008-03-13 04:58:11.000000000 +0100
@@ -0,0 +1,52 @@
+Template: bacula/db_host
+Type: string
+Default: localhost
+_Description: Database server hostname:
+ Please enter the hostname of the database server host.
+
+Template: bacula/dba_name
+Type: string
+Default: root
+_Description: Database administrator username:
+ Please enter the PostgreSQL administrator username, needed for
+ the database creation.
+
+Template: bacula/dba_password
+Type: password
+_Description: Database administrator password:
+ Please enter the PostgreSQL administrator password, needed for
+ the database creation.
+
+Template: bacula/dba_confirm
+Type: password
+_Description: DBA password confirmation:
+ Please confirm the password in order to continue the process.
+
+Template: bacula/mismatch
+Type: note
+_Description: Password mismatch
+ The password and its confirmation do not match. Please
+ reenter the passwords.
+
+Template: bacula/dbu_name
+Type: string
+Default: bacula
+_Description: Database owner username:
+ Please enter the username of the Bacula database owner.
+
+Template: bacula/dbu_password
+Type: password
+_Description: Database owner password:
+ Please enter the password of the Bacula database owner.
+
+Template: bacula/dbu_confirm
+Type: password
+_Description: Database user password confirmation:
+ Please confirm the password of the Bacula database owner.
+
+Template: bacula/notconfigured
+Type: note
+_Description: Warning - Bacula is not configured
+ Please note that you have not completed the Bacula configuration. For
+ completing it, please use "dpkg-reconfigure bacula-director-pgsql" later.
+
diff -Nru /tmp/wVw41Ximu9/bacula-2.2.8/debian/changelog /tmp/BkSB3yG08Z/bacula-2.2.8/debian/changelog
--- bacula-2.2.8/debian/changelog	2008-03-13 04:58:10.000000000 +0100
+++ bacula-2.2.8/debian/changelog	2008-03-13 04:58:11.000000000 +0100
@@ -1,3 +1,19 @@
+bacula (2.2.8-4ubuntu2) hardy; urgency=low
+
+  * Removed libjconv build dependecy
+  * Bumped build dependecy to postgresql-server-dev-8.3
+  * Removed dbconfig-common dependecy for bacula-director-[mysql|pgsql],
+    added database handling to postinstall scripts and templates,
+    modified postinstall script's sed expressions
+  * Removed libwgtk2.6-dev and libqwt5-qt-dev build dependecy; as a result
+    bacula-console-wx and bacula-console-qt aren't built any more
+  * debian/make_catalog_backup_awk.[mysql|pgsql|sqlite3|sqlite]:
+    - new scripts for catalog backup (CVE-2007-5626)
+  * debian/patches/ubuntu_bacula-dir.conf.patch:
+    - replace RunBeforeJob script with new one and add a warning
+
+ -- Ante Karamatic <ivoks@ubuntu.com>  Fri, 15 Feb 2008 13:57:36 +0100
+
 bacula (2.2.8-4ubuntu1) hardy; urgency=low
 
   * Merge from Debian unstable (LP: #189547). Remaining Ubuntu changes:
diff -Nru /tmp/wVw41Ximu9/bacula-2.2.8/debian/control /tmp/BkSB3yG08Z/bacula-2.2.8/debian/control
--- bacula-2.2.8/debian/control	2008-03-13 04:58:10.000000000 +0100
+++ bacula-2.2.8/debian/control	2008-03-13 04:58:11.000000000 +0100
@@ -4,12 +4,12 @@
 Maintainer: Ubuntu MOTU Developers <ubuntu-motu@lists.ubuntu.com>
 XSBC-Original-Maintainer: John Goerzen <jgoerzen@complete.org>
 Build-Depends: autotools-dev, debhelper (>= 4.2), po-debconf (>= 0.8.2), 
- zlib1g-dev, libreadline5-dev | libreadline-dev, libjconv-dev,
+ zlib1g-dev, libreadline5-dev | libreadline-dev,
  libsqlite0-dev, libsqlite3-dev, libmysqlclient15-dev, libpq-dev, 
- postgresql-server-dev-8.2,
+ postgresql-server-dev-8.3,
  libwrap0-dev, python-dev, libgtk2.0-dev (>= 2.10),
- libgnome2-dev, libwxgtk2.6-dev, libacl1-dev, libkrb5-dev, libgnomeui-dev,
- libx11-dev, mtx, bc, libxt-dev, dpkg-dev (>= 1.13.19), libqt4-dev, libqwt5-qt4-dev
+ libgnome2-dev, libacl1-dev, libkrb5-dev, libgnomeui-dev,
+ libx11-dev, mtx, bc, libxt-dev, dpkg-dev (>= 1.13.19), libqt4-dev
 Build-Conflicts: python2.2-dev, python2.3, qt3-dev-tools
 Standards-Version: 3.7.2
 
@@ -86,7 +86,7 @@
 Package: bacula-director-mysql
 Architecture: any
 Pre-Depends: debconf (>= 1.4.30) | debconf-2.0
-Depends: bacula-director-common (= ${binary:Version}), dbconfig-common (>= 1.8.19), mysql-client, ${shlibs:Depends}
+Depends: bacula-director-common (= ${binary:Version}), mysql-client, ${shlibs:Depends}
 Conflicts: bacula-director
 Provides: bacula-director
 Replaces: bacula-director
@@ -103,11 +103,11 @@
 Package: bacula-director-pgsql
 Pre-Depends: debconf (>= 1.4.30) | debconf-2.0
 Architecture: any
-Depends: bacula-director-common (= ${binary:Version}), dbconfig-common (>= 1.8.19), postgresql-client (>= 7.4) | postgresql-client-8.1 | postgresql-client-7.4 , ${shlibs:Depends}
+Depends: bacula-director-common (= ${binary:Version}), postgresql-client (>= 7.4) | postgresql-client-8.1 | postgresql-client-7.4 , ${shlibs:Depends}
 Conflicts: bacula-director
 Provides: bacula-director
 Replaces: bacula-director
-Recommends: postgresql-8.2 | postgresql-8.1 | postgresql-8.0 | postgresql (>= 7.4)
+Recommends: postgresql-8.3 | postgresql-8.2 | postgresql-8.1 | postgresql-8.0 | postgresql (>= 7.4)
 Suggests: postgresql-contrib, postgresql-doc
 Description: Network backup, recovery and verification (Director daemon)
  The Bacula Director service supervises all the backup, restore, verify and
@@ -211,36 +211,6 @@
  The Console allows the administrator or user to communicate with the
  Bacula Director. This is the TTY version.
 
-Package: bacula-console-wx
-Provides: bacula-wxconsole
-Replaces: bacula-wxconsole
-Conflicts: bacula-wxconsole
-Architecture: any
-Pre-Depends: debconf (>= 1.4.30)
-Depends: bacula-common (= ${source:Version}), ${shlibs:Depends}
-Description: Network backup, recovery and verification (Console, Gnome version)
- The WX-Console allows the administrator or user to communicate with the
- Bacula Director. It provides a graphical interface to the backup/restore
- operations.
- .
- This GUI interface has been designed to ease restore operations as much as
- possible as compared to the "conventional" console.
- .
- There is a Win32 version of this program available for download from
- Bacula's website: www.bacula.org
-
-Package: bacula-console-qt
-Architecture: any
-Pre-Depends: debconf (>= 1.4.30)
-Depends: bacula-common (= ${source:Version}), ${shlibs:Depends}
-Description: Network backup, recovery and verification (Console, Qt version)
- The Bacula QT-Console (known as bat) allows the administrator or user to
- communicate with the  Bacula Director. It provides a graphical interface
- to the backup/restore operations.
- .
- This GUI interface has been designed to ease restore operations as much as
- possible as compared to the "conventional" console.
-
 Package: bacula-traymonitor
 Architecture: any
 Depends: ${shlibs:Depends}, bacula-common (= ${source:Version})
diff -Nru /tmp/wVw41Ximu9/bacula-2.2.8/debian/make_catalog_backup_awk.mysql /tmp/BkSB3yG08Z/bacula-2.2.8/debian/make_catalog_backup_awk.mysql
--- bacula-2.2.8/debian/make_catalog_backup_awk.mysql	1970-01-01 01:00:00.000000000 +0100
+++ bacula-2.2.8/debian/make_catalog_backup_awk.mysql	2008-03-13 04:58:11.000000000 +0100
@@ -0,0 +1,53 @@
+#!/usr/bin/gawk -f
+# extract.awk script expects Catalog definition in a form of:
+# Catalog {
+#	Name = NameOfCatalog
+#	dbname = ""; DB Address = ""; user = ""; password = ""; DB Socket = ""; DB Port = ""
+# }
+#
+
+     
+BEGIN { RS= "}" ; FS="[;\n]+"}
+
+function trim(v) {
+	## Remove leading and trailing spaces
+	sub(/^ */,"",v)
+	sub(/ *$/,"",v)
+	return v
+}
+
+
+$0 ~ /Catalog[[:space:]]*{/   { 
+	for ( i = 1; i <= NF ; i++)
+	{
+		split($i,a,"=")
+		if (a[1] ~ /dbname/) 
+			dbname = trim(gensub("\"","","g",a[2])) # remove " char
+		if (a[1] ~ /user/)
+			user = trim(gensub("\"","","g",a[2]))
+		if (a[1] ~ /Name/)
+			catname = trim(gensub("\"","","g",a[2]))
+		if (a[1] ~ /password/)
+			password = trim(gensub("\"","","g",a[2]))
+		if (a[1] ~ /DB Address/)
+			dbaddress = trim(gensub("\"","","g",a[2]))
+		if (a[1] ~ /DB Socket/)
+			dbsocket = trim(gensub("\"","","g",a[2]))
+		if (a[1] ~ /DB Port/)
+			dbport = trim(gensub("\"","","g",a[2]))
+	}
+
+	if (catname == cat1 || catname == cat2 || catname == cat3 || catname == cat4) {
+		if (dbaddress == "") #Not optional in the case of MySQL
+			dbaddress = "localhost"
+                system("rm -rf /var/lib/bacula/.my.cnf")
+                system("touch /var/lib/bacula/.my.cnf")
+                system("chmod 600 /var/lib/bacula/.my.cnf")
+		printf "[client]\n  host=%s\n  user=%s\n  password=%s\n",dbaddress,user,password >> "/var/lib/bacula/.my.cnf"
+		if (dbport != "")
+			printf "  port=%s\n",dbport >> "/var/lib/bacula/.my.cnf"
+		if (dbsocket != "")
+			printf "  socket=%s\n",dbsocket >> "/var/lib/bacula/.my.cnf"
+		system(sprintf ("mysqldump %s > /var/lib/bacula/bacula.sql",dbname))
+	}
+}
diff -Nru /tmp/wVw41Ximu9/bacula-2.2.8/debian/make_catalog_backup_awk.pgsql /tmp/BkSB3yG08Z/bacula-2.2.8/debian/make_catalog_backup_awk.pgsql
--- bacula-2.2.8/debian/make_catalog_backup_awk.pgsql	1970-01-01 01:00:00.000000000 +0100
+++ bacula-2.2.8/debian/make_catalog_backup_awk.pgsql	2008-03-13 04:58:11.000000000 +0100
@@ -0,0 +1,51 @@
+#!/usr/bin/gawk -f
+# extract.awk script expects Catalog definition in a form of:
+# Catalog {
+#	Name = NameOfCatalog
+#	dbname = ""; DB Address = ""; user = ""; password = ""; DB Socket = ""; DB Port = ""
+# }
+#
+
+     
+BEGIN { RS= "}" ; FS="[;\n]+"}
+
+function trim(v) {
+	## Remove leading and trailing spaces
+	sub(/^ */,"",v)
+	sub(/ *$/,"",v)
+	return v
+}
+
+
+$0 ~ /Catalog[[:space:]]*{/   { 
+	for ( i = 1; i <= NF ; i++)
+	{
+		split($i,a,"=")
+		if (a[1] ~ /dbname/) 
+			dbname = trim(gensub("\"","","g",a[2])) # remove " char
+		if (a[1] ~ /user/)
+			user = trim(gensub("\"","","g",a[2]))
+		if (a[1] ~ /Name/)
+			catname = trim(gensub("\"","","g",a[2]))
+		if (a[1] ~ /password/)
+			password = trim(gensub("\"","","g",a[2]))
+		if (a[1] ~ /DB Address/)
+			dbaddress = trim(gensub("\"","","g",a[2]))
+		if (a[1] ~ /DB Socket/)
+			dbsocket = trim(gensub("\"","","g",a[2]))
+		if (a[1] ~ /DB Port/)
+			dbport = trim(gensub("\"","","g",a[2]))
+	}
+
+	if (catname == cat1 || catname == cat2 || catname == cat3 || catname == cat4) {
+		if (dbaddress == "") #Not optional in the case of MySQL
+			dbaddress = "localhost"
+		system("rm -rf /var/lib/bacula/pg_service.conf")
+		system("touch /var/lib/bacula/pg_service.conf")
+		system("chmod 600 /var/lib/bacula/pg_service.conf")
+		printf "[bacula]\n  dbname=%s\n  user=%s\n  password=%s\n",dbname,user,password >> "/var/lib/bacula/pg_service.conf"
+		if (dbport != "")
+			printf "  port=%s\n",dbport >> "/var/lib/bacula/pg_service.conf"
+		system("PGSERVICE=bacula  PGSYSCONFDIR=/tmp pg_dump > /var/lib/bacula/bacula.sql")
+	}
+}
diff -Nru /tmp/wVw41Ximu9/bacula-2.2.8/debian/make_catalog_backup_awk.sqlite /tmp/BkSB3yG08Z/bacula-2.2.8/debian/make_catalog_backup_awk.sqlite
--- bacula-2.2.8/debian/make_catalog_backup_awk.sqlite	1970-01-01 01:00:00.000000000 +0100
+++ bacula-2.2.8/debian/make_catalog_backup_awk.sqlite	2008-03-13 04:58:11.000000000 +0100
@@ -0,0 +1,3 @@
+#!/bin/bash
+
+echo ".dump" | /usr/bin/sqlite bacula.db > bacula.sql
diff -Nru /tmp/wVw41Ximu9/bacula-2.2.8/debian/make_catalog_backup_awk.sqlite3 /tmp/BkSB3yG08Z/bacula-2.2.8/debian/make_catalog_backup_awk.sqlite3
--- bacula-2.2.8/debian/make_catalog_backup_awk.sqlite3	1970-01-01 01:00:00.000000000 +0100
+++ bacula-2.2.8/debian/make_catalog_backup_awk.sqlite3	2008-03-13 04:58:11.000000000 +0100
@@ -0,0 +1,3 @@
+#!/bin/bash
+
+echo ".dump" | /usr/bin/sqlite3 bacula.db > bacula.sql
diff -Nru /tmp/wVw41Ximu9/bacula-2.2.8/debian/patches/ubuntu_bacula-dir.conf.patch /tmp/BkSB3yG08Z/bacula-2.2.8/debian/patches/ubuntu_bacula-dir.conf.patch
--- bacula-2.2.8/debian/patches/ubuntu_bacula-dir.conf.patch	1970-01-01 01:00:00.000000000 +0100
+++ bacula-2.2.8/debian/patches/ubuntu_bacula-dir.conf.patch	2008-03-13 04:58:11.000000000 +0100
@@ -0,0 +1,14 @@
+--- src/dird/bacula-dir.conf.in.old	2008-03-13 03:30:57.000000000 +0100
++++ src/dird/bacula-dir.conf.in	2008-03-13 03:42:41.000000000 +0100
+@@ -62,7 +62,10 @@
+   FileSet="Catalog"
+   Schedule = "WeeklyCycleAfterBackup"
+   # This creates an ASCII copy of the catalog
+-  RunBeforeJob = "@scriptdir@/make_catalog_backup <dbname> <user> <password>"
++  # WARNING!
++  # Ubuntu uses make_catalog_backup_awk script for
++  # security reasons
++  RunBeforeJob = "/usr/bin/awk -f @scriptdir@/make_catalog_backup_awk -v cat1=<CatalogName> @sysconfdir@/bacula-dir.conf"
+   # This deletes the copy of the catalog
+   RunAfterJob  = "@scriptdir@/delete_catalog_backup"
+   Write Bootstrap = "@working_dir@/BackupCatalog.bsr"
diff -Nru /tmp/wVw41Ximu9/bacula-2.2.8/debian/rules /tmp/BkSB3yG08Z/bacula-2.2.8/debian/rules
--- bacula-2.2.8/debian/rules	2008-03-13 04:58:10.000000000 +0100
+++ bacula-2.2.8/debian/rules	2008-03-13 04:58:11.000000000 +0100
@@ -40,7 +40,7 @@
 BUILDDIR := $(CURDIR)/debian/tmp-build
 INSTALLDIR := $(CURDIR)/debian/tmp-install
 DEFAULTINSTALLDIR := $(INSTALLDIR)-$(DEFAULTVARIANT)
-DBC := usr/share/dbconfig-common/data/
+#DBC := usr/share/dbconfig-common/data/
 
 CONF_ALL	= --enable-smartalloc \
 	--with-python --with-tcp-wrappers \
@@ -51,7 +51,7 @@
 			--disable-bat
 
 CONF_sqlite	= --with-sqlite --without-mysql --without-postgresql --without-sqlite3 \
-			--enable-bwx-console --enable-tray-monitor --enable-bat
+			--disable-bwx-console --enable-tray-monitor --disable-bat
 
 CONF_sqlite3	= --with-sqlite3 --without-mysql --without-postgresql --without-sqlite $(CONF_common)
 CONF_mysql	= --with-mysql --without-sqlite --without-postgresql --without-sqlite3 $(CONF_common)
@@ -122,6 +122,7 @@
 
 clean:
 
+	[ ! -f patch-stamp ] || patch -R -p0 -i debian/patches/ubuntu_bacula-dir.conf.patch
 	$(RM) *stamp*
 
 	dh_clean
@@ -145,14 +146,14 @@
 # Macro to extract a here document and put it in place
 # args: 1 -- db name, 2 -- file to extract, 3 -- version
 define ext-upgrade
-debian/patches/extract_here < $(2) > debian/bacula-director-$(1)/$(DBC)/bacula-director-$(1)/upgrade/$(1)/$(3)
+#debian/patches/extract_here < $(2) > debian/bacula-director-$(1)/$(DBC)/bacula-director-$(1)/upgrade/$(1)/$(3)
 endef
 
 # Macro to extract a here document for install and put it in place
 # args: 1 -- db name, 2 -- file to extract
 # We append so we can do the postgresql hack for datestyle
 define ext-install
-debian/patches/extract_here < $(2) > debian/bacula-director-$(1)/$(DBC)/bacula-director-$(1)/install/$(1)
+#debian/patches/extract_here < $(2) > debian/bacula-director-$(1)/$(DBC)/bacula-director-$(1)/install/$(1)
 endef
 
 install: build install-stamp
@@ -161,10 +162,8 @@
 	dh_install -pbacula-director-common
 
 	dh_install -pbacula-fd
-	dh_install -pbacula-console -pbacula-console-wx -pbacula-console-qt
+	dh_install -pbacula-console
 	cp $(DEFAULTINSTALLDIR)/usr/sbin/bconsole debian/bacula-console/usr/sbin/bacula-console
-	cp $(DEFAULTINSTALLDIR)/usr/sbin/bwx-console debian/bacula-console-wx/usr/bin/bacula-console-wx
-	cp debian/tmp-build-$(DEFAULTVARIANT)/src/qt-console/bat debian/bacula-console-qt/usr/bin/bat
 
 
 ######### dbconfig-common stuff
@@ -172,38 +171,38 @@
 # Releases prior to 2.0 put update scripts in updatedb.
 # 2.0.0 now has it in src/cats without a version number.
 # Will need to watch this on the next upgrade (also check it with mysql)
-	$(call ext-upgrade,pgsql,updatedb/update_postgresql_tables_7_to_8,1.36.0)
-	$(call ext-upgrade,pgsql,updatedb/update_postgresql_tables_8_to_9,1.38.0)
-	$(call ext-upgrade,pgsql,debian/tmp-build-pgsql/src/cats/update_postgresql_tables,2.0.0)
-	echo "ALTER DATABASE _DBC_DBNAME_ SET datestyle TO 'ISO, YMD';" > \
-		debian/bacula-director-pgsql/$(DBC)/bacula-director-pgsql/install-dbadmin/pgsql
-	$(call ext-install,pgsql,debian/tmp-build-pgsql/src/cats/make_postgresql_tables)
-# MySQL
-	$(call ext-upgrade,mysql,updatedb/update_mysql_tables_6_to_7,1.32f-5)
-	$(call ext-upgrade,mysql,updatedb/update_mysql_tables_7_to_8,1.36.0)
-	$(call ext-upgrade,mysql,updatedb/update_mysql_tables_8_to_9,1.38.0)
-	$(call ext-upgrade,mysql,debian/tmp-build-mysql/src/cats/update_mysql_tables,2.0.0)
-	$(call ext-install,mysql,debian/tmp-build-mysql/src/cats/make_mysql_tables)
+#	$(call ext-upgrade,pgsql,updatedb/update_postgresql_tables_7_to_8,1.36.0)
+#	$(call ext-upgrade,pgsql,updatedb/update_postgresql_tables_8_to_9,1.38.0)
+#	$(call ext-upgrade,pgsql,debian/tmp-build-pgsql/src/cats/update_postgresql_tables,2.0.0)
+#	echo "ALTER DATABASE _DBC_DBNAME_ SET datestyle TO 'ISO, YMD';" > \
+#		debian/bacula-director-pgsql/$(DBC)/bacula-director-pgsql/install-dbadmin/pgsql
+#	$(call ext-install,pgsql,debian/tmp-build-pgsql/src/cats/make_postgresql_tables)
+## MySQL
+#	$(call ext-upgrade,mysql,updatedb/update_mysql_tables_6_to_7,1.32f-5)
+#	$(call ext-upgrade,mysql,updatedb/update_mysql_tables_7_to_8,1.36.0)
+#	$(call ext-upgrade,mysql,updatedb/update_mysql_tables_8_to_9,1.38.0)
+#	$(call ext-upgrade,mysql,debian/tmp-build-mysql/src/cats/update_mysql_tables,2.0.0)
+#	$(call ext-install,mysql,debian/tmp-build-mysql/src/cats/make_mysql_tables)
 # Remove USE bacula -- dbconfig-common selects the database for us
-	sed -i 's/USE \${db_name};//' debian/bacula-director-mysql/$(DBC)/bacula-director-mysql/install/mysql debian/bacula-director-mysql/$(DBC)/bacula-director-mysql/upgrade/mysql/*
-
-# SQLite
-	cp updatedb/update_sqlite_tables_[678]* \
-		debian/bacula-director-sqlite/usr/share/bacula-director/
-	cp debian/tmp-build-sqlite/src/cats/update_sqlite_tables \
-		debian/bacula-director-sqlite/usr/share/bacula-director/
-	cp debian/tmp-install-sqlite/etc/bacula/scripts/make_sqlite_tables \
-		debian/bacula-director-sqlite/usr/share/bacula-director
-	sed -i 's./var/bacula./var/lib/bacula.' \
-		debian/bacula-director-sqlite/usr/share/bacula-director/update*
-# SQLite3
-	cp debian/tmp-install-sqlite3/etc/bacula/scripts/make_sqlite3_tables \
-		debian/bacula-director-sqlite3/usr/share/bacula-director
-	cp debian/tmp-build-sqlite3/src/cats/update_sqlite3_tables \
-		debian/bacula-director-sqlite3/usr/share/bacula-director/
-	sed -i 's./var/bacula./var/lib/bacula.' \
-		debian/bacula-director-sqlite3/usr/share/bacula-director/update*
-
+#	sed -i 's/USE \${db_name};//' debian/bacula-director-mysql/$(DBC)/bacula-director-mysql/install/mysql debian/bacula-director-mysql/$(DBC)/bacula-director-mysql/upgrade/mysql/*
+#
+## SQLite
+#	cp updatedb/update_sqlite_tables_[678]* \
+#		debian/bacula-director-sqlite/usr/share/bacula-director/
+#	cp debian/tmp-build-sqlite/src/cats/update_sqlite_tables \
+#		debian/bacula-director-sqlite/usr/share/bacula-director/
+#	cp debian/tmp-install-sqlite/etc/bacula/scripts/make_sqlite_tables \
+#		debian/bacula-director-sqlite/usr/share/bacula-director
+#	sed -i 's./var/bacula./var/lib/bacula.' \
+#		debian/bacula-director-sqlite/usr/share/bacula-director/update*
+## SQLite3
+#	cp debian/tmp-install-sqlite3/etc/bacula/scripts/make_sqlite3_tables \
+#		debian/bacula-director-sqlite3/usr/share/bacula-director
+#	cp debian/tmp-build-sqlite3/src/cats/update_sqlite3_tables \
+#		debian/bacula-director-sqlite3/usr/share/bacula-director/
+#	sed -i 's./var/bacula./var/lib/bacula.' \
+#		debian/bacula-director-sqlite3/usr/share/bacula-director/update*
+ 
 	dh_link -pbacula-console usr/share/man/man8/bconsole.8.gz usr/share/man/man8/bacula-console.8.gz
 
 	touch $@
@@ -215,6 +214,7 @@
 	$(MAKE) -C $(BUILDDIR)-$(*) install DESTDIR=$(INSTALLDIR)-$(*)
 
 	dh_install -pbacula-director-$(*)
+	cp debian/make_catalog_backup_awk.$(*) debian/bacula-director-$(*)/etc/bacula/scripts/make_catalog_backup_awk
 	touch $@
 
 
@@ -232,7 +232,7 @@
 install-arch: build install-stamp
 	dh_install -a
 	dh_link -pbacula-common
-	for f in bconsole.conf bwx-console.conf bat.conf \
+	for f in bconsole.conf \
 		bacula-sd.conf bacula-fd.conf tray-monitor.conf; do \
 		debian/patches/fix_config \
 			debian/tmp-install-sqlite/etc/bacula/$$f \
@@ -251,6 +251,8 @@
 		debian/patches/extract_here
 	chmod 755 debian/additions/bconsole
 
+	patch -p0 -i debian/patches/ubuntu_bacula-dir.conf.patch
+
 	touch patch-stamp
 
 # Build architecture-independent files here.
@@ -287,7 +289,7 @@
 	dh_installdebconf -a
 	dh_installdocs -a
 	dh_installexamples -a
-	dh_installmenu -pbacula-console -pbacula-console-wx -pbacula-console-qt
+	dh_installmenu -pbacula-console
 	dh_installlogrotate -a
 	dh_installinit -pbacula-sd -- defaults 90
 	dh_installinit -pbacula-fd -- defaults 91
