summaryrefslogtreecommitdiff
path: root/Master/tlpkg/installer/install-tl-windows.cmd
blob: b9ece1c5e870faf274828743d5cad845ec4fd673 (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
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
@echo off
rem $Id: install-tl.bat 30369 2018-03-11 13:01:27Z siepo $
rem Wrapper script to set up environment for installer
rem
rem Public domain.
rem Originally written 2009 by Tomasz M. Trzeciak.

rem Localize environment changes
setlocal enableextensions enabledelayedexpansion

rem check for version later than vista
for /f "usebackq tokens=2 delims=[]" %%I in (`ver`) do set ver_str=%%I
set ver_str=%ver_str:* =%
rem windows 9x, 2000, xp won't work, vista unsupported but may work
if %ver_str:~,2% == 4. goto tooold
if %ver_str:~,2% == 5. goto tooold
if %ver_str:~,3% == 6.0 (
echo WARNING: Windows 7 is the earliest supported version.
echo TeX Live 2018 has not been tested on Windows Vista.
pause
)

rem version of external perl, if any
set extperl=0
for /f "usebackq tokens=2 delims='" %%a in (`perl -V:version 2^>NUL`) do (
  set extperl=%%a
)

rem set instroot before %0 gets overwritten during argument processing
set instroot=%~dp0

rem while this file resides in tlpkg/installer:
rem alternately remove final backslash and filename part
rem to arrive at grandparent
rem retain final backslash
set instroot=%instroot:~,-1%
for %%J in (%instroot%) do set instroot=%%~dpJ
set instroot=%instroot:~,-1%
for %%J in (%instroot%) do set instroot=%%~dpJ

set notcl=no
set tcl=yes
set args=
goto rebuildargs

rem check for a gui- and lang arguments
rem handle them here and do not pass them on to perl or tcl.
rem cmd.exe converts '=' to a space:
rem '-parameter=value' becomes '-parameter value': two arguments

rem code block for language argument
:dolang
shift
if "%0" == "" goto nomoreargs
set LANG=%0
set LC_ALL=
goto rebuildargs

rem code block for gui argument
:dogui
if x%1 == x (
set tcl=yes
goto rebuildargs
)
if %1 == text (
set tcl=no
shift
goto rebuildargs
)
if %1 == wizard (
set tcl=yes
shift
goto rebuildargs
)
if %1 == perltk (
set tcl=yes
shift
goto rebuildargs
)
if %1 == expert (
set tcl=yes
shift
goto rebuildargs
)
if %1 == tcl (
set tcl=yes
shift
goto rebuildargs
)

rem loop for argument scanning
:rebuildargs
shift
if x%0 == x goto nomoreargs
set p=%0
if %p% == --lang goto dolang
if %p% == -lang goto dolang

if %p% == -print-platform set tcl=no
if %p% == --print-platform set tcl=no
if %p% == -version set tcl=no
if %p% == --version set tcl=no
if %p% == -no-gui (
set notcl=yes
goto rebuildargs
)
if %p% == --no-gui (
set notcl=yes
goto rebuildargs
)
if %p% == -gui goto dogui
if %p% == --gui goto dogui

rem not a gui- or lang argument: copy to args string
if "%args%" == "" (
set args=%p%
) else (
set args=%args% %p%
)
goto rebuildargs
:nomoreargs

set p=
if %notcl% == yes set tcl=no

rem locale detection for tcl
rem the LANG environment variable should set the tcl default language.
rem Since reg.exe may be disabled by e.g. company policy,
rem tcl will yet consult the registry if LANG is not set,
rem although under some circumstances this may cause a long delay.
goto endreg
if %tcl% == no goto endreg
if not x%LANG% == x goto endreg
rem reg.exe runnable by user?
reg /? >nul 2>&1
goto endreg
if errorlevel 1 goto endreg
for /f "skip=1 usebackq tokens=3 delims= " %%a in (`reg query hklm\system\currentcontrolset\control\nls\language /v Installlanguage`) do set lid=%%a
if errorlevel 1 goto endreg
for /f "skip=1 usebackq tokens=3 delims=; " %%a in (`reg query hkcr\mime\database\rfc1766 /v %lid%`) do set LANG=%%a
:endreg

rem Check for tex directories on path and remove them.
rem Need to remove any double quotes from path
set path=%path:"=%
rem Break search path into dir list and rebuild w/o tex dirs.
set path="%path:;=" "%"
set newpath=
for /d %%I in (%path%) do (
set ii=%%I
set ii=!ii:"=!
if not exist !ii!\pdftex.exe (
if not exist !ii!pdftex.exe (
set newpath=!newpath!;!ii!
)
)
)
set ii=
path %newpath%
if "%path:~,1%"==";" set path=%path:~1%
rem Use TL Perl
path=%instroot%tlpkg\tlperl\bin;%path%
set PERL5LIB=%instroot%tlpkg\tlperl\lib
rem for now, assume tcl/tk is on path

rem Clean environment from other Perl variables
set PERL5OPT=
set PERLIO=
set PERLIO_DEBUG=
set PERLLIB=
set PERL5DB=
set PERL5DB_THREADED=
set PERL5SHELL=
set PERL_ALLOW_NON_IFS_LSP=
set PERL_DEBUG_MSTATS=
set PERL_DESTRUCT_LEVEL=
set PERL_DL_NONLAZY=
set PERL_ENCODING=
set PERL_HASH_SEED=
set PERL_HASH_SEED_DEBUG=
set PERL_ROOT=
set PERL_SIGNALS=
set PERL_UNICODE=
set errlev=0

rem Start installer
if %tcl% == yes (
rem echo wish "%instroot%tlpkg\installer\install-tl-gui.tcl" -- %args%
rem pause
wish "%instroot%tlpkg\installer\install-tl-gui.tcl" -- %args%
) else (
rem echo perl "%instroot%install-tl" %args% -no-gui
rem pause
perl "%instroot%install-tl" %args% -no-gui
)

rem The nsis installer will need this:
if errorlevel 1 set errlev=1
goto eoff

:tooold
echo TeX Live does not run on this Windows version.
echo TeX Live is supported on Windows 7 and later.
goto eoff

:eoff
endlocal