From 938983fb49d353314ad046b9f2ccc3c7ce6711c5 Mon Sep 17 00:00:00 2001 From: Pascal Rigaux Date: Tue, 19 Jun 2007 10:56:09 +0000 Subject: - auto_install: allow "automatic=met:http,ser:server,dir:/pub/dir kickstart=/pub/auto_inst.cfg" to get http://server/pub/auto_inst.cfg (#31474) --- perl-install/install/NEWS | 3 +++ perl-install/install/http.pm | 19 ++++++++++++++++++- perl-install/install/media.pm | 2 +- 3 files changed, 22 insertions(+), 2 deletions(-) (limited to 'perl-install') diff --git a/perl-install/install/NEWS b/perl-install/install/NEWS index 8a428c2e0..afa95f705 100644 --- a/perl-install/install/NEWS +++ b/perl-install/install/NEWS @@ -1,3 +1,6 @@ +- auto_install: + o allow "automatic=met:http,ser:server,dir:/pub/dir + kickstart=/pub/auto_inst.cfg" to get http://server/pub/auto_inst.cfg (#31474) - add /etc/mke2fs.conf in order to format ext3fs with 4k blocks (#27377) - diskdrake o fix 1.9TB displayed as 1TB diff --git a/perl-install/install/http.pm b/perl-install/install/http.pm index 75d026d0d..bf59c273b 100644 --- a/perl-install/install/http.pm +++ b/perl-install/install/http.pm @@ -14,6 +14,23 @@ sub getFile { my ($_size, $fh) = get_file_and_size($url) or return; $fh; } + +sub parse_url { + my ($url) = @_; + $url =~ m,^(?:http|ftp)://([^/:]+)(?::(\d+))?(/\S*)?$,; +} + +sub get_file_and_size_ { + my ($f, $url) = @_; + + if ($f =~ m!^/!) { + my ($host, $port, $_path) = parse_url($url); + get_file_and_size("http://$host" . ($port ? ":$port" : '') . $f); + } else { + get_file_and_size("$url/$f"); + } +} + sub get_file_and_size { local ($^W) = 0; @@ -21,7 +38,7 @@ sub get_file_and_size { $sock->close if $sock; # can be used for ftp urls (with http proxy) - my ($host, $port, $path) = $url =~ m,^(?:http|ftp)://([^/:]+)(?::(\d+))?(/\S*)?$,; + my ($host, $port, $path) = parse_url($url); defined $host or return undef; my $use_http_proxy = $ENV{PROXY} && $ENV{PROXYPORT}; diff --git a/perl-install/install/media.pm b/perl-install/install/media.pm index 8944cff34..4468c7d53 100644 --- a/perl-install/install/media.pm +++ b/perl-install/install/media.pm @@ -368,7 +368,7 @@ sub get_file_and_size { install::ftp::get_file_and_size($f, $phys_m->{url}); } elsif ($phys_m->{method} eq "http") { require install::http; - install::http::get_file_and_size("$phys_m->{url}/$f"); + install::http::get_file_and_size_($f, $phys_m->{url}); } elsif ($f =~ m!^/!) { open_file_and_size($f); } elsif ($postinstall_rpms && -e "$postinstall_rpms/$f") { -- cgit v1.2.1