linux-image: prerm: Allow removal of running kernel if we can't ask debconf questions
Closes: #825423
This commit is contained in:
parent
b621344bd9
commit
49b5fbab50
|
@ -22,6 +22,8 @@ linux (4.6-1~exp2) UNRELEASED; urgency=medium
|
|||
* [mips*/*-malta] udeb: Add ata-modules package
|
||||
* linux-image: Stop setting $STEM in environment for maintainer script hooks
|
||||
* linux-image: Add workaround for bug #817083 in debconf
|
||||
* linux-image: prerm: Allow removal of running kernel if we can't ask debconf
|
||||
questions (Closes: #825423)
|
||||
|
||||
[ Aurelien Jarno ]
|
||||
* [mips64{,el}] Set CPU to MIPS64 R2.
|
||||
|
|
|
@ -43,37 +43,43 @@ if (-r "$CONF_LOC" && -f "$CONF_LOC" ) {
|
|||
}
|
||||
|
||||
|
||||
#check to see if we are trying to remove a running kernel
|
||||
# if so we abort right now.
|
||||
# Check to see if we are trying to remove a running kernel.
|
||||
chop($running=`uname -r`);
|
||||
if ($running eq $version) {
|
||||
my $question = "${package_name}/prerm/removing-running-kernel-$version";
|
||||
# If we can ask debconf questions, ask whether that's intended
|
||||
# and abort if not.
|
||||
if (exists($ENV{'DEBIAN_FRONTEND'}) &&
|
||||
$ENV{'DEBIAN_FRONTEND'} eq 'noninteractive') {
|
||||
print STDERR "W: removing running kernel image.\n";
|
||||
} else {
|
||||
my $question = "${package_name}/prerm/removing-running-kernel-$version";
|
||||
|
||||
($ret,$seen) = fset ("$question", 'seen', 'false');
|
||||
die "Error setting debconf flags in $question: $seen" if $ret;
|
||||
($ret,$seen) = fset ("$question", 'seen', 'false');
|
||||
die "Error setting debconf flags in $question: $seen" if $ret;
|
||||
|
||||
$ret = subst("$question", 'running', "$running");
|
||||
die "Error setting debconf substitutions in $question: $seen" if $ret;
|
||||
$ret = subst("$question", 'running', "$running");
|
||||
die "Error setting debconf substitutions in $question: $seen" if $ret;
|
||||
|
||||
($ret,$seen) = input('critical', "$question");
|
||||
if ($ret && $ret != 30 ) {
|
||||
die "Error setting debconf question $question: $seen";
|
||||
}
|
||||
($ret,$seen) = input('critical', "$question");
|
||||
if ($ret && $ret != 30 ) {
|
||||
die "Error setting debconf question $question: $seen";
|
||||
}
|
||||
|
||||
($ret,$seen) = go ();
|
||||
if ($ret && $ret != 30 ) {
|
||||
die "Error asking debconf question $question: $seen";
|
||||
}
|
||||
($ret,$seen) = go ();
|
||||
if ($ret && $ret != 30 ) {
|
||||
die "Error asking debconf question $question: $seen";
|
||||
}
|
||||
|
||||
($ret,$answer) = get("$question");
|
||||
die "Error retreiving answer for $question: $answer" if $ret;
|
||||
($ret,$answer) = get("$question");
|
||||
die "Error retreiving answer for $question: $answer" if $ret;
|
||||
|
||||
if ($answer =~ /^(y|t)/i) {
|
||||
print STDERR "Aborting removal of running kernel image.\n";
|
||||
exit 1; #Operation not permitted
|
||||
}
|
||||
else {
|
||||
print STDERR "Ok, proceeding with removing running kernel image.\n";
|
||||
if ($answer =~ /^(y|t)/i) {
|
||||
print STDERR "Aborting removal of running kernel image.\n";
|
||||
exit 1; #Operation not permitted
|
||||
}
|
||||
else {
|
||||
print STDERR "Ok, proceeding with removing running kernel image.\n";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue