summaryrefslogtreecommitdiff
path: root/Master/bin/win32/tlmgr.bat
blob: 8f72641d00ba605ef808ddbe06633428b2770e19 (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
@echo off
rem Advanced launcher for tlmgr with auto-update
rem
rem Copyright 2009 by Tomasz M. Trzeciak
rem Public Domain

rem Make environment changes local
setlocal enableextensions

rem Get TL installation root (it should be two levels up)
for %%I in ("%~dp0..\..") do (set tlroot=%%~fI)

rem Remove remains of previous update if any
(set tlupdatername=run-updater-w32)
(set tlupdater=%tlroot%\temp\%tlupdatername%)
if exist "%tlupdater%*" del "%tlupdater%*"
if exist "%tlupdater%*" goto :err_updater_exists

rem Start tlmgr
(set PERL5LIB=%tlroot%\tlpkg\tlperl\lib)
path %tlroot%\tlpkg\tlperl\bin;%tlroot%\bin\win32;%path%
perl "%tlroot%\texmf\scripts\texlive\tlmgr.pl" %*

rem Finish if there are no updates to do; the last error code will be returned
if not exist "%tlupdater%" goto :eof
rem Rename updater script before it is run
ren "%tlupdater%" "%tlupdatername%.bat"
if errorlevel 1 goto :err_rename_updater
rem Run updater
echo Starting update ...
endlocal & call "%tlupdater%.bat" & goto :eof

:err_updater_exists
echo %~n0: cannot remove update script, infrastructure update might be in progress>&2
exit /b 1

:err_rename_updater
echo %~n0: cannot rename "%tlupdater%">&2
exit /b 1

:err_OS
echo Unsupported operating system. Windows 2000 or later required.
pause