I was digging into this issue for some time now and I think that I can
get it to work (at least in the pre-seed before installation case).

As a test, I just pre-seeded my package cacti successfully (full
pre-seed at the bottom) by adding
cacti cacti/mysql/admin-pass password here_my_admin_passwd_for_mysql
to the pre-seed file. dbconfig-common than just does the right thing.

However, if I don't want the database to be configured, but still I want
the proper config file, i.e. cacti/dbconfig-install=false,
dbconfig-common does not use the pre-seeded values for the configuration
file unless I specify cacti/internal/skip-preseed=true and disable line
347 of /usr/share/dbconfig-common/dpkg/common.

>  * accept a new debconf flag (let's call it
>    "dbconfig-common/debconf_is_a_registry").

I believe that this flag already exist per package. It is
<package>/internal/skip-preseed=true.

This skip-preseed works because of line 233 in
/usr/share/dbconfig-common/dpkg/common which needs to store the
dbc_install value, which is otherwise overwritten with the hardcoded
dbc_install=true on line 202.

Of course that skip-preseed variable was meant as an internal of
dbconfig-common, but I would say that this bug shows that there is great
need for pre-seeding of packages managed by dbconfig-common. So my
proposal would be to remove line 347 in dpkg/common and document the
rest of this behavior.

I still have to check if/how dpkg-reconfigure works in this respect and
will follow up later on that.

Paul

Full working pre-seed for cacti at default priority:
cacti   cacti/db/app-user       string  cacti
cacti   cacti/db/dbname         string  cacti
cacti   cacti/dbconfig-install  boolean true
cacti   cacti/mysql/admin-pass  password here_root_passwd
cacti   cacti/mysql/admin-user  string  root
cacti   cacti/mysql/app-pass    password blablabla
cacti   cacti/webserver         select  apache2

Full working (with line 347 disabled) pre-seed for cacti if I don't want
to configure the database:
cacti   cacti/db/app-user       string  cacti
cacti   cacti/db/dbname         string  cacti
cacti   cacti/dbconfig-install  boolean false
cacti   cacti/internal/skip-preseed     boolean true
cacti   cacti/mysql/app-pass    password blablabla
cacti   cacti/webserver         select  apache2
Description: Preseeding fails to parse when dbc should not handle database
 If the user sets <package>/dbconfig-install to false the other parameters
 are not processed. By removing on early return check, these parameters do
 get parsed.
Author: Paul Gevers <elb...@debian.org>

diff --git a/dpkg/common b/dpkg/common
index 1d8e31e..5da32af 100644
--- a/dpkg/common
+++ b/dpkg/common
@@ -343,9 +343,6 @@ dbc_read_package_debconf(){
 	db_get $dbc_package/dbconfig-upgrade && dbc_upgrade="$RET"
 	db_get $dbc_package/dbconfig-remove && dbc_remove="$RET"
 
-	# if they don't want help, then we're done and return early
-	if [ "$dbc_install" != "true" ]; then return 0; fi
-	
 	# otherwise, just to make sure dbtype is set...
 	_dbc_sanity_check dbtype || dbc_install_error
 

Attachment: signature.asc
Description: OpenPGP digital signature

Reply via email to