<html><head><meta name="color-scheme" content="light dark"></head><body><pre style="word-wrap: break-word; white-space: pre-wrap;">#!/usr/bin/perl -w
# This file was preprocessed, do not edit!


package Debconf::Db;
use strict;
use Debconf::Log qw{:all};
use Debconf::Config;
use Debconf::DbDriver;
our $config;
our $templates;


sub load {
	my $class=shift;

	Debconf::Config-&gt;load('', @_); # load default config file
	$config=Debconf::DbDriver-&gt;driver(Debconf::Config-&gt;config);
	if (not ref $config) {
		die "Configuration database \"".Debconf::Config-&gt;config.
			"\" was not initialized.\n";
	}
	$templates=Debconf::DbDriver-&gt;driver(Debconf::Config-&gt;templates);
	if (not ref $templates) {
		die "Template database \"".Debconf::Config-&gt;templates.
			"\" was not initialized.\n";
	}
}


sub makedriver {
	my $class=shift;
	my %config=@_;

	my $type=$config{driver} or die "driver type not specified (perhaps you need to re-read debconf.conf(5))";

	if (! UNIVERSAL::can("Debconf::DbDriver::$type", 'new')) {
		eval qq{use Debconf::DbDriver::$type};
		die $@ if $@;
	}
	delete $config{driver}; # not a field for the object
	
	debug db =&gt; "making DbDriver of type $type";
	"Debconf::DbDriver::$type"-&gt;new(%config);
}


sub save {

	$config-&gt;shutdown if $config;
	$templates-&gt;shutdown if $templates;
	$config='';
	$templates='';
}


1
</pre></body></html>