summaryrefslogtreecommitdiff
path: root/Master/install-tl.pl
diff options
context:
space:
mode:
authorReinhard Kotucha <reinhard.kotucha@web.de>2007-11-05 00:53:29 +0000
committerReinhard Kotucha <reinhard.kotucha@web.de>2007-11-05 00:53:29 +0000
commit72576dcfe456f34434be26c0893dd8b87d40e38b (patch)
tree7abd2f334340941edc8c7344997ec9d2ef5d2788 /Master/install-tl.pl
parent5ab4e5094615179493741c7a1cec617193408724 (diff)
TLUtils.pm: fixed $0 for Windows and architectures stuff.
install-tl.pl: Menus, platform detection, dependencies... git-svn-id: svn://tug.org/texlive/trunk@5349 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/install-tl.pl')
-rwxr-xr-xMaster/install-tl.pl330
1 files changed, 193 insertions, 137 deletions
diff --git a/Master/install-tl.pl b/Master/install-tl.pl
index 3048bb5d3de..9d5e92bbdcf 100755
--- a/Master/install-tl.pl
+++ b/Master/install-tl.pl
@@ -11,17 +11,18 @@ $texlive_release="2007";
BEGIN {
$^W = 1;
- ($thisdir=$0)=~s/(.*)\/.*/$1/;
+ my $me=$0;
+ $me=~s!\\!/!g if $^O=~/^MSWin(32|64)$/i;
+ ($thisdir=$me)=~s!(.*)/.*$!$1!;
unshift (@INC, "$thisdir/tlpkg");
}
use TeXLive::TLUtils qw(initialize_installer media platform platform_desc
- which getenv win32 unix program_exists binaries_available_from_disk
- binaries_available_from_net get_system_tmpdir);
+ which getenv win32 unix program_exists architectures_available
+ additional_architectures_available_from_net get_system_tmpdir member);
use TeXLive::TLPOBJ;
use TeXLive::TLPDB;
-
$default_scheme='scheme-full';
###$texlive_url='http://localhost/texlive/Contents/inst';
@@ -56,29 +57,24 @@ sub dump_vars {
}
-# Determine which platforms are supported. This code should be
-# revised later.
+# Determine which platforms are supported.
$trynet=0;
sub set_platforms_supported {
- if (media=~/(CD|DVD)/) {
- my @binaries=binaries_available_from_disk;
- for my $binary (@binaries) {
- unless (defined $vars{"diskbin_$binary"}) {
- $vars{"diskbin_$binary"}=0;
- }
+ my @binaries=architectures_available;
+ for my $binary (@binaries) {
+ unless (defined $vars{"diskbin_$binary"}) {
+ $vars{"diskbin_$binary"}=0;
}
}
- if (media eq 'NET' or $trynet==1) {
- print "\nLoading '$texlive_url/texlive.tlpdb' ...\n";
- my @binaries=binaries_available_from_net;
+ if ($trynet==1) {
+ my @binaries=additional_architectures_available_from_net \%vars;
for my $binary (@binaries) {
- unless (defined $vars{"diskbin_$binary"}) {
- $vars{"netbin_$binary"}=0;
- }
+ $vars{"netbin_$binary"}=0;
}
}
}
+
# Environment variables and default values on UNIX:
# TEXLIVE_INSTALL_PREFIX /usr/local/texlive => $tex_prefix
# TEXLIVE_INSTALL_TEXDIR $tex_prefix/2007 => $TEXDIR
@@ -129,14 +125,12 @@ sub set_texlive_default_dirs {
'n_collections_selected' => 0,
'n_collections_available' => 0,
'total_size' => 0,
- 'o_altfontdir' => 0,
- 'altfontdir' => "$system_tmpdir/texfonts",
- 'o_symlinks' => 0,
+ 'option_symlinks' => 0,
'sys_bin' => '/usr/local/bin',
'sys_man' => '/usr/local/man',
'sys_info' => '/usr/local/info',
- 'o_doc' => 1,
- 'o_src' => 1,
+ 'option_doc' => 1,
+ 'option_src' => 1,
'selected_scheme' => $default_scheme,
);
@@ -178,6 +172,8 @@ sub other_options {
my %opts=(
'-' => 'deselect all',
'+' => 'select all',
+ 'H' => 'help',
+ 'I' => 'start installation',
'N' => 'add binaries from net',
'R' => 'return to main menu',
'Q' => 'quit'
@@ -233,7 +229,7 @@ sub initialize_collections {
my $scheme_tlpobj = $tlpdb->get_package($default_scheme);
if (defined ($scheme_tlpobj)) {
foreach my $dependent ($scheme_tlpobj->depends) {
- if ($dependent=~/.*(collection-.*)/) {
+ if ($dependent=~/^(collection-.*)/) {
$vars{"$1"}=1;
}
}
@@ -241,40 +237,51 @@ sub initialize_collections {
}
}
-# If we are on the CD and we want to download binaries for additional
-# platforms, we need a second database which provides information
-# about binary systems which can be downloaded from net but are not on
-# the DVD, at least if we decide to support this.
-#sub load_tlpdb_net {
-# my $database;
-# $database='http://www.tug.org/svn/texlive/trunk/Master/texlive.tlpdb';
-# $::tlpdb_net=TeXLive::TLPDB->new(location => "$database");
-#}
+sub set_install_platform {
+ my @available_platforms;
+ my $detected_platform=platform;
+ my $warn_nobin;
+ my $warn_nobin_x86_64_linux;
+ my $nowarn="";
+ my $wp='##'; # warning prefix
+
+ $warn_nobin="\n$wp WARNING! No binaries for your platform found! ";
+ if (media eq 'CD') {
+ $warn_nobin.="More binaries are available\n$wp on the DVD. The binary "
+ . "systems menu allows you to download extra binaries\n"
+ . "$wp from the network.\n";
+ }
+ $warn_nobin_x86_64_linux="$warn_nobin" .
+ "$wp No binaries for x86_64-linux found, using i386-linux instead.\n";
+
+ if (defined $vars{"diskbin_$detected_platform"}) {
+ $vars{"diskbin_$detected_platform"}=1;
+ $vars{'inst_platform'}=$detected_platform;
+ return $nowarn;
+ } elsif (defined $vars{"netbin_$detected_platform"}) {
+ $vars{"netbin_$detected_platform"}=1;
+ $vars{'inst_platform'}=$detected_platform;
+ return $nowarn;
+ } elsif ($detected_platform eq 'x86_64-linux') {
+ $vars{'diskbin_i386-linux'}=1;
+ $vars{'inst_platform'}='i386-linux';
+ return $warn_nobin_x86_64_linux;
+ } else {
+ return $warn_nobin;
+ }
+}
# The menu loop. A menu is a function. Its return value is a
# reference to another menu or to itself.
sub run_menu {
my $menu=\&main_menu;
- while (1) {
+ while ($menu!=\&install) {
$menu=$menu->();
}
}
-# Not yet implemented. Will probably go away.
-sub platform_menu {
- my %command=(
- 'self' => \&platform_menu,
- 'R' => \&main_menu,
- 'Q' => \&quit
- );
- print "<<<<< PLATFORM MENU >>>>>>\n";
-
- return $command{'R'}->();
-}
-
-
sub binary_menu {
my %command=(
'self' => \&binary_menu,
@@ -305,6 +312,8 @@ sub binary_menu {
}
my @binaries=sort(@diskbins,@netbins);
+ set_install_platform;
+
$vars{'n_systems_available'}=0;
for my $key (keys %vars) {
++$vars{'n_systems_available'} if ($key=~/^(disk|net)bin/);
@@ -384,7 +393,6 @@ sub scheme_menu {
my @keys=string_to_list "abcdefghijklmnopstuvwxyz";
my %keyval;
my $index=0;
-
menu_head 'Select a scheme:';
@@ -414,7 +422,7 @@ sub scheme_menu {
my $scheme_tlpobj = $tlpdb->get_package($vars{'selected_scheme'});
if (defined ($scheme_tlpobj)) {
foreach my $dependent ($scheme_tlpobj->depends) {
- if ($dependent=~/.*(collection-.*)/) {
+ if ($dependent=~/^(collection-.*)/) {
$vars{"$1"}=1;
}
}
@@ -446,40 +454,54 @@ sub collection_menu {
my @keys=string_to_list "abcdefghijklmnopstuvwxyzABCDEFGHIJKLMNOPSTUVWXYZ";
my %keyval;
my $index=0;
+ my @coll_short_desc;
+ my @coll_long_desc;
menu_head 'Select collections:';
@collections=sort @collections_std;
+ foreach my $collection (@collections) {
+ my $tlpobj = $tlpdb->get_package("$collection");
+ if (length $tlpobj->shortdesc>30) {
+ push @coll_long_desc, $collection;
+ } else {
+ push @coll_short_desc, $collection;
+ }
+ }
+ my $singlecolumn_index=@coll_short_desc-1;
+
##<cols=2>
- my $lines=@collections/2;
- ++$lines if (@collections%2);
- for my $index (0..$lines-1) {
- my $collection=$collections[$index];
+ my $lines=@coll_short_desc/2;
+ ++$lines if (@coll_short_desc%2);
+ for (0..$lines-1) {
+ $index=$_;
+ my $collection=$coll_short_desc[$index];
my $tlpobj = $tlpdb->get_package("$collection");
$keyval{$keys[$index]}="$collection";
printf " %s %s %-33s", $keys[$index], button($vars{"$collection"}),
substr($tlpobj->shortdesc,0,33);
- if (defined $collections[$index+$lines]) {
- my $collection=$collections[$index+$lines];
- my $tlpobj = $tlpdb->get_package("$collection");
+ if (defined $coll_short_desc[$index+$lines]) {
+ my $collection=$coll_short_desc[$index+$lines];
+ my $tlpobj=$tlpdb->get_package("$collection");
$keyval{$keys[$index+$lines]}="$collection";
- printf " %s %s %-33s\n", $keys[$index+$lines],
- button($vars{"$collection"}), substr($tlpobj->shortdesc,0,33);
+ printf " %s %s %-32s\n", $keys[$index+$lines],
+ button($vars{"$collection"}), substr($tlpobj->shortdesc,0,32);
} else {
print "\n";
}
+ }
##</cols=2>
-
-##<cols=1>
-# foreach my $collection (@collections) {
-# my $tlpobj = $tlpdb->get_package("$collection");
-# $keyval{$keys[$index]}="$collection";
-# printf " %s %s %s\n", $keys[$index], button($vars{"$collection"}),
-# $tlpobj->shortdesc;
-# ++$index;
-##</cols=1>
+ $index=$singlecolumn_index;
+# print "\n$index\n\n";
+ foreach my $collection (@coll_long_desc) {
+ my $tlpobj=$tlpdb->get_package("$collection");
+ $keyval{$keys[$index+1]}="$collection";
+ printf " %s %s %s\n", $keys[$index+1], button($vars{"$collection"}),
+ $tlpobj->shortdesc;
+ ++$index;
}
+##</cols=1>
other_options qw(- + R Q);
my $answer=prompt 'Press key to select collections';
@@ -530,7 +552,6 @@ sub language_menu {
@languages=sort @collections_lang;
@lang_docs=sort @collections_lang_doc;
-##<cols=2>
$lines=@languages/2;
++$lines if (@languages%2);
for my $index (0..$lines-1) {
@@ -548,22 +569,10 @@ sub language_menu {
} else {
print "\n";
}
-##</cols=2>
-
-##<cols=1>
-# foreach my $language (@languages) {
-# my $tlpobj = $tlpdb->get_package("$language");
-# $keyval{$lang_keys[$lang_index]}="$language";
-# printf " %s %s %s\n", $lang_keys[$lang_index],
-# button($vars{"$language"}),
-# $tlpobj->shortdesc;
-# ++$lang_index;
-##</cols=1>
}
print "\nLanguage specific documentation. Select languages first.\n\n";
-##<cols=2>
$lines=@lang_docs/2;
++$lines if (@lang_docs%2);
for my $index (0..$lines-1) {
@@ -581,17 +590,6 @@ sub language_menu {
} else {
print "\n";
}
-##</cols=2>
-
-##<cols=1>
-# foreach my $lang_docs (@lang_docs) {
-# my $tlpobj = $tlpdb->get_package("$lang_docs");
-# $keyval{$lang_doc_keys[$lang_doc_index]}="$lang_docs";
-# printf " %s %s %s\n", $lang_doc_keys[$lang_doc_index],
-# button($vars{"$lang_docs"}),
-# $tlpobj->shortdesc;
-# ++$lang_doc_index;
-##</cols=1>
}
other_options qw (+ - R Q);
@@ -690,20 +688,17 @@ EOF
sub options_menu {
- my $b_altfontdir=button($vars{'o_altfontdir'});
- my $b_symlinks=button($vars{'o_symlinks'});
- my $b_doc=button($vars{'o_doc'});
- my $b_src=button($vars{'o_src'});
+ my $b_symlinks=button($vars{'option_symlinks'});
+ my $b_doc=button($vars{'option_doc'});
+ my $b_src=button($vars{'option_src'});
- my $altfontdir=$vars{'altfontdir'};
my $sys_bin=$vars{'sys_bin'};
my $sys_man=$vars{'sys_man'};
my $sys_info=$vars{'sys_info'};
- my $t_altfontdir=($vars{'o_altfontdir'})? $vars{'altfontdir'}:'';
- my $t_sys_bin=($vars{'o_symlinks'})? $vars{'sys_bin'}:'';
- my $t_sys_man=($vars{'o_symlinks'})? $vars{'sys_man'}:'';
- my $t_sys_info=($vars{'o_symlinks'})? $vars{'sys_info'}:'';
+ my $t_sys_bin=($vars{'option_symlinks'})? $vars{'sys_bin'}:'';
+ my $t_sys_man=($vars{'option_symlinks'})? $vars{'sys_man'}:'';
+ my $t_sys_info=($vars{'option_symlinks'})? $vars{'sys_info'}:'';
my %command=(
'self' => \&options_menu,
@@ -714,11 +709,6 @@ sub options_menu {
clear_screen;
menu_head "Current options setup:";
- print <<"EOF";
- <A> alternate directory for automatically generated fonts: $b_altfontdir
- directory name: $t_altfontdir
-EOF
-;
if (unix) {
print <<"EOF";
<L> create symlinks in standard directories: $b_symlinks
@@ -737,19 +727,10 @@ EOF
other_options qw(R Q);
my $answer=prompt 'Enter command';
- if ("\u$answer" eq 'A') {
- toggle 'o_altfontdir';
- if ($vars{'o_altfontdir'}) {
- print "New value for alternate directory [$altfontdir]: ";
- chomp($answer=<STDIN>);
- $vars{'altfontdir'}="$answer" if (length $answer);
- }
- return $command{'self'};
- }
if (unix) {
if ("\u$answer" eq 'L') {
- toggle 'o_symlinks';
- if ($vars{'o_symlinks'}) {
+ toggle 'option_symlinks';
+ if ($vars{'option_symlinks'}) {
print "New value for binary directory [$sys_bin]: ";
chomp($answer=<STDIN>);
$vars{'sys_bin'}="$answer" if (length $answer);
@@ -770,11 +751,11 @@ EOF
}
}
if ("\u$answer" eq 'S') {
- toggle 'o_src';
+ toggle 'option_src';
return $command{'self'};
}
if ("\u$answer" eq 'D') {
- toggle 'o_doc';
+ toggle 'option_doc';
return $command{'self'};
}
if (defined $command{"\u$answer"}) {
@@ -784,9 +765,6 @@ EOF
}
}
-sub install {
- print "<<<<< install >>>>>>\n";
-}
sub quit {
dump_vars;
@@ -796,17 +774,19 @@ sub quit {
sub main_menu {
my $this_platform=platform_desc($vars{'this_platform'});
- my $b_symlinks=button($vars{'o_symlinks'});
- my $b_altfontdir=button($vars{'o_altfontdir'});
- my $b_doc=button($vars{'o_doc'});
- my $b_src=button($vars{'o_src'});
- my $t_altfontdir=($vars{'o_altfontdir'})? "($vars{'altfontdir'})":'';
+ my $b_symlinks=button($vars{'option_symlinks'});
+ my $b_doc=button($vars{'option_doc'});
+ my $b_src=button($vars{'option_src'});
+
+ my $warn_nobin;
$vars{'n_systems_available'}=0;
for my $key (keys %vars) {
++$vars{'n_systems_available'} if ($key=~/^(disk|net)bin/);
}
+ $warn_nobin=set_install_platform;
+
$vars{'n_systems_selected'}=0;
$vars{'n_collections_selected'}=0;
foreach my $key (keys %vars) {
@@ -840,36 +820,38 @@ sub main_menu {
=======> for commands or configurable options <=======
Proposed platform: $this_platform
- warn_nobin
- <P> over-ride system detection and choose platform
+ $warn_nobin
<B> binary systems: $vars{'n_systems_selected'} out of $vars{'n_systems_available'}
+
<S> Installation scheme ($vars{'selected_scheme'})
- [customizing installation scheme:
- <C> standard collections <L> language collections]
- $vars{'n_collections_selected'} out of $vars{'n_collections_available'}, disk space required: $vars{'total_size'} MB
+
+ Customizing installation scheme:
+ <C> standard collections
+ <L> language collections
+ $vars{'n_collections_selected'} collections out of $vars{'n_collections_available'}, disk space required: $vars{'total_size'} MB
+
<D> directories:
TEXDIR (The main TeX directory) : $vars{'TEXDIR'}
TEXMFLOCAL (Directory for local styles etc): $vars{'TEXMFLOCAL'}
TEXMFSYSVAR (Directory for local config) : $vars{'TEXMFSYSVAR'}
+
<O> options:
- $b_altfontdir alternate directory for generated fonts $t_altfontdir
EOF
;
print <<"EOF" if (unix);
$b_symlinks create symlinks in standard directories
EOF
;
- print <<"EOF";
+print <<"EOF";
$b_doc install macro/font doc tree
$b_src install macro/font source tree
- <I> start installation
- <H> help, <Q> quit
EOF
;
- print 'Enter command: ';
+ other_options qw (I H Q);
+ my $answer=prompt 'Enter command';
- chomp(my $answer=<STDIN>);
+# chomp(my $answer=<STDIN>);
if (defined $command{"\u$answer"}) {
return $command{"\u$answer"};
} else {
@@ -878,11 +860,85 @@ EOF
}
+sub calc_depends {
+ # First look for packages in the selected scheme.
+
+ my $scheme=$tlpdb->get_package($vars{'selected_scheme'});
+
+ for my $scheme_content ($scheme->depends) {
+ $install{"$scheme_content"}=1 unless ($scheme_content=~/^collection-/);
+ }
+
+ # Now look for collections in the %vars hash. These are not
+ # necessarily the collections required by a scheme. The final
+ # decision is made in the collections/languages menu.
+
+ my @collections;
+
+ foreach my $key (keys %vars) {
+ if ($key=~/^collection-/) {
+ push @collections, $key if $vars{$key};
+ }
+ }
+# printf "%d collections\n", @collections+0;
+
+ # Now we look for packages in collections. A collection can contain
+ # other collections. In this case we push it to the @collections
+ # list if it doesn't exist already.
+
+ foreach my $selected_collection (@collections) {
+ my $collection=$tlpdb->get_package($selected_collection);
+
+ for my $collection_content ($collection->depends) {
+ if ($collection_content=~/^collection-/) {
+ push @collections, $collection_content
+ unless member $collection_content, @collections;
+ } else {
+ $install{"$collection_content"}=1;
+ }
+ }
+ }
+# printf "%d\n", @collections+0;
+# print "---------------\n";
+# foreach my $pkg (keys %install) {
+# print "Package $pkg\n";
+# }
+# print "---------------\n";
+# foreach my $col (@collections) {
+# print "$col\n";
+# }
+}
+
+sub create_profile {
+ # The file "TLprofile" is created at the beginning of the
+ # installation process and contains information about the current
+ # setup. The purpose is to allow non-interactive installations.
+ open PROFILE, ">$profilepath/TLprofile";
+ print PROFILE "selected_scheme $vars{selected_scheme}\n";
+ foreach my $key (keys %vars) {
+ print PROFILE "$key $vars{$key}\n"
+ if $key=~/^collection/ and $vars{$key}==1;
+ print PROFILE "$key $vars{$key}\n" if $key=~/^option_doc/;
+ print PROFILE "$key $vars{$key}\n" if $key=~/^option_src/;
+ print PROFILE "$key $vars{$key}\n" if $key=~/^option_symlinks/;
+ }
+ close PROFILE;
+}
+
+
load_tlpdb;
set_platforms_supported;
set_texlive_default_dirs;
initialize_collections;
+set_install_platform;
run_menu;
+calc_depends;
+
+
+dump_vars;
+$profilepath='.';
+create_profile;
+print "Profile written to $profilepath/TLprofile\n";
__END__