summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorThierry Vignaud <tv@mandriva.org>2008-11-20 13:30:15 +0000
committerThierry Vignaud <tv@mandriva.org>2008-11-20 13:30:15 +0000
commitee0919bff4322d0cdc9fbb4a88146d3cb28745c7 (patch)
tree86db1f607d72beaf86d2c4730222b78e040d52f0
parent2bda5080cf8805d62693b1dc6961d6f1d9e5c812 (diff)
downloadmgaonline-ee0919bff4322d0cdc9fbb4a88146d3cb28745c7.tar
mgaonline-ee0919bff4322d0cdc9fbb4a88146d3cb28745c7.tar.gz
mgaonline-ee0919bff4322d0cdc9fbb4a88146d3cb28745c7.tar.bz2
mgaonline-ee0919bff4322d0cdc9fbb4a88146d3cb28745c7.tar.xz
mgaonline-ee0919bff4322d0cdc9fbb4a88146d3cb28745c7.zip
(checker_exit) split it out of silentCheck()
-rwxr-xr-xmdkapplet25
1 files changed, 13 insertions, 12 deletions
diff --git a/mdkapplet b/mdkapplet
index 1c180023..b3a34b64 100755
--- a/mdkapplet
+++ b/mdkapplet
@@ -466,6 +466,11 @@ sub installUpdates() {
silentCheck(); gtkflush();
}
+sub checker_exit {
+ my ($state) = @_;
+ POSIX::_exit($comm_codes{$state}{code});
+}
+
sub silentCheck() {
state $check_time;
my $new_time = time();
@@ -494,10 +499,6 @@ sub silentCheck() {
# be nice with other processes:
setpriority(0, $$, 7); # 0 is PRIO_PROCESS
- my $exit = sub {
- my ($state) = @_;
- POSIX::_exit($comm_codes{$state}{code});
- };
my $will_not_update_media;
require urpm;
require urpm::lock;
@@ -512,10 +513,10 @@ sub silentCheck() {
urpm::lock::urpmi_db($urpm, 'exclusive', 1);
}
- $exit->('locked') if $will_not_update_media;
+ checker_exit('locked') if $will_not_update_media;
if (!run_program::raw({ sensitive_arguments => 1 }, 'urpmi.update', '--update', if_($root, "--urpmi-root=$root"))) {
- $exit->('error_updating') if $will_not_update_media;
+ checker_exit('error_updating') if $will_not_update_media;
}
# update inactive backport media:
@@ -528,9 +529,9 @@ sub silentCheck() {
urpm::media::configure($urpm, update => 1);
my @update_medias = grep { $_->{update} } @{$urpm->{media}};
if (!@update_medias) {
- $exit->('no_update_medium');
+ checker_exit('no_update_medium');
} elsif (!any { ! $_->{ignore} } @update_medias) {
- $exit->('no_enabled_medium');
+ checker_exit('no_enabled_medium');
}
if (my $_db = urpm::db_open_or_die($urpm)) {
@@ -545,14 +546,14 @@ sub silentCheck() {
my @requested_strict = map { scalar $_->fullname } @{$urpm->{depslist}}[keys %{$state->{selected}}];
if ($need_restart || @requested_strict) { # FIXME: log first found pkgs?
- $exit->('updates');
+ checker_exit('updates');
} else {
- $exit->('uptodate');
+ checker_exit('uptodate');
}
} else {
- $exit->('db_not_open');
+ checker_exit('db_not_open');
}
- $exit->('updates');
+ checker_exit('updates');
} else {
log::explanations("cannot fork: %s", "update checker ($!)");
go2State('critical');