summaryrefslogtreecommitdiff
path: root/Master/tl-portable.bat
blob: 348ce79b20ec4b9b7d15487803c58ce9a9cfc0b5 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
@echo off
rem Copyright 2008-2009 Siep Kroonenberg, Tomasz M. Trzeciak.
rem You may freely use, modify and/or distribute this file.

rem First, check if this is DOS based system
rem in DOS '^' is just a normal character
if not ^x==x goto DOS

rem Abort if we are running from UNC path
if %~d0==\\ goto UNC

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.
echo You can use pushd/popd commands for temporary mapping.
pause
exit /b 1

:DOS
echo DOS and Windows 9x systems are not supported. Sorry.
echo Windows 2000 or newer is required.
pause