diff options
author | Piotr Strzelczyk <piotr@eps.gda.pl> | 2009-08-03 15:04:46 +0000 |
---|---|---|
committer | Piotr Strzelczyk <piotr@eps.gda.pl> | 2009-08-03 15:04:46 +0000 |
commit | 330853d14e08ad9d787d7b0ad1d2b4907e6ace5a (patch) | |
tree | 0981c6cca25aca1182c2c3f0d43721501f1e1128 | |
parent | 660ccf0ff17bb81dd62bcb21838d12ba95778c46 (diff) |
fixes for tlmgr restart in GUI mode and double backslashes in paths
git-svn-id: svn://tug.org/texlive/trunk@14520 c570f23f-e606-0410-a88d-b1316a301751
-rwxr-xr-x | Master/bin/win32/tlmgr.bat | 22 | ||||
-rw-r--r-- | Master/texmf/scripts/texlive/updater-w32 | 37 |
2 files changed, 31 insertions, 28 deletions
diff --git a/Master/bin/win32/tlmgr.bat b/Master/bin/win32/tlmgr.bat index 03536cb9c88..2d411d1a92d 100755 --- a/Master/bin/win32/tlmgr.bat +++ b/Master/bin/win32/tlmgr.bat @@ -7,32 +7,32 @@ rem Originally written 2009 by Tomasz M. Trzeciak 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 Get TL installation root (w/o trailing backslash)
+set tlroot=%~dp0:
+set tlroot=%tlroot:\bin\win32\:=%
rem Remove remains of previous update if any
-(set tlupdatername=updater-w32)
-(set tlupdater=%tlroot%\temp\%tlupdatername%)
-if exist "%tlupdater%*" del "%tlupdater%*"
-if exist "%tlupdater%*" goto :err_updater_exists
+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)
+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">nul
+move /y "%tlupdater%" "%tlupdater%.bat">nul
if errorlevel 1 goto :err_rename_updater
rem Run updater
-endlocal & call "%tlupdater%.bat" & goto :eof
+call "%tlupdater%.bat" & goto :eof
:err_updater_exists
-echo %~nx0: updater script detected, infrastructure update might be running>&2
+echo %~nx0: locked updater script detected, infrastructure update might be running>&2
exit /b 1
:err_rename_updater
-echo %~nx0: cannot rename "%tlupdater%" to "%tlupdatername%.bat">&2
+echo %~nx0: failed to move "%tlupdater%">&2
exit /b 1
diff --git a/Master/texmf/scripts/texlive/updater-w32 b/Master/texmf/scripts/texlive/updater-w32 index 59f6788bf3e..f2a831f6726 100644 --- a/Master/texmf/scripts/texlive/updater-w32 +++ b/Master/texmf/scripts/texlive/updater-w32 @@ -77,7 +77,11 @@ if not defined w32upd_args ( exit /b 1 ) set dbg=rem -if /i %w32upd_debug%0 GTR 0 set dbg=echo D:updater-w32: +if /i %w32upd_debug%0 GTR 0 ( + set dbg=echo D:updater-w32: + echo D:updater-w32: updater data: + set w32upd_ +) if "%~1"=="main" goto :main @@ -85,15 +89,19 @@ rem Restart in cmd.exe to avoid problems if 4NT is used set respawn=cmd.exe /c call rem For gui mode console window might be hidden, so open a new one if /i %w32upd_gui_mode%0==10 set respawn=start /wait %respawn% +set exitcode=0 rem Lock this file write-open during execution to signal running state call %dbg% respawning in cmd.exe ... %respawn% "%~f0" main 9^>^>"%~f0" +if errorlevel 1 goto :sefldel +if not defined w32upd_rerun_args goto :selfdel + +echo Restarting tlmgr to complete update ... +call %dbg% tlmgr.bat %w32upd_rerun_args% +call tlmgr.bat %w32upd_rerun_args% + +:selfdel set exitcode=%errorlevel% -if /i %exitcode%0 NEQ 0 ( - call %dbg% update script left for inspection at: %~f0.txt - copy /y "%~f0" "%~f0.txt" >nul - exit /b %exitcode% -) rem Self-delete without error message about missing file start /b cmd.exe /c del "%~f0" & exit /b %exitcode% @@ -102,11 +110,12 @@ title %w32upd_title% rem Get TL installation root and log file location for /f "tokens=1-2 delims=;" %%I in ( - 'kpsewhich -expand-var=$SELFAUTOPARENT/.;$TEXMFSYSVAR/web2c' + 'kpsewhich -expand-var=$SELFAUTOLOC/:;$TEXMFSYSVAR/web2c' ) do ( set tlroot=%%~fI set logdir=%%~fJ ) +set "tlroot=%tlroot:\bin\win32\:=%" if not exist "%tlroot%\texmf\scripts\texlive\tlmgr.pl" ( echo updater-w32: cannot locate installation root.>&2 exit /b 1 @@ -142,12 +151,8 @@ if errorlevel 1 goto :rollback call :foreachpkg incltlpobj "%tlroot%\tlpkg\tlpobj\" %pkgpartslist% if errorlevel 1 goto :rollback call :foreachpkg updateinfo "update" %pkglist% -if not defined w32upd_rerun_args goto :finishmsg -echo Restarting tlmgr to complete update ... -call %dbg% tlmgr %w32upd_rerun_args% -"%tlroot%\tlpkg\tlperl\bin\perl.exe" "%tlroot%\texmf\scripts\texlive\tlmgr.pl" %w32upd_rerun_args% -set exitcode=%errorlevel% -goto :finishmsg +call :printmsg%w32upd_gui_mode% "TeX Live infrastructure update complete." 0 "%w32upd_title%" +goto :finish :rollback call :foreachpkg updateinfo "failed update" %pkglist% >&2 @@ -167,10 +172,8 @@ call :printmsg%w32upd_gui_mode% "TeX Live infrastructure update failed and backu rem Evil has taken over - emit adequate exit code exit /b 666 -:finishmsg -call :printmsg%w32upd_gui_mode% "TeX Live infrastructure update complete." 0 "%w32upd_title%" :finish -del "%tlroot%\temp\tar-w32.exe" "%tlroot%\temp\__BACKUP_*" >nul 2>&1 +del "%tlroot%\temp\tar-w32.exe" "%tlroot%\temp\__BACKUP_*" 1>nul 2>nul exit /b %exitcode% REM SUBROUTINES @@ -194,7 +197,7 @@ exit /b 0 :untar %tlroot%\temp\[__BACKUP_] pkgname set "suffix=tar" if %~n1_==__BACKUP__ set "suffix=r%~3.tar" -call %dbg% untar: "%~1%~2.%suffix%" +call %dbg% untar: "%tlroot%\temp\tar-w32.exe" -C "%tlroot%" -f "%~1%~2.%suffix%" -x "%tlroot%\temp\tar-w32.exe" -C "%tlroot%" -f "%~1%~2.%suffix%" -x && del "%~1%~2.%suffix%" exit /b %errorlevel% |