/usr/sbin/dpkg-preconfigure is in debconf 1.5.42ubuntu1.
This file is owned by root:root, with mode 0o755.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 | #!/usr/bin/perl -w
# This file was preprocessed, do not edit!
BEGIN {
eval qq{
use strict;
use FileHandle;
use Debconf::Log qw(:all);
use Debconf::Db;
use Debconf::Template;
use Debconf::Config;
use Debconf::AutoSelect qw(:all);
use Debconf::Gettext;
use Debconf::Path;
};
if ($@) {
print STDERR "debconf: Perl may be unconfigured ($@) -- aborting\n";
exit 0;
}
}
if (exists $ENV{DEBCONF_USE_CDEBCONF} and $ENV{DEBCONF_USE_CDEBCONF} ne '') {
exec "/usr/lib/cdebconf/dpkg-preconfigure", @ARGV;
}
Debconf::Db->load;
my $apt=0;
Debconf::Config->getopt(
qq{Usage: dpkg-preconfigure [options] [debs]
--apt Apt mode.},
"apt" => \$apt,
);
$|=1;
my @debs=@ARGV;
@ARGV=();
my $have_tty=1;
if ($apt) {
while (<>) {
chomp;
push @debs, $_ if length $_;
}
exit unless @debs;
$have_tty=0 unless open (STDIN, "/dev/tty");
}
elsif (! @debs) {
print STDERR sprintf("dpkg-preconfigure: ".gettext("must specify some debs to preconfigure")), "\n";
exit(1);
}
if (! Debconf::Path::find("apt-extracttemplates")) {
warn gettext("delaying package configuration, since apt-utils is not installed");
exit;
}
my $frontend=make_frontend();
if (! $have_tty && $frontend->need_tty) {
print STDERR sprintf("dpkg-preconfigure: ".gettext("unable to re-open stdin: %s"), $!)."\n";
exit 0;
}
my ($package, $version, $template, $config);
unless (open(INFO, "-|")) {
my $command_max=20000; # LINUX SPECIFIC!!
my $static_len=length("apt-extracttemplates");
my $len=$static_len;
my @collect;
if ($apt && @debs > 30) {
STDERR->autoflush(1);
}
foreach my $deb (@debs) {
$len += length($deb) + 1;
if ($len < $command_max && @collect < 30) {
push @collect, $deb;
}
else {
if (system("apt-extracttemplates", @collect) != 0) {
print STDERR sprintf("debconf: ".gettext("apt-extracttemplates failed: %s")."\n",$!);
}
if ($apt && @debs > 30) {
$progress += @collect;
printf STDERR "\r".gettext("Extracting templates from packages: %d%%"), $progress * 100 / @debs;
}
@collect=($deb);
$len=$static_len + length($deb) + 1;
}
}
if (system("apt-extracttemplates", @collect) != 0) {
print STDERR sprintf("debconf: ".gettext("apt-extracttemplates failed: %s")."\n",$!);
}
if ($apt && @debs > 30) {
$progress += @collect;
printf STDERR "\r".gettext("Extracting templates from packages: %d%%")."\n", $progress * 100 / @debs;
}
exit;
}
my @buffer=<INFO>;
if ($apt && @buffer) {
print gettext("Preconfiguring packages ...\n");
}
foreach my $line (@buffer) {
($package, $version, $template, $config)=split /\s/, $line;
if (defined $template && length $template) {
eval q{
Debconf::Template->load($template, $package)
};
unlink $template;
if ($@) {
print STDERR "$package ".sprintf(gettext("template parse error: %s"), $@)."\n";
unlink $config;
next;
}
}
}
foreach my $line (@buffer) {
($package, $version, $template, $config)=split /\s/, $line;
if (defined $config && length $config && -e $config) {
debug user => sprintf("preconfiguring %s (%s)",$package,$version);
chmod(0755, $config) or
die sprintf(gettext("debconf: can't chmod: %s"), $!);
$frontend->default_title($package);
$frontend->info(undef);
my $confmodule=make_confmodule($config, 'configure', $version);
$confmodule->owner($package);
1 while ($confmodule->communicate);
if ($confmodule->exitcode > 0) {
print STDERR sprintf(
gettext("%s failed to preconfigure, with exit status %s"),
$package, $confmodule->exitcode)."\n";
}
unlink $config;
}
}
$frontend->shutdown;
Debconf::Db->save;
|