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

rem Make environment changes local
setlocal enableextensions

rem Get TL installation root (w/o trailing backslash)
set tlroot=%~dp0:
set tlroot=%tlroot:\bin\windows\:=%

rem check for any argument
if x == x%1 goto noargs

rem check for gui argument
set args=

:rebuildargs
shift
if x == x%0 goto nomoreargs
if gui == %0 goto guibailout
if -gui == %0 goto guibailout
if --gui == %0 goto guibailout
set args=%args% %0
goto rebuildargs

:nomoreargs

rem Remove remains of previous update if any
set tlupdater=%tlroot%\temp\updater-w32
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\windows;%path%
"%tlroot%\tlpkg\tlperl\bin\perl.exe" "%tlroot%\texmf-dist\scripts\texlive\tlmgr.pl" %args%

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
move /y "%tlupdater%" "%tlupdater%.bat">nul
if errorlevel 1 goto :err_rename_updater
rem Run updater and don't return
"%tlupdater%.bat"

rem This should never execute
echo %~nx0: this message should never show up, please report it to tex-live@tug.org>&2
exit /b 1

:err_updater_exists
echo %~nx0: failed to remove previous updater script>&2
exit /b 1

:err_rename_updater
echo %~nx0: failed to rename "%tlupdater%">&2
exit /b 1

:noargs
echo No arguments given!

:guibailout
echo Use tlshell as a GUI for tlmgr.
pause
exit /b 1