From bf81740eea5d5e354bb8de76e6505d1d5b3af3dd Mon Sep 17 00:00:00 2001 From: Pascal Rigaux Date: Tue, 11 Mar 2008 14:29:42 +0000 Subject: - urpmi: o have a nicer error message when perl-Hal-Cdroms is missing (#38778) --- NEWS | 2 ++ urpm/cdrom.pm | 6 ++++-- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/NEWS b/NEWS index 6bcbcc2e..5afc90d8 100644 --- a/NEWS +++ b/NEWS @@ -3,6 +3,8 @@ - bash-completion: o restore available-pkgs completion using "urpmq --list" by default (it needed COMP_URPMI_HDLISTS to be set, but it should be fast enough now) +- urpmi: + o have a nicer error message when perl-Hal-Cdroms is missing (#38778) Version 5.9 - 7 March 2008, by Thierry Vignaud diff --git a/urpm/cdrom.pm b/urpm/cdrom.pm index a2b2e7c8..385ac978 100644 --- a/urpm/cdrom.pm +++ b/urpm/cdrom.pm @@ -63,7 +63,8 @@ sub _try_mounting_cdrom_using_hal { $urpm->{cdrom_mounted} = {}; # reset - require Hal::Cdroms; + eval { require Hal::Cdroms; 1 } or $urpm->{error}(N("you must mount cdrom or install perl-Hal-Cdroms to have it done automatically")), return(); + my $hal_cdroms = Hal::Cdroms->new; foreach my $hal_path ($hal_cdroms->list) { my $mntpoint; @@ -121,7 +122,8 @@ sub _eject_cdrom { my $mntpoint = delete $urpm->{cdrom_mounted}{$hal_path}; $urpm->{debug} and $urpm->{debug}("umounting and ejecting $mntpoint (cdrom $hal_path)"); - require Hal::Cdroms; + eval { require Hal::Cdroms; 1 } or return; + my $hal_cdroms = Hal::Cdroms->new; $hal_cdroms->unmount($hal_path) or do { my $mntpoint = $hal_cdroms->get_mount_point($hal_path); -- cgit v1.2.1