summaryrefslogtreecommitdiffstats
path: root/urpm
diff options
context:
space:
mode:
Diffstat (limited to 'urpm')
-rw-r--r--urpm/main_loop.pm26
1 files changed, 18 insertions, 8 deletions
diff --git a/urpm/main_loop.pm b/urpm/main_loop.pm
index cf739af8..31d09dea 100644
--- a/urpm/main_loop.pm
+++ b/urpm/main_loop.pm
@@ -351,18 +351,28 @@ if ($nok) {
} elsif ($test && $exit_code == 0) {
#- Warning : the following message is parsed in urpm::parallel_*
print N("Installation is possible"), "\n";
- } elsif ($callbacks->{need_restart} && intersection([ keys %{$state->{selected}} ],
- [ keys %{$urpm->{provides}{'should-restart'}} ])) {
- if (my $need_restart_formatted = urpm::sys::need_restart_formatted($urpm->{root})) {
- $callbacks->{need_restart}($need_restart_formatted);
-
- # need_restart() accesses rpm db, so we need to ensure things are clean:
- urpm::sys::may_clean_rpmdb_shared_regions($urpm, $options{test});
- }
+ } else {
+ handle_need_restart($urpm, $state, $callbacks);
}
}
}
$exit_code;
}
+sub handle_need_restart {
+ my ($urpm, $state, $callbacks) = @_;
+
+ return if !$callbacks->{need_restart};
+
+ if (intersection([ keys %{$state->{selected}} ],
+ [ keys %{$urpm->{provides}{'should-restart'}} ])) {
+ if (my $need_restart_formatted = urpm::sys::need_restart_formatted($urpm->{root})) {
+ $callbacks->{need_restart}($need_restart_formatted);
+
+ # need_restart() accesses rpm db, so we need to ensure things are clean:
+ urpm::sys::may_clean_rpmdb_shared_regions($urpm, $options{test});
+ }
+ }
+}
+
1;