summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPiotr Strzelczyk <piotr@eps.gda.pl>2010-07-08 22:55:58 +0000
committerPiotr Strzelczyk <piotr@eps.gda.pl>2010-07-08 22:55:58 +0000
commit7cfe9e20cd7d24506adc62a38a078a714b19509f (patch)
tree5889cd0203120b4d3955aa7add2193977365625a
parente0ea7b22699470cd72a9f7d27a0eaf6a5354f752 (diff)
portable and from_dvd installations
git-svn-id: svn://tug.org/texlive/trunk@19292 c570f23f-e606-0410-a88d-b1316a301751
-rwxr-xr-xMaster/install-tl78
-rw-r--r--Master/texmf/doc/texlive/texlive-en/texlive-en.tex39
-rwxr-xr-xMaster/tl-portable47
-rwxr-xr-xMaster/tl-portable.bat34
4 files changed, 115 insertions, 83 deletions
diff --git a/Master/install-tl b/Master/install-tl
index e6f2cb3a50a..f8acda0b911 100755
--- a/Master/install-tl
+++ b/Master/install-tl
@@ -456,6 +456,11 @@ if (($media eq "NET") || ($media eq "CD")) {
$vars{'doc_splitting_supported'} = $tlpdb->config_doc_container;
}
$texlive_release = $tlpdb->config_release;
+if ($media eq "DVD") {
+ # existing installation will 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
@@ -628,7 +633,7 @@ sub do_installation {
}
$localtlpdb->save unless $vars{'from_dvd'};
do_postinst_stuff();
- if (win32()) {
+ if (win32() || $vars{'portable'}) {
print welcome();
} else {
print welcome_paths();
@@ -659,7 +664,9 @@ sub do_postinst_stuff {
#
# create package backup directory for tlmgr autobackup to work
- mkdirhier("$TEXDIR/$TeXLive::TLConfig::PackageBackupDir");
+ # unless installation is on non-writable media (from_dvd or live)
+ mkdirhier("$TEXDIR/$TeXLive::TLConfig::PackageBackupDir")
+ if ($vars{'TEXDIR'} eq $vars{'TEXDIRW'});
# final program execution
# we have to do several things:
@@ -669,16 +676,15 @@ sub do_postinst_stuff {
# - run the programs
# 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
+ PSHEADERS TEXFONTMAPS TEXPSHEADERS TEXCONFIG TEXMFCNF
+ TEXMFMAIN TEXMFDIST TEXMFLOCAL TEXMFSYSVAR TEXMFSYSCONFIG
TEXMFVAR TEXMFCONFIG TEXMFHOME TEXMFCACHE);
- if (defined($ENV{'TEXMFCNF'}) and !$vars{'from_dvd'} and !$vars{'portable'}) {
+ if (defined($ENV{'TEXMFCNF'}) and !$vars{'from_dvd'}) {
print "WARNING: environment variable TEXMFCNF is set.
You should know what you are doing.
We will remove that for the post install actions, but all further
@@ -687,11 +693,6 @@ operations might be disturbed.\n\n";
foreach $tmv (@TMFVARS0) {
delete $ENV{$tmv} if (defined($ENV{$tmv}));
}
- if (!$opt_portable) {
- foreach $tmv (@TMFVARS1) {
- delete $ENV{$tmv} if (defined($ENV{$tmv}));
- }
- }
if ($vars{'from_dvd'}) {
$ENV{'TEXMFSYSVAR'} = $vars{'TEXMFSYSVAR'};
$ENV{'TEXMFCNF'} = $vars{'TEXMFSYSVAR'}."/web2c";
@@ -929,19 +930,25 @@ sub do_texmf_cnf {
push @changedtmf, "TEXMFSYSCONFIG = $vars{'TEXMFSYSCONFIG'}\n";
}
} elsif ($line =~ m/^TEXMFVAR/) {
- push @newtmf, $line;
- if ($vars{"TEXMFVAR"} ne "~/.texlive$yyyy/texmf-var") {
+ if ($vars{"TEXMFVAR"} eq "~/.texlive$yyyy/texmf-var") {
+ push @newtmf, $line;
+ } else {
+ push @newtmf, "TEXMFVAR = $vars{'TEXMFVAR'}\n";
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") {
+ if ("$vars{'TEXMFCONFIG'}" eq "~/.texlive$yyyy/texmf-config") {
+ push @newtmf, $line;
+ } else {
+ push @newtmf, "TEXMFCONFIG = $vars{'TEXMFCONFIG'}\n";
push @changedtmf, "TEXMFCONFIG = $vars{'TEXMFCONFIG'}\n";
}
} elsif ($line =~ m/^TEXMFHOME/) {
- push @newtmf, "TEXMFHOME = $vars{'TEXMFHOME'}\n";
- if ("$vars{'TEXMFHOME'}" ne "~/texmf") {
+ if ("$vars{'TEXMFHOME'}" eq "~/texmf") {
+ push @newtmf, $line;
+ } else {
+ push @newtmf, "TEXMFHOME = $vars{'TEXMFHOME'}\n";
push @changedtmf, "TEXMFHOME = $vars{'TEXMFHOME'}\n";
}
} elsif ($line =~ m/^OSFONTDIR/) {
@@ -957,11 +964,15 @@ sub do_texmf_cnf {
}
if ($vars{'portable'}) {
+ push @newtmf, "ASYMPTOTE_HOME = \$TEXMFCONFIG/asymptote\n";
push @changedtmf, "ASYMPTOTE_HOME = \$TEXMFCONFIG/asymptote\n";
}
my ($TMF, $TMFLUA);
- if (!$vars{'from_dvd'}) {
+ if ($vars{'TEXDIR'} eq $vars{'TEXDIRW'}) {
+ # if TEXDIR == TEXDIRW we want to write only changes to texmf.cnf
+ # even for from_dvd installation (needed by tl-portable script to
+ # initialize an existing, writable installation for portable use)
$TMF = ">$vars{'TEXDIR'}/texmf.cnf";
open(TMF, $TMF) || die "open($TMF) failed: $!";
print TMF <<EOF;
@@ -975,7 +986,11 @@ sub do_texmf_cnf {
% And include *only* your changed values, not a copy of the whole thing!
%
EOF
- foreach (@changedtmf) { print TMF; }
+ foreach (@changedtmf) {
+ # avoid absolute paths for TEXDIR, use $SELFAUTOPARENT instead
+ s/^(TEXMF\w+\s*=\s*)\Q$vars{'TEXDIR'}\E/$1\$SELFAUTOPARENT/;
+ print TMF;
+ }
#
# save the setting of shell_escape to the generated system texmf.cnf
# default in texmf/web2c/texmf.cnf is
@@ -1072,7 +1087,9 @@ sub set_texlive_default_dirs {
} else {
$tex_prefix ||= '/usr/local/texlive';
}
- $vars{'TEXDIRW'} = "$tex_prefix/$texlive_release";
+ # for portable installation we want everything in one directory
+ $vars{'TEXDIRW'} = $vars{'portable'}
+ ? $tex_prefix : "$tex_prefix/$texlive_release";
my $texmfsysvar = getenv('TEXLIVE_INSTALL_TEXMFSYSVAR');
$texmfsysvar ||= $vars{'TEXDIRW'} . '/texmf-var';
@@ -1104,7 +1121,7 @@ sub set_texlive_default_dirs {
$vars{'TEXMFCONFIG'} = $texmfconfig;
# for portable installation we want everything in one directory
- if ($vars{'portable'} && !$vars{'from_dvd'}) {
+ if ($vars{'portable'}) {
$vars{'TEXMFHOME'} = "\$TEXMFLOCAL";
$vars{'TEXMFVAR'} = "\$TEXMFSYSVAR";
$vars{'TEXMFCONFIG'} = "\$TEXMFSYSCONFIG";
@@ -1304,6 +1321,8 @@ END_EXPLICIT_MIRROR
$vars{'option_sys_man'} = $tlpdb->option("sys_man");
$vars{'option_sys_info'} = $tlpdb->option("sys_info");
$vars{'option_write18_restricted'} = $tlpdb->option("write18_restricted");
+ # this option is not stored in tlpdb if an existing installation is used
+ $vars{'option_write18_restricted'} ||= 1;
# check that the default scheme is actually present, otherwise switch to
# scheme-minimal
@@ -1419,6 +1438,7 @@ sub create_profile {
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/;
+ print $fh "$key $vars{$key}\n" if $key =~ /^portable/;
}
if (!ref($profilepath)) {
close PROFILE;
@@ -1467,8 +1487,6 @@ sub read_profile {
# helper subroutine to do sanity check of options before installation
sub sanitise_options {
- # from_dvd option overrides portable option
- $vars{'portable'} &&= !$vars{'from_dvd'};
# portable option overrides any system integration options
$vars{'option_path'} &&= !$vars{'portable'};
$vars{'option_file_assocs'} &&= !$vars{'portable'};
@@ -2069,8 +2087,9 @@ B<--no-persistent-downloads>.
=item B<-portable>
-Start the installer for portable use---but use the C<tl-portable>
-scripts instead of this option. See below for details.
+Install for portable use. This option minimazes the impact on the host
+system making TeX Live self-contained in a single directory and
+usable from portable drives. See also section B<PORTABLE USE> below.
=item B<-print-platform>
@@ -2131,12 +2150,11 @@ arguments can be separated from their options by either a space or C<=>.
=head1 PORTABLE USE
-The TeX Live root directory contains a shell script C<tl-portable.sh>
+The TeX Live root directory contains a shell script C<tl-portable>
and a DOS batch file C<tl-portable.bat> which start up a new shell and
-command prompt in which TeX Live can be run with minimal impact on the
-host system. These files start up C<install-tl> with the
-C<-portable> option for some minimal preparation. Don't use this option
-directly; it makes very specific assumptions about its environment.
+command prompt, respectively, in which TeX Live can be run with minimal
+impact on the host system. When running from non-writable medium some
+minimal preparation of the host system is done on the first run.
=head1 AUTHORS AND COPYRIGHT
diff --git a/Master/texmf/doc/texlive/texlive-en/texlive-en.tex b/Master/texmf/doc/texlive/texlive-en/texlive-en.tex
index 8abcd77974d..fc3cf460844 100644
--- a/Master/texmf/doc/texlive/texlive-en/texlive-en.tex
+++ b/Master/texmf/doc/texlive/texlive-en/texlive-en.tex
@@ -902,6 +902,11 @@ to introduce option names. These are the most common ones:
language but if it fails, or if the right language is not
available, then it uses English as a fallback.
+\item[-portable] Install for portable use on the \acro{USB} stick
+ or \DVD. This option minimazes impact on the host system making \TL{}
+ self contained in a single directory. See also
+ section~\ref{sec:portable-tl} for more details on portable usage.
+
\item[-profile {\sl file}] The installer always writes a file
\filename{texlive.profile} to the \dirname{tlpkg} subdirectory of your
installation. This option tells the installer to re-use such a
@@ -1312,35 +1317,27 @@ in the same zip file. See the web page for more information.
\section{Maximally portable \protect\TL{} on DVD and USB}
\label{sec:portable-tl}
-In the root of the \TL{} installation, or the \dirname{texlive}
-subdirectory of the \TK{} \DVD, are a \filename{tl-portable} script
+In the root of the \TL{} installation are a \filename{tl-portable} script
(Unix) and a \filename{tl-portable.bat} batch file (Windows) which start
up a secondary shell\slash command prompt with environment settings for
-directly accessing the \TL{} on the \DVD.
-
-When it runs for the first time, some files will be generated in a
-directory \dirname{~/.tlportable2010}, which will take a little time.
+directly accessing the \TL{} on the \acro{USB} stick or \DVD.
+
+You should first install \TL{} on the stick using the \optname{-portable}
+option of the installer (see section~\ref{sec:cmdline}). Then run
+the \filename{tl-portable} script from the installation root to start up
+a shell.
+
+You could also burn the resulting contents of the stick back to \DVD{}
+if that is more convenient to (for example) give to others.
+When the \filename{tl-portable} script is run from \DVD{} for the first
+time, some files will be generated on the host system in a directory
+\dirname{~/.tlportable2010}, which will take a little time.
On subsequent runs, though, it will start almost instantaneously.
The rest of the system will be unaware of \TL. If you want your editor
to be aware of this \TL, then you can start it from a second, parallel,
such \filename{tl-portable} session.
-You can also use \filename{tl-portable} to run \TL{} on a
-\acro{USB} stick. In this case, copy all the top-level files and
-the contents of the \dirname{bin}, \dirname{texmf},
-\dirname{texmf-dist}, and \dirname{tlpkg} directories (at least) to
-the stick. This may take quite a while! If you are copying to a
-\acro{FAT}32-formatted \acro{USB} stick, make sure to dereference
-symbolic links (\code{cp -L}). A \dirname{texmf-local} directory on
-the stick will also be found and used.
-
-Then run \filename{tl-portable} from the root of the stick, as above.
-In this case, the script will notice that the stick is writable and use
-it for generated files. You could burn the resulting contents of the
-stick back to \DVD{} if that is more convenient to (for example) give to
-others.
-
\section{\cmdname{tlmgr}: Managing your installation}
\label{sec:tlmgr}
diff --git a/Master/tl-portable b/Master/tl-portable
index a698de457e6..3d02bbce29f 100755
--- a/Master/tl-portable
+++ b/Master/tl-portable
@@ -29,7 +29,6 @@ unset TEXDIR0
dirsave=`pwd`
cd $TEXDIR
TEXDIR=`pwd`
-export TEXDIR
cd $dirsave
# Test whether the TeX Live directory is writable. We need an actual
@@ -55,36 +54,8 @@ testfile=1
else
TEXDIRW=$HOME/.tlportable2010
fi
-export TEXDIRW
echo Using $TEXDIRW for generated files.
-# Use $TEXMFHOME for private data,
-# $TEXMFLOCAL for department- or workgroup data.
-# It is allright if $TEXMFLOCAL does not exist.
-
-TEXMFSYSVAR=$TEXDIRW/texmf-var
-if test -d $TEXDIR/texmf-var; then
- TEXMFSYSVAR=$TEXDIR/texmf-var
-fi
-export TEXMFSYSVAR
-TEXMFSYSCONFIG=$TEXDIRW/texmf-config
-if test -f $TEXDIR/texmf-config; then
- TEXMFSYSCONFIG=$TEXDIR/texmf-config
-fi
-export TEXMFSYSCONFIG
-TEXMFMAIN=$TEXDIR/texmf
-export TEXMFMAIN
-TEXMFDIST=$TEXDIR/texmf-dist
-export TEXMFDIST
-TEXMFLOCAL=$TEXDIR/texmf-local
-export TEXMFLOCAL
-TEXMFHOME=$TEXDIRW/texmf-home
-export TEXMFHOME
-TEXMFVAR=$TEXDIRW/texmf-var
-export TEXMFVAR
-TEXMFCONFIG=$TEXDIRW/texmf-config
-export TEXMFCONFIG
-
platform=`$TEXDIR/install-tl --print-arch`
if test "$platform" = ""; then
@@ -95,11 +66,23 @@ elif test ! -d $TEXDIR/bin/$platform; then
exit 1
fi
-if $TEXDIR/install-tl --portable; then :; else
- echo "$0: Initialization of TeX Live failed!" >&2
- exit 1
+if test "$TEXDIR" = "$TEXDIRW"; then
+ TEXMFCNF=$TEXDIRW
+else
+ TEXMFCNF=$TEXDIRW/texmf-var/web2c
+ export TEXMFCNF
fi
+if test ! -r $TEXMFCNF/texmf.cnf; then
+ TEXLIVE_INSTALL_PREFIX=$TEXDIRW
+ export TEXLIVE_INSTALL_PREFIX
+ if $TEXDIR/install-tl --portable --from_dvd --profile /dev/null; then :; else
+ echo "$0: Initialization of TeX Live for portable use failed!" >&2
+ exit 1
+ fi
+ unset TEXLIVE_INSTALL_PREFIX
+fi
+
# Try to block initialization scripts.
# Set custom prompt for secondary shell, but
# I know of no good way to do this for the C shell.
diff --git a/Master/tl-portable.bat b/Master/tl-portable.bat
index 359eac4d7e4..348ce79b20e 100755
--- a/Master/tl-portable.bat
+++ b/Master/tl-portable.bat
@@ -13,11 +13,45 @@ rem use provided Perl
set PERL5LIB=%~dp0tlpkg\tlperl\lib
path %~dp0bin\win32;%path%
+rem Check for writable medium
+( echo.>"%~dp0tlwrtest" ) 2>nul || ( goto :from_dvd )
+del "%~dp0tlwrtest"
+
+rem On writable media we assume an already portable installation
+rem if there is texmf.cnf present under TL root
+if exist "%~dp0texmf.cnf" goto :tlshell
+
+rem Otherwise initialize for portable use
+set "TEXLIVE_INSTALL_PREFIX=%~dp0?"
+set "TEXLIVE_INSTALL_PREFIX=%TEXLIVE_INSTALL_PREFIX:\?=%"
+goto :genfiles
+
+:from_dvd
+rem We run from non-writable medium
+set TEXMFCNF=%USERPROFILE:\=/%/.tlportable2010/texmf-var/web2c
+if exist "%TEXMFCNF%/texmf.cnf" goto :tlshell
+set TEXLIVE_INSTALL_PREFIX=%USERPROFILE%\.tlportable2010
+
+:genfiles
+echo About to generate some files in "%TEXLIVE_INSTALL_PREFIX%"
+pause
+rem Make -portable -from_dvd installation to generate necessary stuff
+rem The -profile nul hack makes installation unattended
+"%~dp0tlpkg\tlperl\bin\perl.exe" "%~dp0install-tl" -portable -from_dvd -profile nul
+if errorlevel 1 goto :failedinit
+
+:tlshell
rem start new command interperter with customized prompt and window title
rem reuse console window of this interpreter and terminate it after that
+if not defined prompt set prompt=$P$G
start /b "TL-SHELL" "%ComSpec%" /k "title TL-SHELL& prompt TL$S%prompt%"
exit
+:failedinit
+echo Initialization of TeX Live for portable use failed!
+pause
+exit /b 1
+
:UNC
echo Cannot run from UNC path.
echo Map network drive to a drive letter and rerun the script.