diff options
-rw-r--r-- | lib/Iurt/Chroot.pm | 6 | ||||
-rw-r--r-- | lib/Iurt/Urpmi.pm | 7 |
2 files changed, 11 insertions, 2 deletions
diff --git a/lib/Iurt/Chroot.pm b/lib/Iurt/Chroot.pm index 25829b5..546a2ca 100644 --- a/lib/Iurt/Chroot.pm +++ b/lib/Iurt/Chroot.pm @@ -529,6 +529,12 @@ sub build_chroot { # install chroot my $urpmi = $run->{urpmi}; + if ($urpmi->{use__urpmi_root}) { + if (!$urpmi->add_media__urpmi_root($tmp_chroot)) { + plog('ERROR', "urpmi.addmedia --urpmi-root failed"); + return 0; + } + } $urpmi->set_command($tmp_chroot); # 20060826 warly urpmi --root does not work properly diff --git a/lib/Iurt/Urpmi.pm b/lib/Iurt/Urpmi.pm index 0162462..5a8c80a 100644 --- a/lib/Iurt/Urpmi.pm +++ b/lib/Iurt/Urpmi.pm @@ -41,13 +41,16 @@ sub new { plog('DEBUG', "installation media: $run->{chrooted_media}"); } + $self->{use__urpmi_root} = $config->{repository} =~ m/^(http|ftp):/; $self->{distrib_url} = "$config->{repository}/$run->{distro}/$run->{my_arch}"; $self; } -sub set_command { &set_command__use_distrib } - +sub set_command { + my ($self, $chroot_tmp) = @_; + $self->{use__urpmi_root} ? &set_command__urpmi_root : &set_command__use_distrib; +} sub set_command__urpmi_root { my ($self, $chroot_tmp) = @_; $self->{urpmi_command} = "urpmi $self->{urpmi_options} --urpmi-root $chroot_tmp"; |