From bc133295dbbb37984c044e20bdb3b22c67771251 Mon Sep 17 00:00:00 2001 From: Siep Kroonenberg Date: Sun, 8 Jun 2008 21:03:34 +0000 Subject: Support for real installation for running from dvd, non-gui install. Added cachedir tag to fonts.conf. git-svn-id: svn://tug.org/texlive/trunk@8603 c570f23f-e606-0410-a88d-b1316a301751 --- Master/tlpkg/TeXLive/TLPostActions.pm | 25 ++-- Master/tlpkg/TeXLive/TLWinGoo.pm | 74 +++++------- Master/tlpkg/installer/install-menu-perltk.pl | 5 +- Master/tlpkg/installer/install-menu-text.pl | 167 +++++++++++++++++--------- 4 files changed, 161 insertions(+), 110 deletions(-) (limited to 'Master/tlpkg') diff --git a/Master/tlpkg/TeXLive/TLPostActions.pm b/Master/tlpkg/TeXLive/TLPostActions.pm index 9aac45b6031..dd6d1b10eef 100644 --- a/Master/tlpkg/TeXLive/TLPostActions.pm +++ b/Master/tlpkg/TeXLive/TLPostActions.pm @@ -30,7 +30,7 @@ our %PostRemove; # bin-xetex # sub do_install_bin_xetex { - my ($texdir, $texmfsysvar) = @_; + my ($texdir, $texdirw, $texmfsysvar) = @_; # # bin-xetex installs font-config related stuff # @@ -44,14 +44,14 @@ sub do_install_bin_xetex { } else { push @cpycmd, "cp", "-a"; } - system(@cpycmd, + system(@cpycmd, (win32() ? conv_to_win_path("$texdir/bin/win32/conf") : - "$texdir/bin/win32/conf"), + "$texdir/bin/win32/conf"), (win32() ? conv_to_win_path("$texmfsysvar/fonts/conf") : "$texmfsysvar/fonts/conf")); - system(@cpycmd, + system(@cpycmd, (win32() ? conv_to_win_path("$texdir/bin/win32/cache") : - "$texdir/bin/win32/cache"), + "$texdir/bin/win32/cache"), (win32() ? conv_to_win_path("$texmfsysvar/fonts/cache") : "$texmfsysvar/fonts/cache")); open(FONTSCONF, "<$texdir/bin/win32/conf/fonts.conf") @@ -60,8 +60,15 @@ sub do_install_bin_xetex { close(FONTSCONF); open(FONTSCONF, ">$texmfsysvar/fonts/conf/fonts.conf") or die("Cannot open $texmfsysvar/fonts/conf/fonts.conf for writing"); + if (win32()) { + my $winfontdir = $ENV{'SystemRoot'}.'/fonts'; + $winfontdir =~ s!\\!/!g; + mkdirhier("$texmfsysvar/fonts/cache"); + } foreach (@lines) { $_ =~ s!c:/Program Files/texlive/2008!$texdir!; + $_ =~ s!c:/windows/fonts!$winfontdir! if win32(); + $_ =~ s!c:/etc/fccache!$texmfsysvar/fonts/cache!; print FONTSCONF; } close(FONTSCONF); @@ -77,10 +84,10 @@ $PostInstall{"bin-xetex"} = \&do_install_bin_xetex; # bin-texdoc # sub do_install_bin_texdoc { - my ($texdir) = @_; + my ($texdir, $texdirw) = @_; if (win32()) { add_desktop_shortcut( - $texdir, + $texdirw, 'TeXdoc GUI', '', # $vars{'TEXDIR'}.'/tlpkg/doc/notes.ico', # the icon $texdir.'/bin/win32/texdoctk.bat', @@ -111,10 +118,10 @@ $PostRemove{'bin-texdoc'} = \&do_remove_bin_texdoc; # bin-tlpsv.win32 # sub do_install_bin_tlpsv_win32 { - my ($texdir) = @_; + my ($texdir, $texdirw) = @_; if (win32()) { add_desktop_shortcut( - $texdir, + $texdirw, 'PS_View', $texdir.'/tlpkg/tlpsv/psv.exe', # icon, not prog! $texdir.'/bin/win32/psv.bat', diff --git a/Master/tlpkg/TeXLive/TLWinGoo.pm b/Master/tlpkg/TeXLive/TLWinGoo.pm index 4d2c48657c2..5107fe8c6c5 100644 --- a/Master/tlpkg/TeXLive/TLWinGoo.pm +++ b/Master/tlpkg/TeXLive/TLWinGoo.pm @@ -33,7 +33,6 @@ C -- Additional utilities for Windows TeXLive::TLWinGoo::admin; TeXLive::TLWinGoo::non_admin; TeXLive::TLWinGoo::reg_country; - TeXLive::TLWinGoo::dir_writable($d); =head2 ENVIRONMENT AND REGISTRY @@ -89,7 +88,6 @@ BEGIN { &admin &non_admin ®_country - &dir_writable &expand_string &global_tmpdir &get_system_path @@ -273,32 +271,6 @@ sub reg_country { =pod -=item C - -Tests whether its argument is writable by trying to write to -it. This function is necessary because the built-in C<-w> test -apparently doesn't work under Windows. - -=cut - -sub dir_writable { - $d=shift; - return 0 unless -d $d; - $d =~ s!\\!/!g; - $d =~ s!/$!!g; - my $i = 0; - while (-e $d . "/" . $i) { $i++; } - my $f = $d."/".$i; - my $fb = $f; - $fb =~ s!/!\\!g; - return 0 if - system('copy /b ' . $ENV{'COMSPEC'} . ' "' . $fb . '" >nul 2>&1'); - unlink $f if -e $f; - return 1; -} - -=pod - =back =head2 ENVIRONMENT AND REGISTRY @@ -1010,49 +982,69 @@ the job. =cut sub create_uninstaller { - my $tdfw = shift; # TEXDIR + my ($tdfw, $tdwfw, $tdsvfw, $tdscfw) = @_; + # TEXDIR, TEXDIRW, TEXMFSYSVAR, TEXMFSYSCONFIG $tdfw =~ s![\\/]$!!; my $td = $tdfw; $td =~ s!/!\\!g; + $tdwfw =~ s![\\/]$!!; + my $tdw = $tdwfw; + $tdw =~ s!/!\\!g; + + $tdsvfw =~ s![\\/]$!!; + my $tdsv = $tdsvfw; + $tdsv =~ s!/!\\!g; + + $tdscfw =~ s![\\/]$!!; + my $tdsc = $tdscfw; + $tdsc =~ s!/!\\!g; + my $uninst_key = $Registry -> Open((admin() ? "LMachine" : "CUser") . "/software/microsoft/windows/currentversion/", {Access => KEY_ALL_ACCESS()}); my $k = $uninst_key->CreateKey("uninstall/TeXLive/"); $k->{"/DisplayName"} = "TeXLive ".$::texlive_release; - $k->{"/UninstallString"} = "\"$td\\tlpkg\\installer\\uninst.bat\""; + $k->{"/UninstallString"} = "\"$tdw\\tlpkg\\installer\\uninst.bat\""; $k->{'/DisplayVersion'} = $::texlive_release; $k->{'/URLInfoAbout'} = "http://www.tug.org/texlive"; - open UNINST, ">$tdfw/tlpkg/installer/uninst.bat"; + mkdirhier("$tdwfw/tlpkg/installer"); # wasn't this done yet? + open UNINST, ">$tdwfw/tlpkg/installer/uninst.bat"; print UNINST <$tdfw/tlpkg/installer/uninst2.bat"; - print UNINST2 <$tdwfw/tlpkg/installer/uninst2.bat"; + print UNINST2 < "black"); } elsif ("$vars{'TEXMFSYSVAR'}" =~ m;^$vars{'TEXDIR'};) { if (TeXLive::TLUtils::texdir_check($vars{'TEXDIR'})) { menu_set_text($texmfsysvartext, "$vars{'TEXMFSYSVAR'}", -foreground => "black"); @@ -633,7 +633,7 @@ sub menu_set_pathes_text { menu_set_text($texmfsysvartext, $text{'notwritable'}); } if ((-w $vars{'TEXMFSYSCONFIG'}) || (-w dirname($vars{'TEXMFSYSCONFIG'}))) { - menu_set_text($texmfsysconfigtext, "$vars{'TEXMFSYSCONFIG'}"); + menu_set_text($texmfsysconfigtext, "$vars{'TEXMFSYSCONFIG'}", -foreground => "black"); } elsif ("$vars{'TEXMFSYSCONFIG'}" =~ m;^$vars{'TEXDIR'};) { if (TeXLive::TLUtils::texdir_check($vars{'TEXDIR'})) { menu_set_text($texmfsysconfigtext, "$vars{'TEXMFSYSCONFIG'}", -foreground => "black"); @@ -703,6 +703,7 @@ sub callback_edit_directories { $vars{'TEXMFSYSVAR'}="$1/texmf-var"; $vars{'TEXMFSYSCONFIG'}="$1/texmf-config"; } + $vars{'TEXDIRW'}=$vars{'TEXDIR'} } menu_update_texts(); } 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=); - $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; # < and > if (/

(.*?)<\/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>/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>/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, - " top next page

previous page return" + print "\n", hbar, + " top next page

previous page return" . " --", $vars{'page'}+1, "--\n"; my $answer=prompt 'Enter command'; @@ -652,13 +668,13 @@ sub options_menu { create all format files: $b_fmt EOF ; - if ($vars{'doc_splitting_supported'}) { + if ($vars{'doc_splitting_supported'} and !$vars{'from_dvd'}) { print " install font/macro doc tree: $b_doc\n"; } - if ($vars{'src_splitting_supported'}) { + if ($vars{'src_splitting_supported'} and !$vars{'from_dvd'}) { print " install font/macro source tree: $b_src\n"; } - if (unix) { + if (unix and !$vars{'from_dvd'}) { print <<"EOF"; 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=); $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 indicate menu items <======= =======> for commands or configurable options <======= +EOF +; + + if ($vars{'from_dvd'}) { + print " Install to HD (current setting: install for running from DVD)\n\n"; + } else { + print " Install for running from DVD (current setting: install to HD)\n\n"; + } + if (!$vars{'from_dvd'}) { + print <<"EOF"; + Detected platform: $this_platform $warn_nobin 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"; + 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 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 ; -- cgit v1.2.3