summaryrefslogtreecommitdiff
path: root/Master/install-tl
diff options
context:
space:
mode:
authorNorbert Preining <preining@logic.at>2011-09-13 01:18:50 +0000
committerNorbert Preining <preining@logic.at>2011-09-13 01:18:50 +0000
commit8403bdd44f7afb2d9b199f310f21f7d757d4d03f (patch)
tree60a656a6bbf1000344058dda3a793e890e9dbb53 /Master/install-tl
parent3872da8466c31b1cedc8fbf2c43edc1fb720d63d (diff)
support selecting a mirror in all the installers
git-svn-id: svn://tug.org/texlive/trunk@23929 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/install-tl')
-rwxr-xr-xMaster/install-tl313
1 files changed, 186 insertions, 127 deletions
diff --git a/Master/install-tl b/Master/install-tl
index 19602586cd3..05b239b7d5d 100755
--- a/Master/install-tl
+++ b/Master/install-tl
@@ -163,6 +163,7 @@ my $opt_version = 0;
my $opt_force_arch;
my $opt_persistent_downloads = 1;
my $opt_allow_ftp = 0;
+$::opt_select_repository = 0;
# show all options even those not relevant for that arch
$::opt_all_options = 0;
@@ -217,6 +218,7 @@ GetOptions(
"scheme=s" => \$opt_scheme,
"all-options" => \$::opt_all_options,
"persistent-downloads!" => \$opt_persistent_downloads,
+ "select-repository" => \$::opt_select_repository,
"version" => \$opt_version,
"help|?" => \$opt_help) or pod2usage(1);
@@ -373,142 +375,44 @@ if (!$opt_custom_bin && (platform() eq "i386-cygwin")) {
}
}
-if (!setup_programs ("$::installerdir/tlpkg/installer", "$::_platform_")) {
- tldie("$0: Goodbye.\n");
-}
-
-# determine where we will find the distribution to install from.
-#
-$location = $opt_location;
-$location || ($location = "$::installerdir");
-if ($location =~ m!^(ctan$|(http|ftp)://)!i) {
- $location =~ s,/(tlpkg|archive)?/*$,,; # remove any trailing tlpkg or /
- if ($location =~ m/^ctan$/i) {
- $location = TeXLive::TLUtils::give_ctan_mirror();
- } elsif ($location =~ m/^$TeXLiveServerURL/) {
- my $mirrorbase = TeXLive::TLUtils::give_ctan_mirror_base();
- $location =~ s,^($TeXLiveServerURL|ctan$),$mirrorbase,;
- }
- $TeXLiveURL = $location;
- $media = 'NET';
- @media_available = qw/NET/;
-} else {
- # remove leading file:/+ part
- $location =~ s!^file://*!/!i;
- $location = abs_path($location);
+# determine which media are available, don't put NET here, it is
+# assumed to be available at any time
+{
+ # check the installer dir for what is present
+ my $tmp = $::installerdir;
+ $tmp = abs_path($tmp);
# remove trailing \ or / (e.g. root of dvd drive on w32)
- $location =~ s,[\\\/]$,,;
- if (-d "$location/$Archive") {
- push @media_available, 'local_compressed';
+ $tmp =~ s,[\\\/]$,,;
+ if (-d "$tmp/$Archive") {
+ push @media_available, "local_compressed#$tmp";
}
-
- if (-d "$location/texmf/web2c") {
- push @media_available, 'local_uncompressed';
+ if (-d "$tmp/texmf/web2c") {
+ push @media_available, "local_uncompressed#$tmp";
}
+}
- if (member('local_compressed', @media_available)) {
- $media = 'local_compressed';
- # for in_place option we want local_uncompressed media
- $media = 'local_uncompressed' if $opt_in_place &&
- member('local_uncompressed', @media_available);
- } elsif (member('local_uncompressed', @media_available)) {
- $media = 'local_uncompressed';
+# check command line arguments if given
+if ($opt_location) {
+ my $tmp = $opt_location;
+ if ($tmp =~ m!^(http|ftp)://!i) {
+ push @media_available, "NET#$tmp";
} else {
- if ($opt_location) {
- # user gave a --location but nothing can be found there, so die
- die "$0: cannot find installation source at $opt_location.\n";
+ # remove leading file:/+ part
+ $tmp =~ s!^file://*!/!i;
+ $tmp = abs_path($tmp);
+ # remove trailing \ or / (e.g. root of dvd drive on w32)
+ $tmp =~ s,[\\\/]$,,;
+ if (-d "$tmp/$Archive") {
+ push @media_available, "local_compressed#$tmp";
+ }
+ if (-d "$tmp/texmf/web2c") {
+ push @media_available, "local_uncompressed#$tmp";
}
- # no --location given, but NET installation
- $TeXLiveURL = $location = TeXLive::TLUtils::give_ctan_mirror();
- $media = 'NET';
- }
-}
-info("Installing TeX Live $TeXLive::TLConfig::ReleaseYear from: $location\n");
-
-info("Platform: ", platform(), " => \'", platform_desc(platform), "\'\n");
-if ($opt_custom_bin) {
- if (-d $opt_custom_bin && (-r "$opt_custom_bin/kpsewhich"
- || -r "$opt_custom_bin/kpsewhich.exe")) {
- info("Platform overridden, binaries taken from $opt_custom_bin\n"
- . "and will be installed into .../bin/custom.\n");
- } else {
- tldie("$opt_custom_bin: Argument to -custom-bin must be a directory "
- . "with TeX Live binaries.\n");
}
}
-if ($media eq "local_uncompressed") {
- info("Distribution: live (uncompressed)\n");
-} elsif ($media eq "local_compressed") {
- info("Distribution: inst (compressed)\n");
-} elsif ($media eq "NET") {
- info("Distribution: net (downloading)\n");
- info("Using URL: $TeXLiveURL\n");
- TeXLive::TLUtils::setup_persistent_downloads() if $opt_persistent_downloads;
-} else {
- info("Distribution: $media\n");
-}
-info("Directory for temporary files: $system_tmpdir\n");
-
-if ($opt_in_place and ($media ne "local_uncompressed")) {
- print "TeX Live not local or not decompressed; 'in_place' option not applicable\n";
- $opt_in_place = 0;
-} elsif ($opt_in_place and (!TeXLive::TLUtils::texdir_check($::installerdir))) {
- print "Installer dir not writable; 'in_place' option not applicable\n";
- $opt_in_place = 0;
-}
-$vars{'in_place'} = $opt_in_place;
-$opt_scheme = "" if $opt_in_place;
-$vars{'portable'} = $opt_portable;
-
-load_tlpdb();
-
-log("Installer revision: $::installerrevision\n");
-log("Database revision: " . $tlpdb->config_revision . "\n");
-
-# correctly set the splitting support
-# for local_uncompressed we always support splitting
-if (($media eq "NET") || ($media eq "local_compressed")) {
- $vars{'src_splitting_supported'} = $tlpdb->config_src_container;
- $vars{'doc_splitting_supported'} = $tlpdb->config_doc_container;
-}
-$texlive_release = $tlpdb->config_release;
-if ($media eq "local_uncompressed") {
- # existing installation may not have 00texlive.config metapackage
- # so use TLConfig to establish what release we have
- $texlive_release ||= $TeXLive::TLConfig::ReleaseYear;
-}
-
-# if the release from the remote TLPDB does not agree with the
-# TLConfig::ReleaseYear in the first 4 places break out here.
-# Why only the first four places: some optional network distributions
-# might use
-# release/2009-foobar
-if ($media eq "NET"
- && $texlive_release !~ m/^$TeXLive::TLConfig::ReleaseYear/) {
- die <<END_MISMATCH;
-$0: The TeX Live versions of the local installation
-and the repository being accessed are not compatible:
- local: $TeXLive::TLConfig::ReleaseYear
- repository: $texlive_release
-Perhaps you need to use a different CTAN mirror?
-END_MISMATCH
-}
-set_platforms_supported();
-set_texlive_default_dirs();
-set_install_platform();
-initialize_collections();
-
-# initialize the scheme from the command line value, if given.
-if ($opt_scheme) {
- # add the scheme- prefix if they didn't give it.
- $opt_scheme = "scheme-$opt_scheme" if $opt_scheme !~ /^scheme-/;
- my $scheme = $tlpdb->get_package($opt_scheme);
- if (defined($scheme)) {
- select_scheme($opt_scheme); # select it
- } else {
- tlwarn("Scheme $opt_scheme not defined, ignoring it.\n");
- }
+if (!setup_programs ("$::installerdir/tlpkg/installer", "$::_platform_")) {
+ tldie("$0: Goodbye.\n");
}
@@ -622,6 +526,153 @@ exit(0);
#
###################################################################
+#
+# SETUP OF REMOTE STUFF
+#
+# this is now a sub since it is called from the ui plugins on demand
+# this allows selecting a mirror first and then continuing
+
+sub only_load_remote {
+ my $selected_location = shift;
+
+ # determine where we will find the distribution to install from.
+ #
+ $location = $opt_location;
+ $location = $selected_location if defined($selected_location);
+ $location || ($location = "$::installerdir");
+ if ($location =~ m!^(ctan$|(http|ftp)://)!i) {
+ $location =~ s,/(tlpkg|archive)?/*$,,; # remove any trailing tlpkg or /
+ if ($location =~ m/^ctan$/i) {
+ $location = TeXLive::TLUtils::give_ctan_mirror();
+ } elsif ($location =~ m/^$TeXLiveServerURL/) {
+ my $mirrorbase = TeXLive::TLUtils::give_ctan_mirror_base();
+ $location =~ s,^($TeXLiveServerURL|ctan$),$mirrorbase,;
+ }
+ $TeXLiveURL = $location;
+ $media = 'NET';
+ } else {
+ if (scalar grep($_ =~ m/^local_compressed/, @media_available)) {
+ $media = 'local_compressed';
+ # for in_place option we want local_uncompressed media
+ $media = 'local_uncompressed' if $opt_in_place &&
+ member('local_uncompressed', @media_available);
+ } elsif (scalar grep($_ =~ m/^local_uncompressed/, @media_available)) {
+ $media = 'local_uncompressed';
+ } else {
+ if ($opt_location) {
+ # user gave a --location but nothing can be found there, so die
+ die "$0: cannot find installation source at $opt_location.\n";
+ }
+ # no --location given, but NET installation
+ $TeXLiveURL = $location = TeXLive::TLUtils::give_ctan_mirror();
+ $media = 'NET';
+ }
+ }
+ load_tlpdb();
+}
+
+
+sub do_remote_init {
+ only_load_remote(@_);
+ if (!do_version_agree()) {
+ TeXLive::TLUtils::tldie <<END_MISMATCH;
+$0: The TeX Live versions of the local installation
+and the repository being accessed are not compatible:
+ local: $TeXLive::TLConfig::ReleaseYear
+ repository: $texlive_release
+Perhaps you need to use a different CTAN mirror?
+END_MISMATCH
+ }
+ final_remote_init();
+}
+
+sub do_version_agree {
+ $texlive_release = $tlpdb->config_release;
+ if ($media eq "local_uncompressed") {
+ # existing installation may not have 00texlive.config metapackage
+ # so use TLConfig to establish what release we have
+ $texlive_release ||= $TeXLive::TLConfig::ReleaseYear;
+ }
+
+ # if the release from the remote TLPDB does not agree with the
+ # TLConfig::ReleaseYear in the first 4 places break out here.
+ # Why only the first four places: some optional network distributions
+ # might use
+ # release/2009-foobar
+ if ($media eq "NET"
+ && $texlive_release !~ m/^$TeXLive::TLConfig::ReleaseYear/) {
+ return 0;
+ } else {
+ return 1;
+ }
+}
+
+sub final_remote_init {
+ info("Installing TeX Live $TeXLive::TLConfig::ReleaseYear from: $location\n");
+
+ info("Platform: ", platform(), " => \'", platform_desc(platform), "\'\n");
+ if ($opt_custom_bin) {
+ if (-d $opt_custom_bin && (-r "$opt_custom_bin/kpsewhich"
+ || -r "$opt_custom_bin/kpsewhich.exe")) {
+ info("Platform overridden, binaries taken from $opt_custom_bin\n"
+ . "and will be installed into .../bin/custom.\n");
+ } else {
+ tldie("$opt_custom_bin: Argument to -custom-bin must be a directory "
+ . "with TeX Live binaries.\n");
+ }
+ }
+ if ($media eq "local_uncompressed") {
+ info("Distribution: live (uncompressed)\n");
+ } elsif ($media eq "local_compressed") {
+ info("Distribution: inst (compressed)\n");
+ } elsif ($media eq "NET") {
+ info("Distribution: net (downloading)\n");
+ info("Using URL: $TeXLiveURL\n");
+ TeXLive::TLUtils::setup_persistent_downloads() if $opt_persistent_downloads;
+ } else {
+ info("Distribution: $media\n");
+ }
+ info("Directory for temporary files: $system_tmpdir\n");
+
+ if ($opt_in_place and ($media ne "local_uncompressed")) {
+ print "TeX Live not local or not decompressed; 'in_place' option not applicable\n";
+ $opt_in_place = 0;
+ } elsif ($opt_in_place and (!TeXLive::TLUtils::texdir_check($::installerdir))) {
+ print "Installer dir not writable; 'in_place' option not applicable\n";
+ $opt_in_place = 0;
+ }
+ $vars{'in_place'} = $opt_in_place;
+ $opt_scheme = "" if $opt_in_place;
+ $vars{'portable'} = $opt_portable;
+
+ log("Installer revision: $::installerrevision\n");
+ log("Database revision: " . $tlpdb->config_revision . "\n");
+
+ # correctly set the splitting support
+ # for local_uncompressed we always support splitting
+ if (($media eq "NET") || ($media eq "local_compressed")) {
+ $vars{'src_splitting_supported'} = $tlpdb->config_src_container;
+ $vars{'doc_splitting_supported'} = $tlpdb->config_doc_container;
+ }
+ set_platforms_supported();
+ set_texlive_default_dirs();
+ set_install_platform();
+ initialize_collections();
+
+ # initialize the scheme from the command line value, if given.
+ if ($opt_scheme) {
+ # add the scheme- prefix if they didn't give it.
+ $opt_scheme = "scheme-$opt_scheme" if $opt_scheme !~ /^scheme-/;
+ my $scheme = $tlpdb->get_package($opt_scheme);
+ if (defined($scheme)) {
+ select_scheme($opt_scheme); # select it
+ } else {
+ tlwarn("Scheme $opt_scheme not defined, ignoring it.\n");
+ }
+ }
+}
+
+
sub do_installation {
install_warnlines_hook();
if (win32()) {
@@ -2076,6 +2127,14 @@ will be adjusted accordingly.
For backward compatibility and convenience, C<--location> and C<--repo>
are accepted as aliases for this option.
+=item B<-select-repository>
+
+In case the automatic mirror selection does not work out well, giving this
+option allows to select a mirror from the current list of CTAN mirrors.
+This option is supported in all installer modes (text, wizard, perltk)
+and will also offer to install from local media if found, and from
+a repository specified on the command line (see above).
+
=item B<-all-options>
Normally options not regarding the current platform are not shown.