Using dbconfig-common to upgrade an old database
-----BEGIN PGP SIGNED MESSAGE-----
I'm packaging my own software OPUS (ITP bug 415241) and I'd made some
successful packages with my old "upstream" version 3.3, which are in use
by one or two universities.
I'm now packaging my new 4.0 for official submission, and I decided to
use dbconfig-common to handle the database. So far that has been a
qualified success. My new package installs find on a new system, and on
an upgrade it does upgrade the database.
However, I can't seem to get it to honour the old configuration in the
upgrade, and I wondered if anyone here could help me.
Here is my file /etc/debconf_config.php which is generated in the manual
database handling of version 3.3
// DO NOT EDIT THIS FILE, it is automatically generated from debconf
// Use dpkg-reconfigure -p low opus to regenerate this file
$conf['webhost'] = 'localhost';
$conf['institution'] = 'University of Somewhere';
$conf['database'] = array();
$conf['database']['hostname'] = 'localhost';
$conf['database']['database'] = 'opus';
$conf['database']['username'] = 'opus';
$conf['database']['password'] = 'abc';
Unfortunately, this is a bit far away from the format dbconfig expects,
so I created this file in version 4.0
* Read Old OPUS 3.x configuration
* This script only loads old OPUS 3.x style configuration files to map the
* database details into what is expected by dbconfig-common. It is only
* used for automated conversion from old databases using Debian GNU/Linux.
* @package OPUS
* @author Colin Turner <email@example.com>
* @license http://opensource.org/licenses/gpl-license.php GNU Public
$dbuser = $conf['database']['username'];
$dbpass = $conf['database']['password'];
$dbname = $conf['database']['database'];
$dbserver = $conf['database']['hostname'];
$dbtype = 'mysql';
If I run
dbconfig-load-include -f php /usr/share/opus/include/load_old_database.php
I get this output, which looks perfect...
As I understand it, the last piece of the jigsaw is the config file,
which starts like this:
# Attempt at debconf for OPUS
# Source debconf library.
# Deep magic for dbconfig-common
if [ -f /usr/share/dbconfig-common/dpkg/config.mysql ]; then
# This PHP script just reads the old config file and maps it to
dbc_go opus $@
# Now much less to ask about... (the rest deleted)
When I run an upgrade, it prompts me to use dbconfig-common, and then
asks for the opus password. There is no evidence one way or the other (I
have exported dbc_debug=1 and checked the log file) whether the include
file is being read. It *does* say
detected upgrade from previous non-dbconfig version.
long after it dumps out its setup variables with the hostname empty.
Really oddly, I noticed in my previous attempt to write this email that
I'd messed up the dbc_dbserver by reading the wrong variable, fixed it,
and all seemed to work, but it hasn't worked again since in all my trials.
Any ideas what dumb thing I'm doing?
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.6 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org
-----END PGP SIGNATURE-----