diff options
author | Thierry Vignaud <tv@mandriva.org> | 2007-03-16 11:29:42 +0000 |
---|---|---|
committer | Thierry Vignaud <tv@mandriva.org> | 2007-03-16 11:29:42 +0000 |
commit | cf0dd034ca9548ce146068c484f36608c3a90204 (patch) | |
tree | 8aac5a759185e1bcb145866e5ad8300f4e779fa3 /mdkapplet | |
parent | 2022370eddf016180616efb817993f6b0527d04b (diff) | |
download | mgaonline-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
Diffstat (limited to 'mdkapplet')
-rwxr-xr-x | mdkapplet | 21 |
1 files changed, 18 insertions, 3 deletions
@@ -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")); |