diff options
Diffstat (limited to 'lib')
-rw-r--r-- | lib/Iurt/Urpmi.pm | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/lib/Iurt/Urpmi.pm b/lib/Iurt/Urpmi.pm index 86ac52d..51d9022 100644 --- a/lib/Iurt/Urpmi.pm +++ b/lib/Iurt/Urpmi.pm @@ -381,6 +381,11 @@ sub install_packages_old { 1; } +sub are_installed { + my ($chroot, @pkgs) = @_; + system("sudo chroot $chroot rpm -q @pkgs") == 0; +} + sub install_packages { my ($self, $title, $chroot_tmp, $local_spool, $pack_provide, $log, $error, $opt, @packages) = @_; @@ -411,7 +416,7 @@ sub install_packages { my $try_urpmi = 1; my @rpm = grep { !/\.src\.rpm$/ } @to_install; - return 1 if ($opt->{check} && -f "$chroot_tmp/bin/rpm" && @rpm && !system("sudo chroot $chroot_tmp rpm -q @to_install")); + return 1 if ($opt->{check} && -f "$chroot_tmp/bin/rpm" && @rpm && are_installed($chroot_tmp, @to_install)); if ($try_urpmi) { foreach my $try ( @@ -514,7 +519,7 @@ sub install_packages { } $unsatisfied and last; } else { - if (!@rpm || !system("sudo chroot $chroot_tmp rpm -q @rpm")) { + if (!@rpm || are_installed($chroot_tmp, @rpm)) { plog("installation successful"); $ok = 1; } @@ -538,7 +543,7 @@ sub install_packages { last if $ok == 1; } } - if (!-f "$chroot_tmp/bin/rpm" || @rpm && system("sudo chroot $chroot_tmp rpm -q @to_install")) { + if (!-f "$chroot_tmp/bin/rpm" || @rpm && !are_installed($chroot_tmp, @to_install)) { plog(1, "ERROR: urpmi is not working, doing it manually"); my $root = "$config->{repository}/$run->{distro}/$run->{my_arch}"; my $depslist = "$root/media/media_info/depslist.ordered"; |