1 | debconf_get () { |
---|
2 | perl -MDebconf::Db -MDebconf::Question -e ' |
---|
3 | Debconf::Db->load(readonly => "true"); |
---|
4 | for $label (@ARGV) { |
---|
5 | if ($q = Debconf::Question->get($label)) { |
---|
6 | print $q->owners."\t".$q->name."\t".$q->type."\t".$q->value."\t".$q->flag("seen")."\n"; |
---|
7 | } else { |
---|
8 | print "\t$label\t\t\tfalse\n"; |
---|
9 | } |
---|
10 | }' -- "$@" |
---|
11 | } |
---|
12 | |
---|
13 | debconf_set () { |
---|
14 | perl -MDebconf::Db -MDebconf::Template -MDebconf::Question -e ' |
---|
15 | Debconf::Db->load; |
---|
16 | while (<>) { |
---|
17 | chomp; |
---|
18 | ($owners, $label, $type, $value, $seen) = split("\t"); |
---|
19 | @o{split(", ", $owners)} = (); |
---|
20 | unless ($t = Debconf::Template->get($label)) { |
---|
21 | next unless ($owners); |
---|
22 | $t = Debconf::Template->new($label, $owners[0], $type); |
---|
23 | $t->description("Dummy template"); |
---|
24 | $t->extended_description("This is a fake template used to pre-seed the debconf database. If you are seeing this, something is probably wrong."); |
---|
25 | } |
---|
26 | @to{split(", ", $t->owners)} = (); |
---|
27 | map { $t->addowner($_) unless exists $to{$_}; } keys %o; |
---|
28 | map { $t->removeowner($_) unless exists $o{$_}; } keys %to; |
---|
29 | next unless ($q = Debconf::Question->get($label)); |
---|
30 | $q->value($value); |
---|
31 | $q->flag("seen", $seen); |
---|
32 | @qo{split(", ", $q->owners)} = (); |
---|
33 | map { $q->addowner($_) unless exists $qo{$_}; } keys %o; |
---|
34 | map { $q->removeowner($_) unless exists $o{$_}; } keys %qo; |
---|
35 | } |
---|
36 | Debconf::Db->save;' |
---|
37 | } |
---|