Browse Source

remove de-selected installed tasks

tags/2.07
Joey Hess 17 years ago
parent
commit
f631b4e4e2
1 changed files with 20 additions and 9 deletions
  1. +20
    -9
      tasksel.pl

+ 20
- 9
tasksel.pl View File

@@ -417,11 +417,20 @@ sub main {
chomp $ret;
close IN;
unlink $tmpfile;
map { $_->{_install} = 1 unless $_->{_installed} }
debconf_to_task($ret, @tasks);
if ($ret=~/manual package selection/) {
unshift @aptitude_install, "--visual-preview";
}
foreach my $task (debconf_to_task($ret, @tasks)) {
if (! $task->{_installed}) {
$task->{_install} = 1;
}
$task->{_selected} = 1;
}
foreach my $task (@list) {
if (! $task->{_selected} && $task->{_installed}) {
push @aptitude_remove, task_packages($task, 0);
}
}
}

# Mark dependnent packages for install if their dependencies are met.
@@ -439,24 +448,26 @@ sub main {
# Add tasks to install.
push @aptitude_install, map { task_packages($_, 1) } grep { $_->{_install} } @tasks;

# And finally, act on selected tasks.
if (@aptitude_install) {
# Remove any packages we were asked to.
if (@aptitude_remove) {
if ($options{test}) {
print "aptitude --without-recommends -y install ".join(" ", @aptitude_install)."\n";
print "aptitude remove ".join(" ", @aptitude_remove)."\n";
}
else {
my $ret=system("aptitude", "--without-recommends", "-y", "install", @aptitude_install) >> 8;
my $ret=system("aptitude", "remove", @aptitude_remove) >> 8;
if ($ret != 0) {
error gettext("aptitude failed");
}
}
}
if (@aptitude_remove) {
# And finally, act on selected tasks.
if (@aptitude_install) {
if ($options{test}) {
print "aptitude remove ".join(" ", @aptitude_remove)."\n";
print "aptitude --without-recommends -y install ".join(" ", @aptitude_install)."\n";
}
else {
my $ret=system("aptitude", "remove", @aptitude_remove) >> 8;
my $ret=system("aptitude", "--without-recommends", "-y", "install", @aptitude_install) >> 8;
if ($ret != 0) {
error gettext("aptitude failed");
}


Loading…
Cancel
Save