diff options
author | Karl Berry <karl@freefriends.org> | 2010-06-02 21:53:38 +0000 |
---|---|---|
committer | Karl Berry <karl@freefriends.org> | 2010-06-02 21:53:38 +0000 |
commit | 9714d2bea6b318b1d024e34b07d229c03f78eabb (patch) | |
tree | 701ab029dca327ff4838a7b067f92186d8f90f71 /Master/install-tl | |
parent | 34efb674af2282181f80afc4e28bf8c3b2d50ae4 (diff) |
* install-tl, install-menu-text.pl: support changing TEXMFVAR and
TEXMFCONFIG, write in profile, etc.
mkdirhier TEXMFVAR before running luatools --generate.
* tl-update-tlnet: message change.
* texmfcnf.lua: doc changes.
git-svn-id: svn://tug.org/texlive/trunk@18699 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/install-tl')
-rwxr-xr-x | Master/install-tl | 190 |
1 files changed, 115 insertions, 75 deletions
diff --git a/Master/install-tl b/Master/install-tl index 0822249b1a4..d1e12dc51f4 100755 --- a/Master/install-tl +++ b/Master/install-tl @@ -1,7 +1,9 @@ #!/usr/bin/env perl # $Id$ # -# Copyright 2007, 2008, 2009, 2010 Reinhard Kotucha, Norbert Preining +# Copyright 2007, 2008, 2009, 2010 Reinhard Kotucha, Norbert Preining, +# Karl Berry. +# # This file is licensed under the GNU General Public License version 2 # or any later version. # @@ -640,6 +642,8 @@ sub do_postinst_stuff { my $TEXDIRW="$vars{'TEXDIRW'}"; my $TEXMFSYSVAR="$vars{'TEXMFSYSVAR'}"; my $TEXMFSYSCONFIG="$vars{'TEXMFSYSCONFIG'}"; + my $TEXMFVAR="$vars{'TEXMFVAR'}"; + my $TEXMFCONFIG="$vars{'TEXMFCONFIG'}"; my $TEXMFLOCAL="$vars{'TEXMFLOCAL'}"; my $tmv; @@ -663,14 +667,15 @@ sub do_postinst_stuff { # - select perl interpreter and set the correct perllib # - run the programs - # Step 1: Clean the environment + # Step 1: Clean the environment. + # VARS0 are always deleted, VARS1 deleted unless portable. %origenv = %ENV; my @TMFVARS0=qw(VARTEXFONTS TEXMF SYSTEXMF VARTEXFONTS TEXMFDBS WEB2C TEXINPUTS TEXFORMATS MFBASES MPMEMS TEXPOOL MFPOOL MPPOOL PSHEADERS TEXFONTMAPS TEXPSHEADERS TEXCONFIG TEXMFCNF); my @TMFVARS1=qw(TEXMFMAIN TEXMFDIST TEXMFLOCAL TEXMFSYSVAR TEXMFSYSCONFIG - TEXMFHOME TEXMFVAR TEXMFCONFIG); + TEXMFVAR TEXMFCONFIG TEXMFHOME TEXMFCACHE); if (defined($ENV{'TEXMFCNF'}) and !$vars{'from_dvd'} and !$opt_portable) { print "WARNING: environment variable TEXMFCNF is set. @@ -795,7 +800,7 @@ operations might be disturbed.\n\n"; info("running mktexlsr $TEXMFSYSVAR\n"); system('mktexlsr', "$TEXMFSYSVAR"); - info("running updmap-sys... "); + info("running updmap-sys..."); # system('updmap-sys', '--nohash'); log(`updmap-sys --nohash 2>&1`); info("done\n"); @@ -806,7 +811,7 @@ operations might be disturbed.\n\n"; # letter instead of a4 if ($vars{'option_letter'}) { - info("Setting default paper size to letter\n"); + info("setting default paper size to letter\n"); system("tlmgr", "paper", "letter"); } @@ -814,13 +819,10 @@ operations might be disturbed.\n\n"; # we only call luatools --generate once at installation time, the # rest must be managed by the user, Taco email 2010-05-26 if (exists($install{"context"}) && $install{"context"} == 1) { - info("Generating the initial ConTeXt MkIV cache, be patient ..."); - # we put the luatex cache into TEXMFVAR which will solve the problem - # of pregeneration for most people (single user). With multi user - # installations that luatools --generate has to be run by every - # user that did not install TL himself. - chomp (my $tmv = `kpsewhich -var-value=TEXMFVAR`); - mkdirhier($tmv); + info("making ConTeXt MkIV cache with luatools --generate, be patient..."); + chomp (my $tmv = `kpsewhich -expand-braces="$vars{TEXMFVAR}"`); + log("\n TEXMFVAR=$vars{TEXMFVAR}, expanded to $tmv for mkdirhier\n"); + mkdirhier ($tmv); # don't be asked about making the dir log(`luatools --generate 2>&1`); info("done\n"); } @@ -886,13 +888,18 @@ sub do_texmf_cnf { or die "$vars{'TEXDIR'}/texmf/web2c/texmf.cnf not found: $!"; my @texmfcnflines = <TMF>; close(TMF); - my @newtmf; - my @changedtmf; + + my @newtmf = (); # running from dvd: write whole new texmf.cnf + my @changedtmf = (); # install to disk: write only changed items + + my $yyyy = $TeXLive::TLConfig::ReleaseYear; + my $rewritetmflua = 0; # need a new texmfcnf.lua? + # we have to find TEXMFLOCAL TEXMFSYSVAR and TEXMFHOME foreach my $line (@texmfcnflines) { if ($line =~ m/^TEXMFLOCAL/) { # by default TEXMFLOCAL = TEXDIR/../texmf-local, if this is the case - # we don't have to change anything from the default + # we don't have to write a new setting. my $deftmlocal = dirname($vars{'TEXDIR'}); $deftmlocal .= "/texmf-local"; if ("$vars{'TEXMFLOCAL'}" eq "$deftmlocal") { @@ -902,8 +909,6 @@ sub do_texmf_cnf { push @changedtmf, "TEXMFLOCAL = $vars{'TEXMFLOCAL'}\n"; } } elsif ($line =~ m/^TEXMFSYSVAR/) { - # by default TEXMFSYSVAR = TEXDIR/texmf-var, if this is the case - # we don't have to change anything from the default if ("$vars{'TEXMFSYSVAR'}" eq "$vars{'TEXDIR'}/texmf-var") { push @newtmf, $line; } else { @@ -911,17 +916,24 @@ sub do_texmf_cnf { push @changedtmf, "TEXMFSYSVAR = $vars{'TEXMFSYSVAR'}\n"; } } elsif ($line =~ m/^TEXMFSYSCONFIG/) { - # by default TEXMFSYSCONFIG = TEXDIR/texmf-config, if this is the case - # we don't have to change anything from the default if ("$vars{'TEXMFSYSCONFIG'}" eq "$vars{'TEXDIR'}/texmf-config") { push @newtmf, $line; } else { push @newtmf, "TEXMFSYSCONFIG = $vars{'TEXMFSYSCONFIG'}\n"; push @changedtmf, "TEXMFSYSCONFIG = $vars{'TEXMFSYSCONFIG'}\n"; } + } elsif ($line =~ m/^TEXMFVAR/) { + push @newtmf, $line; + if ($vars{"TEXMFVAR"} ne "~/.texlive$yyyy/texmf-var") { + push @changedtmf, "TEXMFVAR = $vars{'TEXMFVAR'}\n"; + $rewritetmflua = 1; # TEXMFVAR change -> new texmfcnf.lua + } + } elsif ($line =~ m/^TEXMFCONFIG/) { + push @newtmf, $line; + if ("$vars{'TEXMFCONFIG'}" ne "~/.texlive$yyyy/texmf-config") { + push @changedtmf, "TEXMFCONFIG = $vars{'TEXMFCONFIG'}\n"; + } } elsif ($line =~ m/^TEXMFHOME/) { - # kpse now expands ~ to USERPROFILE, so we don't treat win32 and - # unix differently push @newtmf, "TEXMFHOME = $vars{'TEXMFHOME'}\n"; if ("$vars{'TEXMFHOME'}" ne "~/texmf") { push @changedtmf, "TEXMFHOME = $vars{'TEXMFHOME'}\n"; @@ -937,24 +949,22 @@ sub do_texmf_cnf { push @newtmf, $line; } } - my $TMF; + + my ($TMF, $TMFLUA); if (!$vars{'from_dvd'}) { $TMF = ">$vars{'TEXDIR'}/texmf.cnf"; open(TMF, $TMF) || die "open($TMF) failed: $!"; print TMF <<EOF; +% (Public domain.) % This texmf.cnf file should contain only your personal changes from the -% main texmf.cnf. -% -% Do NOT change values in the main file (which is in -% .../texlive/YYYY/texmf/web2c/texmf.cnf), as YOUR CHANGES WILL BE LOST -% by later updates. +% original texmf.cnf (for example, as chosen in the installer). % -% If you need to make changes to texmf.cnf, put your custom settings in -% this file instead, which is YYYY/texmf.cnf. And insert *only* your -% changed values. +% That is, if you need to make changes to texmf.cnf, put your custom +% settings in this file, which is .../texlive/YYYY/texmf.cnf, rather than +% the distributed file (which is .../texlive/YYYY/texmf/web2c/texmf.cnf). +% And include *only* your changed values, not a copy of the whole thing! % EOF -; foreach (@changedtmf) { print TMF; } # # save the setting of shell_escape to the generated system texmf.cnf @@ -963,19 +973,42 @@ EOF # so we write that only if the user *deselected* this option if (!$vars{"option_write18_restricted"}) { print TMF <<EOF; -% Disable system commands via \\write18{...}. Please see -% texmf/web2c/texmf.cnf -% for more details. + +% Disable system commands via \\write18{...}. See texmf/web2c/texmf.cnf. shell_escape = 0 EOF ; } + if ($rewritetmflua) { + $TMFLUA = ">$vars{'TEXDIR'}/texmfcnf.lua"; + open(TMFLUA, $TMFLUA) || die "open($TMFLUA) failed: $!"; + } + } else { + # running from DVD, have to use a different directory. $TMF = ">$vars{'TEXMFSYSVAR'}/web2c/texmf.cnf"; - open (TMF, $TMF) || die "open($TMF) failed: $!\n"; + open (TMF, $TMF) || die "open($TMF) failed (dvd): $!\n"; foreach (@newtmf) { print TMF; } + + if ($rewritetmflua) { + $TMFLUA = ">$vars{'TEXMFSYSVAR'}/web2c/texmfcnf.lua"; + open(TMFLUA, $TMFLUA) || die "open($TMFLUA) failed (dvd): $!"; + } } close(TMF) || warn "close($TMF) failed: $!"; + + # contents of the revised texmfcnf.lua is the same whether from_dvd or not. + if ($rewritetmflua) { + print TMFLUA <<EOF; +-- (Public domain.) +-- This texmfcnf.lua file should exist only if you have personal changes +-- from the distributed file; for example, if TEXMFVAR was changed in +-- the installer. +-- +return { TEXMFCACHE = '$vars{"TEXMFVAR"}' } +EOF + close(TMFLUA) || warn "close($TMFLUA) failed: $!"; + } } @@ -1011,48 +1044,54 @@ sub set_platforms_supported { # Environment variables and default values on UNIX: # TEXLIVE_INSTALL_PREFIX /usr/local/texlive => $tex_prefix -# TEXLIVE_INSTALL_TEXDIR $tex_prefix/2007 => $TEXDIR +# TEXLIVE_INSTALL_TEXDIR $tex_prefix/2010 => $TEXDIR # TEXLIVE_INSTALL_TEXMFSYSVAR $TEXDIR/texmf-var # TEXLIVE_INSTALL_TEXMFSYSCONFIG $TEXDIR/texmf-config # TEXLIVE_INSTALL_TEXMFLOCAL $tex_prefix/texmf-local +# TEXLIVE_INSTALL_TEXMFVAR ~/.texlive2010/texmf-var +# TEXLIVE_INSTALL_TEXMFCONFIG ~/.texlive2010/texmf-config # TEXLIVE_INSTALL_TEXMFHOME '$HOME/texmf' sub set_texlive_default_dirs { - my $tex_prefix; - my $texmfsysvar; - my $texmfsysconfig; - my $texmflocal; - my $texmfhome; - - $tex_prefix=getenv('TEXLIVE_INSTALL_PREFIX'); + my $tex_prefix = getenv('TEXLIVE_INSTALL_PREFIX'); if (win32) { $tex_prefix ||= getenv('SystemDrive') . '/texlive'; # we use SystemDrive because ProgramFiles requires admin rights # we don't use USERPROFILE here because that will be copied back and # forth on roaming profiles } else { - $tex_prefix||='/usr/local/texlive'; + $tex_prefix ||= '/usr/local/texlive'; } - $vars{'TEXDIRW'}="$tex_prefix/$texlive_release"; + $vars{'TEXDIRW'} = "$tex_prefix/$texlive_release"; - $texmfsysvar=getenv('TEXLIVE_INSTALL_TEXMFSYSVAR'); - $texmfsysvar||=$vars{'TEXDIRW'} . '/texmf-var'; - $vars{'TEXMFSYSVAR'}=$texmfsysvar; + my $texmfsysvar = getenv('TEXLIVE_INSTALL_TEXMFSYSVAR'); + $texmfsysvar ||= $vars{'TEXDIRW'} . '/texmf-var'; + $vars{'TEXMFSYSVAR'} = $texmfsysvar; - $texmfsysconfig=getenv('TEXLIVE_INSTALL_TEXMFSYSCONFIG'); - $texmfsysconfig||=$vars{'TEXDIRW'} . '/texmf-config'; + my $texmfsysconfig = getenv('TEXLIVE_INSTALL_TEXMFSYSCONFIG'); + $texmfsysconfig ||= $vars{'TEXDIRW'} . '/texmf-config'; $vars{'TEXMFSYSCONFIG'}=$texmfsysconfig; - $texmflocal=getenv('TEXLIVE_INSTALL_TEXMFLOCAL'); - $texmflocal||="$tex_prefix/texmf-local"; - $vars{'TEXMFLOCAL'}=$texmflocal; + my $texmflocal = getenv('TEXLIVE_INSTALL_TEXMFLOCAL'); + $texmflocal ||= "$tex_prefix/texmf-local"; + $vars{'TEXMFLOCAL'} = $texmflocal; - $vars{'TEXDIR'} = $vars{'from_dvd'} ? abs_path($::installerdir) : - $vars{'TEXDIRW'}; + $vars{'TEXDIR'} = $vars{'from_dvd'} + ? abs_path($::installerdir) : $vars{'TEXDIRW'}; - $texmfhome=getenv('TEXLIVE_INSTALL_TEXMFHOME'); + my $texmfhome = getenv('TEXLIVE_INSTALL_TEXMFHOME'); $texmfhome ||= "~"; $vars{'TEXMFHOME'}="$texmfhome/texmf"; + + # use the $texmfhome value just computed for these. + my $yyyy = $TeXLive::TLConfig::ReleaseYear; + my $texmfvar = getenv('TEXLIVE_INSTALL_TEXMFVAR'); + $texmfvar ||= "$texmfhome/.texlive$yyyy/texmf-var"; + $vars{'TEXMFVAR'} = $texmfvar; + + my $texmfconfig = getenv('TEXLIVE_INSTALL_TEXMFCONFIG'); + $texmfconfig ||= "$texmfhome/.texlive$yyyy/texmf-config"; + $vars{'TEXMFCONFIG'} = $texmfconfig; } sub calc_depends { @@ -1321,6 +1360,8 @@ sub create_profile { print $fh "$key $vars{$key}\n" if $key =~ /^TEXDIR/; # includes TEXDIRW print $fh "$key $vars{$key}\n" if $key =~ /^TEXMFSYSVAR/; print $fh "$key $vars{$key}\n" if $key =~ /^TEXMFSYSCONFIG/; + print $fh "$key $vars{$key}\n" if $key =~ /^TEXMFVAR/; + print $fh "$key $vars{$key}\n" if $key =~ /^TEXMFCONFIG/; print $fh "$key $vars{$key}\n" if $key =~ /^TEXMFLOCAL/; print $fh "$key $vars{$key}\n" if $key =~ /^TEXMFHOME/; print $fh "$key $vars{$key}\n" if $key =~ /^from_dvd/; @@ -1615,8 +1656,7 @@ sub check_on_lang_collection_installed { return 0; } -sub do_cleanup -{ +sub do_cleanup { # now open the log file and write out the log lines # try to open a log file # the user could have given the -logfile option in which case all the @@ -1662,8 +1702,7 @@ sub do_cleanup # Return the basic welcome message. -sub welcome -{ +sub welcome { my $welcome = <<"EOF"; See @@ -1684,8 +1723,7 @@ EOF # The same welcome message as above but with hints about C<PATH>, # C<MANPATH>, and C<INFOPATH>. -sub welcome_paths -{ +sub welcome_paths { my $welcome = welcome (); # ugly, remove welcome msg; better than repeating the whole text, though. @@ -1709,29 +1747,31 @@ EOF to your PATH for current and future sessions. EOF - # check for tex-related envvars. - my $texenvs = ""; - for my $evar (sort keys %origenv) { - next if $evar =~ /^(_ - |.*PWD - |GENDOCS_TEMPLATE_DIR|PATH|SHELLOPTS - )$/x; # don't worry about these - if ("$evar $origenv{$evar}" =~ /tex/i) { # check both key and value - $texenvs .= " $evar=$origenv{$evar}\n"; + unless ($ENV{"TEXLIVE_INSTALL_ENV_NOCHECK"}) { + # check for tex-related envvars. + my $texenvs = ""; + for my $evar (sort keys %origenv) { + next if $evar =~ /^(_ + |.*PWD + |GENDOCS_TEMPLATE_DIR|PATH|SHELLOPTS + )$/x; # don't worry about these + if ("$evar $origenv{$evar}" =~ /tex/i) { # check both key and value + $texenvs .= " $evar=$origenv{$evar}\n"; + } } - } - if ($texenvs) { - $welcome .= <<"EOF"; + if ($texenvs) { + $welcome .= <<"EOF"; ---------------------------------------------------------------------- The following environment variables contain the string "tex" (case-independent). If you're doing anything but adding personal directories to the system paths, they may well cause trouble with some parts of running TeX. If you encounter problems, try unsetting - them. (And please ignore any spurious matches that are unrelated to TeX.) + them. Please ignore any spurious matches that are unrelated to TeX. $texenvs ---------------------------------------------------------------------- EOF + } } $welcome .= <<"EOF"; |