| 1 |
#!/usr/bin/perl
|
| 2 |
|
| 3 |
=head1 NAME
|
| 4 |
|
| 5 |
debconf-get-selections
|
| 6 |
|
| 7 |
=head1 SYNOPSIS
|
| 8 |
|
| 9 |
debconf-get-selections [--installer]
|
| 10 |
|
| 11 |
=head1 DESCRIPTION
|
| 12 |
|
| 13 |
Output the current debconf database in a format understandable by
|
| 14 |
debconf-set-selections.
|
| 15 |
|
| 16 |
To dump the debconf database of the debian-installer, from
|
| 17 |
/var/log/installer/cdebconf, use the --installer
|
| 18 |
parameter.
|
| 19 |
|
| 20 |
=cut
|
| 21 |
|
| 22 |
use strict;
|
| 23 |
use warnings;
|
| 24 |
use Debconf::Db;
|
| 25 |
use Debconf::Template;
|
| 26 |
use Debconf::Question;
|
| 27 |
|
| 28 |
Debconf::Db->load(readonly => "true");
|
| 29 |
|
| 30 |
my $defaultowner="unknown";
|
| 31 |
|
| 32 |
if (@ARGV && $ARGV[0] eq '--installer') {
|
| 33 |
# A bit of a hack..
|
| 34 |
my $di_path="/var/log/installer/cdebconf";
|
| 35 |
$Debconf::Db::config=Debconf::Db->makedriver(
|
| 36 |
driver => "File",
|
| 37 |
name => "di_questions",
|
| 38 |
filename => "$di_path/questions.dat",
|
| 39 |
readonly => "true",
|
| 40 |
);
|
| 41 |
$Debconf::Db::templates=Debconf::Db->makedriver(
|
| 42 |
driver => "File",
|
| 43 |
name => "di_templates",
|
| 44 |
filename => "$di_path/templates.dat",
|
| 45 |
readonly => "true",
|
| 46 |
);
|
| 47 |
$defaultowner="d-i";
|
| 48 |
}
|
| 49 |
|
| 50 |
my $qi = Debconf::Question->iterator;
|
| 51 |
|
| 52 |
while (my $q = $qi->iterate) {
|
| 53 |
my ($name, $type, $value) = ($q->name, $q->type, $q->value);
|
| 54 |
next if (! length $type || $type eq 'text' || $type eq 'note' || $type eq 'error' || $type eq 'title');
|
| 55 |
print "# ".$q->description."\n";
|
| 56 |
if ($q->owners) {
|
| 57 |
foreach my $owner (split ", ", $q->owners) {
|
| 58 |
print "$owner\t$name\t$type\t$value\n";
|
| 59 |
}
|
| 60 |
}
|
| 61 |
else {
|
| 62 |
print "$defaultowner\t$name\t$type\t$value\n";
|
| 63 |
}
|
| 64 |
}
|
| 65 |
|
| 66 |
=head1 AUTHOR
|
| 67 |
|
| 68 |
Petter Reinholdtsen <pere@hungry.com>
|
| 69 |
|
| 70 |
=cut
|