-
Notifications
You must be signed in to change notification settings - Fork 8
/
Copy pathdebconf-communicate
executable file
·78 lines (51 loc) · 1.67 KB
/
debconf-communicate
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
#!/usr/bin/perl -w
=head1 NAME
debconf-communicate - communicate with debconf
=cut
=head1 SYNOPSIS
echo commands | debconf-communicate [options] [package]
=head1 DESCRIPTION
B<debconf-communicate> allows you to communicate with debconf on the fly,
from the command line. The package argument is the name of the package
which you are pretending to be as you communicate with debconf, and it may
be omitted if you are lazy. It reads commands in the form used by the debconf
protocol from stdin. For documentation on the available commands and their
usage, see the debconf specification.
The commands are executed in sequence. The textual return code of each is
printed out to standard output.
The return value of this program is the numeric return code of the last
executed command.
=head1 EXAMPLE
echo get debconf/frontend | debconf-communicate
Print out the value of the debconf/frontend question.
=head1 WARNING
This program should never be used from a maintainer script of a package
that uses debconf! It may however, be useful in debugging.
=head1 SEE ALSO
L<debconf-loadtemplate(1)>
=cut
use strict;
use Debconf::Db;
use Debconf::AutoSelect qw(:all);
use Debconf::Config;
use Debconf::Gettext;
Debconf::Db->load;
Debconf::Config->getopt(gettext("Usage: debconf-communicate [options] [package]"));
my $frontend=make_frontend();
my $confmodule=make_confmodule();
$confmodule->owner(shift) if @ARGV;
my $code=127;
autoflush STDOUT 1;
while (<>) {
chomp;
my $ret=$confmodule->process_command($_);
($code, undef)=split(/ /, $ret, 2);
print "$ret\n";
}
$frontend->shutdown;
$confmodule->finish;
Debconf::Db->save;
exit $code;
=head1 AUTHOR
Joey Hess <[email protected]>
=cut