Since I've already created it I'll send this patch to the BTS just for
reference.
This one takes the alternative route of not having a hard-dependency on
both mysql- and postgresql-client, but instead recommends them both and
checks which one is available during configuration.
A helpful note is also shown if none is available.

Patch attached.

PS. please run "fakeroot debian/rules clean" before building to update
*.po and *.pot files which where excluded in the diff to not clutter up
the patch.

-- 
Regards,
Andreas Henriksson
diff -ur -x '*.po' -x '*.pot' phpgacl-3.3.7/debian/changelog 
phpgacl-3.3.7.fixed/debian/changelog
--- phpgacl-3.3.7/debian/changelog      2006-11-22 13:20:46.000000000 +0100
+++ phpgacl-3.3.7.fixed/debian/changelog        2006-11-22 13:43:04.000000000 
+0100
@@ -1,3 +1,14 @@
+phpgacl (3.3.7-3.2) unstable; urgency=low
+
+  * NMU
+  * Remove postgresql-client from depends.
+  * Check for available mysql and psql clients in config and postinst.
+  * Show a helpful note if no db client is available and safely abort
+    configuration.
+  * Add mysql-client and postgresql-client as a Recommends dependency.
+
+ -- Andreas Henriksson <[EMAIL PROTECTED]>  Wed, 22 Nov 2006 13:21:08 +0100
+
 phpgacl (3.3.7-3.1) unstable; urgency=high
 
   * Non-maintainer upload.
diff -ur -x '*.po' -x '*.pot' phpgacl-3.3.7/debian/control 
phpgacl-3.3.7.fixed/debian/control
--- phpgacl-3.3.7/debian/control        2006-11-22 13:20:46.000000000 +0100
+++ phpgacl-3.3.7.fixed/debian/control  2006-11-22 13:40:36.000000000 +0100
@@ -8,7 +8,8 @@
 
 Package: phpgacl
 Architecture: all
-Depends: ${misc:Depends}, dbconfig-common, postgresql-client, libphp-adodb (>= 
4.64), smarty (>= 2.6.9), php-cache-lite (>= 1.5.2)
+Depends: ${misc:Depends}, dbconfig-common, libphp-adodb (>= 4.64), smarty (>= 
2.6.9), php-cache-lite (>= 1.5.2)
+Recommends: mysql-client, postgresql-client
 Description: PHP Generic Access Control Lists
  phpGACL is a set of PHP functions giving web developers a simple,
  yet immensely powerful "drop in" permission system for their current
diff -ur -x '*.po' -x '*.pot' phpgacl-3.3.7/debian/phpgacl.config 
phpgacl-3.3.7.fixed/debian/phpgacl.config
--- phpgacl-3.3.7/debian/phpgacl.config 2006-11-22 13:20:46.000000000 +0100
+++ phpgacl-3.3.7.fixed/debian/phpgacl.config   2006-11-22 13:26:39.000000000 
+0100
@@ -3,8 +3,31 @@
 # 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
+
+dbc_dbtypes=""
+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 phpgacl/manualdb
+       db_go
+       exit 0
+fi
+
 # source dbconfig-common stuff
-dbc_dbtypes="mysql, pgsql"
 
 if [ -f /usr/share/dbconfig-common/dpkg/config ]; then
     . /usr/share/dbconfig-common/dpkg/config
diff -ur -x '*.po' -x '*.pot' phpgacl-3.3.7/debian/phpgacl.postinst 
phpgacl-3.3.7.fixed/debian/phpgacl.postinst
--- phpgacl-3.3.7/debian/phpgacl.postinst       2006-11-22 13:20:46.000000000 
+0100
+++ phpgacl-3.3.7.fixed/debian/phpgacl.postinst 2006-11-22 13:28:06.000000000 
+0100
@@ -3,8 +3,30 @@
 # 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
+
+dbc_dbtypes=""
+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_go phpgacl $@
 
diff -ur -x '*.po' -x '*.pot' phpgacl-3.3.7/debian/phpgacl.templates 
phpgacl-3.3.7.fixed/debian/phpgacl.templates
--- phpgacl-3.3.7/debian/phpgacl.templates      2006-11-22 13:20:46.000000000 
+0100
+++ phpgacl-3.3.7.fixed/debian/phpgacl.templates        2006-11-22 
13:36:35.000000000 +0100
@@ -18,3 +18,12 @@
  Your system has an obsolete configuration file
  (/etc/phpgacl/phpgacl.conf.php). Please, review the new configuration file
  (/etc/phpgacl/gacl.ini.php) and remove the obsolete one.
+
+Template: phpgacl/manualdb
+Type: note
+_Description: No database clients available.
+ Neigther the mysql or the postgresql database clients are available. To set
+ up the required database connection atleast one needs to be available.
+ Please install atleast one of "mysql-client" or "postgresql-client" and then
+ rerun the configuration with the command "dpkg-reconfigure phpgacl".
+

Reply via email to