Re: Iterating over the debconf answers using cdebconf?
[Tollef Fog Heen]
> something like
Thank you. I've added debconf-dumpdb.c to the cdebconf source.
I assume the license is the same as the rest of cdebconf. Please let
me know if that is not the case.
We should add a similar tool into debconf. And perhaps we should have
a similar tool loading the answers as well, but that is a bit harder
when one want to load the answers before the template is available.
This is the debconf version using perl. Should I file a wishlist bug
against debconf asking for it to be included?
#!/usr/bin/perl -w
#
# Author: Petter Reinholdtsen <pere@hungry.com>
# Date: 2002-04-26
#
# Output the current debconf database in a format understandable by
# debconf-load-defaults.
#
# The reimplementation using the Debconf modules is based on Progenys
# readdebconf from Debian package autoinstall.
use strict;
use warnings;
use Debconf::Db;
use Debconf::Template;
use Debconf::Question;
Debconf::Db->load;
my $qi = Debconf::Question->iterator;
while (my $q = $qi->iterate)
{
my ($name, $type, $value) = ($q->name, $q->type, $q->value);
$value = "[undef]" if (! defined $value || "" eq $value);
print "$name $type $value\n";
}
exit 0;
Reply to: