#!/usr/bin/perl -w =head1 NAME debconf - run a debconf-using program =cut =head1 SYNOPSIS debconf [options] command [args] =head1 DESCRIPTION Debconf is a configuration system for Debian packages. For a debconf overview and documentation for sysadmins, see L (in the debconf-doc package). The B program runs a program under debconf's control, setting it up to talk with debconf on stdio. The program's output is expected to be debconf protocol commands, and it is expected to read result codes on stdin. See L for details about the debconf protocol. The command to be run under debconf must be specified in a way that will let your PATH find it. This command is not the usual way that debconf is used. It's more typical for debconf to be used via L or L. =head1 OPTIONS =over 4 =item B<-o>I, B<--owner=>I Tell debconf what package the command it is running is a part of. This is necessary to get ownership of registered questions right, and to support unregister and purge commands properly. =item B<-f>I, B<--frontend=>I Select the frontend to use. =item B<-p>I, B<--priority=>I Specify the minimum priority of question that will be displayed. =item B<--terse> Enables terse output mode. This affects only some frontends. =back =head1 EXAMPLES To debug a shell script that uses debconf, you might use: DEBCONF_DEBUG=developer debconf my-shell-prog Or, you might use this: debconf --frontend=readline sh -x my-shell-prog =head1 SEE ALSO L, L =cut use strict; use Debconf::Db; use Debconf::AutoSelect qw(:all); use Debconf::Gettext; use Debconf::Config; # Find the end of the options for this command, and the beginning of the # command to run, which may have arguments. Break those arguments out. my (@argv, @command); for (my $x=0; $x <= $#ARGV; $x++) { if ($ARGV[$x] =~ /^-(o|f|p|-(owner|frontend|priority))$/) { push @argv, $ARGV[$x++]; push @argv, $ARGV[$x] if defined $ARGV[$x]; # skip option argument next; } elsif ($ARGV[$x] =~ /^-/) { push @argv, $ARGV[$x]; } else { # end of arguments, start of command @command=@ARGV[$x..$#ARGV]; last; } } @ARGV=@argv; my $usage = gettext("Usage: debconf [options] command [args]"); my $owner=''; Debconf::Config->getopt($usage.gettext(qq{ -o, --owner=package Set the package that owns the command.}), "o|owner=s" => \$owner, ); die "$usage\n" unless @command; Debconf::Db->load; my $frontend=make_frontend(); my $confmodule=make_confmodule(@command); $confmodule->owner($owner) if length $owner; 1 while ($confmodule->communicate); my $code=$confmodule->exitcode; $frontend->shutdown; $confmodule->finish; Debconf::Db->save; exit $code; =head1 AUTHOR Joey Hess =cut