tags 398619 + patch
thanks

The attached patch should hopefully fix the problems when installing
acidbase without having the selected options database client installed.
It does this by only giving the choices where the db client is
installed, or by showing a note about how to install db clients and
safely aborts configuration if none is installed.
This way adding both to depends isn't required (both has been added to
Recommends).

Patch attached.

PS. Don't forget to add the translation patch in bug #395055.
Also run "fakeroot debian/rules clean" to update *.po and *.pot files
that where excluded in diff to not clutter up the patch.

-- 
Regards,
Andreas Henriksson
diff -ur acidbase-1.2.6/debian/changelog acidbase-1.2.6.fixed/debian/changelog
--- acidbase-1.2.6/debian/changelog     2006-11-22 14:15:21.000000000 +0100
+++ acidbase-1.2.6.fixed/debian/changelog       2006-11-22 14:07:31.000000000 
+0100
@@ -1,3 +1,12 @@
+acidbase (1.2.6-1.1) unstable; urgency=medium
+
+  * NMU
+  * Recommend mysql-client and postgresql-client.
+  * Check for available db client in during package config. (Closes: #398619)
+  * Show a helpful note when no db client is available and safely abort.
+
+ -- Andreas Henriksson <[EMAIL PROTECTED]>  Wed, 22 Nov 2006 14:05:42 +0100
+
 acidbase (1.2.6-1) unstable; urgency=low
 
   * New upstream release.
diff -ur acidbase-1.2.6/debian/config acidbase-1.2.6.fixed/debian/config
--- acidbase-1.2.6/debian/config        2006-11-22 14:15:21.000000000 +0100
+++ acidbase-1.2.6.fixed/debian/config  2006-11-22 14:10:44.000000000 +0100
@@ -3,8 +3,30 @@
 # Source debconf library.
 . /usr/share/debconf/confmodule
 
+# check for available db clients
+MYSQLCLIENT=0
+PSQLCLIENT=0
+
+if which mysql >/dev/null 2>&1 ; then
+       MYSQLCLIENT=1
+fi
+if which psql >/dev/null 2>&1 ; then
+       PSQLCLIENT=1
+fi
+
+if [ "$MYSQLCLIENT" = "1" ] && [ "$PSQLCLIENT" = "1" ]; then
+       dbc_dbtypes="mysql, pgsql"
+elif [ "$MYSQLCLIENT" = "1" ]; then
+       dbc_dbtypes="mysql"
+elif [ "$PSQLCLIENT" = "1" ]; then
+       dbc_dbtypes="pgsql"
+else
+       db_input high acidbase/manualdb
+       db_go
+       exit 0
+fi
+
 # source dbconfig-common stuff
-dbc_dbtypes="mysql, pgsql"
 dbc_dbuser="snort"
 dbc_dbname="snort"
 
diff -ur acidbase-1.2.6/debian/control acidbase-1.2.6.fixed/debian/control
--- acidbase-1.2.6/debian/control       2006-11-22 14:15:21.000000000 +0100
+++ acidbase-1.2.6.fixed/debian/control 2006-11-22 14:05:37.000000000 +0100
@@ -9,6 +9,7 @@
 Package: acidbase
 Architecture: all
 Depends: ${misc:Depends}, dbconfig-common, php5 | php4 | php5-cli | php4-cli, 
php5-gd | php4-gd, libphp-adodb (>= 4.62), php-image-graph, libwww-perl
+Recommends: mysql-client, postgresql-client
 Suggests: snort-mysql | snort-pgsql
 Description: Basic Analysis and Security Engine
  BASE is based on the code from the Analysis Console for Intrusion Databases
diff -ur acidbase-1.2.6/debian/postinst acidbase-1.2.6.fixed/debian/postinst
--- acidbase-1.2.6/debian/postinst      2006-11-22 14:15:21.000000000 +0100
+++ acidbase-1.2.6.fixed/debian/postinst        2006-11-22 14:11:15.000000000 
+0100
@@ -3,8 +3,29 @@
 # debconf
 . /usr/share/debconf/confmodule
 
+# check for available db clients
+MYSQLCLIENT=0
+PSQLCLIENT=0
+
+if which mysql >/dev/null 2>&1 ; then
+       MYSQLCLIENT=1
+fi
+if which psql >/dev/null 2>&1 ; then
+       PSQLCLIENT=1
+fi
+
+if [ "$MYSQLCLIENT" = "1" ] && [ "$PSQLCLIENT" = "1" ]; then
+       dbc_dbtypes="mysql, pgsql"
+elif [ "$MYSQLCLIENT" = "1" ]; then
+       dbc_dbtypes="mysql"
+elif [ "$PSQLCLIENT" = "1" ]; then
+       dbc_dbtypes="pgsql"
+else
+       exit 0
+fi
+
+#
 # source dbconfig-common stuff
-dbc_dbtypes="mysql, pgsql"
 . /usr/share/dbconfig-common/dpkg/postinst
 dbc_generate_include="php:/etc/acidbase/database.php"
 dbc_generate_include_owner="root:www-data"
diff -ur acidbase-1.2.6/debian/templates acidbase-1.2.6.fixed/debian/templates
--- acidbase-1.2.6/debian/templates     2006-11-22 14:15:21.000000000 +0100
+++ acidbase-1.2.6.fixed/debian/templates       2006-11-22 14:14:28.000000000 
+0100
@@ -17,3 +17,13 @@
 _Description: NOTE: Manual configuration required
  You will need to go to http://localhost/acidbase first to force the
  database modifications for BASE.
+
+Template: acidbase/manualdb
+Type: note
+_Description: No database client found.
+ Configuration of database settings can't be completed since there's no
+ database client available. Please install atleast one of "mysql-client"
+ and/or "postgresql-client". You can then rerun the configuration by
+ running the command "dpkg-reconfigure acidbase".
+ Acidbase configuration will now abort...
+

Reply via email to