summaryrefslogtreecommitdiffstats
path: root/perl-install/install/any.pm
diff options
context:
space:
mode:
authorMartin Whitaker <mageia@martin-whitaker.me.uk>2022-11-19 09:26:09 +0000
committerMartin Whitaker <mageia@martin-whitaker.me.uk>2022-11-19 13:14:33 +0000
commit5c59aff6bd4ec774070568a3c23bc4f467643eb7 (patch)
treeba9182080ac7f69a2c2fa3dd044652b5d7bab9e2 /perl-install/install/any.pm
parent39111de7fbaa830a225714066b3d9a0ae12b1996 (diff)
downloaddrakx-5c59aff6bd4ec774070568a3c23bc4f467643eb7.tar
drakx-5c59aff6bd4ec774070568a3c23bc4f467643eb7.tar.gz
drakx-5c59aff6bd4ec774070568a3c23bc4f467643eb7.tar.bz2
drakx-5c59aff6bd4ec774070568a3c23bc4f467643eb7.tar.xz
drakx-5c59aff6bd4ec774070568a3c23bc4f467643eb7.zip
Move ask_mirror() from install::any to any.
This makes it available for use by draklive-install.
Diffstat (limited to 'perl-install/install/any.pm')
-rw-r--r--perl-install/install/any.pm71
1 files changed, 1 insertions, 70 deletions
diff --git a/perl-install/install/any.pm b/perl-install/install/any.pm
index a55de478d..78bb16eaf 100644
--- a/perl-install/install/any.pm
+++ b/perl-install/install/any.pm
@@ -210,80 +210,11 @@ sub prep_net_suppl_media {
sleep(3);
}
-=item ask_url($in, $o_url)
-
-Asks URL of the mirror
-
-=cut
-
-sub ask_url {
- my ($in, $o_url) = @_;
-
- my $url = $o_url;
- $in->ask_from_({ messages => N("URL of the mirror?"), focus_first => 1 }, [
- { val => \$url,
- validate => sub {
- if ($url =~ m!^(http|ftp)://!) {
- 1;
- } else {
- $in->ask_warn('', N("URL must start with ftp:// or http://"));
- 0;
- }
- } } ]) && $url;
-}
-
-=item ask_mirror($o, $type, $o_url)
-
-Retrieves list of mirrors and offers to pick one
-
-=cut
-
-sub ask_mirror {
- my ($o, $type, $o_url) = @_;
-
- require mirror;
-
- my $mirrors = eval {
- my $_w = $o->wait_message('', N("Contacting %s web site to get the list of available mirrors...", N("Mageia")));
- mirror::list($o->{product_id}, $type);
- };
- my $err = $@;
- if (!$mirrors) {
- $o->ask_warn('', N("Failed contacting %s web site to get the list of available mirrors", N("Mageia")) . "\n$err");
- return ask_url($o, $o_url);
- }
-
- my $give_url = { country => '-', host => 'URL' };
-
- my $mirror = $o_url ? (find { $_->{url} eq $o_url } @$mirrors) || $give_url
- #- use current time zone to select best mirror
- : mirror::nearest($o->{timezone}{timezone}, $mirrors);
-
- $o->ask_from_({ messages => N("Choose a mirror from which to get the packages"),
- cancel => N("Cancel"),
- }, [ { separator => '|',
- format => \&mirror::mirror2text,
- list => [ @$mirrors, $give_url ],
- val => \$mirror,
- },
- ]) or return;
-
- my $url;
- if ($mirror eq $give_url) {
- $url = ask_url($o, $o_url) or goto &ask_mirror;
- } else {
- $url = $mirror->{url};
- }
- $url =~ s!/main/?$!!;
- log::l("chosen mirror: $url");
- $url;
-}
-
sub ask_suppl_media_url {
my ($o, $method, $o_url) = @_;
if (member($method, qw(ftp http))) {
- install::any::ask_mirror($o, 'distrib', $o_url);
+ any::ask_mirror($o, 'distrib', $o_url);
} elsif ($method eq 'nfs') {
my ($host, $dir) = $o_url ? $o_url =~ m!nfs://(.*?)(/.*)! : ();
$o->ask_from_(