diff options
author | Piotr Strzelczyk <piotr@eps.gda.pl> | 2009-08-11 07:03:01 +0000 |
---|---|---|
committer | Piotr Strzelczyk <piotr@eps.gda.pl> | 2009-08-11 07:03:01 +0000 |
commit | bcb7f83732c8609f2ab6d1d225d0b3de097f5701 (patch) | |
tree | bf7c407666bdbdc6b5d54650e770f69f30094304 /Master | |
parent | 1bb99cc1747fe11fa945e528244f3adcf11963e6 (diff) |
set svn:eol-style to CRLF
git-svn-id: svn://tug.org/texlive/trunk@14616 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master')
-rw-r--r-- | Master/texmf/scripts/texlive/updater-w32 | 474 |
1 files changed, 237 insertions, 237 deletions
diff --git a/Master/texmf/scripts/texlive/updater-w32 b/Master/texmf/scripts/texlive/updater-w32 index 187206e856b..033df6feeff 100644 --- a/Master/texmf/scripts/texlive/updater-w32 +++ b/Master/texmf/scripts/texlive/updater-w32 @@ -1,237 +1,237 @@ -@echo off -rem Update script for TeX Live infrastructure -rem called automatically if there are any infrastructure updates -rem -rem Copyright 2009 by Tomasz M. Trzeciak <t.m.trzeciak@googlemail.com> -rem This file is licensed under the GNU General Public License version 2 -rem or any later version. -rem - -:: =================================================================== -:: INFRASTRUCTURE UPDATE ON WINDOWS -:: =================================================================== -:: Infrastructure files cannot be updated directly from the tlmgr.pl -:: script due to file locking problem on Windows---files that are in -:: use (either open or executing) cannot be removed or replaced. -:: Therefore the update process is performed by a batch script outside -:: of tlmgr.pl. -:: There are three pieces involved in the update: tlmgr.bat launcher, -:: write_w32_updater subroutine in tlmgr.pl and this script. Their -:: roles are as follows: -:: * tlmgr.bat is a watchdog, it launches tlmgr.pl and watches for -:: a trigger script that is to be executed. If trigger script exists -:: before tlmgr.pl is launched, it will be removed or tlmgr.bat will -:: abort if it fails to do so. This means that the trigger script -:: has to be created by the current invocation of tlmgr.pl. -:: Futhermore, the trigger script is renamed from updater-w32 to -:: updater-w32.bat just before it is run, and thus it can trigger only -:: once. -:: * write_w32_updater subroutine in tlmgr.pl prepares the update -:: and writes the trigger script. Packages in .xz archives are -:: dowloaded/copied and uncompressed to .tar files. Also .tar -:: backups of the current packages are made. If everything is -:: successful, the trigger script is created from the template -:: appended with evironment settings needed for the update. -:: Otherwise the update is aborted. -:: * updater-w32[.bat], which is this script, triggers and executes -:: the actual update. The list of packages to update and any -:: additional information is passed through evironment, -:: including agrmuments for tlmgr restart needed to complete the -:: update of remaining packages. -:: The list of infrastructure packages consists of triples: -:: package-name old-revision-number new-revision-number -:: For each package-name a .tar archive package-name.tar is expected -:: (also for .source and .doc pseudo packages---those are for -:: distribution only and don't appear separately in tlpdb). -:: Additionally a backup archive is expected: -:: __BACKUP_package-name.rXXX.tar, -:: where XXX is (old) revision number (.source and .doc are included -:: in the backup). -:: The update itself proceeds as follows: -:: (1) untar all package archives -:: (2) include .tlpobj files into tlpdb -:: (3) print update info -:: (4) optionally restart tlmgr to complete the update -:: Any error during (1) or (2) triggers the rollback action: -:: (1) print failed update info -:: (2) untar all package backups -:: (3) include .tlpobj files (from backup) into tlpdb -:: (4) print restore info -:: Any error during (2) or (3) and we go into panic mode. At this -:: point there is no guarantee that the installation is still -:: working. There is not much we can do but to print failed restore -:: info and give instructions to download and run -:: 'update-tlmgr-latest.exe' to repair the installation. -:: =================================================================== - - -rem Make environment changes local & enable cmd extensions -rem (we don't want delayed expansion becasue it's hard to echo bang !) -setlocal enableextensions disabledelayedexpansion - -rem Make sure that dynamic variables are not overshadowed -for %%I in (errorlevel date time) do (set %%I=) - -rem Set up the evironment for update -call :setupenv -if /i %w32upd_debug%0 GEQ 20 (echo on) - -if "%~1"=="main" goto :main - -set respawn= -rem For gui mode console window might be hidden, so open a new one -if "%w32upd_gui_mode%"=="1" set respawn=start /wait -rem Restart in cmd.exe to avoid problems if 4NT is used -call :debug "respawning in cmd.exe ..." -%respawn% cmd.exe /c call "%~f0" main -if errorlevel 1 exit /b %errorlevel% -if defined w32upd_rerun_args ( - call :info "Restarting tlmgr to complete update ..." - call tlmgr.bat %w32upd_rerun_args% -) -set exitcode=%errorlevel% -rem Self-delete without error message about missing file -start /b cmd.exe /c del "%~f0" & exit /b %exitcode% - -:main -title %w32upd_title% - -if not defined w32upd_args ( - call :error "Update arguments not defined, please report this to: tex-live@tug.org" - goto :abort -) -call :debug "update package list: %w32upd_args%" - -rem Get TL installation root and log file location -for /f "tokens=1-2 delims=;" %%I in ( - 'kpsewhich -expand-var="$SELFAUTOLOC/:;$TEXMFSYSVAR/web2c/tlmgr.log"' -) do ( - set tlroot=%%~fI - set tlmgrlog=%%~fJ -) -set "tlroot=%tlroot:\bin\win32\:=%" -if not exist "%tlroot%\texmf\scripts\texlive\tlmgr.pl" ( - call :error "Could not locate installation root." - goto :abort -) -call :debug "TL root: %tlroot%" -if not exist "%tlmgrlog%" (set tlmgrlog=%~dpn0.log) - -rem Make a private copy of tar.exe -copy /y "%tlroot%\tlpkg\installer\tar.exe" "%tlroot%\temp\tar-w32.exe" >nul -if errorlevel 1 ( - call :error "Could not copy tar.exe." - goto :abort -) - -rem Set up perl environment -set PERL5LIB=%tlroot%\tlpkg\tlperl\lib - -rem Get package list -set pkgpartslist=%w32upd_args% -rem Construct package list without .source and .doc packages -rem Count the total number of packages while doing that -set pkgcount=0 -(set pkglist=) -call :foreachpkg remove_src_doc pkglist %pkgpartslist% - -rem Begin update -echo DO NOT CLOSE THIS WINDOW! -call :info "TeX Live infrastructure update [%date% %time%]" -call :foreachpkg untar "%tlroot%\temp\" %pkgpartslist% -if errorlevel 1 goto :rollback -call :foreachpkg incltlpobj "%tlroot%\tlpkg\tlpobj\" %pkgpartslist% -if errorlevel 1 goto :rollback -call :foreachpkg updateinfo "update" %pkglist% -call :printmsg "TeX Live infrastructure update complete." 0 "%w32upd_title%" -del "%tlroot%\temp\tar-w32.exe" "%tlroot%\temp\*.tar" 1>nul -exit /b 0 - -:rollback -call :foreachpkg updateinfo "failed update" %pkglist% >&2 -call :info "Rolling back to previous version ..." -call :foreachpkg untar "%tlroot%\temp\__BACKUP_" %pkglist% -if errorlevel 1 goto :panic -call :foreachpkg incltlpobj "%tlroot%\tlpkg\tlpobj\" %pkglist% -if errorlevel 1 goto :panic -call :foreachpkg restoreinfo "restore" %pkglist% -call :printmsg "TeX Live infrastructure update failed.\nPrevious version has been restored." 16 "ERROR: %w32upd_title%" >&2 -exit /b 1 - -:panic -call :foreachpkg restoreinfo "failed restore" %pkglist% >&2 -call :printmsg "TeX Live infrastructure update failed and backup recovery failed as well.\nYour TeX Live installation may be broken, to repair it download and run:\nhttp://mirror.ctan.org/systems/texlive/tlnet/update-tlmgr-latest.exe" 16 "FATAL ERROR: %w32upd_title%" >&2 -rem Evil has taken over - emit adequate exit code -exit /b 666 - -:abort -call :info "Aborting infrastructure update, no changes have been made." -exit /b 1 - -REM SUBROUTINES - -:foreachpkg cmd prefix pkgname oldrev newrev ... -set pkgnr=0 -:pkgloop -if [%3]==[] exit /b 0 -call :%1 %2 %3 %4 %5 -if errorlevel 1 exit /b 1 -shift /3 & shift /3 & shift /3 -goto :pkgloop - -:remove_src_doc -if /i %~x2.==.source. exit /b 0 -if /i %~x2.==.doc. exit /b 0 -set %1=%pkglist% %2 %3 %4 -set /a pkgcount+=1 -exit /b 0 - -:untar %tlroot%\temp\[__BACKUP_] pkgname -set "suffix=tar" -if %~n1_==__BACKUP__ set "suffix=r%~3.tar" -call :debug "untar: %~1%~2.%suffix%" -"%tlroot%\temp\tar-w32.exe" -C "%tlroot%" -f "%~1%~2.%suffix%" -x -exit /b %errorlevel% - -:incltlpobj %tlroot%\tlpkg\tlpobj\ pkgname -call :debug "include into tlpdb: %~1%~2.tlpobj" -"%tlroot%\tlpkg\tlperl\bin\perl.exe" "%tlroot%\texmf\scripts\texlive\tlmgr.pl" _include_tlpobj "%~1%~2.tlpobj" -exit /b %errorlevel% - -:info "message text" -echo.%~1>>"%~dpn0.log" -echo.%~1 -exit /b 0 - -:debug "message text" -echo.%~1>>"%~dpn0.log" -if /i %w32upd_debug%0 GTR 0 (>&2 echo D: %~1) -exit /b 0 - -:error "message text" -echo.%~1>>"%~dpn0.log" ->&2 echo.%~1 -exit /b 1 - -:updateinfo header pkgname oldrev newrev -set "infomsg= -> %~4" -:restoreinfo header pkgname oldrev newrev -set "infomsg=%~1: %~2 (%~3%infomsg%)" -set "infomsg=%infomsg:>=^>%" -set /a pkgnr+=1 -echo [%pkgnr%/%pkgcount%] %infomsg% -echo [%pkgnr%/%pkgcount%] %infomsg%>>"%~dpn0.log" -echo [%date% %time%] %infomsg%>>"%tlmgrlog%" -set "infomsg=" -exit /b 0 - -:printmsg "message text" -set infomsg=%~1 -for %%I in ("%infomsg:\n=" "%") do call :info "%%~I" -if not "%w32upd_gui_mode%"=="1" exit /b 0 -echo MsgBox Replace("%~1", "\n", Chr(10)), %2, "%~3" >"%tlroot%\temp\dialogpopup.vbs" -cscript -nologo "%tlroot%\temp\dialogpopup.vbs" -del "%tlroot%\temp\dialogpopup.vbs" -exit /b %errorlevel% - -rem Everything below is generated automatically by tlmgr on each infrastructure update +@echo off
+rem Update script for TeX Live infrastructure
+rem called automatically if there are any infrastructure updates
+rem
+rem Copyright 2009 by Tomasz M. Trzeciak <t.m.trzeciak@googlemail.com>
+rem This file is licensed under the GNU General Public License version 2
+rem or any later version.
+rem
+
+:: ===================================================================
+:: INFRASTRUCTURE UPDATE ON WINDOWS
+:: ===================================================================
+:: Infrastructure files cannot be updated directly from the tlmgr.pl
+:: script due to file locking problem on Windows---files that are in
+:: use (either open or executing) cannot be removed or replaced.
+:: Therefore the update process is performed by a batch script outside
+:: of tlmgr.pl.
+:: There are three pieces involved in the update: tlmgr.bat launcher,
+:: write_w32_updater subroutine in tlmgr.pl and this script. Their
+:: roles are as follows:
+:: * tlmgr.bat is a watchdog, it launches tlmgr.pl and watches for
+:: a trigger script that is to be executed. If trigger script exists
+:: before tlmgr.pl is launched, it will be removed or tlmgr.bat will
+:: abort if it fails to do so. This means that the trigger script
+:: has to be created by the current invocation of tlmgr.pl.
+:: Futhermore, the trigger script is renamed from updater-w32 to
+:: updater-w32.bat just before it is run, and thus it can trigger only
+:: once.
+:: * write_w32_updater subroutine in tlmgr.pl prepares the update
+:: and writes the trigger script. Packages in .xz archives are
+:: dowloaded/copied and uncompressed to .tar files. Also .tar
+:: backups of the current packages are made. If everything is
+:: successful, the trigger script is created from the template
+:: appended with evironment settings needed for the update.
+:: Otherwise the update is aborted.
+:: * updater-w32[.bat], which is this script, triggers and executes
+:: the actual update. The list of packages to update and any
+:: additional information is passed through evironment,
+:: including agrmuments for tlmgr restart needed to complete the
+:: update of remaining packages.
+:: The list of infrastructure packages consists of triples:
+:: package-name old-revision-number new-revision-number
+:: For each package-name a .tar archive package-name.tar is expected
+:: (also for .source and .doc pseudo packages---those are for
+:: distribution only and don't appear separately in tlpdb).
+:: Additionally a backup archive is expected:
+:: __BACKUP_package-name.rXXX.tar,
+:: where XXX is (old) revision number (.source and .doc are included
+:: in the backup).
+:: The update itself proceeds as follows:
+:: (1) untar all package archives
+:: (2) include .tlpobj files into tlpdb
+:: (3) print update info
+:: (4) optionally restart tlmgr to complete the update
+:: Any error during (1) or (2) triggers the rollback action:
+:: (1) print failed update info
+:: (2) untar all package backups
+:: (3) include .tlpobj files (from backup) into tlpdb
+:: (4) print restore info
+:: Any error during (2) or (3) and we go into panic mode. At this
+:: point there is no guarantee that the installation is still
+:: working. There is not much we can do but to print failed restore
+:: info and give instructions to download and run
+:: 'update-tlmgr-latest.exe' to repair the installation.
+:: ===================================================================
+
+
+rem Make environment changes local & enable cmd extensions
+rem (we don't want delayed expansion becasue it's hard to echo bang !)
+setlocal enableextensions disabledelayedexpansion
+
+rem Make sure that dynamic variables are not overshadowed
+for %%I in (errorlevel date time) do (set %%I=)
+
+rem Set up the evironment for update
+call :setupenv
+if /i %w32upd_debug%0 GEQ 20 (echo on)
+
+if "%~1"=="main" goto :main
+
+set respawn=
+rem For gui mode console window might be hidden, so open a new one
+if "%w32upd_gui_mode%"=="1" set respawn=start /wait
+rem Restart in cmd.exe to avoid problems if 4NT is used
+call :debug "respawning in cmd.exe ..."
+%respawn% cmd.exe /c call "%~f0" main
+if errorlevel 1 exit /b %errorlevel%
+if defined w32upd_rerun_args (
+ call :info "Restarting tlmgr to complete update ..."
+ call tlmgr.bat %w32upd_rerun_args%
+)
+set exitcode=%errorlevel%
+rem Self-delete without error message about missing file
+start /b cmd.exe /c del "%~f0" & exit /b %exitcode%
+
+:main
+title %w32upd_title%
+
+if not defined w32upd_args (
+ call :error "Update arguments not defined, please report this to: tex-live@tug.org"
+ goto :abort
+)
+call :debug "update package list: %w32upd_args%"
+
+rem Get TL installation root and log file location
+for /f "tokens=1-2 delims=;" %%I in (
+ 'kpsewhich -expand-var="$SELFAUTOLOC/:;$TEXMFSYSVAR/web2c/tlmgr.log"'
+) do (
+ set tlroot=%%~fI
+ set tlmgrlog=%%~fJ
+)
+set "tlroot=%tlroot:\bin\win32\:=%"
+if not exist "%tlroot%\texmf\scripts\texlive\tlmgr.pl" (
+ call :error "Could not locate installation root."
+ goto :abort
+)
+call :debug "TL root: %tlroot%"
+if not exist "%tlmgrlog%" (set tlmgrlog=%~dpn0.log)
+
+rem Make a private copy of tar.exe
+copy /y "%tlroot%\tlpkg\installer\tar.exe" "%tlroot%\temp\tar-w32.exe" >nul
+if errorlevel 1 (
+ call :error "Could not copy tar.exe."
+ goto :abort
+)
+
+rem Set up perl environment
+set PERL5LIB=%tlroot%\tlpkg\tlperl\lib
+
+rem Get package list
+set pkgpartslist=%w32upd_args%
+rem Construct package list without .source and .doc packages
+rem Count the total number of packages while doing that
+set pkgcount=0
+(set pkglist=)
+call :foreachpkg remove_src_doc pkglist %pkgpartslist%
+
+rem Begin update
+echo DO NOT CLOSE THIS WINDOW!
+call :info "TeX Live infrastructure update [%date% %time%]"
+call :foreachpkg untar "%tlroot%\temp\" %pkgpartslist%
+if errorlevel 1 goto :rollback
+call :foreachpkg incltlpobj "%tlroot%\tlpkg\tlpobj\" %pkgpartslist%
+if errorlevel 1 goto :rollback
+call :foreachpkg updateinfo "update" %pkglist%
+call :printmsg "TeX Live infrastructure update complete." 0 "%w32upd_title%"
+del "%tlroot%\temp\tar-w32.exe" "%tlroot%\temp\*.tar" 1>nul
+exit /b 0
+
+:rollback
+call :foreachpkg updateinfo "failed update" %pkglist% >&2
+call :info "Rolling back to previous version ..."
+call :foreachpkg untar "%tlroot%\temp\__BACKUP_" %pkglist%
+if errorlevel 1 goto :panic
+call :foreachpkg incltlpobj "%tlroot%\tlpkg\tlpobj\" %pkglist%
+if errorlevel 1 goto :panic
+call :foreachpkg restoreinfo "restore" %pkglist%
+call :printmsg "TeX Live infrastructure update failed.\nPrevious version has been restored." 16 "ERROR: %w32upd_title%" >&2
+exit /b 1
+
+:panic
+call :foreachpkg restoreinfo "failed restore" %pkglist% >&2
+call :printmsg "TeX Live infrastructure update failed and backup recovery failed as well.\nYour TeX Live installation may be broken, to repair it download and run:\nhttp://mirror.ctan.org/systems/texlive/tlnet/update-tlmgr-latest.exe" 16 "FATAL ERROR: %w32upd_title%" >&2
+rem Evil has taken over - emit adequate exit code
+exit /b 666
+
+:abort
+call :info "Aborting infrastructure update, no changes have been made."
+exit /b 1
+
+REM SUBROUTINES
+
+:foreachpkg cmd prefix pkgname oldrev newrev ...
+set pkgnr=0
+:pkgloop
+if [%3]==[] exit /b 0
+call :%1 %2 %3 %4 %5
+if errorlevel 1 exit /b 1
+shift /3 & shift /3 & shift /3
+goto :pkgloop
+
+:remove_src_doc
+if /i %~x2.==.source. exit /b 0
+if /i %~x2.==.doc. exit /b 0
+set %1=%pkglist% %2 %3 %4
+set /a pkgcount+=1
+exit /b 0
+
+:untar %tlroot%\temp\[__BACKUP_] pkgname
+set "suffix=tar"
+if %~n1_==__BACKUP__ set "suffix=r%~3.tar"
+call :debug "untar: %~1%~2.%suffix%"
+"%tlroot%\temp\tar-w32.exe" -C "%tlroot%" -f "%~1%~2.%suffix%" -x
+exit /b %errorlevel%
+
+:incltlpobj %tlroot%\tlpkg\tlpobj\ pkgname
+call :debug "include into tlpdb: %~1%~2.tlpobj"
+"%tlroot%\tlpkg\tlperl\bin\perl.exe" "%tlroot%\texmf\scripts\texlive\tlmgr.pl" _include_tlpobj "%~1%~2.tlpobj"
+exit /b %errorlevel%
+
+:info "message text"
+echo.%~1>>"%~dpn0.log"
+echo.%~1
+exit /b 0
+
+:debug "message text"
+echo.%~1>>"%~dpn0.log"
+if /i %w32upd_debug%0 GTR 0 (>&2 echo D: %~1)
+exit /b 0
+
+:error "message text"
+echo.%~1>>"%~dpn0.log"
+>&2 echo.%~1
+exit /b 1
+
+:updateinfo header pkgname oldrev newrev
+set "infomsg= -> %~4"
+:restoreinfo header pkgname oldrev newrev
+set "infomsg=%~1: %~2 (%~3%infomsg%)"
+set "infomsg=%infomsg:>=^>%"
+set /a pkgnr+=1
+echo [%pkgnr%/%pkgcount%] %infomsg%
+echo [%pkgnr%/%pkgcount%] %infomsg%>>"%~dpn0.log"
+echo [%date% %time%] %infomsg%>>"%tlmgrlog%"
+set "infomsg="
+exit /b 0
+
+:printmsg "message text"
+set infomsg=%~1
+for %%I in ("%infomsg:\n=" "%") do call :info "%%~I"
+if not "%w32upd_gui_mode%"=="1" exit /b 0
+echo MsgBox Replace("%~1", "\n", Chr(10)), %2, "%~3" >"%tlroot%\temp\dialogpopup.vbs"
+cscript -nologo "%tlroot%\temp\dialogpopup.vbs"
+del "%tlroot%\temp\dialogpopup.vbs"
+exit /b %errorlevel%
+
+rem Everything below is generated automatically by tlmgr on each infrastructure update
|