summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPiotr Strzelczyk <piotr@eps.gda.pl>2010-06-25 00:57:36 +0000
committerPiotr Strzelczyk <piotr@eps.gda.pl>2010-06-25 00:57:36 +0000
commit0402f14f8d60fd3b46a00e4f81a2bbe925565b2b (patch)
treefdadbd7d23d99c6cbf17bac41563e76e4814c1c9
parent7ddd7b09dbcaf57579980d5cc31d1f06370bdbd4 (diff)
portable installation option (changes handling of -portable switch)
git-svn-id: svn://tug.org/texlive/trunk@19149 c570f23f-e606-0410-a88d-b1316a301751
-rwxr-xr-xMaster/install-tl101
-rwxr-xr-xMaster/tl-portable.bat51
2 files changed, 34 insertions, 118 deletions
diff --git a/Master/install-tl b/Master/install-tl
index 3469697aee1..6a0b83d3857 100755
--- a/Master/install-tl
+++ b/Master/install-tl
@@ -143,6 +143,7 @@ our %vars=( # 'n_' means 'number of'.
'doc_splitting_supported' => 1,
'selected_scheme' => $default_scheme,
'from_dvd' => 0,
+ 'portable' => 0,
);
# option handling
@@ -305,8 +306,6 @@ our @media_available;
if ($opt_print_arch) {
print platform()."\n";
exit 0;
-} elsif ($opt_portable) {
- &do_portable ();
}
@@ -443,6 +442,7 @@ if ($opt_from_dvd and ($media ne "DVD")) {
$opt_from_dvd = 0;
}
$vars{'from_dvd'} = $opt_from_dvd;
+$vars{'portable'} = $opt_portable;
load_tlpdb();
@@ -569,6 +569,7 @@ if (!$finished) {
# in case it is the root of a drive
$vars{'TEXDIR'} =~ s![/\\]$!!;
$vars{'TEXDIRW'} =~ s![/\\]$!!;
+ sanitise_options();
info("Installing to: $vars{TEXDIRW}\n");
do_installation();
}
@@ -647,7 +648,7 @@ sub do_postinst_stuff {
my $TEXMFLOCAL="$vars{'TEXMFLOCAL'}";
my $tmv;
- do_texmf_cnf() unless ($opt_portable);
+ do_texmf_cnf();
#
# clean up useless files in texmf-dist/tlpkg as this is only
@@ -677,7 +678,7 @@ sub do_postinst_stuff {
my @TMFVARS1=qw(TEXMFMAIN TEXMFDIST TEXMFLOCAL TEXMFSYSVAR TEXMFSYSCONFIG
TEXMFVAR TEXMFCONFIG TEXMFHOME TEXMFCACHE);
- if (defined($ENV{'TEXMFCNF'}) and !$vars{'from_dvd'} and !$opt_portable) {
+ if (defined($ENV{'TEXMFCNF'}) and !$vars{'from_dvd'} and !$vars{'portable'}) {
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
@@ -749,19 +750,16 @@ operations might be disturbed.\n\n";
debug 'Effective TEXMFCNF: '.`kpsewhich -expand-path=\$TEXMFCNF`."\n";
}
- # TODO: can the following two clauses be merged?
- if (win32()) {
+ if (win32() and !$vars{'portable'}) {
create_uninstaller($vars{'TEXDIR'}, $vars{'TEXDIRW'},
$vars{'TEXMFSYSVAR'}, $vars{'TEXMFSYSCONFIG'});
- }
- # (re-)initialize batchfile for uninstalling shortcuts
- if (win32() and !$opt_portable) {
+ # (re-)initialize batchfile for uninstalling shortcuts
mkdirhier("$TEXDIRW/tlpkg/installer") if $vars{'from_dvd'};
}
# Step 4: run the programs
- if (!$opt_portable and !$vars{'from_dvd'}) {
+ if (!$vars{'from_dvd'}) {
info("running mktexlsr $TEXDIR/texmf-dist $TEXDIR/texmf\n");
system('mktexlsr', "$TEXDIR/texmf-dist", "$TEXDIR/texmf");
}
@@ -958,6 +956,10 @@ sub do_texmf_cnf {
}
}
+ if ($vars{'portable'}) {
+ push @changedtmf, "ASYMPTOTE_HOME = \$TEXMFCONFIG/asymptote\n";
+ }
+
my ($TMF, $TMFLUA);
if (!$vars{'from_dvd'}) {
$TMF = ">$vars{'TEXDIR'}/texmf.cnf";
@@ -1100,6 +1102,13 @@ sub set_texlive_default_dirs {
my $texmfconfig = getenv('TEXLIVE_INSTALL_TEXMFCONFIG');
$texmfconfig ||= "$texmfhome/.texlive$yyyy/texmf-config";
$vars{'TEXMFCONFIG'} = $texmfconfig;
+
+ # for portable installation we want everything in one directory
+ if ($vars{'portable'} && !$vars{'from_dvd'}) {
+ $vars{'TEXMFHOME'} = "\$TEXMFLOCAL";
+ $vars{'TEXMFVAR'} = "\$TEXMFSYSVAR";
+ $vars{'TEXMFCONFIG'} = "\$TEXMFSYSCONFIG";
+ }
}
sub calc_depends {
@@ -1456,6 +1465,16 @@ 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'};
+ $vars{'option_desktop_integration'} &&= !$vars{'portable'};
+}
+
sub prepare_installation {
make_var_skeleton "$vars{'TEXMFSYSVAR'}";
make_local_skeleton "$vars{'TEXMFLOCAL'}";
@@ -1830,68 +1849,6 @@ EOF
}
-# portable option, invoked from tl-portable script.
-#
-sub do_portable {
- $::opt_verbosity = -1;
- $::_platform_ = platform();
- $location = getenv('TEXDIR');
- die "$0: Don't use --portable directly; use tl-portable instead\n"
- unless $location;
- $vars{'TEXDIR'} = $location;
- if (not -d $vars{'TEXDIR'}.'/bin/'.$::_platform_) { # shouldn't happen
- die "$0: Platform ".$::_platform_." not supported.";
- }
- # set_platforms_supported();
- # set_texlive_default_dirs();
- $vars{'TEXDIRW'} = getenv('TEXDIRW');
- $vars{'TEXMFSYSVAR'} = getenv('TEXMFSYSVAR');
- $vars{'TEXMFSYSCONFIG'} = getenv('TEXMFSYSCONFIG');
- $vars{'TEXMFLOCAL'} = getenv('TEXMFLOCAL');
- $vars{'TEXMFHOME'} = getenv('TEXMFHOME');
- $vars{'TEXMFVAR'} = getenv('TEXMFVAR');
- $vars{'TEXMFCONFIG'} = getenv('TEXMFCONFIG');
- if (win32()) {
- non_admin();
- my $winpath = "$vars{'TEXDIR'}/bin/win32";
- }
-
- our $PORTABLE_PROMPT_DONE = 0; # used in subroutine below
- if (! -d "$vars{'TEXMFCONFIG'}" ) {
- portable_prompt ();
- mkdirhier "$vars{'TEXMFCONFIG'}";
- }
- if (! -d "$vars{'TEXMFSYSCONFIG'}" ) {
- portable_prompt ();
- mkdirhier "$vars{'TEXMFSYSCONFIG'}";
- }
- if (! -d "$vars{'TEXMFSYSVAR'}" ) {
- portable_prompt ();
- load_tlpdb();
- $localtlpdb = $tlpdb;
- $texlive_release = $tlpdb->config_release;
- make_var_skeleton "$vars{'TEXMFSYSVAR'}";
- # the usual option for pregenerating all formats doesn't apply
- $vars{'option_fmt'} = 0;
- do_postinst_stuff();
- }
-
- close($::LOGFILE) if defined($::LOGFILE);
- print welcome();
- exit 0;
-
-
- # Give the user a chance to bail before changing anything.
- # (Nested subroutine.)
- sub portable_prompt
- {
- return if $PORTABLE_PROMPT_DONE;
- $PORTABLE_PROMPT_DONE = 1;
- print "About to generate some files, press Enter to continue:";
- <STDIN>;
- }
-}
-
#
# some helper fucntion
sub select_collections {
diff --git a/Master/tl-portable.bat b/Master/tl-portable.bat
index abaf87540b7..359eac4d7e4 100755
--- a/Master/tl-portable.bat
+++ b/Master/tl-portable.bat
@@ -9,55 +9,14 @@ if not ^x==x goto DOS
rem Abort if we are running from UNC path
if %~d0==\\ goto UNC
-rem Localize environment changes
-setlocal enableextensions
-
-rem TeX Live Root; ends with backslash
-set TEXDIR=%~dp0
-
-rem TEXDIR writable?
-set TEXDIRW=%USERPROFILE%\.tlportable2010\
-del "%TEXDIR%tl_wrtest" 2>nul
-echo Testing for write access %TEXDIR%...
-echo Hello >"%TEXDIR%tl_wrtest"
-if not exist "%TEXDIR%tl_wrtest" goto wrtestdone
-del "%TEXDIR%tl_wrtest"
-set TEXDIRW=%TEXDIR%
-:wrtestdone
-if not exist "%TEXDIRW%" md "%TEXDIRW%"
-
-rem Use TEXMFHOME for private data,
-rem TEXMFLOCAL for department- or workgroup data.
-rem It is allright if TEXMFLOCAL does not exist.
-
-set TEXMFSYSVAR=%TEXDIRW%texmf-var
-if exist "%TEXDIR%texmf-var" set TEXMFSYSVAR=%TEXDIR%texmf-var
-
-set TEXMFSYSCONFIG=%TEXDIRW%texmf-config
-if exist "%TEXDIR%texmf-config" set TEXMFSYSCONFIG=%TEXDIR%texmf-config
-set TEXMFMAIN=%TEXDIR%texmf
-set TEXMFDIST=%TEXDIR%texmf-dist
-set TEXMFLOCAL=%TEXDIR%texmf-local
-set TEXMFHOME=%TEXDIRW%texmf-home
-set TEXMFVAR=%TEXDIRW%texmf-var
-set TEXMFCONFIG=%TEXDIRW%texmf-config
-set TEXBINDIR=%TEXDIR%bin\win32
-set platform=win32
-
rem use provided Perl
-set PERL5LIB=%TEXDIR%tlpkg\tlperl\lib
-path %TEXDIR%tlpkg\tlperl\bin;%TEXDIR%bin\win32;%path%
-perl "%TEXDIR%install-tl" --portable
-if errorlevel 1 goto failedinit
+set PERL5LIB=%~dp0tlpkg\tlperl\lib
+path %~dp0bin\win32;%path%
rem start new command interperter with customized prompt and window title
-"%ComSpec%" /k "title TL-SHELL& prompt TL %prompt%"
-goto :eof
-
-:failedinit
-echo Initialization of TeX Live failed!
-pause
-exit /b 1
+rem reuse console window of this interpreter and terminate it after that
+start /b "TL-SHELL" "%ComSpec%" /k "title TL-SHELL& prompt TL$S%prompt%"
+exit
:UNC
echo Cannot run from UNC path.