/usr/share/PackageKit/helpers/aptcc/pkconffile is in packagekit 1.0.1-2.
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 | #!/usr/bin/perl
use Debconf::Client::ConfModule ':all';
use Cwd 'abs_path';
use File::Temp qw/ tempfile tempdir /;
use strict;
my $template_fname;
(undef, $template_fname) = tempfile('/tmp/pkconffileXXXXXX', SUFFIX => '.template');
# (1) quit unless we have the correct number of command-line args
if ($#ARGV + 1 != 3) {
print STDERR "Usage: ./pkconffile package original_conf new_conf\n";
exit;
}
## Process template so we can add the diff at the end
## the abs_path will give us the full path where this script is so we can find the template
open (TEMP_NODIFF, abs_path($0).'.nodiff') || die ("could not open the template");
open (TEMPLATE, ">$template_fname");
## Adds the original template
while (<TEMP_NODIFF>) {
print TEMPLATE $_;
}
close (TEMP_NODIFF);
## get the original and new files
my $package = $ARGV[0];
my $forig = $ARGV[1];
my $fnew = $ARGV[2];
## Add the diff to the end of the TEMPLATE
my @diff = `diff -u $forig $fnew`;
foreach (@diff) {
if ($_ =~ /^\$/) {
print TEMPLATE " .\n";
} else {
chomp;
## Add two spaces here so that the extended description
## receives the proper line breaks.
print TEMPLATE " $_\n";
}
}
close (TEMPLATE);
## Force the template to be loaded again
x_loadtemplatefile($template_fname);
## set the package name in the title
subst("pkconffile/title", "package", $package);
settitle("pkconffile/title");
my $state = 1;
while (1) {
if ($state == 1) {
## ask the user what to do with the conf file
fset("pkconffile/what_to_do", "seen", "false");
subst("pkconffile/what_to_do", "forig", $forig);
input("high", "pkconffile/what_to_do");
} else {
## the user whants to see the diff
fset("pkconffile/diff", "seen", "false");
subst("pkconffile/diff", "forig", $forig);
subst("pkconffile/diff", "fnew", $fnew);
input("high", "pkconffile/diff");
}
## get the user answer
if (go() == 0 && $state == 1) {
my @ret = get("pkconffile/what_to_do");
if ($ret[1] =~ "Keep the currently installed version") {
$state = 10;
last;
} elsif ($ret[1] =~ "Install the package maintainer's version") {
$state = 20;
last;
}
$state = 2;
} else {
$state = 1;
}
}
unlink($template_fname);
exit $state;
|