#!/usr/bin/perl

# readdebconf - dump the debconf database to a specific text format
#
# Copyright (c) 2001, Progeny Linux Systems
# Written by Jeff Licquia
#
# This script dumps the debconf database to a text file in a format
# suitable for use on an autoinstall floppy created with autoinstall.
# 
# $Progeny: readdebconf-v0.9,v 1.2 2002/01/18 06:19:38 dsp Exp $

use strict;
use warnings;
use Debconf::Db;
use Debconf::Template;
use Debconf::Question;

my $outfile = shift || die "readdebconf: no output file given\n";
open(OUTPUT, ">$outfile");

Debconf::Db->load;
my $qi = Debconf::Question->iterator;

while (my $q = $qi->iterate)
{
    # This is really bizarre.  Why can't I do $q->template->name?
    print OUTPUT $q->template->[1], " ", $q->name, " ", $q->value, "\n";
}

close OUTPUT;
