summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorThierry Vignaud <tv@mandriva.org>2007-03-16 11:29:42 +0000
committerThierry Vignaud <tv@mandriva.org>2007-03-16 11:29:42 +0000
commitcf0dd034ca9548ce146068c484f36608c3a90204 (patch)
tree8aac5a759185e1bcb145866e5ad8300f4e779fa3
parent2022370eddf016180616efb817993f6b0527d04b (diff)
downloadmgaonline-cf0dd034ca9548ce146068c484f36608c3a90204.tar
mgaonline-cf0dd034ca9548ce146068c484f36608c3a90204.tar.gz
mgaonline-cf0dd034ca9548ce146068c484f36608c3a90204.tar.bz2
mgaonline-cf0dd034ca9548ce146068c484f36608c3a90204.tar.xz
mgaonline-cf0dd034ca9548ce146068c484f36608c3a90204.zip
(silentCheck) check if urpm db is not lockable; if not, skip updating it
-rwxr-xr-xmdkapplet21
1 files changed, 18 insertions, 3 deletions
diff --git a/mdkapplet b/mdkapplet
index 115ef067..eac4ac49 100755
--- a/mdkapplet
+++ b/mdkapplet
@@ -309,8 +309,23 @@ sub silentCheck() {
# are there any updates ?
if (my $data = $response->{data}) {
if ($data->{isUpdateAvailable}) {
- if (!run_program::raw({}, 'urpmi.update', '--update')) { # shoud wait for it while gtkflus()ing: { detach => 1 }
- logIt(N("Error updating media"));
+ my $will_not_update_media;
+ require urpm::lock;
+ my $urpm = urpm->new;
+ {
+ local $urpm->{fatal} = sub {
+ logIt(N("%s database locked", 'urpmi'));
+ logIt("skipping updating urpmi database");
+ print "Fatal: @_\n";
+ $will_not_update_media = 1;
+ };
+ local $urpm->{error} = $urpm->{fatal};
+
+ urpm::lock::urpmi_db($urpm, 'exclusive', 1);
+ }
+
+ if (!$will_not_update_media and my $res = !run_program::raw({}, 'urpmi.update', '--update')) { # shoud wait for it while gtkflus()ing: { detach => 1 }
+ logIt(N("Error updating media") . $res);
go2State('critical');
return 0;
}
@@ -318,7 +333,7 @@ sub silentCheck() {
use urpm; # to force require
require urpm::select;
require urpm::media;
- my $urpm = urpm->new;
+ $urpm = urpm->new;
urpm::media::configure($urpm);
logIt(N("Computing new updates...\n"));