summaryrefslogtreecommitdiff
path: root/Master/tl-portable.bat
diff options
context:
space:
mode:
Diffstat (limited to 'Master/tl-portable.bat')
-rwxr-xr-xMaster/tl-portable.bat34
1 files changed, 34 insertions, 0 deletions
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.