summaryrefslogtreecommitdiff
path: root/Master/tl-portable.bat
blob: ee0d12167d3c5c22c2567debe3da36002e455830 (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
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
@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 Now check for Windows NT which is also not supported
ver | find "NT"
if not errorlevel 1 goto WinNT

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%\.tlportable2008\
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

rem start new command interperter with customized prompt and window title
rem reuse existing console but without blocking the parent process
start "TL-SHELL" /b "%ComSpec%" /k "title TL-SHELL& prompt TL %prompt%"
goto :eof

:failedinit
echo Initialization of TeX Live 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

:WinNT
echo Windows NT is not supported. Sorry.
echo Windows 2000 or newer is required.
pause
exit /b 1

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