diff options
author | Pascal Rigaux <pixel@mandriva.com> | 2007-12-05 16:30:45 +0000 |
---|---|---|
committer | Pascal Rigaux <pixel@mandriva.com> | 2007-12-05 16:30:45 +0000 |
commit | a1e68ff6761fe316671e760785ce27e376053991 (patch) | |
tree | c4213d176fab48220e7a1964fd876f42549da4dc /urpmi.addmedia | |
parent | 1a26f8e97d214ae49dda536b8b27a3175e174fae (diff) | |
download | urpmi-a1e68ff6761fe316671e760785ce27e376053991.tar urpmi-a1e68ff6761fe316671e760785ce27e376053991.tar.gz urpmi-a1e68ff6761fe316671e760785ce27e376053991.tar.bz2 urpmi-a1e68ff6761fe316671e760785ce27e376053991.tar.xz urpmi-a1e68ff6761fe316671e760785ce27e376053991.zip |
- urpmi.addmedia:
o exit code 1 when a medium can't be added
and simplifies a mess in urpmi.addmedia: this mess is not needed anymore since
update_media() will exit on error
Diffstat (limited to 'urpmi.addmedia')
-rwxr-xr-x | urpmi.addmedia | 28 |
1 files changed, 5 insertions, 23 deletions
diff --git a/urpmi.addmedia b/urpmi.addmedia index 0ef5b807..988c39a8 100755 --- a/urpmi.addmedia +++ b/urpmi.addmedia @@ -75,18 +75,6 @@ and [options] are from exit 1; } -#- remove quietly the failing media. -sub remove_failed { - my ($urpm, @media) = @_; - if (@media) { - print STDERR join("\n", map { N("unable to update medium \"%s\"\n", $_->{name}) } @media); - local $urpm->{log} = sub {}; - urpm::media::remove_selected_media($urpm); - urpm::media::update_media($urpm, %options, quiet => 1); - exit(1); - } -} - $ENV{PATH} = "/sbin:/usr/sbin:/bin:/usr/bin:/usr/X11R6/bin"; delete @ENV{qw(ENV BASH_ENV IFS CDPATH)}; @@ -118,6 +106,7 @@ if (!-e $urpm->{config}) { my $_urpmi_lock = urpm::lock::urpmi_db($urpm, 'exclusive', wait => $options{wait_lock}); urpm::media::read_config($urpm); +my $ok = 1; if ($options{distrib}) { $with || $relative_hdlist and usage N("no need to give <relative path of hdlist> with --distrib"); @@ -145,15 +134,9 @@ if ($options{distrib}) { nolock => $options{nolock}, ask_media => $add_media_callback, ); - local $SIG{INT} = sub { - remove_failed($urpm, grep { $_->{modified} } @{$urpm->{media}}); - exit(1); - }; - urpm::media::update_media($urpm, %options, + $ok = urpm::media::update_media($urpm, %options, quiet => $options{verbose} < 0, callback => \&urpm::download::sync_logger); - remove_failed($urpm, grep { $_->{modified} } @{$urpm->{media}}); - } else { $name or usage(); @@ -180,16 +163,15 @@ if ($options{distrib}) { remove_failed($urpm, $medium) if $medium && $medium->{modified}; exit(1); }; - urpm::media::update_media($urpm, %options, + $ok = urpm::media::update_media($urpm, %options, quiet => $options{verbose} < 0, callback => \&urpm::download::sync_logger); - #- check creation of media - my $medium = urpm::media::name2medium($urpm, $name) or die N("unable to create medium \"%s\"\n", $name); - remove_failed($urpm, $medium) if $medium->{modified}; } } #- try to umount removable devices which may have been mounted. urpm::removable::try_umounting_removables($urpm); +exit($ok ? 0 : 1); + # vim:ts=8:sts=4:sw=4 |