summaryrefslogtreecommitdiff
path: root/Master/tlpkg/TeXLive
diff options
context:
space:
mode:
Diffstat (limited to 'Master/tlpkg/TeXLive')
-rw-r--r--Master/tlpkg/TeXLive/TLUtils.pm22
1 files changed, 20 insertions, 2 deletions
diff --git a/Master/tlpkg/TeXLive/TLUtils.pm b/Master/tlpkg/TeXLive/TLUtils.pm
index 69f73071552..3968c18bcae 100644
--- a/Master/tlpkg/TeXLive/TLUtils.pm
+++ b/Master/tlpkg/TeXLive/TLUtils.pm
@@ -65,6 +65,7 @@ C<TeXLive::TLUtils> -- utilities used in the TeX Live infrastructure
TeXLive::TLUtils::texdir_check($texdir);
TeXLive::TLUtils::kpsewhich;
TeXLive::TLUtils::conv_to_win_path($path);
+ TeXLive::TLUtils::give_ctan_mirror($path);
=head1 DESCRIPTION
@@ -113,6 +114,7 @@ BEGIN {
&process_logging_options
&welcome
&welcome_paths
+ &give_ctan_mirror
);
@EXPORT = qw(setup_programs download_file info log debug ddebug tlwarn process_logging_options win32);
}
@@ -1426,10 +1428,26 @@ sub give_ctan_mirror {
my $wget = $::progs{'wget'};
if (!defined($wget)) {
tlwarn("programs not set up, trying wget\n");
+ $wget = "wget";
}
-
-
+ if (win32()) {
+ $cmd = "$wget http://mirror.ctan.org -O nul 2>&1";
+ } else {
+ $cmd = "$wget http://mirror.ctan.org -O /dev/null 2>&1";
+ }
+ my @out = `$cmd`;
+ # now analyze the output
+ my $mirror = "http://mirror.ctan.org/systems/texlive/tlnet/tldev/";
+ foreach (@out) {
+ if (m/^Location: (\S*)\s*.*$/) {
+ $mirror = "$1" . "/systems/texlive/tlnet/tldev";
+ last;
+ }
+ }
+ # if we cannot find a mirror, return the mirror.ctan.org itself
+ return($mirror);
}
+
#############################################
#
# Taken from Text::ParseWords