diff options
Diffstat (limited to 'Master/tlpkg/installer/install-menu-text.pl')
-rwxr-xr-x | Master/tlpkg/installer/install-menu-text.pl | 167 |
1 files changed, 109 insertions, 58 deletions
diff --git a/Master/tlpkg/installer/install-menu-text.pl b/Master/tlpkg/installer/install-menu-text.pl index a92eb87b21b..563eeed6f06 100755 --- a/Master/tlpkg/installer/install-menu-text.pl +++ b/Master/tlpkg/installer/install-menu-text.pl @@ -108,7 +108,7 @@ sub binary_menu { my @binaries; my @keys=string_to_list "abcdefghijklmopstuvwxyz"; my $index=0; - my %keyval; + my %keyval; my $selected_platform; menu_head "Available sets of binaries:"; @@ -121,7 +121,7 @@ sub binary_menu { @binaries=sort(@binaries); foreach my $binary (@binaries) { - printf " %s %s %-16s %s\n", $keys[$index], + printf " %s %s %-16s %s\n", $keys[$index], button($vars{"binary_$binary"}), "$binary" . ":", platform_desc "$binary"; @@ -131,9 +131,9 @@ sub binary_menu { other_options qw(- + R Q); my $answer=prompt 'Press key to select/deselect binary systems'; - + my @keystrokes=string_to_list $answer; - + foreach my $keystroke (@keystrokes) { if ($keystroke eq '-') { for my $binary (@binaries) { @@ -212,7 +212,7 @@ sub scheme_menu { } else { $vars{"collection-wintools"} = 0; } - + other_options qw(R Q); my $answer=prompt 'Press key to select a scheme'; @@ -271,7 +271,7 @@ sub collection_menu { my $collection=$coll_short_desc[$index+$lines]; my $tlpobj=$tlpdb->get_package("$collection"); $keyval{$keys[$index+$lines]}="$collection"; - printf " %s %s %-32s\n", $keys[$index+$lines], + printf " %s %s %-32s\n", $keys[$index+$lines], button($vars{"$collection"}), substr($tlpobj->shortdesc,0,32); } else { print "\n"; @@ -293,7 +293,7 @@ sub collection_menu { my $answer=prompt 'Press key to select collections'; my @keystrokes=string_to_list $answer; - + foreach my $keystroke (@keystrokes) { if ($keystroke eq '-') { for my $collection (@collections) { @@ -350,7 +350,7 @@ sub language_menu { my $language=$languages[$index+$lines]; my $tlpobj = $tlpdb->get_package("$language"); $keyval{$lang_keys[$index+$lines]}="$language"; - printf " %s %s %-32s\n", $lang_keys[$index+$lines], + printf " %s %s %-32s\n", $lang_keys[$index+$lines], button($vars{"$language"}), substr($tlpobj->shortdesc,0,32); } else { print "\n"; @@ -371,7 +371,7 @@ sub language_menu { my $lang_doc=$lang_docs[$index+$lines]; my $tlpobj = $tlpdb->get_package("$lang_doc"); $keyval{$lang_doc_keys[$index+$lines]}="$lang_doc"; - printf " %s %s %-32s\n", $lang_doc_keys[$index+$lines], + printf " %s %s %-32s\n", $lang_doc_keys[$index+$lines], button($vars{"$lang_doc"}), substr($tlpobj->shortdesc,0,32); } else { print "\n"; @@ -382,7 +382,7 @@ sub language_menu { my $answer=prompt 'Press key to select language'; my @keystrokes=string_to_list $answer; - + foreach my $keystroke (@keystrokes) { if ($keystroke eq '-') { for my $collection (@languages,@lang_docs) { @@ -418,16 +418,29 @@ sub directories_menu { 'Q' => \&quit ); + my $maindir = $vars{'from_dvd'} ? 'TEXDIRW' : 'TEXDIR'; + menu_head "Current directories setup:"; - if (!TeXLive::TLUtils::texdir_check($vars{'TEXDIR'})) { + if (!TeXLive::TLUtils::texdir_check($vars{$maindir})) { print "!! The default location as given below can't be written to. -!! Either change the destination directory using <1> or create it +!! Either change the destination directory using <1> or create it !! outside this script. "; } + if ($vars{'from_dvd'}) { + print <<"EOF"; + <1> TEXDIRW: $vars{'TEXDIRW'} + (root for configuration- and generated data) +EOF +; + } else { + print <<"EOF"; + <1> TEXDIR: $vars{'TEXDIR'} + support tree: $vars{'TEXDIR'}/texmf +EOF +; + } print <<"EOF"; - <1> TEXDIR: $vars{'TEXDIR'} - support tree: $vars{'TEXDIR'}/texmf <2> TEXMFLOCAL: $vars{'TEXMFLOCAL'} <3> TEXMFSYSVAR: $vars{'TEXMFSYSVAR'} @@ -437,6 +450,7 @@ sub directories_menu { EOF ; + if (win32) { print " Note: ~ will expand to %USERPROFILE%\n"; } else { @@ -450,20 +464,22 @@ EOF $home = getenv('USERPROFILE') if (win32); $home ||= '~'; if ("\u$answer" eq '1') { - print "New value TEXDIR [$vars{'TEXDIR'}]: "; + print "New value $maindir [$vars{$maindir}]: "; chomp($answer=<STDIN>); - $vars{'TEXDIR'}="$answer" if (length $answer); - $vars{'TEXDIR'}=~s@\\@/@g if (win32); - $vars{'TEXDIR'} =~ s/^~/$home/; - if ($vars{'TEXDIR'}=~/^(.*)\/$texlive_release$/) { + $vars{$maindir}="$answer" if (length $answer); + $vars{$maindir}=~s@\\@/@g if (win32); + $vars{$maindir} =~ s/^~/$home/; + if ($vars{$maindir}=~/^(.*)\/$texlive_release$/) { $vars{'TEXMFLOCAL'}="$1/texmf-local"; $vars{'TEXMFSYSVAR'}="$1/$texlive_release/texmf-var"; $vars{'TEXMFSYSCONFIG'}="$1/$texlive_release/texmf-config"; + $vars{'TEXDIRW'} = $vars{'TEXDIR'} unless $vars{'from_dvd'}; return $command{'self'}; - } elsif ($vars{'TEXDIR'}=~/^(.*)$/) { + } elsif ($vars{$maindir}=~/^(.*)$/) { $vars{'TEXMFLOCAL'}="$1/texmf-local"; $vars{'TEXMFSYSVAR'}="$1/texmf-var"; $vars{'TEXMFSYSCONFIG'}="$1/texmf-config"; + $vars{'TEXDIRW'} = $vars{'TEXDIR'} unless $vars{'from_dvd'}; return $command{'self'}; } } @@ -540,12 +556,12 @@ sub html2text { s/&emdash;/--/gi; # emdash s/</</gi; s/>/>/gi; # < and > if (/<h1>(.*?)<\/h1>/i) { - push @text, " " x $h1_indent. "$1\n"; + push @text, " " x $h1_indent. "$1\n"; push @text, " " x $h1_indent. "=" x (length $1). "\n"; push @text, "\n"; } elsif (/<h2>(.*?)<\/h2>/i) { push @text, "\n"; - push @text, " " x $h2_indent. "$1\n"; + push @text, " " x $h2_indent. "$1\n"; push @text, " " x $h2_indent. "~" x (length $1). "\n"; push @text, "\n"; } elsif (/<h3>(.*?)<\/h3>/i) { @@ -582,7 +598,7 @@ sub help_menu { 'Q' => \&quit ); my $installer_help="$installerdir/tlpkg/installer/install-tl.html"; - + clear_screen; my @text=html2text "$installer_help"; @@ -597,8 +613,8 @@ sub help_menu { print "$_" if ($line>=$firstline and $line<=$lastline); ++$line; } - print "\n", hbar, - " <T> top <N> next page <P> previous page <R> return" + print "\n", hbar, + " <T> top <N> next page <P> previous page <R> return" . " --", $vars{'page'}+1, "--\n"; my $answer=prompt 'Enter command'; @@ -652,13 +668,13 @@ sub options_menu { <F> create all format files: $b_fmt EOF ; - if ($vars{'doc_splitting_supported'}) { + if ($vars{'doc_splitting_supported'} and !$vars{'from_dvd'}) { print " <D> install font/macro doc tree: $b_doc\n"; } - if ($vars{'src_splitting_supported'}) { + if ($vars{'src_splitting_supported'} and !$vars{'from_dvd'}) { print " <S> install font/macro source tree: $b_src\n"; } - if (unix) { + if (unix and !$vars{'from_dvd'}) { print <<"EOF"; <L> create symlinks in standard directories: $b_symlinks binaries to: $t_sys_bin @@ -671,7 +687,7 @@ EOF my $answer=prompt 'Enter command'; if (unix) { - if ("\u$answer" eq 'L') { + if (("\u$answer" eq 'L') and !$vars{'from_dvd'}) { my $home = getenv('HOME'); $home = getenv('USERPROFILE') if (win32); $home ||= '~'; @@ -691,7 +707,7 @@ EOF $vars{'sys_man'}="$answer" if (length $answer); $vars{'sys_man'} =~ s@\\@/@g if (win32); $vars{'sys_man'} =~ s/^~/$home/; - + print "New value for info directory [$vars{'sys_info'}]: "; chomp($answer=<STDIN>); $vars{'sys_info'}="$answer" if (length $answer); @@ -709,15 +725,11 @@ EOF toggle 'option_fmt'; return $command{'self'}; } - if ("\u$answer" eq 'S') { + if ("\u$answer" eq 'S' and !$vars{'from_dvd'}) { toggle 'option_src'; return $command{'self'}; } - if ("\u$answer" eq 'S') { - toggle 'option_src'; - return $command{'self'}; - } - if ("\u$answer" eq 'D') { + if ("\u$answer" eq 'D' and !$vars{'from_dvd'}) { toggle 'option_doc'; return $command{'self'}; } @@ -738,19 +750,33 @@ sub do_install { $RETURN = $MENU_INSTALL; } +sub to_hd { + $vars{'from_dvd'} = 0; + $vars{'TEXDIR'} = $vars{'TEXDIRW'}; + main_menu; +} + +sub from_dvd { + $vars{'from_dvd'} = 1; + $vars{'TEXDIR'} = abs_path($::installerdir); + main_menu; +} + sub main_menu { my $this_platform=platform_desc($vars{'this_platform'}); - my $b_symlinks=button($vars{'option_symlinks'}); - my $b_doc=button($vars{'option_doc'}); - my $b_src=button($vars{'option_src'}); - my $b_fmt=button($vars{'option_fmt'}); - my $b_letter=button($vars{'option_letter'}); + my $b_symlinks=button($vars{'option_symlinks'}); + my $b_doc=button($vars{'option_doc'}); + my $b_src=button($vars{'option_src'}); + my $b_fmt=button($vars{'option_fmt'}); + my $b_letter=button($vars{'option_letter'}); my $warn_nobin; $warn_nobin=set_install_platform; + my $maindir = $vars{'from_dvd'} ? 'TEXDIRW' : 'TEXDIR'; + $vars{'n_systems_selected'}=0; $vars{'n_collections_selected'}=0; foreach my $key (keys %vars) { @@ -767,26 +793,39 @@ sub main_menu { 'self' => \&main_menu, 'O' => \&options_menu, 'I' => \&do_install, - 'C' => \&collection_menu, 'H' => \&help_menu, - 'L' => \&language_menu, 'D' => \&directories_menu, - 'S' => \&scheme_menu, + 'T' => \&to_hd, + 'V' => \&from_dvd, 'Q' => \&quit ); - - if (unix) { - $command{'B'}=\&binary_menu; + if (!$vars{'from_dvd'}) { + $command{'S'}=\&scheme_menu; + $command{'C'}=\&collection_menu; + $command{'L'}=\&language_menu; + $command{'B'}=\&binary_menu if unix; } + clear_screen; - + print <<"EOF"; ======================> TeX Live installation procedure <===================== =======> Note: Letters/digits in <angle brackets> indicate menu items <======= =======> for commands or configurable options <======= +EOF +; + + if ($vars{'from_dvd'}) { + print " <T> Install to HD (current setting: install for running from DVD)\n\n"; + } else { + print " <V> Install for running from DVD (current setting: install to HD)\n\n"; + } + if (!$vars{'from_dvd'}) { + print <<"EOF"; + Detected platform: $this_platform $warn_nobin <B> binary systems: $vars{'n_systems_selected'} out of $vars{'n_systems_available'} @@ -802,10 +841,18 @@ sub main_menu { TEXDIR (the main TeX directory): EOF ; - if (TeXLive::TLUtils::texdir_check($vars{'TEXDIR'})) { - print " $vars{'TEXDIR'}\n"; + } else { # $vars{'from_dvd'} + print <<"EOF"; + <D> directories: + TEXDIRW (Writable root): +EOF +; + } + + if (TeXLive::TLUtils::texdir_check($vars{$maindir})) { + print " $vars{$maindir}\n"; } else { - print " !! default location: $vars{'TEXDIR'}\n"; + print " !! default location: $vars{$maindir}\n"; print " !! is not writable, please select a different one!\n"; } print <<"EOF"; @@ -819,19 +866,23 @@ EOF <O> options: EOF ; + print <<"EOF"; $b_letter use letter size instead of A4 by default $b_fmt create all format files EOF ; - if ($vars{'doc_splitting_supported'}) { - print " $b_doc install macro/font doc tree\n"; - } - if ($vars{'src_splitting_supported'}) { - print " $b_src install macro/font source tree\n"; + + if (!$vars{'from_dvd'}) { + if ($vars{'doc_splitting_supported'}) { + print " $b_doc install macro/font doc tree\n"; + } + if ($vars{'src_splitting_supported'}) { + print " $b_src install macro/font source tree\n"; + } } - print <<"EOF" if (unix); - $b_symlinks create symlinks in standard directories + print <<"EOF" if (unix and !$vars{'from_dvd'}); + $b_symlinks create symlinks in standard directories EOF ; |