Package: debconf
Version: 1.5.24
Severity: wishlist
Tags: patch

Hello,

In the current frontend selection mechanism, saying --frontend=gnome
unconditionally assumes the frontend should be loaded from
FrontEnd/Gnome.pm and have a package name Debconf::FrontEnd::Gnome.

However, it is handy to allow the file and package to have different
names (Set filename to your customized frontend, and package name to
existing frontend's name).

That way, you can override/extend parts of an existing frontend with
great ease, and use all other parts as-is.

The simple patch attached allows Debconf to use a different file and
package name when selecting and initializing the frontend.

The functionality is accessed by specifying '=' in the frontend name.

So, a setting of --frontend frontend2=gnome has the following effect:

  File to "use": FrontEnd/Frontend2.pm
  Package to call "->new" on: Debconf::FrontEnd::Gnome

Thanks,
Davor Ocelic
doce...@spinlocksolutions.com
http://www.spinlocksolutions.com/
diff -ruNP debconf-1.5.24/Debconf/AutoSelect.pm debconf-1.5.24,p/Debconf/AutoSelect.pm
--- debconf-1.5.24/Debconf/AutoSelect.pm	2005-08-01 19:51:57.000000000 +0200
+++ debconf-1.5.24,p/Debconf/AutoSelect.pm	2009-01-14 15:34:12.000000000 +0100
@@ -41,7 +41,8 @@
 
 );
 
-my $frontend;
+our $frontend;
+our $confmodule;
 my $type;
 
 =head1 METHODS
@@ -69,14 +70,19 @@
 
 	my $showfallback=0;
 	foreach $type ($starttype, @{$fallback{$starttype}}, 'Noninteractive') {
+		my $file = $type;
+		if ( index($type, '=') > 0) {
+			($file, $type) = split /=/, $type;
+			$type=ucfirst($type);
+		}
 		if (! $showfallback) {
-			debug user => "trying frontend $type";
+			debug user => "trying frontend $type (file $file)";
 		}
 		else {
 			warn(sprintf(gettext("falling back to frontend: %s"), $type));
 		}
 		$frontend=eval qq{
-			use Debconf::FrontEnd::$type;
+			use Debconf::FrontEnd::$file;
 			Debconf::FrontEnd::$type->new();
 		};
 		return $frontend if defined $frontend;
@@ -98,7 +104,7 @@
 =cut
 
 sub make_confmodule {
-	my $confmodule=Debconf::ConfModule->new(frontend => $frontend);
+	$confmodule=Debconf::ConfModule->new(frontend => $frontend);
 
 	$confmodule->startup(@_) if @_;
 	

Reply via email to