diff options
author | Norbert Preining <preining@logic.at> | 2008-06-29 06:38:07 +0000 |
---|---|---|
committer | Norbert Preining <preining@logic.at> | 2008-06-29 06:38:07 +0000 |
commit | b352a643c267d8b2216b9f9f0048f439cbac190b (patch) | |
tree | 67504f2449be2b6241b041aab6705f23ff3037b5 /Master/tlpkg/TeXLive/TLUtils.pm | |
parent | e146530572262a4218bd5a4f0d396f3d4635239a (diff) |
fix on one mirror, and allow restart, really
git-svn-id: svn://tug.org/texlive/trunk@9081 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/tlpkg/TeXLive/TLUtils.pm')
-rw-r--r-- | Master/tlpkg/TeXLive/TLUtils.pm | 22 |
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 |