From b352a643c267d8b2216b9f9f0048f439cbac190b Mon Sep 17 00:00:00 2001 From: Norbert Preining Date: Sun, 29 Jun 2008 06:38:07 +0000 Subject: fix on one mirror, and allow restart, really git-svn-id: svn://tug.org/texlive/trunk@9081 c570f23f-e606-0410-a88d-b1316a301751 --- Master/install-tl | 30 ++++++++++++++++++++++-------- Master/tlpkg/TeXLive/TLUtils.pm | 22 ++++++++++++++++++++-- 2 files changed, 42 insertions(+), 10 deletions(-) diff --git a/Master/install-tl b/Master/install-tl index 319394c3716..10e8ba68d8d 100755 --- a/Master/install-tl +++ b/Master/install-tl @@ -139,10 +139,6 @@ our %vars=( # 'n_' means 'number of'. 'from_dvd' => 0, ); -# -# first process verbosity/quiet options -process_logging_options(); - # option handling my $opt_media = ""; my $opt_from_dvd = ""; @@ -157,10 +153,25 @@ my $opt_help = 0; my $opt_version = 0; my $opt_gui = 0; $opt_gui = 1 if (win32); - # default language for GUI installer $::lang = "en"; + +# if we find a file installation.profile we ask the user whether we should +# continue with the installation +# note, we are in the installer directory! +if (-r "installation.profile") { + print "ABORTED INSTALLATION FOUND: $localpath/installation.profile!!!\n"; + print "Do you want to continue with the exact same settings as before (y/N): "; + my $answer = ; + if ($answer =~ m/^y(es)?$/i) { + $opt_profile = "installation.profile"; + } +} + +# first process verbosity/quiet options +process_logging_options(); +# now the others GetOptions("media=s" => \$opt_media, "from_dvd" => \$opt_from_dvd, "profile=s"=> \$opt_profile, @@ -223,9 +234,6 @@ if ("$opt_profile" ne "") { if ($opt_nonadmin and win32()) { non_admin(); } -if ("$opt_url" ne "") { - $TeXLiveURL = "$opt_url"; -} # the TLPDB instances we will use. $tlpdb is for the one from the installation # media, while $localtlpdb is for the new installation @@ -317,6 +325,12 @@ if ($opt_from_dvd and ($::_media_ ne "DVD")) { $vars{'from_dvd'} = $opt_from_dvd; setup_programs("$::installerdir/tlpkg/installer", "$::_platform_"); +if ("$opt_url" ne "") { + $TeXLiveURL = "$opt_url"; +} else { + $TeXLiveURL = TeXLive::TLUtils::give_ctan_mirror(); +} +info("Using URL $TeXLiveURL\n"); load_tlpdb(); log("Installer revision: $::installerrevision\n"); 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 -- 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 -- cgit v1.2.3