summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPiotr Strzelczyk <piotr@eps.gda.pl>2009-05-13 20:21:12 +0000
committerPiotr Strzelczyk <piotr@eps.gda.pl>2009-05-13 20:21:12 +0000
commitd162ec653894bda9d4d36c698ba1247f14c1435e (patch)
treeca9e21d69ed6cbf97491cf216ea6a4a14e7ea2f0
parent8731675b6dfc522aa19d4192021b991dacf66326 (diff)
single .bat wrapper replacemant for .bat+.texlua combo
git-svn-id: svn://tug.org/texlive/trunk@13075 c570f23f-e606-0410-a88d-b1316a301751
-rwxr-xr-xBuild/source/texk/texlive/tl-w32-starter.bat84
-rwxr-xr-xMaster/bin/win32/a2ping.bat84
-rwxr-xr-xMaster/bin/win32/afm2afm.bat84
-rwxr-xr-xMaster/bin/win32/autoinst.bat84
-rwxr-xr-xMaster/bin/win32/cmap2enc.bat84
-rwxr-xr-xMaster/bin/win32/dviasm.bat78
-rwxr-xr-xMaster/bin/win32/e2pall.bat84
-rwxr-xr-xMaster/bin/win32/ebong.bat78
-rwxr-xr-xMaster/bin/win32/eps2eps.bat84
-rwxr-xr-xMaster/bin/win32/epspdf.bat89
-rwxr-xr-xMaster/bin/win32/epspdf.texlua51
-rwxr-xr-xMaster/bin/win32/epspdftk.bat89
-rwxr-xr-xMaster/bin/win32/epstopdf.bat84
-rwxr-xr-xMaster/bin/win32/fmtutil-sys.bat84
-rwxr-xr-xMaster/bin/win32/font2afm.bat84
-rwxr-xr-xMaster/bin/win32/getnonfreefonts-sys.bat84
-rwxr-xr-xMaster/bin/win32/getnonfreefonts.bat84
-rwxr-xr-xMaster/bin/win32/latexmk.bat84
-rwxr-xr-xMaster/bin/win32/makeglossaries.bat84
-rwxr-xr-xMaster/bin/win32/mk4ht.bat84
-rwxr-xr-xMaster/bin/win32/mkjobtexmf.bat84
-rwxr-xr-xMaster/bin/win32/mkt1font.bat84
-rwxr-xr-xMaster/bin/win32/ot2kpx.bat84
-rwxr-xr-xMaster/bin/win32/pdf2dsc.bat84
-rwxr-xr-xMaster/bin/win32/pdfannotextractor.bat84
-rwxr-xr-xMaster/bin/win32/pdfatfi.bat84
-rwxr-xr-xMaster/bin/win32/pdfcrop.bat84
-rwxr-xr-xMaster/bin/win32/pdfopt.bat84
-rwxr-xr-xMaster/bin/win32/pdfthumb.bat84
-rwxr-xr-xMaster/bin/win32/perltex.bat84
-rwxr-xr-xMaster/bin/win32/pfm2kpx.bat84
-rwxr-xr-xMaster/bin/win32/pkfix.bat84
-rwxr-xr-xMaster/bin/win32/ppower4.bat84
-rwxr-xr-xMaster/bin/win32/ps2ascii.bat84
-rwxr-xr-xMaster/bin/win32/ps2eps.bat84
-rwxr-xr-xMaster/bin/win32/ps2pdf.bat84
-rwxr-xr-xMaster/bin/win32/ps2pdf12.bat84
-rwxr-xr-xMaster/bin/win32/ps2pdf13.bat84
-rwxr-xr-xMaster/bin/win32/ps2pdf14.bat84
-rwxr-xr-xMaster/bin/win32/pst2pdf.bat84
-rwxr-xr-xMaster/bin/win32/psv.bat84
-rwxr-xr-xMaster/bin/win32/rungs.bat84
-rwxr-xr-xMaster/bin/win32/showglyphs.bat84
-rwxr-xr-xMaster/bin/win32/splitindex.bat84
-rwxr-xr-xMaster/bin/win32/texcount.bat84
-rwxr-xr-xMaster/bin/win32/texdirflatten.bat84
-rwxr-xr-xMaster/bin/win32/texdoc.bat85
-rwxr-xr-xMaster/bin/win32/texdoctk.bat84
-rwxr-xr-xMaster/bin/win32/texindy.bat84
-rwxr-xr-xMaster/bin/win32/thumbpdf.bat84
-rwxr-xr-xMaster/bin/win32/tl-w32-texdoc-wrapper.texlua107
-rwxr-xr-xMaster/bin/win32/tl-w32-wrapper.texlua98
-rwxr-xr-xMaster/bin/win32/updmap-sys.bat84
-rwxr-xr-xMaster/bin/win32/updmap.bat84
-rwxr-xr-xMaster/bin/win32/vpe.bat84
-rwxr-xr-xMaster/bin/win32/vpl2ovp.bat84
-rwxr-xr-xMaster/bin/win32/vpl2vpl.bat84
-rwxr-xr-xMaster/bin/win32/xindy.bat84
-rwxr-xr-xMaster/tlpkg/bin/check-wrapper-consistency4
59 files changed, 4239 insertions, 640 deletions
diff --git a/Build/source/texk/texlive/tl-w32-starter.bat b/Build/source/texk/texlive/tl-w32-starter.bat
index fe949613d7c..42ba109d438 100755
--- a/Build/source/texk/texlive/tl-w32-starter.bat
+++ b/Build/source/texk/texlive/tl-w32-starter.bat
@@ -1,8 +1,78 @@
@echo off
-rem tl-w32-starter.bat
-rem universal script starter, batch file part
-rem this program calls the tl-w32-wrapper.texlua
-setlocal
-set ownpath=%~dp0%
-texlua "%ownpath%tl-w32-wrapper.texlua" "%~dpn0" %*
-endlocal
+rem Universal script launcher
+rem
+rem Copyright 2009 by Tomasz M. Trzeciak
+rem Public Domain
+
+rem Make environment changes local
+setlocal enableextensions
+rem Get program/script name
+if not defined progname set progname=%~n0
+rem Check if this is 'sys' version of program
+set TEX_SYS_PROG=
+if /i "%progname:~-4%"=="-sys" (
+ set progname=%progname:~0,-4%
+ set TEX_SYS_PROG=true
+)
+
+rem Default command to execute
+set command=call :noscript
+rem Make sure our dir is on the search path; avoid trailing backslash
+for %%I in ("%~f0\..") do path %%~fI;%path%
+rem Ask kpsewhich about root and texmfsys trees (the first line of output)
+rem and location of the script (the second line of output)
+rem (4NT shell acts wierd with 'if' statements in a 'for' loop,
+rem so better process this output further in a subroutine)
+for /f "tokens=1-3 delims=;" %%I in (
+ 'kpsewhich --expand-var "$SELFAUTOPARENT;$TEXMFSYSCONFIG;$TEXMFSYSVAR" ^
+ --format texmfscripts "%progname%.pl" "%progname%.tlu" "%progname%.rb" "%progname%.py"'
+) do (
+ call :setcmdenv "%%~I" "%%~J" "%%~K"
+)
+
+rem By now we should have the command to execute (whatever that is), so
+rem pass through all the arguments we have and execute it
+%command% %*
+rem Finish with goto :eof (it will preserve the last set errorlevel)
+goto :eof
+
+REM SUBROUTINES
+
+:setcmdenv selfautoparent texmfsysconfig texmfsysvar
+rem If there is only one argument it must be a script name
+if "%~2"=="" goto :setcmd
+rem Otherwise, it is the first line from kpsewhich, so to set up the environment
+set PERL5LIB=%~f1\tlpkg\tlperl\lib
+set GS_LIB=%~f1\tlpkg\tlgs\lib;%~f1\tlpkg\tlgs\fonts
+path %~f1\tlpkg\tlgs\bin;%~f1\tlpkg\tlperl\bin;%~f1\tlpkg\installer;%~f1\tlpkg\installer\wget;%path%
+if not defined TEX_SYS_PROG goto :eof
+rem Extra stuff for sys version
+set TEXMFCONFIG=%~2
+set TEXMFVAR=%~3
+rem For sys version we might have an executable in the bin dir, so check for it
+if exist "%~f1\bin\win32\%progname%.exe" set command="%~f1\bin\win32\%progname%.exe"
+goto :eof
+
+:setcmd script
+rem Set command based on the script extension
+if /i %~x1==.pl set command=Perl.exe "%~f1"
+if /i %~x1==.tlu set command=TeXLua.exe "%~f1"
+rem For Ruby and Python we additionally check if their interpreter is available
+if /i %~x1==.rb call :chkcmd Ruby.exe "%~f1"
+if /i %~x1==.py call :chkcmd Python.exe "%~f1"
+goto :eof
+
+:chkcmd program script
+set command=%*
+rem If there is no interpreter Ruby or Python, suggest getting one
+if "%~$PATH:1"=="" set command=call :noinst %*
+goto :eof
+
+:noinst program
+echo %1 not found on search path>&2
+echo %~n1 is not distributed with TeX Live and has to be installed separately
+exit /b 1
+
+:noscript
+echo %progname%: no appropriate script or program found>&2
+exit /b 1
diff --git a/Master/bin/win32/a2ping.bat b/Master/bin/win32/a2ping.bat
index fe949613d7c..42ba109d438 100755
--- a/Master/bin/win32/a2ping.bat
+++ b/Master/bin/win32/a2ping.bat
@@ -1,8 +1,78 @@
@echo off
-rem tl-w32-starter.bat
-rem universal script starter, batch file part
-rem this program calls the tl-w32-wrapper.texlua
-setlocal
-set ownpath=%~dp0%
-texlua "%ownpath%tl-w32-wrapper.texlua" "%~dpn0" %*
-endlocal
+rem Universal script launcher
+rem
+rem Copyright 2009 by Tomasz M. Trzeciak
+rem Public Domain
+
+rem Make environment changes local
+setlocal enableextensions
+rem Get program/script name
+if not defined progname set progname=%~n0
+rem Check if this is 'sys' version of program
+set TEX_SYS_PROG=
+if /i "%progname:~-4%"=="-sys" (
+ set progname=%progname:~0,-4%
+ set TEX_SYS_PROG=true
+)
+
+rem Default command to execute
+set command=call :noscript
+rem Make sure our dir is on the search path; avoid trailing backslash
+for %%I in ("%~f0\..") do path %%~fI;%path%
+rem Ask kpsewhich about root and texmfsys trees (the first line of output)
+rem and location of the script (the second line of output)
+rem (4NT shell acts wierd with 'if' statements in a 'for' loop,
+rem so better process this output further in a subroutine)
+for /f "tokens=1-3 delims=;" %%I in (
+ 'kpsewhich --expand-var "$SELFAUTOPARENT;$TEXMFSYSCONFIG;$TEXMFSYSVAR" ^
+ --format texmfscripts "%progname%.pl" "%progname%.tlu" "%progname%.rb" "%progname%.py"'
+) do (
+ call :setcmdenv "%%~I" "%%~J" "%%~K"
+)
+
+rem By now we should have the command to execute (whatever that is), so
+rem pass through all the arguments we have and execute it
+%command% %*
+rem Finish with goto :eof (it will preserve the last set errorlevel)
+goto :eof
+
+REM SUBROUTINES
+
+:setcmdenv selfautoparent texmfsysconfig texmfsysvar
+rem If there is only one argument it must be a script name
+if "%~2"=="" goto :setcmd
+rem Otherwise, it is the first line from kpsewhich, so to set up the environment
+set PERL5LIB=%~f1\tlpkg\tlperl\lib
+set GS_LIB=%~f1\tlpkg\tlgs\lib;%~f1\tlpkg\tlgs\fonts
+path %~f1\tlpkg\tlgs\bin;%~f1\tlpkg\tlperl\bin;%~f1\tlpkg\installer;%~f1\tlpkg\installer\wget;%path%
+if not defined TEX_SYS_PROG goto :eof
+rem Extra stuff for sys version
+set TEXMFCONFIG=%~2
+set TEXMFVAR=%~3
+rem For sys version we might have an executable in the bin dir, so check for it
+if exist "%~f1\bin\win32\%progname%.exe" set command="%~f1\bin\win32\%progname%.exe"
+goto :eof
+
+:setcmd script
+rem Set command based on the script extension
+if /i %~x1==.pl set command=Perl.exe "%~f1"
+if /i %~x1==.tlu set command=TeXLua.exe "%~f1"
+rem For Ruby and Python we additionally check if their interpreter is available
+if /i %~x1==.rb call :chkcmd Ruby.exe "%~f1"
+if /i %~x1==.py call :chkcmd Python.exe "%~f1"
+goto :eof
+
+:chkcmd program script
+set command=%*
+rem If there is no interpreter Ruby or Python, suggest getting one
+if "%~$PATH:1"=="" set command=call :noinst %*
+goto :eof
+
+:noinst program
+echo %1 not found on search path>&2
+echo %~n1 is not distributed with TeX Live and has to be installed separately
+exit /b 1
+
+:noscript
+echo %progname%: no appropriate script or program found>&2
+exit /b 1
diff --git a/Master/bin/win32/afm2afm.bat b/Master/bin/win32/afm2afm.bat
index fe949613d7c..42ba109d438 100755
--- a/Master/bin/win32/afm2afm.bat
+++ b/Master/bin/win32/afm2afm.bat
@@ -1,8 +1,78 @@
@echo off
-rem tl-w32-starter.bat
-rem universal script starter, batch file part
-rem this program calls the tl-w32-wrapper.texlua
-setlocal
-set ownpath=%~dp0%
-texlua "%ownpath%tl-w32-wrapper.texlua" "%~dpn0" %*
-endlocal
+rem Universal script launcher
+rem
+rem Copyright 2009 by Tomasz M. Trzeciak
+rem Public Domain
+
+rem Make environment changes local
+setlocal enableextensions
+rem Get program/script name
+if not defined progname set progname=%~n0
+rem Check if this is 'sys' version of program
+set TEX_SYS_PROG=
+if /i "%progname:~-4%"=="-sys" (
+ set progname=%progname:~0,-4%
+ set TEX_SYS_PROG=true
+)
+
+rem Default command to execute
+set command=call :noscript
+rem Make sure our dir is on the search path; avoid trailing backslash
+for %%I in ("%~f0\..") do path %%~fI;%path%
+rem Ask kpsewhich about root and texmfsys trees (the first line of output)
+rem and location of the script (the second line of output)
+rem (4NT shell acts wierd with 'if' statements in a 'for' loop,
+rem so better process this output further in a subroutine)
+for /f "tokens=1-3 delims=;" %%I in (
+ 'kpsewhich --expand-var "$SELFAUTOPARENT;$TEXMFSYSCONFIG;$TEXMFSYSVAR" ^
+ --format texmfscripts "%progname%.pl" "%progname%.tlu" "%progname%.rb" "%progname%.py"'
+) do (
+ call :setcmdenv "%%~I" "%%~J" "%%~K"
+)
+
+rem By now we should have the command to execute (whatever that is), so
+rem pass through all the arguments we have and execute it
+%command% %*
+rem Finish with goto :eof (it will preserve the last set errorlevel)
+goto :eof
+
+REM SUBROUTINES
+
+:setcmdenv selfautoparent texmfsysconfig texmfsysvar
+rem If there is only one argument it must be a script name
+if "%~2"=="" goto :setcmd
+rem Otherwise, it is the first line from kpsewhich, so to set up the environment
+set PERL5LIB=%~f1\tlpkg\tlperl\lib
+set GS_LIB=%~f1\tlpkg\tlgs\lib;%~f1\tlpkg\tlgs\fonts
+path %~f1\tlpkg\tlgs\bin;%~f1\tlpkg\tlperl\bin;%~f1\tlpkg\installer;%~f1\tlpkg\installer\wget;%path%
+if not defined TEX_SYS_PROG goto :eof
+rem Extra stuff for sys version
+set TEXMFCONFIG=%~2
+set TEXMFVAR=%~3
+rem For sys version we might have an executable in the bin dir, so check for it
+if exist "%~f1\bin\win32\%progname%.exe" set command="%~f1\bin\win32\%progname%.exe"
+goto :eof
+
+:setcmd script
+rem Set command based on the script extension
+if /i %~x1==.pl set command=Perl.exe "%~f1"
+if /i %~x1==.tlu set command=TeXLua.exe "%~f1"
+rem For Ruby and Python we additionally check if their interpreter is available
+if /i %~x1==.rb call :chkcmd Ruby.exe "%~f1"
+if /i %~x1==.py call :chkcmd Python.exe "%~f1"
+goto :eof
+
+:chkcmd program script
+set command=%*
+rem If there is no interpreter Ruby or Python, suggest getting one
+if "%~$PATH:1"=="" set command=call :noinst %*
+goto :eof
+
+:noinst program
+echo %1 not found on search path>&2
+echo %~n1 is not distributed with TeX Live and has to be installed separately
+exit /b 1
+
+:noscript
+echo %progname%: no appropriate script or program found>&2
+exit /b 1
diff --git a/Master/bin/win32/autoinst.bat b/Master/bin/win32/autoinst.bat
index fe949613d7c..42ba109d438 100755
--- a/Master/bin/win32/autoinst.bat
+++ b/Master/bin/win32/autoinst.bat
@@ -1,8 +1,78 @@
@echo off
-rem tl-w32-starter.bat
-rem universal script starter, batch file part
-rem this program calls the tl-w32-wrapper.texlua
-setlocal
-set ownpath=%~dp0%
-texlua "%ownpath%tl-w32-wrapper.texlua" "%~dpn0" %*
-endlocal
+rem Universal script launcher
+rem
+rem Copyright 2009 by Tomasz M. Trzeciak
+rem Public Domain
+
+rem Make environment changes local
+setlocal enableextensions
+rem Get program/script name
+if not defined progname set progname=%~n0
+rem Check if this is 'sys' version of program
+set TEX_SYS_PROG=
+if /i "%progname:~-4%"=="-sys" (
+ set progname=%progname:~0,-4%
+ set TEX_SYS_PROG=true
+)
+
+rem Default command to execute
+set command=call :noscript
+rem Make sure our dir is on the search path; avoid trailing backslash
+for %%I in ("%~f0\..") do path %%~fI;%path%
+rem Ask kpsewhich about root and texmfsys trees (the first line of output)
+rem and location of the script (the second line of output)
+rem (4NT shell acts wierd with 'if' statements in a 'for' loop,
+rem so better process this output further in a subroutine)
+for /f "tokens=1-3 delims=;" %%I in (
+ 'kpsewhich --expand-var "$SELFAUTOPARENT;$TEXMFSYSCONFIG;$TEXMFSYSVAR" ^
+ --format texmfscripts "%progname%.pl" "%progname%.tlu" "%progname%.rb" "%progname%.py"'
+) do (
+ call :setcmdenv "%%~I" "%%~J" "%%~K"
+)
+
+rem By now we should have the command to execute (whatever that is), so
+rem pass through all the arguments we have and execute it
+%command% %*
+rem Finish with goto :eof (it will preserve the last set errorlevel)
+goto :eof
+
+REM SUBROUTINES
+
+:setcmdenv selfautoparent texmfsysconfig texmfsysvar
+rem If there is only one argument it must be a script name
+if "%~2"=="" goto :setcmd
+rem Otherwise, it is the first line from kpsewhich, so to set up the environment
+set PERL5LIB=%~f1\tlpkg\tlperl\lib
+set GS_LIB=%~f1\tlpkg\tlgs\lib;%~f1\tlpkg\tlgs\fonts
+path %~f1\tlpkg\tlgs\bin;%~f1\tlpkg\tlperl\bin;%~f1\tlpkg\installer;%~f1\tlpkg\installer\wget;%path%
+if not defined TEX_SYS_PROG goto :eof
+rem Extra stuff for sys version
+set TEXMFCONFIG=%~2
+set TEXMFVAR=%~3
+rem For sys version we might have an executable in the bin dir, so check for it
+if exist "%~f1\bin\win32\%progname%.exe" set command="%~f1\bin\win32\%progname%.exe"
+goto :eof
+
+:setcmd script
+rem Set command based on the script extension
+if /i %~x1==.pl set command=Perl.exe "%~f1"
+if /i %~x1==.tlu set command=TeXLua.exe "%~f1"
+rem For Ruby and Python we additionally check if their interpreter is available
+if /i %~x1==.rb call :chkcmd Ruby.exe "%~f1"
+if /i %~x1==.py call :chkcmd Python.exe "%~f1"
+goto :eof
+
+:chkcmd program script
+set command=%*
+rem If there is no interpreter Ruby or Python, suggest getting one
+if "%~$PATH:1"=="" set command=call :noinst %*
+goto :eof
+
+:noinst program
+echo %1 not found on search path>&2
+echo %~n1 is not distributed with TeX Live and has to be installed separately
+exit /b 1
+
+:noscript
+echo %progname%: no appropriate script or program found>&2
+exit /b 1
diff --git a/Master/bin/win32/cmap2enc.bat b/Master/bin/win32/cmap2enc.bat
index fe949613d7c..42ba109d438 100755
--- a/Master/bin/win32/cmap2enc.bat
+++ b/Master/bin/win32/cmap2enc.bat
@@ -1,8 +1,78 @@
@echo off
-rem tl-w32-starter.bat
-rem universal script starter, batch file part
-rem this program calls the tl-w32-wrapper.texlua
-setlocal
-set ownpath=%~dp0%
-texlua "%ownpath%tl-w32-wrapper.texlua" "%~dpn0" %*
-endlocal
+rem Universal script launcher
+rem
+rem Copyright 2009 by Tomasz M. Trzeciak
+rem Public Domain
+
+rem Make environment changes local
+setlocal enableextensions
+rem Get program/script name
+if not defined progname set progname=%~n0
+rem Check if this is 'sys' version of program
+set TEX_SYS_PROG=
+if /i "%progname:~-4%"=="-sys" (
+ set progname=%progname:~0,-4%
+ set TEX_SYS_PROG=true
+)
+
+rem Default command to execute
+set command=call :noscript
+rem Make sure our dir is on the search path; avoid trailing backslash
+for %%I in ("%~f0\..") do path %%~fI;%path%
+rem Ask kpsewhich about root and texmfsys trees (the first line of output)
+rem and location of the script (the second line of output)
+rem (4NT shell acts wierd with 'if' statements in a 'for' loop,
+rem so better process this output further in a subroutine)
+for /f "tokens=1-3 delims=;" %%I in (
+ 'kpsewhich --expand-var "$SELFAUTOPARENT;$TEXMFSYSCONFIG;$TEXMFSYSVAR" ^
+ --format texmfscripts "%progname%.pl" "%progname%.tlu" "%progname%.rb" "%progname%.py"'
+) do (
+ call :setcmdenv "%%~I" "%%~J" "%%~K"
+)
+
+rem By now we should have the command to execute (whatever that is), so
+rem pass through all the arguments we have and execute it
+%command% %*
+rem Finish with goto :eof (it will preserve the last set errorlevel)
+goto :eof
+
+REM SUBROUTINES
+
+:setcmdenv selfautoparent texmfsysconfig texmfsysvar
+rem If there is only one argument it must be a script name
+if "%~2"=="" goto :setcmd
+rem Otherwise, it is the first line from kpsewhich, so to set up the environment
+set PERL5LIB=%~f1\tlpkg\tlperl\lib
+set GS_LIB=%~f1\tlpkg\tlgs\lib;%~f1\tlpkg\tlgs\fonts
+path %~f1\tlpkg\tlgs\bin;%~f1\tlpkg\tlperl\bin;%~f1\tlpkg\installer;%~f1\tlpkg\installer\wget;%path%
+if not defined TEX_SYS_PROG goto :eof
+rem Extra stuff for sys version
+set TEXMFCONFIG=%~2
+set TEXMFVAR=%~3
+rem For sys version we might have an executable in the bin dir, so check for it
+if exist "%~f1\bin\win32\%progname%.exe" set command="%~f1\bin\win32\%progname%.exe"
+goto :eof
+
+:setcmd script
+rem Set command based on the script extension
+if /i %~x1==.pl set command=Perl.exe "%~f1"
+if /i %~x1==.tlu set command=TeXLua.exe "%~f1"
+rem For Ruby and Python we additionally check if their interpreter is available
+if /i %~x1==.rb call :chkcmd Ruby.exe "%~f1"
+if /i %~x1==.py call :chkcmd Python.exe "%~f1"
+goto :eof
+
+:chkcmd program script
+set command=%*
+rem If there is no interpreter Ruby or Python, suggest getting one
+if "%~$PATH:1"=="" set command=call :noinst %*
+goto :eof
+
+:noinst program
+echo %1 not found on search path>&2
+echo %~n1 is not distributed with TeX Live and has to be installed separately
+exit /b 1
+
+:noscript
+echo %progname%: no appropriate script or program found>&2
+exit /b 1
diff --git a/Master/bin/win32/dviasm.bat b/Master/bin/win32/dviasm.bat
new file mode 100755
index 00000000000..42ba109d438
--- /dev/null
+++ b/Master/bin/win32/dviasm.bat
@@ -0,0 +1,78 @@
+@echo off
+rem Universal script launcher
+rem
+rem Copyright 2009 by Tomasz M. Trzeciak
+rem Public Domain
+
+rem Make environment changes local
+setlocal enableextensions
+rem Get program/script name
+if not defined progname set progname=%~n0
+rem Check if this is 'sys' version of program
+set TEX_SYS_PROG=
+if /i "%progname:~-4%"=="-sys" (
+ set progname=%progname:~0,-4%
+ set TEX_SYS_PROG=true
+)
+
+rem Default command to execute
+set command=call :noscript
+rem Make sure our dir is on the search path; avoid trailing backslash
+for %%I in ("%~f0\..") do path %%~fI;%path%
+rem Ask kpsewhich about root and texmfsys trees (the first line of output)
+rem and location of the script (the second line of output)
+rem (4NT shell acts wierd with 'if' statements in a 'for' loop,
+rem so better process this output further in a subroutine)
+for /f "tokens=1-3 delims=;" %%I in (
+ 'kpsewhich --expand-var "$SELFAUTOPARENT;$TEXMFSYSCONFIG;$TEXMFSYSVAR" ^
+ --format texmfscripts "%progname%.pl" "%progname%.tlu" "%progname%.rb" "%progname%.py"'
+) do (
+ call :setcmdenv "%%~I" "%%~J" "%%~K"
+)
+
+rem By now we should have the command to execute (whatever that is), so
+rem pass through all the arguments we have and execute it
+%command% %*
+rem Finish with goto :eof (it will preserve the last set errorlevel)
+goto :eof
+
+REM SUBROUTINES
+
+:setcmdenv selfautoparent texmfsysconfig texmfsysvar
+rem If there is only one argument it must be a script name
+if "%~2"=="" goto :setcmd
+rem Otherwise, it is the first line from kpsewhich, so to set up the environment
+set PERL5LIB=%~f1\tlpkg\tlperl\lib
+set GS_LIB=%~f1\tlpkg\tlgs\lib;%~f1\tlpkg\tlgs\fonts
+path %~f1\tlpkg\tlgs\bin;%~f1\tlpkg\tlperl\bin;%~f1\tlpkg\installer;%~f1\tlpkg\installer\wget;%path%
+if not defined TEX_SYS_PROG goto :eof
+rem Extra stuff for sys version
+set TEXMFCONFIG=%~2
+set TEXMFVAR=%~3
+rem For sys version we might have an executable in the bin dir, so check for it
+if exist "%~f1\bin\win32\%progname%.exe" set command="%~f1\bin\win32\%progname%.exe"
+goto :eof
+
+:setcmd script
+rem Set command based on the script extension
+if /i %~x1==.pl set command=Perl.exe "%~f1"
+if /i %~x1==.tlu set command=TeXLua.exe "%~f1"
+rem For Ruby and Python we additionally check if their interpreter is available
+if /i %~x1==.rb call :chkcmd Ruby.exe "%~f1"
+if /i %~x1==.py call :chkcmd Python.exe "%~f1"
+goto :eof
+
+:chkcmd program script
+set command=%*
+rem If there is no interpreter Ruby or Python, suggest getting one
+if "%~$PATH:1"=="" set command=call :noinst %*
+goto :eof
+
+:noinst program
+echo %1 not found on search path>&2
+echo %~n1 is not distributed with TeX Live and has to be installed separately
+exit /b 1
+
+:noscript
+echo %progname%: no appropriate script or program found>&2
+exit /b 1
diff --git a/Master/bin/win32/e2pall.bat b/Master/bin/win32/e2pall.bat
index fe949613d7c..42ba109d438 100755
--- a/Master/bin/win32/e2pall.bat
+++ b/Master/bin/win32/e2pall.bat
@@ -1,8 +1,78 @@
@echo off
-rem tl-w32-starter.bat
-rem universal script starter, batch file part
-rem this program calls the tl-w32-wrapper.texlua
-setlocal
-set ownpath=%~dp0%
-texlua "%ownpath%tl-w32-wrapper.texlua" "%~dpn0" %*
-endlocal
+rem Universal script launcher
+rem
+rem Copyright 2009 by Tomasz M. Trzeciak
+rem Public Domain
+
+rem Make environment changes local
+setlocal enableextensions
+rem Get program/script name
+if not defined progname set progname=%~n0
+rem Check if this is 'sys' version of program
+set TEX_SYS_PROG=
+if /i "%progname:~-4%"=="-sys" (
+ set progname=%progname:~0,-4%
+ set TEX_SYS_PROG=true
+)
+
+rem Default command to execute
+set command=call :noscript
+rem Make sure our dir is on the search path; avoid trailing backslash
+for %%I in ("%~f0\..") do path %%~fI;%path%
+rem Ask kpsewhich about root and texmfsys trees (the first line of output)
+rem and location of the script (the second line of output)
+rem (4NT shell acts wierd with 'if' statements in a 'for' loop,
+rem so better process this output further in a subroutine)
+for /f "tokens=1-3 delims=;" %%I in (
+ 'kpsewhich --expand-var "$SELFAUTOPARENT;$TEXMFSYSCONFIG;$TEXMFSYSVAR" ^
+ --format texmfscripts "%progname%.pl" "%progname%.tlu" "%progname%.rb" "%progname%.py"'
+) do (
+ call :setcmdenv "%%~I" "%%~J" "%%~K"
+)
+
+rem By now we should have the command to execute (whatever that is), so
+rem pass through all the arguments we have and execute it
+%command% %*
+rem Finish with goto :eof (it will preserve the last set errorlevel)
+goto :eof
+
+REM SUBROUTINES
+
+:setcmdenv selfautoparent texmfsysconfig texmfsysvar
+rem If there is only one argument it must be a script name
+if "%~2"=="" goto :setcmd
+rem Otherwise, it is the first line from kpsewhich, so to set up the environment
+set PERL5LIB=%~f1\tlpkg\tlperl\lib
+set GS_LIB=%~f1\tlpkg\tlgs\lib;%~f1\tlpkg\tlgs\fonts
+path %~f1\tlpkg\tlgs\bin;%~f1\tlpkg\tlperl\bin;%~f1\tlpkg\installer;%~f1\tlpkg\installer\wget;%path%
+if not defined TEX_SYS_PROG goto :eof
+rem Extra stuff for sys version
+set TEXMFCONFIG=%~2
+set TEXMFVAR=%~3
+rem For sys version we might have an executable in the bin dir, so check for it
+if exist "%~f1\bin\win32\%progname%.exe" set command="%~f1\bin\win32\%progname%.exe"
+goto :eof
+
+:setcmd script
+rem Set command based on the script extension
+if /i %~x1==.pl set command=Perl.exe "%~f1"
+if /i %~x1==.tlu set command=TeXLua.exe "%~f1"
+rem For Ruby and Python we additionally check if their interpreter is available
+if /i %~x1==.rb call :chkcmd Ruby.exe "%~f1"
+if /i %~x1==.py call :chkcmd Python.exe "%~f1"
+goto :eof
+
+:chkcmd program script
+set command=%*
+rem If there is no interpreter Ruby or Python, suggest getting one
+if "%~$PATH:1"=="" set command=call :noinst %*
+goto :eof
+
+:noinst program
+echo %1 not found on search path>&2
+echo %~n1 is not distributed with TeX Live and has to be installed separately
+exit /b 1
+
+:noscript
+echo %progname%: no appropriate script or program found>&2
+exit /b 1
diff --git a/Master/bin/win32/ebong.bat b/Master/bin/win32/ebong.bat
new file mode 100755
index 00000000000..42ba109d438
--- /dev/null
+++ b/Master/bin/win32/ebong.bat
@@ -0,0 +1,78 @@
+@echo off
+rem Universal script launcher
+rem
+rem Copyright 2009 by Tomasz M. Trzeciak
+rem Public Domain
+
+rem Make environment changes local
+setlocal enableextensions
+rem Get program/script name
+if not defined progname set progname=%~n0
+rem Check if this is 'sys' version of program
+set TEX_SYS_PROG=
+if /i "%progname:~-4%"=="-sys" (
+ set progname=%progname:~0,-4%
+ set TEX_SYS_PROG=true
+)
+
+rem Default command to execute
+set command=call :noscript
+rem Make sure our dir is on the search path; avoid trailing backslash
+for %%I in ("%~f0\..") do path %%~fI;%path%
+rem Ask kpsewhich about root and texmfsys trees (the first line of output)
+rem and location of the script (the second line of output)
+rem (4NT shell acts wierd with 'if' statements in a 'for' loop,
+rem so better process this output further in a subroutine)
+for /f "tokens=1-3 delims=;" %%I in (
+ 'kpsewhich --expand-var "$SELFAUTOPARENT;$TEXMFSYSCONFIG;$TEXMFSYSVAR" ^
+ --format texmfscripts "%progname%.pl" "%progname%.tlu" "%progname%.rb" "%progname%.py"'
+) do (
+ call :setcmdenv "%%~I" "%%~J" "%%~K"
+)
+
+rem By now we should have the command to execute (whatever that is), so
+rem pass through all the arguments we have and execute it
+%command% %*
+rem Finish with goto :eof (it will preserve the last set errorlevel)
+goto :eof
+
+REM SUBROUTINES
+
+:setcmdenv selfautoparent texmfsysconfig texmfsysvar
+rem If there is only one argument it must be a script name
+if "%~2"=="" goto :setcmd
+rem Otherwise, it is the first line from kpsewhich, so to set up the environment
+set PERL5LIB=%~f1\tlpkg\tlperl\lib
+set GS_LIB=%~f1\tlpkg\tlgs\lib;%~f1\tlpkg\tlgs\fonts
+path %~f1\tlpkg\tlgs\bin;%~f1\tlpkg\tlperl\bin;%~f1\tlpkg\installer;%~f1\tlpkg\installer\wget;%path%
+if not defined TEX_SYS_PROG goto :eof
+rem Extra stuff for sys version
+set TEXMFCONFIG=%~2
+set TEXMFVAR=%~3
+rem For sys version we might have an executable in the bin dir, so check for it
+if exist "%~f1\bin\win32\%progname%.exe" set command="%~f1\bin\win32\%progname%.exe"
+goto :eof
+
+:setcmd script
+rem Set command based on the script extension
+if /i %~x1==.pl set command=Perl.exe "%~f1"
+if /i %~x1==.tlu set command=TeXLua.exe "%~f1"
+rem For Ruby and Python we additionally check if their interpreter is available
+if /i %~x1==.rb call :chkcmd Ruby.exe "%~f1"
+if /i %~x1==.py call :chkcmd Python.exe "%~f1"
+goto :eof
+
+:chkcmd program script
+set command=%*
+rem If there is no interpreter Ruby or Python, suggest getting one
+if "%~$PATH:1"=="" set command=call :noinst %*
+goto :eof
+
+:noinst program
+echo %1 not found on search path>&2
+echo %~n1 is not distributed with TeX Live and has to be installed separately
+exit /b 1
+
+:noscript
+echo %progname%: no appropriate script or program found>&2
+exit /b 1
diff --git a/Master/bin/win32/eps2eps.bat b/Master/bin/win32/eps2eps.bat
index fe949613d7c..42ba109d438 100755
--- a/Master/bin/win32/eps2eps.bat
+++ b/Master/bin/win32/eps2eps.bat
@@ -1,8 +1,78 @@
@echo off
-rem tl-w32-starter.bat
-rem universal script starter, batch file part
-rem this program calls the tl-w32-wrapper.texlua
-setlocal
-set ownpath=%~dp0%
-texlua "%ownpath%tl-w32-wrapper.texlua" "%~dpn0" %*
-endlocal
+rem Universal script launcher
+rem
+rem Copyright 2009 by Tomasz M. Trzeciak
+rem Public Domain
+
+rem Make environment changes local
+setlocal enableextensions
+rem Get program/script name
+if not defined progname set progname=%~n0
+rem Check if this is 'sys' version of program
+set TEX_SYS_PROG=
+if /i "%progname:~-4%"=="-sys" (
+ set progname=%progname:~0,-4%
+ set TEX_SYS_PROG=true
+)
+
+rem Default command to execute
+set command=call :noscript
+rem Make sure our dir is on the search path; avoid trailing backslash
+for %%I in ("%~f0\..") do path %%~fI;%path%
+rem Ask kpsewhich about root and texmfsys trees (the first line of output)
+rem and location of the script (the second line of output)
+rem (4NT shell acts wierd with 'if' statements in a 'for' loop,
+rem so better process this output further in a subroutine)
+for /f "tokens=1-3 delims=;" %%I in (
+ 'kpsewhich --expand-var "$SELFAUTOPARENT;$TEXMFSYSCONFIG;$TEXMFSYSVAR" ^
+ --format texmfscripts "%progname%.pl" "%progname%.tlu" "%progname%.rb" "%progname%.py"'
+) do (
+ call :setcmdenv "%%~I" "%%~J" "%%~K"
+)
+
+rem By now we should have the command to execute (whatever that is), so
+rem pass through all the arguments we have and execute it
+%command% %*
+rem Finish with goto :eof (it will preserve the last set errorlevel)
+goto :eof
+
+REM SUBROUTINES
+
+:setcmdenv selfautoparent texmfsysconfig texmfsysvar
+rem If there is only one argument it must be a script name
+if "%~2"=="" goto :setcmd
+rem Otherwise, it is the first line from kpsewhich, so to set up the environment
+set PERL5LIB=%~f1\tlpkg\tlperl\lib
+set GS_LIB=%~f1\tlpkg\tlgs\lib;%~f1\tlpkg\tlgs\fonts
+path %~f1\tlpkg\tlgs\bin;%~f1\tlpkg\tlperl\bin;%~f1\tlpkg\installer;%~f1\tlpkg\installer\wget;%path%
+if not defined TEX_SYS_PROG goto :eof
+rem Extra stuff for sys version
+set TEXMFCONFIG=%~2
+set TEXMFVAR=%~3
+rem For sys version we might have an executable in the bin dir, so check for it
+if exist "%~f1\bin\win32\%progname%.exe" set command="%~f1\bin\win32\%progname%.exe"
+goto :eof
+
+:setcmd script
+rem Set command based on the script extension
+if /i %~x1==.pl set command=Perl.exe "%~f1"
+if /i %~x1==.tlu set command=TeXLua.exe "%~f1"
+rem For Ruby and Python we additionally check if their interpreter is available
+if /i %~x1==.rb call :chkcmd Ruby.exe "%~f1"
+if /i %~x1==.py call :chkcmd Python.exe "%~f1"
+goto :eof
+
+:chkcmd program script
+set command=%*
+rem If there is no interpreter Ruby or Python, suggest getting one
+if "%~$PATH:1"=="" set command=call :noinst %*
+goto :eof
+
+:noinst program
+echo %1 not found on search path>&2
+echo %~n1 is not distributed with TeX Live and has to be installed separately
+exit /b 1
+
+:noscript
+echo %progname%: no appropriate script or program found>&2
+exit /b 1
diff --git a/Master/bin/win32/epspdf.bat b/Master/bin/win32/epspdf.bat
index 48d1141fb26..42ba109d438 100755
--- a/Master/bin/win32/epspdf.bat
+++ b/Master/bin/win32/epspdf.bat
@@ -1,11 +1,78 @@
-@echo off
-ruby -v >nul 2>&1
-if not errorlevel 1 goto doit
-echo Ruby not found. Install Ruby,
-echo get the Ruby-included version or use epstopdf.
-goto :EOF
-:doit
-setlocal
-set ownpath=%~dp0%
-texlua "%ownpath%epspdf.texlua" "%~dpn0" %*
-endlocal
+@echo off
+rem Universal script launcher
+rem
+rem Copyright 2009 by Tomasz M. Trzeciak
+rem Public Domain
+
+rem Make environment changes local
+setlocal enableextensions
+rem Get program/script name
+if not defined progname set progname=%~n0
+rem Check if this is 'sys' version of program
+set TEX_SYS_PROG=
+if /i "%progname:~-4%"=="-sys" (
+ set progname=%progname:~0,-4%
+ set TEX_SYS_PROG=true
+)
+
+rem Default command to execute
+set command=call :noscript
+rem Make sure our dir is on the search path; avoid trailing backslash
+for %%I in ("%~f0\..") do path %%~fI;%path%
+rem Ask kpsewhich about root and texmfsys trees (the first line of output)
+rem and location of the script (the second line of output)
+rem (4NT shell acts wierd with 'if' statements in a 'for' loop,
+rem so better process this output further in a subroutine)
+for /f "tokens=1-3 delims=;" %%I in (
+ 'kpsewhich --expand-var "$SELFAUTOPARENT;$TEXMFSYSCONFIG;$TEXMFSYSVAR" ^
+ --format texmfscripts "%progname%.pl" "%progname%.tlu" "%progname%.rb" "%progname%.py"'
+) do (
+ call :setcmdenv "%%~I" "%%~J" "%%~K"
+)
+
+rem By now we should have the command to execute (whatever that is), so
+rem pass through all the arguments we have and execute it
+%command% %*
+rem Finish with goto :eof (it will preserve the last set errorlevel)
+goto :eof
+
+REM SUBROUTINES
+
+:setcmdenv selfautoparent texmfsysconfig texmfsysvar
+rem If there is only one argument it must be a script name
+if "%~2"=="" goto :setcmd
+rem Otherwise, it is the first line from kpsewhich, so to set up the environment
+set PERL5LIB=%~f1\tlpkg\tlperl\lib
+set GS_LIB=%~f1\tlpkg\tlgs\lib;%~f1\tlpkg\tlgs\fonts
+path %~f1\tlpkg\tlgs\bin;%~f1\tlpkg\tlperl\bin;%~f1\tlpkg\installer;%~f1\tlpkg\installer\wget;%path%
+if not defined TEX_SYS_PROG goto :eof
+rem Extra stuff for sys version
+set TEXMFCONFIG=%~2
+set TEXMFVAR=%~3
+rem For sys version we might have an executable in the bin dir, so check for it
+if exist "%~f1\bin\win32\%progname%.exe" set command="%~f1\bin\win32\%progname%.exe"
+goto :eof
+
+:setcmd script
+rem Set command based on the script extension
+if /i %~x1==.pl set command=Perl.exe "%~f1"
+if /i %~x1==.tlu set command=TeXLua.exe "%~f1"
+rem For Ruby and Python we additionally check if their interpreter is available
+if /i %~x1==.rb call :chkcmd Ruby.exe "%~f1"
+if /i %~x1==.py call :chkcmd Python.exe "%~f1"
+goto :eof
+
+:chkcmd program script
+set command=%*
+rem If there is no interpreter Ruby or Python, suggest getting one
+if "%~$PATH:1"=="" set command=call :noinst %*
+goto :eof
+
+:noinst program
+echo %1 not found on search path>&2
+echo %~n1 is not distributed with TeX Live and has to be installed separately
+exit /b 1
+
+:noscript
+echo %progname%: no appropriate script or program found>&2
+exit /b 1
diff --git a/Master/bin/win32/epspdf.texlua b/Master/bin/win32/epspdf.texlua
deleted file mode 100755
index b31efa964d7..00000000000
--- a/Master/bin/win32/epspdf.texlua
+++ /dev/null
@@ -1,51 +0,0 @@
-#! /usr/bin/env texlua
-
-function fixwin(args_unix)
- if os.type == 'windows' then
- local args_win={} -- new table
- args_win[0]=args_unix[1]
- for i=1, #args_unix do
- args_win[i]='"'..args_unix[i]..'"'
- end
- return args_win
- else
- return args_unix
- end
-end
-
-if string.find(arg[0], '/') then -- UNIX path
- basename = select(1, string.gsub(arg[1], '.*/', ''))
-elseif string.find(arg[0], '\\') then -- Windows path
- basename = select(1, string.gsub(arg[1], '.*\\', ''))
- -- we might have \ and / mixed together ...
- basename = select(1, string.gsub(basename, '.*/', ''))
-else -- no path
- basename = arg[1]
-end
-
-kpse.set_program_name(basename..".bat", basename)
-TLROOT=kpse.var_value('SELFAUTOPARENT')
-BINDIR=kpse.var_value('SELFAUTOLOC')
-
-os.setenv('PATH', TLROOT..'/tlpkg/tlgs/bin;'..os.getenv('PATH'))
-os.setenv('GS_LIB', TLROOT..'/tlpkg/tlgs/lib;'..TLROOT..'/tlpkg/tlgs/fonts')
-os.setenv('TLROOT', TLROOT)
-
-script=kpse.find_file(basename..'.rb', 'texmfscripts')
-command={'ruby.exe', script}
-
-for i=2, #arg do
- command[#command+1]=arg[i]
-end
-
-command=fixwin(command)
-
---[[ Prepend an additional hyphen to activate this code.
-for i=0, #command do
- print (command[i])
-end
-os.exit(ret)
---]]
-
-ret=os.spawn(command)
-os.exit(ret)
diff --git a/Master/bin/win32/epspdftk.bat b/Master/bin/win32/epspdftk.bat
index 34fb1093feb..42ba109d438 100755
--- a/Master/bin/win32/epspdftk.bat
+++ b/Master/bin/win32/epspdftk.bat
@@ -1,11 +1,78 @@
-@echo off
-ruby -v >nul 2>&1
-if not errorlevel 1 goto doit
-echo Ruby not found. Install Ruby and Tcl,
-echo get the Ruby-included version or use epstopdf.
-goto :EOF
-:doit
-setlocal
-set ownpath=%~dp0%
-texlua "%ownpath%epspdf.texlua" "%~dpn0" %*
-endlocal
+@echo off
+rem Universal script launcher
+rem
+rem Copyright 2009 by Tomasz M. Trzeciak
+rem Public Domain
+
+rem Make environment changes local
+setlocal enableextensions
+rem Get program/script name
+if not defined progname set progname=%~n0
+rem Check if this is 'sys' version of program
+set TEX_SYS_PROG=
+if /i "%progname:~-4%"=="-sys" (
+ set progname=%progname:~0,-4%
+ set TEX_SYS_PROG=true
+)
+
+rem Default command to execute
+set command=call :noscript
+rem Make sure our dir is on the search path; avoid trailing backslash
+for %%I in ("%~f0\..") do path %%~fI;%path%
+rem Ask kpsewhich about root and texmfsys trees (the first line of output)
+rem and location of the script (the second line of output)
+rem (4NT shell acts wierd with 'if' statements in a 'for' loop,
+rem so better process this output further in a subroutine)
+for /f "tokens=1-3 delims=;" %%I in (
+ 'kpsewhich --expand-var "$SELFAUTOPARENT;$TEXMFSYSCONFIG;$TEXMFSYSVAR" ^
+ --format texmfscripts "%progname%.pl" "%progname%.tlu" "%progname%.rb" "%progname%.py"'
+) do (
+ call :setcmdenv "%%~I" "%%~J" "%%~K"
+)
+
+rem By now we should have the command to execute (whatever that is), so
+rem pass through all the arguments we have and execute it
+%command% %*
+rem Finish with goto :eof (it will preserve the last set errorlevel)
+goto :eof
+
+REM SUBROUTINES
+
+:setcmdenv selfautoparent texmfsysconfig texmfsysvar
+rem If there is only one argument it must be a script name
+if "%~2"=="" goto :setcmd
+rem Otherwise, it is the first line from kpsewhich, so to set up the environment
+set PERL5LIB=%~f1\tlpkg\tlperl\lib
+set GS_LIB=%~f1\tlpkg\tlgs\lib;%~f1\tlpkg\tlgs\fonts
+path %~f1\tlpkg\tlgs\bin;%~f1\tlpkg\tlperl\bin;%~f1\tlpkg\installer;%~f1\tlpkg\installer\wget;%path%
+if not defined TEX_SYS_PROG goto :eof
+rem Extra stuff for sys version
+set TEXMFCONFIG=%~2
+set TEXMFVAR=%~3
+rem For sys version we might have an executable in the bin dir, so check for it
+if exist "%~f1\bin\win32\%progname%.exe" set command="%~f1\bin\win32\%progname%.exe"
+goto :eof
+
+:setcmd script
+rem Set command based on the script extension
+if /i %~x1==.pl set command=Perl.exe "%~f1"
+if /i %~x1==.tlu set command=TeXLua.exe "%~f1"
+rem For Ruby and Python we additionally check if their interpreter is available
+if /i %~x1==.rb call :chkcmd Ruby.exe "%~f1"
+if /i %~x1==.py call :chkcmd Python.exe "%~f1"
+goto :eof
+
+:chkcmd program script
+set command=%*
+rem If there is no interpreter Ruby or Python, suggest getting one
+if "%~$PATH:1"=="" set command=call :noinst %*
+goto :eof
+
+:noinst program
+echo %1 not found on search path>&2
+echo %~n1 is not distributed with TeX Live and has to be installed separately
+exit /b 1
+
+:noscript
+echo %progname%: no appropriate script or program found>&2
+exit /b 1
diff --git a/Master/bin/win32/epstopdf.bat b/Master/bin/win32/epstopdf.bat
index fe949613d7c..42ba109d438 100755
--- a/Master/bin/win32/epstopdf.bat
+++ b/Master/bin/win32/epstopdf.bat
@@ -1,8 +1,78 @@
@echo off
-rem tl-w32-starter.bat
-rem universal script starter, batch file part
-rem this program calls the tl-w32-wrapper.texlua
-setlocal
-set ownpath=%~dp0%
-texlua "%ownpath%tl-w32-wrapper.texlua" "%~dpn0" %*
-endlocal
+rem Universal script launcher
+rem
+rem Copyright 2009 by Tomasz M. Trzeciak
+rem Public Domain
+
+rem Make environment changes local
+setlocal enableextensions
+rem Get program/script name
+if not defined progname set progname=%~n0
+rem Check if this is 'sys' version of program
+set TEX_SYS_PROG=
+if /i "%progname:~-4%"=="-sys" (
+ set progname=%progname:~0,-4%
+ set TEX_SYS_PROG=true
+)
+
+rem Default command to execute
+set command=call :noscript
+rem Make sure our dir is on the search path; avoid trailing backslash
+for %%I in ("%~f0\..") do path %%~fI;%path%
+rem Ask kpsewhich about root and texmfsys trees (the first line of output)
+rem and location of the script (the second line of output)
+rem (4NT shell acts wierd with 'if' statements in a 'for' loop,
+rem so better process this output further in a subroutine)
+for /f "tokens=1-3 delims=;" %%I in (
+ 'kpsewhich --expand-var "$SELFAUTOPARENT;$TEXMFSYSCONFIG;$TEXMFSYSVAR" ^
+ --format texmfscripts "%progname%.pl" "%progname%.tlu" "%progname%.rb" "%progname%.py"'
+) do (
+ call :setcmdenv "%%~I" "%%~J" "%%~K"
+)
+
+rem By now we should have the command to execute (whatever that is), so
+rem pass through all the arguments we have and execute it
+%command% %*
+rem Finish with goto :eof (it will preserve the last set errorlevel)
+goto :eof
+
+REM SUBROUTINES
+
+:setcmdenv selfautoparent texmfsysconfig texmfsysvar
+rem If there is only one argument it must be a script name
+if "%~2"=="" goto :setcmd
+rem Otherwise, it is the first line from kpsewhich, so to set up the environment
+set PERL5LIB=%~f1\tlpkg\tlperl\lib
+set GS_LIB=%~f1\tlpkg\tlgs\lib;%~f1\tlpkg\tlgs\fonts
+path %~f1\tlpkg\tlgs\bin;%~f1\tlpkg\tlperl\bin;%~f1\tlpkg\installer;%~f1\tlpkg\installer\wget;%path%
+if not defined TEX_SYS_PROG goto :eof
+rem Extra stuff for sys version
+set TEXMFCONFIG=%~2
+set TEXMFVAR=%~3
+rem For sys version we might have an executable in the bin dir, so check for it
+if exist "%~f1\bin\win32\%progname%.exe" set command="%~f1\bin\win32\%progname%.exe"
+goto :eof
+
+:setcmd script
+rem Set command based on the script extension
+if /i %~x1==.pl set command=Perl.exe "%~f1"
+if /i %~x1==.tlu set command=TeXLua.exe "%~f1"
+rem For Ruby and Python we additionally check if their interpreter is available
+if /i %~x1==.rb call :chkcmd Ruby.exe "%~f1"
+if /i %~x1==.py call :chkcmd Python.exe "%~f1"
+goto :eof
+
+:chkcmd program script
+set command=%*
+rem If there is no interpreter Ruby or Python, suggest getting one
+if "%~$PATH:1"=="" set command=call :noinst %*
+goto :eof
+
+:noinst program
+echo %1 not found on search path>&2
+echo %~n1 is not distributed with TeX Live and has to be installed separately
+exit /b 1
+
+:noscript
+echo %progname%: no appropriate script or program found>&2
+exit /b 1
diff --git a/Master/bin/win32/fmtutil-sys.bat b/Master/bin/win32/fmtutil-sys.bat
index fe949613d7c..42ba109d438 100755
--- a/Master/bin/win32/fmtutil-sys.bat
+++ b/Master/bin/win32/fmtutil-sys.bat
@@ -1,8 +1,78 @@
@echo off
-rem tl-w32-starter.bat
-rem universal script starter, batch file part
-rem this program calls the tl-w32-wrapper.texlua
-setlocal
-set ownpath=%~dp0%
-texlua "%ownpath%tl-w32-wrapper.texlua" "%~dpn0" %*
-endlocal
+rem Universal script launcher
+rem
+rem Copyright 2009 by Tomasz M. Trzeciak
+rem Public Domain
+
+rem Make environment changes local
+setlocal enableextensions
+rem Get program/script name
+if not defined progname set progname=%~n0
+rem Check if this is 'sys' version of program
+set TEX_SYS_PROG=
+if /i "%progname:~-4%"=="-sys" (
+ set progname=%progname:~0,-4%
+ set TEX_SYS_PROG=true
+)
+
+rem Default command to execute
+set command=call :noscript
+rem Make sure our dir is on the search path; avoid trailing backslash
+for %%I in ("%~f0\..") do path %%~fI;%path%
+rem Ask kpsewhich about root and texmfsys trees (the first line of output)
+rem and location of the script (the second line of output)
+rem (4NT shell acts wierd with 'if' statements in a 'for' loop,
+rem so better process this output further in a subroutine)
+for /f "tokens=1-3 delims=;" %%I in (
+ 'kpsewhich --expand-var "$SELFAUTOPARENT;$TEXMFSYSCONFIG;$TEXMFSYSVAR" ^
+ --format texmfscripts "%progname%.pl" "%progname%.tlu" "%progname%.rb" "%progname%.py"'
+) do (
+ call :setcmdenv "%%~I" "%%~J" "%%~K"
+)
+
+rem By now we should have the command to execute (whatever that is), so
+rem pass through all the arguments we have and execute it
+%command% %*
+rem Finish with goto :eof (it will preserve the last set errorlevel)
+goto :eof
+
+REM SUBROUTINES
+
+:setcmdenv selfautoparent texmfsysconfig texmfsysvar
+rem If there is only one argument it must be a script name
+if "%~2"=="" goto :setcmd
+rem Otherwise, it is the first line from kpsewhich, so to set up the environment
+set PERL5LIB=%~f1\tlpkg\tlperl\lib
+set GS_LIB=%~f1\tlpkg\tlgs\lib;%~f1\tlpkg\tlgs\fonts
+path %~f1\tlpkg\tlgs\bin;%~f1\tlpkg\tlperl\bin;%~f1\tlpkg\installer;%~f1\tlpkg\installer\wget;%path%
+if not defined TEX_SYS_PROG goto :eof
+rem Extra stuff for sys version
+set TEXMFCONFIG=%~2
+set TEXMFVAR=%~3
+rem For sys version we might have an executable in the bin dir, so check for it
+if exist "%~f1\bin\win32\%progname%.exe" set command="%~f1\bin\win32\%progname%.exe"
+goto :eof
+
+:setcmd script
+rem Set command based on the script extension
+if /i %~x1==.pl set command=Perl.exe "%~f1"
+if /i %~x1==.tlu set command=TeXLua.exe "%~f1"
+rem For Ruby and Python we additionally check if their interpreter is available
+if /i %~x1==.rb call :chkcmd Ruby.exe "%~f1"
+if /i %~x1==.py call :chkcmd Python.exe "%~f1"
+goto :eof
+
+:chkcmd program script
+set command=%*
+rem If there is no interpreter Ruby or Python, suggest getting one
+if "%~$PATH:1"=="" set command=call :noinst %*
+goto :eof
+
+:noinst program
+echo %1 not found on search path>&2
+echo %~n1 is not distributed with TeX Live and has to be installed separately
+exit /b 1
+
+:noscript
+echo %progname%: no appropriate script or program found>&2
+exit /b 1
diff --git a/Master/bin/win32/font2afm.bat b/Master/bin/win32/font2afm.bat
index fe949613d7c..42ba109d438 100755
--- a/Master/bin/win32/font2afm.bat
+++ b/Master/bin/win32/font2afm.bat
@@ -1,8 +1,78 @@
@echo off
-rem tl-w32-starter.bat
-rem universal script starter, batch file part
-rem this program calls the tl-w32-wrapper.texlua
-setlocal
-set ownpath=%~dp0%
-texlua "%ownpath%tl-w32-wrapper.texlua" "%~dpn0" %*
-endlocal
+rem Universal script launcher
+rem
+rem Copyright 2009 by Tomasz M. Trzeciak
+rem Public Domain
+
+rem Make environment changes local
+setlocal enableextensions
+rem Get program/script name
+if not defined progname set progname=%~n0
+rem Check if this is 'sys' version of program
+set TEX_SYS_PROG=
+if /i "%progname:~-4%"=="-sys" (
+ set progname=%progname:~0,-4%
+ set TEX_SYS_PROG=true
+)
+
+rem Default command to execute
+set command=call :noscript
+rem Make sure our dir is on the search path; avoid trailing backslash
+for %%I in ("%~f0\..") do path %%~fI;%path%
+rem Ask kpsewhich about root and texmfsys trees (the first line of output)
+rem and location of the script (the second line of output)
+rem (4NT shell acts wierd with 'if' statements in a 'for' loop,
+rem so better process this output further in a subroutine)
+for /f "tokens=1-3 delims=;" %%I in (
+ 'kpsewhich --expand-var "$SELFAUTOPARENT;$TEXMFSYSCONFIG;$TEXMFSYSVAR" ^
+ --format texmfscripts "%progname%.pl" "%progname%.tlu" "%progname%.rb" "%progname%.py"'
+) do (
+ call :setcmdenv "%%~I" "%%~J" "%%~K"
+)
+
+rem By now we should have the command to execute (whatever that is), so
+rem pass through all the arguments we have and execute it
+%command% %*
+rem Finish with goto :eof (it will preserve the last set errorlevel)
+goto :eof
+
+REM SUBROUTINES
+
+:setcmdenv selfautoparent texmfsysconfig texmfsysvar
+rem If there is only one argument it must be a script name
+if "%~2"=="" goto :setcmd
+rem Otherwise, it is the first line from kpsewhich, so to set up the environment
+set PERL5LIB=%~f1\tlpkg\tlperl\lib
+set GS_LIB=%~f1\tlpkg\tlgs\lib;%~f1\tlpkg\tlgs\fonts
+path %~f1\tlpkg\tlgs\bin;%~f1\tlpkg\tlperl\bin;%~f1\tlpkg\installer;%~f1\tlpkg\installer\wget;%path%
+if not defined TEX_SYS_PROG goto :eof
+rem Extra stuff for sys version
+set TEXMFCONFIG=%~2
+set TEXMFVAR=%~3
+rem For sys version we might have an executable in the bin dir, so check for it
+if exist "%~f1\bin\win32\%progname%.exe" set command="%~f1\bin\win32\%progname%.exe"
+goto :eof
+
+:setcmd script
+rem Set command based on the script extension
+if /i %~x1==.pl set command=Perl.exe "%~f1"
+if /i %~x1==.tlu set command=TeXLua.exe "%~f1"
+rem For Ruby and Python we additionally check if their interpreter is available
+if /i %~x1==.rb call :chkcmd Ruby.exe "%~f1"
+if /i %~x1==.py call :chkcmd Python.exe "%~f1"
+goto :eof
+
+:chkcmd program script
+set command=%*
+rem If there is no interpreter Ruby or Python, suggest getting one
+if "%~$PATH:1"=="" set command=call :noinst %*
+goto :eof
+
+:noinst program
+echo %1 not found on search path>&2
+echo %~n1 is not distributed with TeX Live and has to be installed separately
+exit /b 1
+
+:noscript
+echo %progname%: no appropriate script or program found>&2
+exit /b 1
diff --git a/Master/bin/win32/getnonfreefonts-sys.bat b/Master/bin/win32/getnonfreefonts-sys.bat
index fe949613d7c..42ba109d438 100755
--- a/Master/bin/win32/getnonfreefonts-sys.bat
+++ b/Master/bin/win32/getnonfreefonts-sys.bat
@@ -1,8 +1,78 @@
@echo off
-rem tl-w32-starter.bat
-rem universal script starter, batch file part
-rem this program calls the tl-w32-wrapper.texlua
-setlocal
-set ownpath=%~dp0%
-texlua "%ownpath%tl-w32-wrapper.texlua" "%~dpn0" %*
-endlocal
+rem Universal script launcher
+rem
+rem Copyright 2009 by Tomasz M. Trzeciak
+rem Public Domain
+
+rem Make environment changes local
+setlocal enableextensions
+rem Get program/script name
+if not defined progname set progname=%~n0
+rem Check if this is 'sys' version of program
+set TEX_SYS_PROG=
+if /i "%progname:~-4%"=="-sys" (
+ set progname=%progname:~0,-4%
+ set TEX_SYS_PROG=true
+)
+
+rem Default command to execute
+set command=call :noscript
+rem Make sure our dir is on the search path; avoid trailing backslash
+for %%I in ("%~f0\..") do path %%~fI;%path%
+rem Ask kpsewhich about root and texmfsys trees (the first line of output)
+rem and location of the script (the second line of output)
+rem (4NT shell acts wierd with 'if' statements in a 'for' loop,
+rem so better process this output further in a subroutine)
+for /f "tokens=1-3 delims=;" %%I in (
+ 'kpsewhich --expand-var "$SELFAUTOPARENT;$TEXMFSYSCONFIG;$TEXMFSYSVAR" ^
+ --format texmfscripts "%progname%.pl" "%progname%.tlu" "%progname%.rb" "%progname%.py"'
+) do (
+ call :setcmdenv "%%~I" "%%~J" "%%~K"
+)
+
+rem By now we should have the command to execute (whatever that is), so
+rem pass through all the arguments we have and execute it
+%command% %*
+rem Finish with goto :eof (it will preserve the last set errorlevel)
+goto :eof
+
+REM SUBROUTINES
+
+:setcmdenv selfautoparent texmfsysconfig texmfsysvar
+rem If there is only one argument it must be a script name
+if "%~2"=="" goto :setcmd
+rem Otherwise, it is the first line from kpsewhich, so to set up the environment
+set PERL5LIB=%~f1\tlpkg\tlperl\lib
+set GS_LIB=%~f1\tlpkg\tlgs\lib;%~f1\tlpkg\tlgs\fonts
+path %~f1\tlpkg\tlgs\bin;%~f1\tlpkg\tlperl\bin;%~f1\tlpkg\installer;%~f1\tlpkg\installer\wget;%path%
+if not defined TEX_SYS_PROG goto :eof
+rem Extra stuff for sys version
+set TEXMFCONFIG=%~2
+set TEXMFVAR=%~3
+rem For sys version we might have an executable in the bin dir, so check for it
+if exist "%~f1\bin\win32\%progname%.exe" set command="%~f1\bin\win32\%progname%.exe"
+goto :eof
+
+:setcmd script
+rem Set command based on the script extension
+if /i %~x1==.pl set command=Perl.exe "%~f1"
+if /i %~x1==.tlu set command=TeXLua.exe "%~f1"
+rem For Ruby and Python we additionally check if their interpreter is available
+if /i %~x1==.rb call :chkcmd Ruby.exe "%~f1"
+if /i %~x1==.py call :chkcmd Python.exe "%~f1"
+goto :eof
+
+:chkcmd program script
+set command=%*
+rem If there is no interpreter Ruby or Python, suggest getting one
+if "%~$PATH:1"=="" set command=call :noinst %*
+goto :eof
+
+:noinst program
+echo %1 not found on search path>&2
+echo %~n1 is not distributed with TeX Live and has to be installed separately
+exit /b 1
+
+:noscript
+echo %progname%: no appropriate script or program found>&2
+exit /b 1
diff --git a/Master/bin/win32/getnonfreefonts.bat b/Master/bin/win32/getnonfreefonts.bat
index fe949613d7c..42ba109d438 100755
--- a/Master/bin/win32/getnonfreefonts.bat
+++ b/Master/bin/win32/getnonfreefonts.bat
@@ -1,8 +1,78 @@
@echo off
-rem tl-w32-starter.bat
-rem universal script starter, batch file part
-rem this program calls the tl-w32-wrapper.texlua
-setlocal
-set ownpath=%~dp0%
-texlua "%ownpath%tl-w32-wrapper.texlua" "%~dpn0" %*
-endlocal
+rem Universal script launcher
+rem
+rem Copyright 2009 by Tomasz M. Trzeciak
+rem Public Domain
+
+rem Make environment changes local
+setlocal enableextensions
+rem Get program/script name
+if not defined progname set progname=%~n0
+rem Check if this is 'sys' version of program
+set TEX_SYS_PROG=
+if /i "%progname:~-4%"=="-sys" (
+ set progname=%progname:~0,-4%
+ set TEX_SYS_PROG=true
+)
+
+rem Default command to execute
+set command=call :noscript
+rem Make sure our dir is on the search path; avoid trailing backslash
+for %%I in ("%~f0\..") do path %%~fI;%path%
+rem Ask kpsewhich about root and texmfsys trees (the first line of output)
+rem and location of the script (the second line of output)
+rem (4NT shell acts wierd with 'if' statements in a 'for' loop,
+rem so better process this output further in a subroutine)
+for /f "tokens=1-3 delims=;" %%I in (
+ 'kpsewhich --expand-var "$SELFAUTOPARENT;$TEXMFSYSCONFIG;$TEXMFSYSVAR" ^
+ --format texmfscripts "%progname%.pl" "%progname%.tlu" "%progname%.rb" "%progname%.py"'
+) do (
+ call :setcmdenv "%%~I" "%%~J" "%%~K"
+)
+
+rem By now we should have the command to execute (whatever that is), so
+rem pass through all the arguments we have and execute it
+%command% %*
+rem Finish with goto :eof (it will preserve the last set errorlevel)
+goto :eof
+
+REM SUBROUTINES
+
+:setcmdenv selfautoparent texmfsysconfig texmfsysvar
+rem If there is only one argument it must be a script name
+if "%~2"=="" goto :setcmd
+rem Otherwise, it is the first line from kpsewhich, so to set up the environment
+set PERL5LIB=%~f1\tlpkg\tlperl\lib
+set GS_LIB=%~f1\tlpkg\tlgs\lib;%~f1\tlpkg\tlgs\fonts
+path %~f1\tlpkg\tlgs\bin;%~f1\tlpkg\tlperl\bin;%~f1\tlpkg\installer;%~f1\tlpkg\installer\wget;%path%
+if not defined TEX_SYS_PROG goto :eof
+rem Extra stuff for sys version
+set TEXMFCONFIG=%~2
+set TEXMFVAR=%~3
+rem For sys version we might have an executable in the bin dir, so check for it
+if exist "%~f1\bin\win32\%progname%.exe" set command="%~f1\bin\win32\%progname%.exe"
+goto :eof
+
+:setcmd script
+rem Set command based on the script extension
+if /i %~x1==.pl set command=Perl.exe "%~f1"
+if /i %~x1==.tlu set command=TeXLua.exe "%~f1"
+rem For Ruby and Python we additionally check if their interpreter is available
+if /i %~x1==.rb call :chkcmd Ruby.exe "%~f1"
+if /i %~x1==.py call :chkcmd Python.exe "%~f1"
+goto :eof
+
+:chkcmd program script
+set command=%*
+rem If there is no interpreter Ruby or Python, suggest getting one
+if "%~$PATH:1"=="" set command=call :noinst %*
+goto :eof
+
+:noinst program
+echo %1 not found on search path>&2
+echo %~n1 is not distributed with TeX Live and has to be installed separately
+exit /b 1
+
+:noscript
+echo %progname%: no appropriate script or program found>&2
+exit /b 1
diff --git a/Master/bin/win32/latexmk.bat b/Master/bin/win32/latexmk.bat
index fe949613d7c..42ba109d438 100755
--- a/Master/bin/win32/latexmk.bat
+++ b/Master/bin/win32/latexmk.bat
@@ -1,8 +1,78 @@
@echo off
-rem tl-w32-starter.bat
-rem universal script starter, batch file part
-rem this program calls the tl-w32-wrapper.texlua
-setlocal
-set ownpath=%~dp0%
-texlua "%ownpath%tl-w32-wrapper.texlua" "%~dpn0" %*
-endlocal
+rem Universal script launcher
+rem
+rem Copyright 2009 by Tomasz M. Trzeciak
+rem Public Domain
+
+rem Make environment changes local
+setlocal enableextensions
+rem Get program/script name
+if not defined progname set progname=%~n0
+rem Check if this is 'sys' version of program
+set TEX_SYS_PROG=
+if /i "%progname:~-4%"=="-sys" (
+ set progname=%progname:~0,-4%
+ set TEX_SYS_PROG=true
+)
+
+rem Default command to execute
+set command=call :noscript
+rem Make sure our dir is on the search path; avoid trailing backslash
+for %%I in ("%~f0\..") do path %%~fI;%path%
+rem Ask kpsewhich about root and texmfsys trees (the first line of output)
+rem and location of the script (the second line of output)
+rem (4NT shell acts wierd with 'if' statements in a 'for' loop,
+rem so better process this output further in a subroutine)
+for /f "tokens=1-3 delims=;" %%I in (
+ 'kpsewhich --expand-var "$SELFAUTOPARENT;$TEXMFSYSCONFIG;$TEXMFSYSVAR" ^
+ --format texmfscripts "%progname%.pl" "%progname%.tlu" "%progname%.rb" "%progname%.py"'
+) do (
+ call :setcmdenv "%%~I" "%%~J" "%%~K"
+)
+
+rem By now we should have the command to execute (whatever that is), so
+rem pass through all the arguments we have and execute it
+%command% %*
+rem Finish with goto :eof (it will preserve the last set errorlevel)
+goto :eof
+
+REM SUBROUTINES
+
+:setcmdenv selfautoparent texmfsysconfig texmfsysvar
+rem If there is only one argument it must be a script name
+if "%~2"=="" goto :setcmd
+rem Otherwise, it is the first line from kpsewhich, so to set up the environment
+set PERL5LIB=%~f1\tlpkg\tlperl\lib
+set GS_LIB=%~f1\tlpkg\tlgs\lib;%~f1\tlpkg\tlgs\fonts
+path %~f1\tlpkg\tlgs\bin;%~f1\tlpkg\tlperl\bin;%~f1\tlpkg\installer;%~f1\tlpkg\installer\wget;%path%
+if not defined TEX_SYS_PROG goto :eof
+rem Extra stuff for sys version
+set TEXMFCONFIG=%~2
+set TEXMFVAR=%~3
+rem For sys version we might have an executable in the bin dir, so check for it
+if exist "%~f1\bin\win32\%progname%.exe" set command="%~f1\bin\win32\%progname%.exe"
+goto :eof
+
+:setcmd script
+rem Set command based on the script extension
+if /i %~x1==.pl set command=Perl.exe "%~f1"
+if /i %~x1==.tlu set command=TeXLua.exe "%~f1"
+rem For Ruby and Python we additionally check if their interpreter is available
+if /i %~x1==.rb call :chkcmd Ruby.exe "%~f1"
+if /i %~x1==.py call :chkcmd Python.exe "%~f1"
+goto :eof
+
+:chkcmd program script
+set command=%*
+rem If there is no interpreter Ruby or Python, suggest getting one
+if "%~$PATH:1"=="" set command=call :noinst %*
+goto :eof
+
+:noinst program
+echo %1 not found on search path>&2
+echo %~n1 is not distributed with TeX Live and has to be installed separately
+exit /b 1
+
+:noscript
+echo %progname%: no appropriate script or program found>&2
+exit /b 1
diff --git a/Master/bin/win32/makeglossaries.bat b/Master/bin/win32/makeglossaries.bat
index fe949613d7c..42ba109d438 100755
--- a/Master/bin/win32/makeglossaries.bat
+++ b/Master/bin/win32/makeglossaries.bat
@@ -1,8 +1,78 @@
@echo off
-rem tl-w32-starter.bat
-rem universal script starter, batch file part
-rem this program calls the tl-w32-wrapper.texlua
-setlocal
-set ownpath=%~dp0%
-texlua "%ownpath%tl-w32-wrapper.texlua" "%~dpn0" %*
-endlocal
+rem Universal script launcher
+rem
+rem Copyright 2009 by Tomasz M. Trzeciak
+rem Public Domain
+
+rem Make environment changes local
+setlocal enableextensions
+rem Get program/script name
+if not defined progname set progname=%~n0
+rem Check if this is 'sys' version of program
+set TEX_SYS_PROG=
+if /i "%progname:~-4%"=="-sys" (
+ set progname=%progname:~0,-4%
+ set TEX_SYS_PROG=true
+)
+
+rem Default command to execute
+set command=call :noscript
+rem Make sure our dir is on the search path; avoid trailing backslash
+for %%I in ("%~f0\..") do path %%~fI;%path%
+rem Ask kpsewhich about root and texmfsys trees (the first line of output)
+rem and location of the script (the second line of output)
+rem (4NT shell acts wierd with 'if' statements in a 'for' loop,
+rem so better process this output further in a subroutine)
+for /f "tokens=1-3 delims=;" %%I in (
+ 'kpsewhich --expand-var "$SELFAUTOPARENT;$TEXMFSYSCONFIG;$TEXMFSYSVAR" ^
+ --format texmfscripts "%progname%.pl" "%progname%.tlu" "%progname%.rb" "%progname%.py"'
+) do (
+ call :setcmdenv "%%~I" "%%~J" "%%~K"
+)
+
+rem By now we should have the command to execute (whatever that is), so
+rem pass through all the arguments we have and execute it
+%command% %*
+rem Finish with goto :eof (it will preserve the last set errorlevel)
+goto :eof
+
+REM SUBROUTINES
+
+:setcmdenv selfautoparent texmfsysconfig texmfsysvar
+rem If there is only one argument it must be a script name
+if "%~2"=="" goto :setcmd
+rem Otherwise, it is the first line from kpsewhich, so to set up the environment
+set PERL5LIB=%~f1\tlpkg\tlperl\lib
+set GS_LIB=%~f1\tlpkg\tlgs\lib;%~f1\tlpkg\tlgs\fonts
+path %~f1\tlpkg\tlgs\bin;%~f1\tlpkg\tlperl\bin;%~f1\tlpkg\installer;%~f1\tlpkg\installer\wget;%path%
+if not defined TEX_SYS_PROG goto :eof
+rem Extra stuff for sys version
+set TEXMFCONFIG=%~2
+set TEXMFVAR=%~3
+rem For sys version we might have an executable in the bin dir, so check for it
+if exist "%~f1\bin\win32\%progname%.exe" set command="%~f1\bin\win32\%progname%.exe"
+goto :eof
+
+:setcmd script
+rem Set command based on the script extension
+if /i %~x1==.pl set command=Perl.exe "%~f1"
+if /i %~x1==.tlu set command=TeXLua.exe "%~f1"
+rem For Ruby and Python we additionally check if their interpreter is available
+if /i %~x1==.rb call :chkcmd Ruby.exe "%~f1"
+if /i %~x1==.py call :chkcmd Python.exe "%~f1"
+goto :eof
+
+:chkcmd program script
+set command=%*
+rem If there is no interpreter Ruby or Python, suggest getting one
+if "%~$PATH:1"=="" set command=call :noinst %*
+goto :eof
+
+:noinst program
+echo %1 not found on search path>&2
+echo %~n1 is not distributed with TeX Live and has to be installed separately
+exit /b 1
+
+:noscript
+echo %progname%: no appropriate script or program found>&2
+exit /b 1
diff --git a/Master/bin/win32/mk4ht.bat b/Master/bin/win32/mk4ht.bat
index fe949613d7c..42ba109d438 100755
--- a/Master/bin/win32/mk4ht.bat
+++ b/Master/bin/win32/mk4ht.bat
@@ -1,8 +1,78 @@
@echo off
-rem tl-w32-starter.bat
-rem universal script starter, batch file part
-rem this program calls the tl-w32-wrapper.texlua
-setlocal
-set ownpath=%~dp0%
-texlua "%ownpath%tl-w32-wrapper.texlua" "%~dpn0" %*
-endlocal
+rem Universal script launcher
+rem
+rem Copyright 2009 by Tomasz M. Trzeciak
+rem Public Domain
+
+rem Make environment changes local
+setlocal enableextensions
+rem Get program/script name
+if not defined progname set progname=%~n0
+rem Check if this is 'sys' version of program
+set TEX_SYS_PROG=
+if /i "%progname:~-4%"=="-sys" (
+ set progname=%progname:~0,-4%
+ set TEX_SYS_PROG=true
+)
+
+rem Default command to execute
+set command=call :noscript
+rem Make sure our dir is on the search path; avoid trailing backslash
+for %%I in ("%~f0\..") do path %%~fI;%path%
+rem Ask kpsewhich about root and texmfsys trees (the first line of output)
+rem and location of the script (the second line of output)
+rem (4NT shell acts wierd with 'if' statements in a 'for' loop,
+rem so better process this output further in a subroutine)
+for /f "tokens=1-3 delims=;" %%I in (
+ 'kpsewhich --expand-var "$SELFAUTOPARENT;$TEXMFSYSCONFIG;$TEXMFSYSVAR" ^
+ --format texmfscripts "%progname%.pl" "%progname%.tlu" "%progname%.rb" "%progname%.py"'
+) do (
+ call :setcmdenv "%%~I" "%%~J" "%%~K"
+)
+
+rem By now we should have the command to execute (whatever that is), so
+rem pass through all the arguments we have and execute it
+%command% %*
+rem Finish with goto :eof (it will preserve the last set errorlevel)
+goto :eof
+
+REM SUBROUTINES
+
+:setcmdenv selfautoparent texmfsysconfig texmfsysvar
+rem If there is only one argument it must be a script name
+if "%~2"=="" goto :setcmd
+rem Otherwise, it is the first line from kpsewhich, so to set up the environment
+set PERL5LIB=%~f1\tlpkg\tlperl\lib
+set GS_LIB=%~f1\tlpkg\tlgs\lib;%~f1\tlpkg\tlgs\fonts
+path %~f1\tlpkg\tlgs\bin;%~f1\tlpkg\tlperl\bin;%~f1\tlpkg\installer;%~f1\tlpkg\installer\wget;%path%
+if not defined TEX_SYS_PROG goto :eof
+rem Extra stuff for sys version
+set TEXMFCONFIG=%~2
+set TEXMFVAR=%~3
+rem For sys version we might have an executable in the bin dir, so check for it
+if exist "%~f1\bin\win32\%progname%.exe" set command="%~f1\bin\win32\%progname%.exe"
+goto :eof
+
+:setcmd script
+rem Set command based on the script extension
+if /i %~x1==.pl set command=Perl.exe "%~f1"
+if /i %~x1==.tlu set command=TeXLua.exe "%~f1"
+rem For Ruby and Python we additionally check if their interpreter is available
+if /i %~x1==.rb call :chkcmd Ruby.exe "%~f1"
+if /i %~x1==.py call :chkcmd Python.exe "%~f1"
+goto :eof
+
+:chkcmd program script
+set command=%*
+rem If there is no interpreter Ruby or Python, suggest getting one
+if "%~$PATH:1"=="" set command=call :noinst %*
+goto :eof
+
+:noinst program
+echo %1 not found on search path>&2
+echo %~n1 is not distributed with TeX Live and has to be installed separately
+exit /b 1
+
+:noscript
+echo %progname%: no appropriate script or program found>&2
+exit /b 1
diff --git a/Master/bin/win32/mkjobtexmf.bat b/Master/bin/win32/mkjobtexmf.bat
index fe949613d7c..42ba109d438 100755
--- a/Master/bin/win32/mkjobtexmf.bat
+++ b/Master/bin/win32/mkjobtexmf.bat
@@ -1,8 +1,78 @@
@echo off
-rem tl-w32-starter.bat
-rem universal script starter, batch file part
-rem this program calls the tl-w32-wrapper.texlua
-setlocal
-set ownpath=%~dp0%
-texlua "%ownpath%tl-w32-wrapper.texlua" "%~dpn0" %*
-endlocal
+rem Universal script launcher
+rem
+rem Copyright 2009 by Tomasz M. Trzeciak
+rem Public Domain
+
+rem Make environment changes local
+setlocal enableextensions
+rem Get program/script name
+if not defined progname set progname=%~n0
+rem Check if this is 'sys' version of program
+set TEX_SYS_PROG=
+if /i "%progname:~-4%"=="-sys" (
+ set progname=%progname:~0,-4%
+ set TEX_SYS_PROG=true
+)
+
+rem Default command to execute
+set command=call :noscript
+rem Make sure our dir is on the search path; avoid trailing backslash
+for %%I in ("%~f0\..") do path %%~fI;%path%
+rem Ask kpsewhich about root and texmfsys trees (the first line of output)
+rem and location of the script (the second line of output)
+rem (4NT shell acts wierd with 'if' statements in a 'for' loop,
+rem so better process this output further in a subroutine)
+for /f "tokens=1-3 delims=;" %%I in (
+ 'kpsewhich --expand-var "$SELFAUTOPARENT;$TEXMFSYSCONFIG;$TEXMFSYSVAR" ^
+ --format texmfscripts "%progname%.pl" "%progname%.tlu" "%progname%.rb" "%progname%.py"'
+) do (
+ call :setcmdenv "%%~I" "%%~J" "%%~K"
+)
+
+rem By now we should have the command to execute (whatever that is), so
+rem pass through all the arguments we have and execute it
+%command% %*
+rem Finish with goto :eof (it will preserve the last set errorlevel)
+goto :eof
+
+REM SUBROUTINES
+
+:setcmdenv selfautoparent texmfsysconfig texmfsysvar
+rem If there is only one argument it must be a script name
+if "%~2"=="" goto :setcmd
+rem Otherwise, it is the first line from kpsewhich, so to set up the environment
+set PERL5LIB=%~f1\tlpkg\tlperl\lib
+set GS_LIB=%~f1\tlpkg\tlgs\lib;%~f1\tlpkg\tlgs\fonts
+path %~f1\tlpkg\tlgs\bin;%~f1\tlpkg\tlperl\bin;%~f1\tlpkg\installer;%~f1\tlpkg\installer\wget;%path%
+if not defined TEX_SYS_PROG goto :eof
+rem Extra stuff for sys version
+set TEXMFCONFIG=%~2
+set TEXMFVAR=%~3
+rem For sys version we might have an executable in the bin dir, so check for it
+if exist "%~f1\bin\win32\%progname%.exe" set command="%~f1\bin\win32\%progname%.exe"
+goto :eof
+
+:setcmd script
+rem Set command based on the script extension
+if /i %~x1==.pl set command=Perl.exe "%~f1"
+if /i %~x1==.tlu set command=TeXLua.exe "%~f1"
+rem For Ruby and Python we additionally check if their interpreter is available
+if /i %~x1==.rb call :chkcmd Ruby.exe "%~f1"
+if /i %~x1==.py call :chkcmd Python.exe "%~f1"
+goto :eof
+
+:chkcmd program script
+set command=%*
+rem If there is no interpreter Ruby or Python, suggest getting one
+if "%~$PATH:1"=="" set command=call :noinst %*
+goto :eof
+
+:noinst program
+echo %1 not found on search path>&2
+echo %~n1 is not distributed with TeX Live and has to be installed separately
+exit /b 1
+
+:noscript
+echo %progname%: no appropriate script or program found>&2
+exit /b 1
diff --git a/Master/bin/win32/mkt1font.bat b/Master/bin/win32/mkt1font.bat
index fe949613d7c..42ba109d438 100755
--- a/Master/bin/win32/mkt1font.bat
+++ b/Master/bin/win32/mkt1font.bat
@@ -1,8 +1,78 @@
@echo off
-rem tl-w32-starter.bat
-rem universal script starter, batch file part
-rem this program calls the tl-w32-wrapper.texlua
-setlocal
-set ownpath=%~dp0%
-texlua "%ownpath%tl-w32-wrapper.texlua" "%~dpn0" %*
-endlocal
+rem Universal script launcher
+rem
+rem Copyright 2009 by Tomasz M. Trzeciak
+rem Public Domain
+
+rem Make environment changes local
+setlocal enableextensions
+rem Get program/script name
+if not defined progname set progname=%~n0
+rem Check if this is 'sys' version of program
+set TEX_SYS_PROG=
+if /i "%progname:~-4%"=="-sys" (
+ set progname=%progname:~0,-4%
+ set TEX_SYS_PROG=true
+)
+
+rem Default command to execute
+set command=call :noscript
+rem Make sure our dir is on the search path; avoid trailing backslash
+for %%I in ("%~f0\..") do path %%~fI;%path%
+rem Ask kpsewhich about root and texmfsys trees (the first line of output)
+rem and location of the script (the second line of output)
+rem (4NT shell acts wierd with 'if' statements in a 'for' loop,
+rem so better process this output further in a subroutine)
+for /f "tokens=1-3 delims=;" %%I in (
+ 'kpsewhich --expand-var "$SELFAUTOPARENT;$TEXMFSYSCONFIG;$TEXMFSYSVAR" ^
+ --format texmfscripts "%progname%.pl" "%progname%.tlu" "%progname%.rb" "%progname%.py"'
+) do (
+ call :setcmdenv "%%~I" "%%~J" "%%~K"
+)
+
+rem By now we should have the command to execute (whatever that is), so
+rem pass through all the arguments we have and execute it
+%command% %*
+rem Finish with goto :eof (it will preserve the last set errorlevel)
+goto :eof
+
+REM SUBROUTINES
+
+:setcmdenv selfautoparent texmfsysconfig texmfsysvar
+rem If there is only one argument it must be a script name
+if "%~2"=="" goto :setcmd
+rem Otherwise, it is the first line from kpsewhich, so to set up the environment
+set PERL5LIB=%~f1\tlpkg\tlperl\lib
+set GS_LIB=%~f1\tlpkg\tlgs\lib;%~f1\tlpkg\tlgs\fonts
+path %~f1\tlpkg\tlgs\bin;%~f1\tlpkg\tlperl\bin;%~f1\tlpkg\installer;%~f1\tlpkg\installer\wget;%path%
+if not defined TEX_SYS_PROG goto :eof
+rem Extra stuff for sys version
+set TEXMFCONFIG=%~2
+set TEXMFVAR=%~3
+rem For sys version we might have an executable in the bin dir, so check for it
+if exist "%~f1\bin\win32\%progname%.exe" set command="%~f1\bin\win32\%progname%.exe"
+goto :eof
+
+:setcmd script
+rem Set command based on the script extension
+if /i %~x1==.pl set command=Perl.exe "%~f1"
+if /i %~x1==.tlu set command=TeXLua.exe "%~f1"
+rem For Ruby and Python we additionally check if their interpreter is available
+if /i %~x1==.rb call :chkcmd Ruby.exe "%~f1"
+if /i %~x1==.py call :chkcmd Python.exe "%~f1"
+goto :eof
+
+:chkcmd program script
+set command=%*
+rem If there is no interpreter Ruby or Python, suggest getting one
+if "%~$PATH:1"=="" set command=call :noinst %*
+goto :eof
+
+:noinst program
+echo %1 not found on search path>&2
+echo %~n1 is not distributed with TeX Live and has to be installed separately
+exit /b 1
+
+:noscript
+echo %progname%: no appropriate script or program found>&2
+exit /b 1
diff --git a/Master/bin/win32/ot2kpx.bat b/Master/bin/win32/ot2kpx.bat
index fe949613d7c..42ba109d438 100755
--- a/Master/bin/win32/ot2kpx.bat
+++ b/Master/bin/win32/ot2kpx.bat
@@ -1,8 +1,78 @@
@echo off
-rem tl-w32-starter.bat
-rem universal script starter, batch file part
-rem this program calls the tl-w32-wrapper.texlua
-setlocal
-set ownpath=%~dp0%
-texlua "%ownpath%tl-w32-wrapper.texlua" "%~dpn0" %*
-endlocal
+rem Universal script launcher
+rem
+rem Copyright 2009 by Tomasz M. Trzeciak
+rem Public Domain
+
+rem Make environment changes local
+setlocal enableextensions
+rem Get program/script name
+if not defined progname set progname=%~n0
+rem Check if this is 'sys' version of program
+set TEX_SYS_PROG=
+if /i "%progname:~-4%"=="-sys" (
+ set progname=%progname:~0,-4%
+ set TEX_SYS_PROG=true
+)
+
+rem Default command to execute
+set command=call :noscript
+rem Make sure our dir is on the search path; avoid trailing backslash
+for %%I in ("%~f0\..") do path %%~fI;%path%
+rem Ask kpsewhich about root and texmfsys trees (the first line of output)
+rem and location of the script (the second line of output)
+rem (4NT shell acts wierd with 'if' statements in a 'for' loop,
+rem so better process this output further in a subroutine)
+for /f "tokens=1-3 delims=;" %%I in (
+ 'kpsewhich --expand-var "$SELFAUTOPARENT;$TEXMFSYSCONFIG;$TEXMFSYSVAR" ^
+ --format texmfscripts "%progname%.pl" "%progname%.tlu" "%progname%.rb" "%progname%.py"'
+) do (
+ call :setcmdenv "%%~I" "%%~J" "%%~K"
+)
+
+rem By now we should have the command to execute (whatever that is), so
+rem pass through all the arguments we have and execute it
+%command% %*
+rem Finish with goto :eof (it will preserve the last set errorlevel)
+goto :eof
+
+REM SUBROUTINES
+
+:setcmdenv selfautoparent texmfsysconfig texmfsysvar
+rem If there is only one argument it must be a script name
+if "%~2"=="" goto :setcmd
+rem Otherwise, it is the first line from kpsewhich, so to set up the environment
+set PERL5LIB=%~f1\tlpkg\tlperl\lib
+set GS_LIB=%~f1\tlpkg\tlgs\lib;%~f1\tlpkg\tlgs\fonts
+path %~f1\tlpkg\tlgs\bin;%~f1\tlpkg\tlperl\bin;%~f1\tlpkg\installer;%~f1\tlpkg\installer\wget;%path%
+if not defined TEX_SYS_PROG goto :eof
+rem Extra stuff for sys version
+set TEXMFCONFIG=%~2
+set TEXMFVAR=%~3
+rem For sys version we might have an executable in the bin dir, so check for it
+if exist "%~f1\bin\win32\%progname%.exe" set command="%~f1\bin\win32\%progname%.exe"
+goto :eof
+
+:setcmd script
+rem Set command based on the script extension
+if /i %~x1==.pl set command=Perl.exe "%~f1"
+if /i %~x1==.tlu set command=TeXLua.exe "%~f1"
+rem For Ruby and Python we additionally check if their interpreter is available
+if /i %~x1==.rb call :chkcmd Ruby.exe "%~f1"
+if /i %~x1==.py call :chkcmd Python.exe "%~f1"
+goto :eof
+
+:chkcmd program script
+set command=%*
+rem If there is no interpreter Ruby or Python, suggest getting one
+if "%~$PATH:1"=="" set command=call :noinst %*
+goto :eof
+
+:noinst program
+echo %1 not found on search path>&2
+echo %~n1 is not distributed with TeX Live and has to be installed separately
+exit /b 1
+
+:noscript
+echo %progname%: no appropriate script or program found>&2
+exit /b 1
diff --git a/Master/bin/win32/pdf2dsc.bat b/Master/bin/win32/pdf2dsc.bat
index fe949613d7c..42ba109d438 100755
--- a/Master/bin/win32/pdf2dsc.bat
+++ b/Master/bin/win32/pdf2dsc.bat
@@ -1,8 +1,78 @@
@echo off
-rem tl-w32-starter.bat
-rem universal script starter, batch file part
-rem this program calls the tl-w32-wrapper.texlua
-setlocal
-set ownpath=%~dp0%
-texlua "%ownpath%tl-w32-wrapper.texlua" "%~dpn0" %*
-endlocal
+rem Universal script launcher
+rem
+rem Copyright 2009 by Tomasz M. Trzeciak
+rem Public Domain
+
+rem Make environment changes local
+setlocal enableextensions
+rem Get program/script name
+if not defined progname set progname=%~n0
+rem Check if this is 'sys' version of program
+set TEX_SYS_PROG=
+if /i "%progname:~-4%"=="-sys" (
+ set progname=%progname:~0,-4%
+ set TEX_SYS_PROG=true
+)
+
+rem Default command to execute
+set command=call :noscript
+rem Make sure our dir is on the search path; avoid trailing backslash
+for %%I in ("%~f0\..") do path %%~fI;%path%
+rem Ask kpsewhich about root and texmfsys trees (the first line of output)
+rem and location of the script (the second line of output)
+rem (4NT shell acts wierd with 'if' statements in a 'for' loop,
+rem so better process this output further in a subroutine)
+for /f "tokens=1-3 delims=;" %%I in (
+ 'kpsewhich --expand-var "$SELFAUTOPARENT;$TEXMFSYSCONFIG;$TEXMFSYSVAR" ^
+ --format texmfscripts "%progname%.pl" "%progname%.tlu" "%progname%.rb" "%progname%.py"'
+) do (
+ call :setcmdenv "%%~I" "%%~J" "%%~K"
+)
+
+rem By now we should have the command to execute (whatever that is), so
+rem pass through all the arguments we have and execute it
+%command% %*
+rem Finish with goto :eof (it will preserve the last set errorlevel)
+goto :eof
+
+REM SUBROUTINES
+
+:setcmdenv selfautoparent texmfsysconfig texmfsysvar
+rem If there is only one argument it must be a script name
+if "%~2"=="" goto :setcmd
+rem Otherwise, it is the first line from kpsewhich, so to set up the environment
+set PERL5LIB=%~f1\tlpkg\tlperl\lib
+set GS_LIB=%~f1\tlpkg\tlgs\lib;%~f1\tlpkg\tlgs\fonts
+path %~f1\tlpkg\tlgs\bin;%~f1\tlpkg\tlperl\bin;%~f1\tlpkg\installer;%~f1\tlpkg\installer\wget;%path%
+if not defined TEX_SYS_PROG goto :eof
+rem Extra stuff for sys version
+set TEXMFCONFIG=%~2
+set TEXMFVAR=%~3
+rem For sys version we might have an executable in the bin dir, so check for it
+if exist "%~f1\bin\win32\%progname%.exe" set command="%~f1\bin\win32\%progname%.exe"
+goto :eof
+
+:setcmd script
+rem Set command based on the script extension
+if /i %~x1==.pl set command=Perl.exe "%~f1"
+if /i %~x1==.tlu set command=TeXLua.exe "%~f1"
+rem For Ruby and Python we additionally check if their interpreter is available
+if /i %~x1==.rb call :chkcmd Ruby.exe "%~f1"
+if /i %~x1==.py call :chkcmd Python.exe "%~f1"
+goto :eof
+
+:chkcmd program script
+set command=%*
+rem If there is no interpreter Ruby or Python, suggest getting one
+if "%~$PATH:1"=="" set command=call :noinst %*
+goto :eof
+
+:noinst program
+echo %1 not found on search path>&2
+echo %~n1 is not distributed with TeX Live and has to be installed separately
+exit /b 1
+
+:noscript
+echo %progname%: no appropriate script or program found>&2
+exit /b 1
diff --git a/Master/bin/win32/pdfannotextractor.bat b/Master/bin/win32/pdfannotextractor.bat
index fe949613d7c..42ba109d438 100755
--- a/Master/bin/win32/pdfannotextractor.bat
+++ b/Master/bin/win32/pdfannotextractor.bat
@@ -1,8 +1,78 @@
@echo off
-rem tl-w32-starter.bat
-rem universal script starter, batch file part
-rem this program calls the tl-w32-wrapper.texlua
-setlocal
-set ownpath=%~dp0%
-texlua "%ownpath%tl-w32-wrapper.texlua" "%~dpn0" %*
-endlocal
+rem Universal script launcher
+rem
+rem Copyright 2009 by Tomasz M. Trzeciak
+rem Public Domain
+
+rem Make environment changes local
+setlocal enableextensions
+rem Get program/script name
+if not defined progname set progname=%~n0
+rem Check if this is 'sys' version of program
+set TEX_SYS_PROG=
+if /i "%progname:~-4%"=="-sys" (
+ set progname=%progname:~0,-4%
+ set TEX_SYS_PROG=true
+)
+
+rem Default command to execute
+set command=call :noscript
+rem Make sure our dir is on the search path; avoid trailing backslash
+for %%I in ("%~f0\..") do path %%~fI;%path%
+rem Ask kpsewhich about root and texmfsys trees (the first line of output)
+rem and location of the script (the second line of output)
+rem (4NT shell acts wierd with 'if' statements in a 'for' loop,
+rem so better process this output further in a subroutine)
+for /f "tokens=1-3 delims=;" %%I in (
+ 'kpsewhich --expand-var "$SELFAUTOPARENT;$TEXMFSYSCONFIG;$TEXMFSYSVAR" ^
+ --format texmfscripts "%progname%.pl" "%progname%.tlu" "%progname%.rb" "%progname%.py"'
+) do (
+ call :setcmdenv "%%~I" "%%~J" "%%~K"
+)
+
+rem By now we should have the command to execute (whatever that is), so
+rem pass through all the arguments we have and execute it
+%command% %*
+rem Finish with goto :eof (it will preserve the last set errorlevel)
+goto :eof
+
+REM SUBROUTINES
+
+:setcmdenv selfautoparent texmfsysconfig texmfsysvar
+rem If there is only one argument it must be a script name
+if "%~2"=="" goto :setcmd
+rem Otherwise, it is the first line from kpsewhich, so to set up the environment
+set PERL5LIB=%~f1\tlpkg\tlperl\lib
+set GS_LIB=%~f1\tlpkg\tlgs\lib;%~f1\tlpkg\tlgs\fonts
+path %~f1\tlpkg\tlgs\bin;%~f1\tlpkg\tlperl\bin;%~f1\tlpkg\installer;%~f1\tlpkg\installer\wget;%path%
+if not defined TEX_SYS_PROG goto :eof
+rem Extra stuff for sys version
+set TEXMFCONFIG=%~2
+set TEXMFVAR=%~3
+rem For sys version we might have an executable in the bin dir, so check for it
+if exist "%~f1\bin\win32\%progname%.exe" set command="%~f1\bin\win32\%progname%.exe"
+goto :eof
+
+:setcmd script
+rem Set command based on the script extension
+if /i %~x1==.pl set command=Perl.exe "%~f1"
+if /i %~x1==.tlu set command=TeXLua.exe "%~f1"
+rem For Ruby and Python we additionally check if their interpreter is available
+if /i %~x1==.rb call :chkcmd Ruby.exe "%~f1"
+if /i %~x1==.py call :chkcmd Python.exe "%~f1"
+goto :eof
+
+:chkcmd program script
+set command=%*
+rem If there is no interpreter Ruby or Python, suggest getting one
+if "%~$PATH:1"=="" set command=call :noinst %*
+goto :eof
+
+:noinst program
+echo %1 not found on search path>&2
+echo %~n1 is not distributed with TeX Live and has to be installed separately
+exit /b 1
+
+:noscript
+echo %progname%: no appropriate script or program found>&2
+exit /b 1
diff --git a/Master/bin/win32/pdfatfi.bat b/Master/bin/win32/pdfatfi.bat
index fe949613d7c..42ba109d438 100755
--- a/Master/bin/win32/pdfatfi.bat
+++ b/Master/bin/win32/pdfatfi.bat
@@ -1,8 +1,78 @@
@echo off
-rem tl-w32-starter.bat
-rem universal script starter, batch file part
-rem this program calls the tl-w32-wrapper.texlua
-setlocal
-set ownpath=%~dp0%
-texlua "%ownpath%tl-w32-wrapper.texlua" "%~dpn0" %*
-endlocal
+rem Universal script launcher
+rem
+rem Copyright 2009 by Tomasz M. Trzeciak
+rem Public Domain
+
+rem Make environment changes local
+setlocal enableextensions
+rem Get program/script name
+if not defined progname set progname=%~n0
+rem Check if this is 'sys' version of program
+set TEX_SYS_PROG=
+if /i "%progname:~-4%"=="-sys" (
+ set progname=%progname:~0,-4%
+ set TEX_SYS_PROG=true
+)
+
+rem Default command to execute
+set command=call :noscript
+rem Make sure our dir is on the search path; avoid trailing backslash
+for %%I in ("%~f0\..") do path %%~fI;%path%
+rem Ask kpsewhich about root and texmfsys trees (the first line of output)
+rem and location of the script (the second line of output)
+rem (4NT shell acts wierd with 'if' statements in a 'for' loop,
+rem so better process this output further in a subroutine)
+for /f "tokens=1-3 delims=;" %%I in (
+ 'kpsewhich --expand-var "$SELFAUTOPARENT;$TEXMFSYSCONFIG;$TEXMFSYSVAR" ^
+ --format texmfscripts "%progname%.pl" "%progname%.tlu" "%progname%.rb" "%progname%.py"'
+) do (
+ call :setcmdenv "%%~I" "%%~J" "%%~K"
+)
+
+rem By now we should have the command to execute (whatever that is), so
+rem pass through all the arguments we have and execute it
+%command% %*
+rem Finish with goto :eof (it will preserve the last set errorlevel)
+goto :eof
+
+REM SUBROUTINES
+
+:setcmdenv selfautoparent texmfsysconfig texmfsysvar
+rem If there is only one argument it must be a script name
+if "%~2"=="" goto :setcmd
+rem Otherwise, it is the first line from kpsewhich, so to set up the environment
+set PERL5LIB=%~f1\tlpkg\tlperl\lib
+set GS_LIB=%~f1\tlpkg\tlgs\lib;%~f1\tlpkg\tlgs\fonts
+path %~f1\tlpkg\tlgs\bin;%~f1\tlpkg\tlperl\bin;%~f1\tlpkg\installer;%~f1\tlpkg\installer\wget;%path%
+if not defined TEX_SYS_PROG goto :eof
+rem Extra stuff for sys version
+set TEXMFCONFIG=%~2
+set TEXMFVAR=%~3
+rem For sys version we might have an executable in the bin dir, so check for it
+if exist "%~f1\bin\win32\%progname%.exe" set command="%~f1\bin\win32\%progname%.exe"
+goto :eof
+
+:setcmd script
+rem Set command based on the script extension
+if /i %~x1==.pl set command=Perl.exe "%~f1"
+if /i %~x1==.tlu set command=TeXLua.exe "%~f1"
+rem For Ruby and Python we additionally check if their interpreter is available
+if /i %~x1==.rb call :chkcmd Ruby.exe "%~f1"
+if /i %~x1==.py call :chkcmd Python.exe "%~f1"
+goto :eof
+
+:chkcmd program script
+set command=%*
+rem If there is no interpreter Ruby or Python, suggest getting one
+if "%~$PATH:1"=="" set command=call :noinst %*
+goto :eof
+
+:noinst program
+echo %1 not found on search path>&2
+echo %~n1 is not distributed with TeX Live and has to be installed separately
+exit /b 1
+
+:noscript
+echo %progname%: no appropriate script or program found>&2
+exit /b 1
diff --git a/Master/bin/win32/pdfcrop.bat b/Master/bin/win32/pdfcrop.bat
index fe949613d7c..42ba109d438 100755
--- a/Master/bin/win32/pdfcrop.bat
+++ b/Master/bin/win32/pdfcrop.bat
@@ -1,8 +1,78 @@
@echo off
-rem tl-w32-starter.bat
-rem universal script starter, batch file part
-rem this program calls the tl-w32-wrapper.texlua
-setlocal
-set ownpath=%~dp0%
-texlua "%ownpath%tl-w32-wrapper.texlua" "%~dpn0" %*
-endlocal
+rem Universal script launcher
+rem
+rem Copyright 2009 by Tomasz M. Trzeciak
+rem Public Domain
+
+rem Make environment changes local
+setlocal enableextensions
+rem Get program/script name
+if not defined progname set progname=%~n0
+rem Check if this is 'sys' version of program
+set TEX_SYS_PROG=
+if /i "%progname:~-4%"=="-sys" (
+ set progname=%progname:~0,-4%
+ set TEX_SYS_PROG=true
+)
+
+rem Default command to execute
+set command=call :noscript
+rem Make sure our dir is on the search path; avoid trailing backslash
+for %%I in ("%~f0\..") do path %%~fI;%path%
+rem Ask kpsewhich about root and texmfsys trees (the first line of output)
+rem and location of the script (the second line of output)
+rem (4NT shell acts wierd with 'if' statements in a 'for' loop,
+rem so better process this output further in a subroutine)
+for /f "tokens=1-3 delims=;" %%I in (
+ 'kpsewhich --expand-var "$SELFAUTOPARENT;$TEXMFSYSCONFIG;$TEXMFSYSVAR" ^
+ --format texmfscripts "%progname%.pl" "%progname%.tlu" "%progname%.rb" "%progname%.py"'
+) do (
+ call :setcmdenv "%%~I" "%%~J" "%%~K"
+)
+
+rem By now we should have the command to execute (whatever that is), so
+rem pass through all the arguments we have and execute it
+%command% %*
+rem Finish with goto :eof (it will preserve the last set errorlevel)
+goto :eof
+
+REM SUBROUTINES
+
+:setcmdenv selfautoparent texmfsysconfig texmfsysvar
+rem If there is only one argument it must be a script name
+if "%~2"=="" goto :setcmd
+rem Otherwise, it is the first line from kpsewhich, so to set up the environment
+set PERL5LIB=%~f1\tlpkg\tlperl\lib
+set GS_LIB=%~f1\tlpkg\tlgs\lib;%~f1\tlpkg\tlgs\fonts
+path %~f1\tlpkg\tlgs\bin;%~f1\tlpkg\tlperl\bin;%~f1\tlpkg\installer;%~f1\tlpkg\installer\wget;%path%
+if not defined TEX_SYS_PROG goto :eof
+rem Extra stuff for sys version
+set TEXMFCONFIG=%~2
+set TEXMFVAR=%~3
+rem For sys version we might have an executable in the bin dir, so check for it
+if exist "%~f1\bin\win32\%progname%.exe" set command="%~f1\bin\win32\%progname%.exe"
+goto :eof
+
+:setcmd script
+rem Set command based on the script extension
+if /i %~x1==.pl set command=Perl.exe "%~f1"
+if /i %~x1==.tlu set command=TeXLua.exe "%~f1"
+rem For Ruby and Python we additionally check if their interpreter is available
+if /i %~x1==.rb call :chkcmd Ruby.exe "%~f1"
+if /i %~x1==.py call :chkcmd Python.exe "%~f1"
+goto :eof
+
+:chkcmd program script
+set command=%*
+rem If there is no interpreter Ruby or Python, suggest getting one
+if "%~$PATH:1"=="" set command=call :noinst %*
+goto :eof
+
+:noinst program
+echo %1 not found on search path>&2
+echo %~n1 is not distributed with TeX Live and has to be installed separately
+exit /b 1
+
+:noscript
+echo %progname%: no appropriate script or program found>&2
+exit /b 1
diff --git a/Master/bin/win32/pdfopt.bat b/Master/bin/win32/pdfopt.bat
index fe949613d7c..42ba109d438 100755
--- a/Master/bin/win32/pdfopt.bat
+++ b/Master/bin/win32/pdfopt.bat
@@ -1,8 +1,78 @@
@echo off
-rem tl-w32-starter.bat
-rem universal script starter, batch file part
-rem this program calls the tl-w32-wrapper.texlua
-setlocal
-set ownpath=%~dp0%
-texlua "%ownpath%tl-w32-wrapper.texlua" "%~dpn0" %*
-endlocal
+rem Universal script launcher
+rem
+rem Copyright 2009 by Tomasz M. Trzeciak
+rem Public Domain
+
+rem Make environment changes local
+setlocal enableextensions
+rem Get program/script name
+if not defined progname set progname=%~n0
+rem Check if this is 'sys' version of program
+set TEX_SYS_PROG=
+if /i "%progname:~-4%"=="-sys" (
+ set progname=%progname:~0,-4%
+ set TEX_SYS_PROG=true
+)
+
+rem Default command to execute
+set command=call :noscript
+rem Make sure our dir is on the search path; avoid trailing backslash
+for %%I in ("%~f0\..") do path %%~fI;%path%
+rem Ask kpsewhich about root and texmfsys trees (the first line of output)
+rem and location of the script (the second line of output)
+rem (4NT shell acts wierd with 'if' statements in a 'for' loop,
+rem so better process this output further in a subroutine)
+for /f "tokens=1-3 delims=;" %%I in (
+ 'kpsewhich --expand-var "$SELFAUTOPARENT;$TEXMFSYSCONFIG;$TEXMFSYSVAR" ^
+ --format texmfscripts "%progname%.pl" "%progname%.tlu" "%progname%.rb" "%progname%.py"'
+) do (
+ call :setcmdenv "%%~I" "%%~J" "%%~K"
+)
+
+rem By now we should have the command to execute (whatever that is), so
+rem pass through all the arguments we have and execute it
+%command% %*
+rem Finish with goto :eof (it will preserve the last set errorlevel)
+goto :eof
+
+REM SUBROUTINES
+
+:setcmdenv selfautoparent texmfsysconfig texmfsysvar
+rem If there is only one argument it must be a script name
+if "%~2"=="" goto :setcmd
+rem Otherwise, it is the first line from kpsewhich, so to set up the environment
+set PERL5LIB=%~f1\tlpkg\tlperl\lib
+set GS_LIB=%~f1\tlpkg\tlgs\lib;%~f1\tlpkg\tlgs\fonts
+path %~f1\tlpkg\tlgs\bin;%~f1\tlpkg\tlperl\bin;%~f1\tlpkg\installer;%~f1\tlpkg\installer\wget;%path%
+if not defined TEX_SYS_PROG goto :eof
+rem Extra stuff for sys version
+set TEXMFCONFIG=%~2
+set TEXMFVAR=%~3
+rem For sys version we might have an executable in the bin dir, so check for it
+if exist "%~f1\bin\win32\%progname%.exe" set command="%~f1\bin\win32\%progname%.exe"
+goto :eof
+
+:setcmd script
+rem Set command based on the script extension
+if /i %~x1==.pl set command=Perl.exe "%~f1"
+if /i %~x1==.tlu set command=TeXLua.exe "%~f1"
+rem For Ruby and Python we additionally check if their interpreter is available
+if /i %~x1==.rb call :chkcmd Ruby.exe "%~f1"
+if /i %~x1==.py call :chkcmd Python.exe "%~f1"
+goto :eof
+
+:chkcmd program script
+set command=%*
+rem If there is no interpreter Ruby or Python, suggest getting one
+if "%~$PATH:1"=="" set command=call :noinst %*
+goto :eof
+
+:noinst program
+echo %1 not found on search path>&2
+echo %~n1 is not distributed with TeX Live and has to be installed separately
+exit /b 1
+
+:noscript
+echo %progname%: no appropriate script or program found>&2
+exit /b 1
diff --git a/Master/bin/win32/pdfthumb.bat b/Master/bin/win32/pdfthumb.bat
index fe949613d7c..42ba109d438 100755
--- a/Master/bin/win32/pdfthumb.bat
+++ b/Master/bin/win32/pdfthumb.bat
@@ -1,8 +1,78 @@
@echo off
-rem tl-w32-starter.bat
-rem universal script starter, batch file part
-rem this program calls the tl-w32-wrapper.texlua
-setlocal
-set ownpath=%~dp0%
-texlua "%ownpath%tl-w32-wrapper.texlua" "%~dpn0" %*
-endlocal
+rem Universal script launcher
+rem
+rem Copyright 2009 by Tomasz M. Trzeciak
+rem Public Domain
+
+rem Make environment changes local
+setlocal enableextensions
+rem Get program/script name
+if not defined progname set progname=%~n0
+rem Check if this is 'sys' version of program
+set TEX_SYS_PROG=
+if /i "%progname:~-4%"=="-sys" (
+ set progname=%progname:~0,-4%
+ set TEX_SYS_PROG=true
+)
+
+rem Default command to execute
+set command=call :noscript
+rem Make sure our dir is on the search path; avoid trailing backslash
+for %%I in ("%~f0\..") do path %%~fI;%path%
+rem Ask kpsewhich about root and texmfsys trees (the first line of output)
+rem and location of the script (the second line of output)
+rem (4NT shell acts wierd with 'if' statements in a 'for' loop,
+rem so better process this output further in a subroutine)
+for /f "tokens=1-3 delims=;" %%I in (
+ 'kpsewhich --expand-var "$SELFAUTOPARENT;$TEXMFSYSCONFIG;$TEXMFSYSVAR" ^
+ --format texmfscripts "%progname%.pl" "%progname%.tlu" "%progname%.rb" "%progname%.py"'
+) do (
+ call :setcmdenv "%%~I" "%%~J" "%%~K"
+)
+
+rem By now we should have the command to execute (whatever that is), so
+rem pass through all the arguments we have and execute it
+%command% %*
+rem Finish with goto :eof (it will preserve the last set errorlevel)
+goto :eof
+
+REM SUBROUTINES
+
+:setcmdenv selfautoparent texmfsysconfig texmfsysvar
+rem If there is only one argument it must be a script name
+if "%~2"=="" goto :setcmd
+rem Otherwise, it is the first line from kpsewhich, so to set up the environment
+set PERL5LIB=%~f1\tlpkg\tlperl\lib
+set GS_LIB=%~f1\tlpkg\tlgs\lib;%~f1\tlpkg\tlgs\fonts
+path %~f1\tlpkg\tlgs\bin;%~f1\tlpkg\tlperl\bin;%~f1\tlpkg\installer;%~f1\tlpkg\installer\wget;%path%
+if not defined TEX_SYS_PROG goto :eof
+rem Extra stuff for sys version
+set TEXMFCONFIG=%~2
+set TEXMFVAR=%~3
+rem For sys version we might have an executable in the bin dir, so check for it
+if exist "%~f1\bin\win32\%progname%.exe" set command="%~f1\bin\win32\%progname%.exe"
+goto :eof
+
+:setcmd script
+rem Set command based on the script extension
+if /i %~x1==.pl set command=Perl.exe "%~f1"
+if /i %~x1==.tlu set command=TeXLua.exe "%~f1"
+rem For Ruby and Python we additionally check if their interpreter is available
+if /i %~x1==.rb call :chkcmd Ruby.exe "%~f1"
+if /i %~x1==.py call :chkcmd Python.exe "%~f1"
+goto :eof
+
+:chkcmd program script
+set command=%*
+rem If there is no interpreter Ruby or Python, suggest getting one
+if "%~$PATH:1"=="" set command=call :noinst %*
+goto :eof
+
+:noinst program
+echo %1 not found on search path>&2
+echo %~n1 is not distributed with TeX Live and has to be installed separately
+exit /b 1
+
+:noscript
+echo %progname%: no appropriate script or program found>&2
+exit /b 1
diff --git a/Master/bin/win32/perltex.bat b/Master/bin/win32/perltex.bat
index fe949613d7c..42ba109d438 100755
--- a/Master/bin/win32/perltex.bat
+++ b/Master/bin/win32/perltex.bat
@@ -1,8 +1,78 @@
@echo off
-rem tl-w32-starter.bat
-rem universal script starter, batch file part
-rem this program calls the tl-w32-wrapper.texlua
-setlocal
-set ownpath=%~dp0%
-texlua "%ownpath%tl-w32-wrapper.texlua" "%~dpn0" %*
-endlocal
+rem Universal script launcher
+rem
+rem Copyright 2009 by Tomasz M. Trzeciak
+rem Public Domain
+
+rem Make environment changes local
+setlocal enableextensions
+rem Get program/script name
+if not defined progname set progname=%~n0
+rem Check if this is 'sys' version of program
+set TEX_SYS_PROG=
+if /i "%progname:~-4%"=="-sys" (
+ set progname=%progname:~0,-4%
+ set TEX_SYS_PROG=true
+)
+
+rem Default command to execute
+set command=call :noscript
+rem Make sure our dir is on the search path; avoid trailing backslash
+for %%I in ("%~f0\..") do path %%~fI;%path%
+rem Ask kpsewhich about root and texmfsys trees (the first line of output)
+rem and location of the script (the second line of output)
+rem (4NT shell acts wierd with 'if' statements in a 'for' loop,
+rem so better process this output further in a subroutine)
+for /f "tokens=1-3 delims=;" %%I in (
+ 'kpsewhich --expand-var "$SELFAUTOPARENT;$TEXMFSYSCONFIG;$TEXMFSYSVAR" ^
+ --format texmfscripts "%progname%.pl" "%progname%.tlu" "%progname%.rb" "%progname%.py"'
+) do (
+ call :setcmdenv "%%~I" "%%~J" "%%~K"
+)
+
+rem By now we should have the command to execute (whatever that is), so
+rem pass through all the arguments we have and execute it
+%command% %*
+rem Finish with goto :eof (it will preserve the last set errorlevel)
+goto :eof
+
+REM SUBROUTINES
+
+:setcmdenv selfautoparent texmfsysconfig texmfsysvar
+rem If there is only one argument it must be a script name
+if "%~2"=="" goto :setcmd
+rem Otherwise, it is the first line from kpsewhich, so to set up the environment
+set PERL5LIB=%~f1\tlpkg\tlperl\lib
+set GS_LIB=%~f1\tlpkg\tlgs\lib;%~f1\tlpkg\tlgs\fonts
+path %~f1\tlpkg\tlgs\bin;%~f1\tlpkg\tlperl\bin;%~f1\tlpkg\installer;%~f1\tlpkg\installer\wget;%path%
+if not defined TEX_SYS_PROG goto :eof
+rem Extra stuff for sys version
+set TEXMFCONFIG=%~2
+set TEXMFVAR=%~3
+rem For sys version we might have an executable in the bin dir, so check for it
+if exist "%~f1\bin\win32\%progname%.exe" set command="%~f1\bin\win32\%progname%.exe"
+goto :eof
+
+:setcmd script
+rem Set command based on the script extension
+if /i %~x1==.pl set command=Perl.exe "%~f1"
+if /i %~x1==.tlu set command=TeXLua.exe "%~f1"
+rem For Ruby and Python we additionally check if their interpreter is available
+if /i %~x1==.rb call :chkcmd Ruby.exe "%~f1"
+if /i %~x1==.py call :chkcmd Python.exe "%~f1"
+goto :eof
+
+:chkcmd program script
+set command=%*
+rem If there is no interpreter Ruby or Python, suggest getting one
+if "%~$PATH:1"=="" set command=call :noinst %*
+goto :eof
+
+:noinst program
+echo %1 not found on search path>&2
+echo %~n1 is not distributed with TeX Live and has to be installed separately
+exit /b 1
+
+:noscript
+echo %progname%: no appropriate script or program found>&2
+exit /b 1
diff --git a/Master/bin/win32/pfm2kpx.bat b/Master/bin/win32/pfm2kpx.bat
index fe949613d7c..42ba109d438 100755
--- a/Master/bin/win32/pfm2kpx.bat
+++ b/Master/bin/win32/pfm2kpx.bat
@@ -1,8 +1,78 @@
@echo off
-rem tl-w32-starter.bat
-rem universal script starter, batch file part
-rem this program calls the tl-w32-wrapper.texlua
-setlocal
-set ownpath=%~dp0%
-texlua "%ownpath%tl-w32-wrapper.texlua" "%~dpn0" %*
-endlocal
+rem Universal script launcher
+rem
+rem Copyright 2009 by Tomasz M. Trzeciak
+rem Public Domain
+
+rem Make environment changes local
+setlocal enableextensions
+rem Get program/script name
+if not defined progname set progname=%~n0
+rem Check if this is 'sys' version of program
+set TEX_SYS_PROG=
+if /i "%progname:~-4%"=="-sys" (
+ set progname=%progname:~0,-4%
+ set TEX_SYS_PROG=true
+)
+
+rem Default command to execute
+set command=call :noscript
+rem Make sure our dir is on the search path; avoid trailing backslash
+for %%I in ("%~f0\..") do path %%~fI;%path%
+rem Ask kpsewhich about root and texmfsys trees (the first line of output)
+rem and location of the script (the second line of output)
+rem (4NT shell acts wierd with 'if' statements in a 'for' loop,
+rem so better process this output further in a subroutine)
+for /f "tokens=1-3 delims=;" %%I in (
+ 'kpsewhich --expand-var "$SELFAUTOPARENT;$TEXMFSYSCONFIG;$TEXMFSYSVAR" ^
+ --format texmfscripts "%progname%.pl" "%progname%.tlu" "%progname%.rb" "%progname%.py"'
+) do (
+ call :setcmdenv "%%~I" "%%~J" "%%~K"
+)
+
+rem By now we should have the command to execute (whatever that is), so
+rem pass through all the arguments we have and execute it
+%command% %*
+rem Finish with goto :eof (it will preserve the last set errorlevel)
+goto :eof
+
+REM SUBROUTINES
+
+:setcmdenv selfautoparent texmfsysconfig texmfsysvar
+rem If there is only one argument it must be a script name
+if "%~2"=="" goto :setcmd
+rem Otherwise, it is the first line from kpsewhich, so to set up the environment
+set PERL5LIB=%~f1\tlpkg\tlperl\lib
+set GS_LIB=%~f1\tlpkg\tlgs\lib;%~f1\tlpkg\tlgs\fonts
+path %~f1\tlpkg\tlgs\bin;%~f1\tlpkg\tlperl\bin;%~f1\tlpkg\installer;%~f1\tlpkg\installer\wget;%path%
+if not defined TEX_SYS_PROG goto :eof
+rem Extra stuff for sys version
+set TEXMFCONFIG=%~2
+set TEXMFVAR=%~3
+rem For sys version we might have an executable in the bin dir, so check for it
+if exist "%~f1\bin\win32\%progname%.exe" set command="%~f1\bin\win32\%progname%.exe"
+goto :eof
+
+:setcmd script
+rem Set command based on the script extension
+if /i %~x1==.pl set command=Perl.exe "%~f1"
+if /i %~x1==.tlu set command=TeXLua.exe "%~f1"
+rem For Ruby and Python we additionally check if their interpreter is available
+if /i %~x1==.rb call :chkcmd Ruby.exe "%~f1"
+if /i %~x1==.py call :chkcmd Python.exe "%~f1"
+goto :eof
+
+:chkcmd program script
+set command=%*
+rem If there is no interpreter Ruby or Python, suggest getting one
+if "%~$PATH:1"=="" set command=call :noinst %*
+goto :eof
+
+:noinst program
+echo %1 not found on search path>&2
+echo %~n1 is not distributed with TeX Live and has to be installed separately
+exit /b 1
+
+:noscript
+echo %progname%: no appropriate script or program found>&2
+exit /b 1
diff --git a/Master/bin/win32/pkfix.bat b/Master/bin/win32/pkfix.bat
index fe949613d7c..42ba109d438 100755
--- a/Master/bin/win32/pkfix.bat
+++ b/Master/bin/win32/pkfix.bat
@@ -1,8 +1,78 @@
@echo off
-rem tl-w32-starter.bat
-rem universal script starter, batch file part
-rem this program calls the tl-w32-wrapper.texlua
-setlocal
-set ownpath=%~dp0%
-texlua "%ownpath%tl-w32-wrapper.texlua" "%~dpn0" %*
-endlocal
+rem Universal script launcher
+rem
+rem Copyright 2009 by Tomasz M. Trzeciak
+rem Public Domain
+
+rem Make environment changes local
+setlocal enableextensions
+rem Get program/script name
+if not defined progname set progname=%~n0
+rem Check if this is 'sys' version of program
+set TEX_SYS_PROG=
+if /i "%progname:~-4%"=="-sys" (
+ set progname=%progname:~0,-4%
+ set TEX_SYS_PROG=true
+)
+
+rem Default command to execute
+set command=call :noscript
+rem Make sure our dir is on the search path; avoid trailing backslash
+for %%I in ("%~f0\..") do path %%~fI;%path%
+rem Ask kpsewhich about root and texmfsys trees (the first line of output)
+rem and location of the script (the second line of output)
+rem (4NT shell acts wierd with 'if' statements in a 'for' loop,
+rem so better process this output further in a subroutine)
+for /f "tokens=1-3 delims=;" %%I in (
+ 'kpsewhich --expand-var "$SELFAUTOPARENT;$TEXMFSYSCONFIG;$TEXMFSYSVAR" ^
+ --format texmfscripts "%progname%.pl" "%progname%.tlu" "%progname%.rb" "%progname%.py"'
+) do (
+ call :setcmdenv "%%~I" "%%~J" "%%~K"
+)
+
+rem By now we should have the command to execute (whatever that is), so
+rem pass through all the arguments we have and execute it
+%command% %*
+rem Finish with goto :eof (it will preserve the last set errorlevel)
+goto :eof
+
+REM SUBROUTINES
+
+:setcmdenv selfautoparent texmfsysconfig texmfsysvar
+rem If there is only one argument it must be a script name
+if "%~2"=="" goto :setcmd
+rem Otherwise, it is the first line from kpsewhich, so to set up the environment
+set PERL5LIB=%~f1\tlpkg\tlperl\lib
+set GS_LIB=%~f1\tlpkg\tlgs\lib;%~f1\tlpkg\tlgs\fonts
+path %~f1\tlpkg\tlgs\bin;%~f1\tlpkg\tlperl\bin;%~f1\tlpkg\installer;%~f1\tlpkg\installer\wget;%path%
+if not defined TEX_SYS_PROG goto :eof
+rem Extra stuff for sys version
+set TEXMFCONFIG=%~2
+set TEXMFVAR=%~3
+rem For sys version we might have an executable in the bin dir, so check for it
+if exist "%~f1\bin\win32\%progname%.exe" set command="%~f1\bin\win32\%progname%.exe"
+goto :eof
+
+:setcmd script
+rem Set command based on the script extension
+if /i %~x1==.pl set command=Perl.exe "%~f1"
+if /i %~x1==.tlu set command=TeXLua.exe "%~f1"
+rem For Ruby and Python we additionally check if their interpreter is available
+if /i %~x1==.rb call :chkcmd Ruby.exe "%~f1"
+if /i %~x1==.py call :chkcmd Python.exe "%~f1"
+goto :eof
+
+:chkcmd program script
+set command=%*
+rem If there is no interpreter Ruby or Python, suggest getting one
+if "%~$PATH:1"=="" set command=call :noinst %*
+goto :eof
+
+:noinst program
+echo %1 not found on search path>&2
+echo %~n1 is not distributed with TeX Live and has to be installed separately
+exit /b 1
+
+:noscript
+echo %progname%: no appropriate script or program found>&2
+exit /b 1
diff --git a/Master/bin/win32/ppower4.bat b/Master/bin/win32/ppower4.bat
index fe949613d7c..42ba109d438 100755
--- a/Master/bin/win32/ppower4.bat
+++ b/Master/bin/win32/ppower4.bat
@@ -1,8 +1,78 @@
@echo off
-rem tl-w32-starter.bat
-rem universal script starter, batch file part
-rem this program calls the tl-w32-wrapper.texlua
-setlocal
-set ownpath=%~dp0%
-texlua "%ownpath%tl-w32-wrapper.texlua" "%~dpn0" %*
-endlocal
+rem Universal script launcher
+rem
+rem Copyright 2009 by Tomasz M. Trzeciak
+rem Public Domain
+
+rem Make environment changes local
+setlocal enableextensions
+rem Get program/script name
+if not defined progname set progname=%~n0
+rem Check if this is 'sys' version of program
+set TEX_SYS_PROG=
+if /i "%progname:~-4%"=="-sys" (
+ set progname=%progname:~0,-4%
+ set TEX_SYS_PROG=true
+)
+
+rem Default command to execute
+set command=call :noscript
+rem Make sure our dir is on the search path; avoid trailing backslash
+for %%I in ("%~f0\..") do path %%~fI;%path%
+rem Ask kpsewhich about root and texmfsys trees (the first line of output)
+rem and location of the script (the second line of output)
+rem (4NT shell acts wierd with 'if' statements in a 'for' loop,
+rem so better process this output further in a subroutine)
+for /f "tokens=1-3 delims=;" %%I in (
+ 'kpsewhich --expand-var "$SELFAUTOPARENT;$TEXMFSYSCONFIG;$TEXMFSYSVAR" ^
+ --format texmfscripts "%progname%.pl" "%progname%.tlu" "%progname%.rb" "%progname%.py"'
+) do (
+ call :setcmdenv "%%~I" "%%~J" "%%~K"
+)
+
+rem By now we should have the command to execute (whatever that is), so
+rem pass through all the arguments we have and execute it
+%command% %*
+rem Finish with goto :eof (it will preserve the last set errorlevel)
+goto :eof
+
+REM SUBROUTINES
+
+:setcmdenv selfautoparent texmfsysconfig texmfsysvar
+rem If there is only one argument it must be a script name
+if "%~2"=="" goto :setcmd
+rem Otherwise, it is the first line from kpsewhich, so to set up the environment
+set PERL5LIB=%~f1\tlpkg\tlperl\lib
+set GS_LIB=%~f1\tlpkg\tlgs\lib;%~f1\tlpkg\tlgs\fonts
+path %~f1\tlpkg\tlgs\bin;%~f1\tlpkg\tlperl\bin;%~f1\tlpkg\installer;%~f1\tlpkg\installer\wget;%path%
+if not defined TEX_SYS_PROG goto :eof
+rem Extra stuff for sys version
+set TEXMFCONFIG=%~2
+set TEXMFVAR=%~3
+rem For sys version we might have an executable in the bin dir, so check for it
+if exist "%~f1\bin\win32\%progname%.exe" set command="%~f1\bin\win32\%progname%.exe"
+goto :eof
+
+:setcmd script
+rem Set command based on the script extension
+if /i %~x1==.pl set command=Perl.exe "%~f1"
+if /i %~x1==.tlu set command=TeXLua.exe "%~f1"
+rem For Ruby and Python we additionally check if their interpreter is available
+if /i %~x1==.rb call :chkcmd Ruby.exe "%~f1"
+if /i %~x1==.py call :chkcmd Python.exe "%~f1"
+goto :eof
+
+:chkcmd program script
+set command=%*
+rem If there is no interpreter Ruby or Python, suggest getting one
+if "%~$PATH:1"=="" set command=call :noinst %*
+goto :eof
+
+:noinst program
+echo %1 not found on search path>&2
+echo %~n1 is not distributed with TeX Live and has to be installed separately
+exit /b 1
+
+:noscript
+echo %progname%: no appropriate script or program found>&2
+exit /b 1
diff --git a/Master/bin/win32/ps2ascii.bat b/Master/bin/win32/ps2ascii.bat
index fe949613d7c..42ba109d438 100755
--- a/Master/bin/win32/ps2ascii.bat
+++ b/Master/bin/win32/ps2ascii.bat
@@ -1,8 +1,78 @@
@echo off
-rem tl-w32-starter.bat
-rem universal script starter, batch file part
-rem this program calls the tl-w32-wrapper.texlua
-setlocal
-set ownpath=%~dp0%
-texlua "%ownpath%tl-w32-wrapper.texlua" "%~dpn0" %*
-endlocal
+rem Universal script launcher
+rem
+rem Copyright 2009 by Tomasz M. Trzeciak
+rem Public Domain
+
+rem Make environment changes local
+setlocal enableextensions
+rem Get program/script name
+if not defined progname set progname=%~n0
+rem Check if this is 'sys' version of program
+set TEX_SYS_PROG=
+if /i "%progname:~-4%"=="-sys" (
+ set progname=%progname:~0,-4%
+ set TEX_SYS_PROG=true
+)
+
+rem Default command to execute
+set command=call :noscript
+rem Make sure our dir is on the search path; avoid trailing backslash
+for %%I in ("%~f0\..") do path %%~fI;%path%
+rem Ask kpsewhich about root and texmfsys trees (the first line of output)
+rem and location of the script (the second line of output)
+rem (4NT shell acts wierd with 'if' statements in a 'for' loop,
+rem so better process this output further in a subroutine)
+for /f "tokens=1-3 delims=;" %%I in (
+ 'kpsewhich --expand-var "$SELFAUTOPARENT;$TEXMFSYSCONFIG;$TEXMFSYSVAR" ^
+ --format texmfscripts "%progname%.pl" "%progname%.tlu" "%progname%.rb" "%progname%.py"'
+) do (
+ call :setcmdenv "%%~I" "%%~J" "%%~K"
+)
+
+rem By now we should have the command to execute (whatever that is), so
+rem pass through all the arguments we have and execute it
+%command% %*
+rem Finish with goto :eof (it will preserve the last set errorlevel)
+goto :eof
+
+REM SUBROUTINES
+
+:setcmdenv selfautoparent texmfsysconfig texmfsysvar
+rem If there is only one argument it must be a script name
+if "%~2"=="" goto :setcmd
+rem Otherwise, it is the first line from kpsewhich, so to set up the environment
+set PERL5LIB=%~f1\tlpkg\tlperl\lib
+set GS_LIB=%~f1\tlpkg\tlgs\lib;%~f1\tlpkg\tlgs\fonts
+path %~f1\tlpkg\tlgs\bin;%~f1\tlpkg\tlperl\bin;%~f1\tlpkg\installer;%~f1\tlpkg\installer\wget;%path%
+if not defined TEX_SYS_PROG goto :eof
+rem Extra stuff for sys version
+set TEXMFCONFIG=%~2
+set TEXMFVAR=%~3
+rem For sys version we might have an executable in the bin dir, so check for it
+if exist "%~f1\bin\win32\%progname%.exe" set command="%~f1\bin\win32\%progname%.exe"
+goto :eof
+
+:setcmd script
+rem Set command based on the script extension
+if /i %~x1==.pl set command=Perl.exe "%~f1"
+if /i %~x1==.tlu set command=TeXLua.exe "%~f1"
+rem For Ruby and Python we additionally check if their interpreter is available
+if /i %~x1==.rb call :chkcmd Ruby.exe "%~f1"
+if /i %~x1==.py call :chkcmd Python.exe "%~f1"
+goto :eof
+
+:chkcmd program script
+set command=%*
+rem If there is no interpreter Ruby or Python, suggest getting one
+if "%~$PATH:1"=="" set command=call :noinst %*
+goto :eof
+
+:noinst program
+echo %1 not found on search path>&2
+echo %~n1 is not distributed with TeX Live and has to be installed separately
+exit /b 1
+
+:noscript
+echo %progname%: no appropriate script or program found>&2
+exit /b 1
diff --git a/Master/bin/win32/ps2eps.bat b/Master/bin/win32/ps2eps.bat
index fe949613d7c..42ba109d438 100755
--- a/Master/bin/win32/ps2eps.bat
+++ b/Master/bin/win32/ps2eps.bat
@@ -1,8 +1,78 @@
@echo off
-rem tl-w32-starter.bat
-rem universal script starter, batch file part
-rem this program calls the tl-w32-wrapper.texlua
-setlocal
-set ownpath=%~dp0%
-texlua "%ownpath%tl-w32-wrapper.texlua" "%~dpn0" %*
-endlocal
+rem Universal script launcher
+rem
+rem Copyright 2009 by Tomasz M. Trzeciak
+rem Public Domain
+
+rem Make environment changes local
+setlocal enableextensions
+rem Get program/script name
+if not defined progname set progname=%~n0
+rem Check if this is 'sys' version of program
+set TEX_SYS_PROG=
+if /i "%progname:~-4%"=="-sys" (
+ set progname=%progname:~0,-4%
+ set TEX_SYS_PROG=true
+)
+
+rem Default command to execute
+set command=call :noscript
+rem Make sure our dir is on the search path; avoid trailing backslash
+for %%I in ("%~f0\..") do path %%~fI;%path%
+rem Ask kpsewhich about root and texmfsys trees (the first line of output)
+rem and location of the script (the second line of output)
+rem (4NT shell acts wierd with 'if' statements in a 'for' loop,
+rem so better process this output further in a subroutine)
+for /f "tokens=1-3 delims=;" %%I in (
+ 'kpsewhich --expand-var "$SELFAUTOPARENT;$TEXMFSYSCONFIG;$TEXMFSYSVAR" ^
+ --format texmfscripts "%progname%.pl" "%progname%.tlu" "%progname%.rb" "%progname%.py"'
+) do (
+ call :setcmdenv "%%~I" "%%~J" "%%~K"
+)
+
+rem By now we should have the command to execute (whatever that is), so
+rem pass through all the arguments we have and execute it
+%command% %*
+rem Finish with goto :eof (it will preserve the last set errorlevel)
+goto :eof
+
+REM SUBROUTINES
+
+:setcmdenv selfautoparent texmfsysconfig texmfsysvar
+rem If there is only one argument it must be a script name
+if "%~2"=="" goto :setcmd
+rem Otherwise, it is the first line from kpsewhich, so to set up the environment
+set PERL5LIB=%~f1\tlpkg\tlperl\lib
+set GS_LIB=%~f1\tlpkg\tlgs\lib;%~f1\tlpkg\tlgs\fonts
+path %~f1\tlpkg\tlgs\bin;%~f1\tlpkg\tlperl\bin;%~f1\tlpkg\installer;%~f1\tlpkg\installer\wget;%path%
+if not defined TEX_SYS_PROG goto :eof
+rem Extra stuff for sys version
+set TEXMFCONFIG=%~2
+set TEXMFVAR=%~3
+rem For sys version we might have an executable in the bin dir, so check for it
+if exist "%~f1\bin\win32\%progname%.exe" set command="%~f1\bin\win32\%progname%.exe"
+goto :eof
+
+:setcmd script
+rem Set command based on the script extension
+if /i %~x1==.pl set command=Perl.exe "%~f1"
+if /i %~x1==.tlu set command=TeXLua.exe "%~f1"
+rem For Ruby and Python we additionally check if their interpreter is available
+if /i %~x1==.rb call :chkcmd Ruby.exe "%~f1"
+if /i %~x1==.py call :chkcmd Python.exe "%~f1"
+goto :eof
+
+:chkcmd program script
+set command=%*
+rem If there is no interpreter Ruby or Python, suggest getting one
+if "%~$PATH:1"=="" set command=call :noinst %*
+goto :eof
+
+:noinst program
+echo %1 not found on search path>&2
+echo %~n1 is not distributed with TeX Live and has to be installed separately
+exit /b 1
+
+:noscript
+echo %progname%: no appropriate script or program found>&2
+exit /b 1
diff --git a/Master/bin/win32/ps2pdf.bat b/Master/bin/win32/ps2pdf.bat
index fe949613d7c..42ba109d438 100755
--- a/Master/bin/win32/ps2pdf.bat
+++ b/Master/bin/win32/ps2pdf.bat
@@ -1,8 +1,78 @@
@echo off
-rem tl-w32-starter.bat
-rem universal script starter, batch file part
-rem this program calls the tl-w32-wrapper.texlua
-setlocal
-set ownpath=%~dp0%
-texlua "%ownpath%tl-w32-wrapper.texlua" "%~dpn0" %*
-endlocal
+rem Universal script launcher
+rem
+rem Copyright 2009 by Tomasz M. Trzeciak
+rem Public Domain
+
+rem Make environment changes local
+setlocal enableextensions
+rem Get program/script name
+if not defined progname set progname=%~n0
+rem Check if this is 'sys' version of program
+set TEX_SYS_PROG=
+if /i "%progname:~-4%"=="-sys" (
+ set progname=%progname:~0,-4%
+ set TEX_SYS_PROG=true
+)
+
+rem Default command to execute
+set command=call :noscript
+rem Make sure our dir is on the search path; avoid trailing backslash
+for %%I in ("%~f0\..") do path %%~fI;%path%
+rem Ask kpsewhich about root and texmfsys trees (the first line of output)
+rem and location of the script (the second line of output)
+rem (4NT shell acts wierd with 'if' statements in a 'for' loop,
+rem so better process this output further in a subroutine)
+for /f "tokens=1-3 delims=;" %%I in (
+ 'kpsewhich --expand-var "$SELFAUTOPARENT;$TEXMFSYSCONFIG;$TEXMFSYSVAR" ^
+ --format texmfscripts "%progname%.pl" "%progname%.tlu" "%progname%.rb" "%progname%.py"'
+) do (
+ call :setcmdenv "%%~I" "%%~J" "%%~K"
+)
+
+rem By now we should have the command to execute (whatever that is), so
+rem pass through all the arguments we have and execute it
+%command% %*
+rem Finish with goto :eof (it will preserve the last set errorlevel)
+goto :eof
+
+REM SUBROUTINES
+
+:setcmdenv selfautoparent texmfsysconfig texmfsysvar
+rem If there is only one argument it must be a script name
+if "%~2"=="" goto :setcmd
+rem Otherwise, it is the first line from kpsewhich, so to set up the environment
+set PERL5LIB=%~f1\tlpkg\tlperl\lib
+set GS_LIB=%~f1\tlpkg\tlgs\lib;%~f1\tlpkg\tlgs\fonts
+path %~f1\tlpkg\tlgs\bin;%~f1\tlpkg\tlperl\bin;%~f1\tlpkg\installer;%~f1\tlpkg\installer\wget;%path%
+if not defined TEX_SYS_PROG goto :eof
+rem Extra stuff for sys version
+set TEXMFCONFIG=%~2
+set TEXMFVAR=%~3
+rem For sys version we might have an executable in the bin dir, so check for it
+if exist "%~f1\bin\win32\%progname%.exe" set command="%~f1\bin\win32\%progname%.exe"
+goto :eof
+
+:setcmd script
+rem Set command based on the script extension
+if /i %~x1==.pl set command=Perl.exe "%~f1"
+if /i %~x1==.tlu set command=TeXLua.exe "%~f1"
+rem For Ruby and Python we additionally check if their interpreter is available
+if /i %~x1==.rb call :chkcmd Ruby.exe "%~f1"
+if /i %~x1==.py call :chkcmd Python.exe "%~f1"
+goto :eof
+
+:chkcmd program script
+set command=%*
+rem If there is no interpreter Ruby or Python, suggest getting one
+if "%~$PATH:1"=="" set command=call :noinst %*
+goto :eof
+
+:noinst program
+echo %1 not found on search path>&2
+echo %~n1 is not distributed with TeX Live and has to be installed separately
+exit /b 1
+
+:noscript
+echo %progname%: no appropriate script or program found>&2
+exit /b 1
diff --git a/Master/bin/win32/ps2pdf12.bat b/Master/bin/win32/ps2pdf12.bat
index fe949613d7c..42ba109d438 100755
--- a/Master/bin/win32/ps2pdf12.bat
+++ b/Master/bin/win32/ps2pdf12.bat
@@ -1,8 +1,78 @@
@echo off
-rem tl-w32-starter.bat
-rem universal script starter, batch file part
-rem this program calls the tl-w32-wrapper.texlua
-setlocal
-set ownpath=%~dp0%
-texlua "%ownpath%tl-w32-wrapper.texlua" "%~dpn0" %*
-endlocal
+rem Universal script launcher
+rem
+rem Copyright 2009 by Tomasz M. Trzeciak
+rem Public Domain
+
+rem Make environment changes local
+setlocal enableextensions
+rem Get program/script name
+if not defined progname set progname=%~n0
+rem Check if this is 'sys' version of program
+set TEX_SYS_PROG=
+if /i "%progname:~-4%"=="-sys" (
+ set progname=%progname:~0,-4%
+ set TEX_SYS_PROG=true
+)
+
+rem Default command to execute
+set command=call :noscript
+rem Make sure our dir is on the search path; avoid trailing backslash
+for %%I in ("%~f0\..") do path %%~fI;%path%
+rem Ask kpsewhich about root and texmfsys trees (the first line of output)
+rem and location of the script (the second line of output)
+rem (4NT shell acts wierd with 'if' statements in a 'for' loop,
+rem so better process this output further in a subroutine)
+for /f "tokens=1-3 delims=;" %%I in (
+ 'kpsewhich --expand-var "$SELFAUTOPARENT;$TEXMFSYSCONFIG;$TEXMFSYSVAR" ^
+ --format texmfscripts "%progname%.pl" "%progname%.tlu" "%progname%.rb" "%progname%.py"'
+) do (
+ call :setcmdenv "%%~I" "%%~J" "%%~K"
+)
+
+rem By now we should have the command to execute (whatever that is), so
+rem pass through all the arguments we have and execute it
+%command% %*
+rem Finish with goto :eof (it will preserve the last set errorlevel)
+goto :eof
+
+REM SUBROUTINES
+
+:setcmdenv selfautoparent texmfsysconfig texmfsysvar
+rem If there is only one argument it must be a script name
+if "%~2"=="" goto :setcmd
+rem Otherwise, it is the first line from kpsewhich, so to set up the environment
+set PERL5LIB=%~f1\tlpkg\tlperl\lib
+set GS_LIB=%~f1\tlpkg\tlgs\lib;%~f1\tlpkg\tlgs\fonts
+path %~f1\tlpkg\tlgs\bin;%~f1\tlpkg\tlperl\bin;%~f1\tlpkg\installer;%~f1\tlpkg\installer\wget;%path%
+if not defined TEX_SYS_PROG goto :eof
+rem Extra stuff for sys version
+set TEXMFCONFIG=%~2
+set TEXMFVAR=%~3
+rem For sys version we might have an executable in the bin dir, so check for it
+if exist "%~f1\bin\win32\%progname%.exe" set command="%~f1\bin\win32\%progname%.exe"
+goto :eof
+
+:setcmd script
+rem Set command based on the script extension
+if /i %~x1==.pl set command=Perl.exe "%~f1"
+if /i %~x1==.tlu set command=TeXLua.exe "%~f1"
+rem For Ruby and Python we additionally check if their interpreter is available
+if /i %~x1==.rb call :chkcmd Ruby.exe "%~f1"
+if /i %~x1==.py call :chkcmd Python.exe "%~f1"
+goto :eof
+
+:chkcmd program script
+set command=%*
+rem If there is no interpreter Ruby or Python, suggest getting one
+if "%~$PATH:1"=="" set command=call :noinst %*
+goto :eof
+
+:noinst program
+echo %1 not found on search path>&2
+echo %~n1 is not distributed with TeX Live and has to be installed separately
+exit /b 1
+
+:noscript
+echo %progname%: no appropriate script or program found>&2
+exit /b 1
diff --git a/Master/bin/win32/ps2pdf13.bat b/Master/bin/win32/ps2pdf13.bat
index fe949613d7c..42ba109d438 100755
--- a/Master/bin/win32/ps2pdf13.bat
+++ b/Master/bin/win32/ps2pdf13.bat
@@ -1,8 +1,78 @@
@echo off
-rem tl-w32-starter.bat
-rem universal script starter, batch file part
-rem this program calls the tl-w32-wrapper.texlua
-setlocal
-set ownpath=%~dp0%
-texlua "%ownpath%tl-w32-wrapper.texlua" "%~dpn0" %*
-endlocal
+rem Universal script launcher
+rem
+rem Copyright 2009 by Tomasz M. Trzeciak
+rem Public Domain
+
+rem Make environment changes local
+setlocal enableextensions
+rem Get program/script name
+if not defined progname set progname=%~n0
+rem Check if this is 'sys' version of program
+set TEX_SYS_PROG=
+if /i "%progname:~-4%"=="-sys" (
+ set progname=%progname:~0,-4%
+ set TEX_SYS_PROG=true
+)
+
+rem Default command to execute
+set command=call :noscript
+rem Make sure our dir is on the search path; avoid trailing backslash
+for %%I in ("%~f0\..") do path %%~fI;%path%
+rem Ask kpsewhich about root and texmfsys trees (the first line of output)
+rem and location of the script (the second line of output)
+rem (4NT shell acts wierd with 'if' statements in a 'for' loop,
+rem so better process this output further in a subroutine)
+for /f "tokens=1-3 delims=;" %%I in (
+ 'kpsewhich --expand-var "$SELFAUTOPARENT;$TEXMFSYSCONFIG;$TEXMFSYSVAR" ^
+ --format texmfscripts "%progname%.pl" "%progname%.tlu" "%progname%.rb" "%progname%.py"'
+) do (
+ call :setcmdenv "%%~I" "%%~J" "%%~K"
+)
+
+rem By now we should have the command to execute (whatever that is), so
+rem pass through all the arguments we have and execute it
+%command% %*
+rem Finish with goto :eof (it will preserve the last set errorlevel)
+goto :eof
+
+REM SUBROUTINES
+
+:setcmdenv selfautoparent texmfsysconfig texmfsysvar
+rem If there is only one argument it must be a script name
+if "%~2"=="" goto :setcmd
+rem Otherwise, it is the first line from kpsewhich, so to set up the environment
+set PERL5LIB=%~f1\tlpkg\tlperl\lib
+set GS_LIB=%~f1\tlpkg\tlgs\lib;%~f1\tlpkg\tlgs\fonts
+path %~f1\tlpkg\tlgs\bin;%~f1\tlpkg\tlperl\bin;%~f1\tlpkg\installer;%~f1\tlpkg\installer\wget;%path%
+if not defined TEX_SYS_PROG goto :eof
+rem Extra stuff for sys version
+set TEXMFCONFIG=%~2
+set TEXMFVAR=%~3
+rem For sys version we might have an executable in the bin dir, so check for it
+if exist "%~f1\bin\win32\%progname%.exe" set command="%~f1\bin\win32\%progname%.exe"
+goto :eof
+
+:setcmd script
+rem Set command based on the script extension
+if /i %~x1==.pl set command=Perl.exe "%~f1"
+if /i %~x1==.tlu set command=TeXLua.exe "%~f1"
+rem For Ruby and Python we additionally check if their interpreter is available
+if /i %~x1==.rb call :chkcmd Ruby.exe "%~f1"
+if /i %~x1==.py call :chkcmd Python.exe "%~f1"
+goto :eof
+
+:chkcmd program script
+set command=%*
+rem If there is no interpreter Ruby or Python, suggest getting one
+if "%~$PATH:1"=="" set command=call :noinst %*
+goto :eof
+
+:noinst program
+echo %1 not found on search path>&2
+echo %~n1 is not distributed with TeX Live and has to be installed separately
+exit /b 1
+
+:noscript
+echo %progname%: no appropriate script or program found>&2
+exit /b 1
diff --git a/Master/bin/win32/ps2pdf14.bat b/Master/bin/win32/ps2pdf14.bat
index fe949613d7c..42ba109d438 100755
--- a/Master/bin/win32/ps2pdf14.bat
+++ b/Master/bin/win32/ps2pdf14.bat
@@ -1,8 +1,78 @@
@echo off
-rem tl-w32-starter.bat
-rem universal script starter, batch file part
-rem this program calls the tl-w32-wrapper.texlua
-setlocal
-set ownpath=%~dp0%
-texlua "%ownpath%tl-w32-wrapper.texlua" "%~dpn0" %*
-endlocal
+rem Universal script launcher
+rem
+rem Copyright 2009 by Tomasz M. Trzeciak
+rem Public Domain
+
+rem Make environment changes local
+setlocal enableextensions
+rem Get program/script name
+if not defined progname set progname=%~n0
+rem Check if this is 'sys' version of program
+set TEX_SYS_PROG=
+if /i "%progname:~-4%"=="-sys" (
+ set progname=%progname:~0,-4%
+ set TEX_SYS_PROG=true
+)
+
+rem Default command to execute
+set command=call :noscript
+rem Make sure our dir is on the search path; avoid trailing backslash
+for %%I in ("%~f0\..") do path %%~fI;%path%
+rem Ask kpsewhich about root and texmfsys trees (the first line of output)
+rem and location of the script (the second line of output)
+rem (4NT shell acts wierd with 'if' statements in a 'for' loop,
+rem so better process this output further in a subroutine)
+for /f "tokens=1-3 delims=;" %%I in (
+ 'kpsewhich --expand-var "$SELFAUTOPARENT;$TEXMFSYSCONFIG;$TEXMFSYSVAR" ^
+ --format texmfscripts "%progname%.pl" "%progname%.tlu" "%progname%.rb" "%progname%.py"'
+) do (
+ call :setcmdenv "%%~I" "%%~J" "%%~K"
+)
+
+rem By now we should have the command to execute (whatever that is), so
+rem pass through all the arguments we have and execute it
+%command% %*
+rem Finish with goto :eof (it will preserve the last set errorlevel)
+goto :eof
+
+REM SUBROUTINES
+
+:setcmdenv selfautoparent texmfsysconfig texmfsysvar
+rem If there is only one argument it must be a script name
+if "%~2"=="" goto :setcmd
+rem Otherwise, it is the first line from kpsewhich, so to set up the environment
+set PERL5LIB=%~f1\tlpkg\tlperl\lib
+set GS_LIB=%~f1\tlpkg\tlgs\lib;%~f1\tlpkg\tlgs\fonts
+path %~f1\tlpkg\tlgs\bin;%~f1\tlpkg\tlperl\bin;%~f1\tlpkg\installer;%~f1\tlpkg\installer\wget;%path%
+if not defined TEX_SYS_PROG goto :eof
+rem Extra stuff for sys version
+set TEXMFCONFIG=%~2
+set TEXMFVAR=%~3
+rem For sys version we might have an executable in the bin dir, so check for it
+if exist "%~f1\bin\win32\%progname%.exe" set command="%~f1\bin\win32\%progname%.exe"
+goto :eof
+
+:setcmd script
+rem Set command based on the script extension
+if /i %~x1==.pl set command=Perl.exe "%~f1"
+if /i %~x1==.tlu set command=TeXLua.exe "%~f1"
+rem For Ruby and Python we additionally check if their interpreter is available
+if /i %~x1==.rb call :chkcmd Ruby.exe "%~f1"
+if /i %~x1==.py call :chkcmd Python.exe "%~f1"
+goto :eof
+
+:chkcmd program script
+set command=%*
+rem If there is no interpreter Ruby or Python, suggest getting one
+if "%~$PATH:1"=="" set command=call :noinst %*
+goto :eof
+
+:noinst program
+echo %1 not found on search path>&2
+echo %~n1 is not distributed with TeX Live and has to be installed separately
+exit /b 1
+
+:noscript
+echo %progname%: no appropriate script or program found>&2
+exit /b 1
diff --git a/Master/bin/win32/pst2pdf.bat b/Master/bin/win32/pst2pdf.bat
index fe949613d7c..42ba109d438 100755
--- a/Master/bin/win32/pst2pdf.bat
+++ b/Master/bin/win32/pst2pdf.bat
@@ -1,8 +1,78 @@
@echo off
-rem tl-w32-starter.bat
-rem universal script starter, batch file part
-rem this program calls the tl-w32-wrapper.texlua
-setlocal
-set ownpath=%~dp0%
-texlua "%ownpath%tl-w32-wrapper.texlua" "%~dpn0" %*
-endlocal
+rem Universal script launcher
+rem
+rem Copyright 2009 by Tomasz M. Trzeciak
+rem Public Domain
+
+rem Make environment changes local
+setlocal enableextensions
+rem Get program/script name
+if not defined progname set progname=%~n0
+rem Check if this is 'sys' version of program
+set TEX_SYS_PROG=
+if /i "%progname:~-4%"=="-sys" (
+ set progname=%progname:~0,-4%
+ set TEX_SYS_PROG=true
+)
+
+rem Default command to execute
+set command=call :noscript
+rem Make sure our dir is on the search path; avoid trailing backslash
+for %%I in ("%~f0\..") do path %%~fI;%path%
+rem Ask kpsewhich about root and texmfsys trees (the first line of output)
+rem and location of the script (the second line of output)
+rem (4NT shell acts wierd with 'if' statements in a 'for' loop,
+rem so better process this output further in a subroutine)
+for /f "tokens=1-3 delims=;" %%I in (
+ 'kpsewhich --expand-var "$SELFAUTOPARENT;$TEXMFSYSCONFIG;$TEXMFSYSVAR" ^
+ --format texmfscripts "%progname%.pl" "%progname%.tlu" "%progname%.rb" "%progname%.py"'
+) do (
+ call :setcmdenv "%%~I" "%%~J" "%%~K"
+)
+
+rem By now we should have the command to execute (whatever that is), so
+rem pass through all the arguments we have and execute it
+%command% %*
+rem Finish with goto :eof (it will preserve the last set errorlevel)
+goto :eof
+
+REM SUBROUTINES
+
+:setcmdenv selfautoparent texmfsysconfig texmfsysvar
+rem If there is only one argument it must be a script name
+if "%~2"=="" goto :setcmd
+rem Otherwise, it is the first line from kpsewhich, so to set up the environment
+set PERL5LIB=%~f1\tlpkg\tlperl\lib
+set GS_LIB=%~f1\tlpkg\tlgs\lib;%~f1\tlpkg\tlgs\fonts
+path %~f1\tlpkg\tlgs\bin;%~f1\tlpkg\tlperl\bin;%~f1\tlpkg\installer;%~f1\tlpkg\installer\wget;%path%
+if not defined TEX_SYS_PROG goto :eof
+rem Extra stuff for sys version
+set TEXMFCONFIG=%~2
+set TEXMFVAR=%~3
+rem For sys version we might have an executable in the bin dir, so check for it
+if exist "%~f1\bin\win32\%progname%.exe" set command="%~f1\bin\win32\%progname%.exe"
+goto :eof
+
+:setcmd script
+rem Set command based on the script extension
+if /i %~x1==.pl set command=Perl.exe "%~f1"
+if /i %~x1==.tlu set command=TeXLua.exe "%~f1"
+rem For Ruby and Python we additionally check if their interpreter is available
+if /i %~x1==.rb call :chkcmd Ruby.exe "%~f1"
+if /i %~x1==.py call :chkcmd Python.exe "%~f1"
+goto :eof
+
+:chkcmd program script
+set command=%*
+rem If there is no interpreter Ruby or Python, suggest getting one
+if "%~$PATH:1"=="" set command=call :noinst %*
+goto :eof
+
+:noinst program
+echo %1 not found on search path>&2
+echo %~n1 is not distributed with TeX Live and has to be installed separately
+exit /b 1
+
+:noscript
+echo %progname%: no appropriate script or program found>&2
+exit /b 1
diff --git a/Master/bin/win32/psv.bat b/Master/bin/win32/psv.bat
index fe949613d7c..42ba109d438 100755
--- a/Master/bin/win32/psv.bat
+++ b/Master/bin/win32/psv.bat
@@ -1,8 +1,78 @@
@echo off
-rem tl-w32-starter.bat
-rem universal script starter, batch file part
-rem this program calls the tl-w32-wrapper.texlua
-setlocal
-set ownpath=%~dp0%
-texlua "%ownpath%tl-w32-wrapper.texlua" "%~dpn0" %*
-endlocal
+rem Universal script launcher
+rem
+rem Copyright 2009 by Tomasz M. Trzeciak
+rem Public Domain
+
+rem Make environment changes local
+setlocal enableextensions
+rem Get program/script name
+if not defined progname set progname=%~n0
+rem Check if this is 'sys' version of program
+set TEX_SYS_PROG=
+if /i "%progname:~-4%"=="-sys" (
+ set progname=%progname:~0,-4%
+ set TEX_SYS_PROG=true
+)
+
+rem Default command to execute
+set command=call :noscript
+rem Make sure our dir is on the search path; avoid trailing backslash
+for %%I in ("%~f0\..") do path %%~fI;%path%
+rem Ask kpsewhich about root and texmfsys trees (the first line of output)
+rem and location of the script (the second line of output)
+rem (4NT shell acts wierd with 'if' statements in a 'for' loop,
+rem so better process this output further in a subroutine)
+for /f "tokens=1-3 delims=;" %%I in (
+ 'kpsewhich --expand-var "$SELFAUTOPARENT;$TEXMFSYSCONFIG;$TEXMFSYSVAR" ^
+ --format texmfscripts "%progname%.pl" "%progname%.tlu" "%progname%.rb" "%progname%.py"'
+) do (
+ call :setcmdenv "%%~I" "%%~J" "%%~K"
+)
+
+rem By now we should have the command to execute (whatever that is), so
+rem pass through all the arguments we have and execute it
+%command% %*
+rem Finish with goto :eof (it will preserve the last set errorlevel)
+goto :eof
+
+REM SUBROUTINES
+
+:setcmdenv selfautoparent texmfsysconfig texmfsysvar
+rem If there is only one argument it must be a script name
+if "%~2"=="" goto :setcmd
+rem Otherwise, it is the first line from kpsewhich, so to set up the environment
+set PERL5LIB=%~f1\tlpkg\tlperl\lib
+set GS_LIB=%~f1\tlpkg\tlgs\lib;%~f1\tlpkg\tlgs\fonts
+path %~f1\tlpkg\tlgs\bin;%~f1\tlpkg\tlperl\bin;%~f1\tlpkg\installer;%~f1\tlpkg\installer\wget;%path%
+if not defined TEX_SYS_PROG goto :eof
+rem Extra stuff for sys version
+set TEXMFCONFIG=%~2
+set TEXMFVAR=%~3
+rem For sys version we might have an executable in the bin dir, so check for it
+if exist "%~f1\bin\win32\%progname%.exe" set command="%~f1\bin\win32\%progname%.exe"
+goto :eof
+
+:setcmd script
+rem Set command based on the script extension
+if /i %~x1==.pl set command=Perl.exe "%~f1"
+if /i %~x1==.tlu set command=TeXLua.exe "%~f1"
+rem For Ruby and Python we additionally check if their interpreter is available
+if /i %~x1==.rb call :chkcmd Ruby.exe "%~f1"
+if /i %~x1==.py call :chkcmd Python.exe "%~f1"
+goto :eof
+
+:chkcmd program script
+set command=%*
+rem If there is no interpreter Ruby or Python, suggest getting one
+if "%~$PATH:1"=="" set command=call :noinst %*
+goto :eof
+
+:noinst program
+echo %1 not found on search path>&2
+echo %~n1 is not distributed with TeX Live and has to be installed separately
+exit /b 1
+
+:noscript
+echo %progname%: no appropriate script or program found>&2
+exit /b 1
diff --git a/Master/bin/win32/rungs.bat b/Master/bin/win32/rungs.bat
index fe949613d7c..42ba109d438 100755
--- a/Master/bin/win32/rungs.bat
+++ b/Master/bin/win32/rungs.bat
@@ -1,8 +1,78 @@
@echo off
-rem tl-w32-starter.bat
-rem universal script starter, batch file part
-rem this program calls the tl-w32-wrapper.texlua
-setlocal
-set ownpath=%~dp0%
-texlua "%ownpath%tl-w32-wrapper.texlua" "%~dpn0" %*
-endlocal
+rem Universal script launcher
+rem
+rem Copyright 2009 by Tomasz M. Trzeciak
+rem Public Domain
+
+rem Make environment changes local
+setlocal enableextensions
+rem Get program/script name
+if not defined progname set progname=%~n0
+rem Check if this is 'sys' version of program
+set TEX_SYS_PROG=
+if /i "%progname:~-4%"=="-sys" (
+ set progname=%progname:~0,-4%
+ set TEX_SYS_PROG=true
+)
+
+rem Default command to execute
+set command=call :noscript
+rem Make sure our dir is on the search path; avoid trailing backslash
+for %%I in ("%~f0\..") do path %%~fI;%path%
+rem Ask kpsewhich about root and texmfsys trees (the first line of output)
+rem and location of the script (the second line of output)
+rem (4NT shell acts wierd with 'if' statements in a 'for' loop,
+rem so better process this output further in a subroutine)
+for /f "tokens=1-3 delims=;" %%I in (
+ 'kpsewhich --expand-var "$SELFAUTOPARENT;$TEXMFSYSCONFIG;$TEXMFSYSVAR" ^
+ --format texmfscripts "%progname%.pl" "%progname%.tlu" "%progname%.rb" "%progname%.py"'
+) do (
+ call :setcmdenv "%%~I" "%%~J" "%%~K"
+)
+
+rem By now we should have the command to execute (whatever that is), so
+rem pass through all the arguments we have and execute it
+%command% %*
+rem Finish with goto :eof (it will preserve the last set errorlevel)
+goto :eof
+
+REM SUBROUTINES
+
+:setcmdenv selfautoparent texmfsysconfig texmfsysvar
+rem If there is only one argument it must be a script name
+if "%~2"=="" goto :setcmd
+rem Otherwise, it is the first line from kpsewhich, so to set up the environment
+set PERL5LIB=%~f1\tlpkg\tlperl\lib
+set GS_LIB=%~f1\tlpkg\tlgs\lib;%~f1\tlpkg\tlgs\fonts
+path %~f1\tlpkg\tlgs\bin;%~f1\tlpkg\tlperl\bin;%~f1\tlpkg\installer;%~f1\tlpkg\installer\wget;%path%
+if not defined TEX_SYS_PROG goto :eof
+rem Extra stuff for sys version
+set TEXMFCONFIG=%~2
+set TEXMFVAR=%~3
+rem For sys version we might have an executable in the bin dir, so check for it
+if exist "%~f1\bin\win32\%progname%.exe" set command="%~f1\bin\win32\%progname%.exe"
+goto :eof
+
+:setcmd script
+rem Set command based on the script extension
+if /i %~x1==.pl set command=Perl.exe "%~f1"
+if /i %~x1==.tlu set command=TeXLua.exe "%~f1"
+rem For Ruby and Python we additionally check if their interpreter is available
+if /i %~x1==.rb call :chkcmd Ruby.exe "%~f1"
+if /i %~x1==.py call :chkcmd Python.exe "%~f1"
+goto :eof
+
+:chkcmd program script
+set command=%*
+rem If there is no interpreter Ruby or Python, suggest getting one
+if "%~$PATH:1"=="" set command=call :noinst %*
+goto :eof
+
+:noinst program
+echo %1 not found on search path>&2
+echo %~n1 is not distributed with TeX Live and has to be installed separately
+exit /b 1
+
+:noscript
+echo %progname%: no appropriate script or program found>&2
+exit /b 1
diff --git a/Master/bin/win32/showglyphs.bat b/Master/bin/win32/showglyphs.bat
index fe949613d7c..42ba109d438 100755
--- a/Master/bin/win32/showglyphs.bat
+++ b/Master/bin/win32/showglyphs.bat
@@ -1,8 +1,78 @@
@echo off
-rem tl-w32-starter.bat
-rem universal script starter, batch file part
-rem this program calls the tl-w32-wrapper.texlua
-setlocal
-set ownpath=%~dp0%
-texlua "%ownpath%tl-w32-wrapper.texlua" "%~dpn0" %*
-endlocal
+rem Universal script launcher
+rem
+rem Copyright 2009 by Tomasz M. Trzeciak
+rem Public Domain
+
+rem Make environment changes local
+setlocal enableextensions
+rem Get program/script name
+if not defined progname set progname=%~n0
+rem Check if this is 'sys' version of program
+set TEX_SYS_PROG=
+if /i "%progname:~-4%"=="-sys" (
+ set progname=%progname:~0,-4%
+ set TEX_SYS_PROG=true
+)
+
+rem Default command to execute
+set command=call :noscript
+rem Make sure our dir is on the search path; avoid trailing backslash
+for %%I in ("%~f0\..") do path %%~fI;%path%
+rem Ask kpsewhich about root and texmfsys trees (the first line of output)
+rem and location of the script (the second line of output)
+rem (4NT shell acts wierd with 'if' statements in a 'for' loop,
+rem so better process this output further in a subroutine)
+for /f "tokens=1-3 delims=;" %%I in (
+ 'kpsewhich --expand-var "$SELFAUTOPARENT;$TEXMFSYSCONFIG;$TEXMFSYSVAR" ^
+ --format texmfscripts "%progname%.pl" "%progname%.tlu" "%progname%.rb" "%progname%.py"'
+) do (
+ call :setcmdenv "%%~I" "%%~J" "%%~K"
+)
+
+rem By now we should have the command to execute (whatever that is), so
+rem pass through all the arguments we have and execute it
+%command% %*
+rem Finish with goto :eof (it will preserve the last set errorlevel)
+goto :eof
+
+REM SUBROUTINES
+
+:setcmdenv selfautoparent texmfsysconfig texmfsysvar
+rem If there is only one argument it must be a script name
+if "%~2"=="" goto :setcmd
+rem Otherwise, it is the first line from kpsewhich, so to set up the environment
+set PERL5LIB=%~f1\tlpkg\tlperl\lib
+set GS_LIB=%~f1\tlpkg\tlgs\lib;%~f1\tlpkg\tlgs\fonts
+path %~f1\tlpkg\tlgs\bin;%~f1\tlpkg\tlperl\bin;%~f1\tlpkg\installer;%~f1\tlpkg\installer\wget;%path%
+if not defined TEX_SYS_PROG goto :eof
+rem Extra stuff for sys version
+set TEXMFCONFIG=%~2
+set TEXMFVAR=%~3
+rem For sys version we might have an executable in the bin dir, so check for it
+if exist "%~f1\bin\win32\%progname%.exe" set command="%~f1\bin\win32\%progname%.exe"
+goto :eof
+
+:setcmd script
+rem Set command based on the script extension
+if /i %~x1==.pl set command=Perl.exe "%~f1"
+if /i %~x1==.tlu set command=TeXLua.exe "%~f1"
+rem For Ruby and Python we additionally check if their interpreter is available
+if /i %~x1==.rb call :chkcmd Ruby.exe "%~f1"
+if /i %~x1==.py call :chkcmd Python.exe "%~f1"
+goto :eof
+
+:chkcmd program script
+set command=%*
+rem If there is no interpreter Ruby or Python, suggest getting one
+if "%~$PATH:1"=="" set command=call :noinst %*
+goto :eof
+
+:noinst program
+echo %1 not found on search path>&2
+echo %~n1 is not distributed with TeX Live and has to be installed separately
+exit /b 1
+
+:noscript
+echo %progname%: no appropriate script or program found>&2
+exit /b 1
diff --git a/Master/bin/win32/splitindex.bat b/Master/bin/win32/splitindex.bat
index fe949613d7c..42ba109d438 100755
--- a/Master/bin/win32/splitindex.bat
+++ b/Master/bin/win32/splitindex.bat
@@ -1,8 +1,78 @@
@echo off
-rem tl-w32-starter.bat
-rem universal script starter, batch file part
-rem this program calls the tl-w32-wrapper.texlua
-setlocal
-set ownpath=%~dp0%
-texlua "%ownpath%tl-w32-wrapper.texlua" "%~dpn0" %*
-endlocal
+rem Universal script launcher
+rem
+rem Copyright 2009 by Tomasz M. Trzeciak
+rem Public Domain
+
+rem Make environment changes local
+setlocal enableextensions
+rem Get program/script name
+if not defined progname set progname=%~n0
+rem Check if this is 'sys' version of program
+set TEX_SYS_PROG=
+if /i "%progname:~-4%"=="-sys" (
+ set progname=%progname:~0,-4%
+ set TEX_SYS_PROG=true
+)
+
+rem Default command to execute
+set command=call :noscript
+rem Make sure our dir is on the search path; avoid trailing backslash
+for %%I in ("%~f0\..") do path %%~fI;%path%
+rem Ask kpsewhich about root and texmfsys trees (the first line of output)
+rem and location of the script (the second line of output)
+rem (4NT shell acts wierd with 'if' statements in a 'for' loop,
+rem so better process this output further in a subroutine)
+for /f "tokens=1-3 delims=;" %%I in (
+ 'kpsewhich --expand-var "$SELFAUTOPARENT;$TEXMFSYSCONFIG;$TEXMFSYSVAR" ^
+ --format texmfscripts "%progname%.pl" "%progname%.tlu" "%progname%.rb" "%progname%.py"'
+) do (
+ call :setcmdenv "%%~I" "%%~J" "%%~K"
+)
+
+rem By now we should have the command to execute (whatever that is), so
+rem pass through all the arguments we have and execute it
+%command% %*
+rem Finish with goto :eof (it will preserve the last set errorlevel)
+goto :eof
+
+REM SUBROUTINES
+
+:setcmdenv selfautoparent texmfsysconfig texmfsysvar
+rem If there is only one argument it must be a script name
+if "%~2"=="" goto :setcmd
+rem Otherwise, it is the first line from kpsewhich, so to set up the environment
+set PERL5LIB=%~f1\tlpkg\tlperl\lib
+set GS_LIB=%~f1\tlpkg\tlgs\lib;%~f1\tlpkg\tlgs\fonts
+path %~f1\tlpkg\tlgs\bin;%~f1\tlpkg\tlperl\bin;%~f1\tlpkg\installer;%~f1\tlpkg\installer\wget;%path%
+if not defined TEX_SYS_PROG goto :eof
+rem Extra stuff for sys version
+set TEXMFCONFIG=%~2
+set TEXMFVAR=%~3
+rem For sys version we might have an executable in the bin dir, so check for it
+if exist "%~f1\bin\win32\%progname%.exe" set command="%~f1\bin\win32\%progname%.exe"
+goto :eof
+
+:setcmd script
+rem Set command based on the script extension
+if /i %~x1==.pl set command=Perl.exe "%~f1"
+if /i %~x1==.tlu set command=TeXLua.exe "%~f1"
+rem For Ruby and Python we additionally check if their interpreter is available
+if /i %~x1==.rb call :chkcmd Ruby.exe "%~f1"
+if /i %~x1==.py call :chkcmd Python.exe "%~f1"
+goto :eof
+
+:chkcmd program script
+set command=%*
+rem If there is no interpreter Ruby or Python, suggest getting one
+if "%~$PATH:1"=="" set command=call :noinst %*
+goto :eof
+
+:noinst program
+echo %1 not found on search path>&2
+echo %~n1 is not distributed with TeX Live and has to be installed separately
+exit /b 1
+
+:noscript
+echo %progname%: no appropriate script or program found>&2
+exit /b 1
diff --git a/Master/bin/win32/texcount.bat b/Master/bin/win32/texcount.bat
index fe949613d7c..42ba109d438 100755
--- a/Master/bin/win32/texcount.bat
+++ b/Master/bin/win32/texcount.bat
@@ -1,8 +1,78 @@
@echo off
-rem tl-w32-starter.bat
-rem universal script starter, batch file part
-rem this program calls the tl-w32-wrapper.texlua
-setlocal
-set ownpath=%~dp0%
-texlua "%ownpath%tl-w32-wrapper.texlua" "%~dpn0" %*
-endlocal
+rem Universal script launcher
+rem
+rem Copyright 2009 by Tomasz M. Trzeciak
+rem Public Domain
+
+rem Make environment changes local
+setlocal enableextensions
+rem Get program/script name
+if not defined progname set progname=%~n0
+rem Check if this is 'sys' version of program
+set TEX_SYS_PROG=
+if /i "%progname:~-4%"=="-sys" (
+ set progname=%progname:~0,-4%
+ set TEX_SYS_PROG=true
+)
+
+rem Default command to execute
+set command=call :noscript
+rem Make sure our dir is on the search path; avoid trailing backslash
+for %%I in ("%~f0\..") do path %%~fI;%path%
+rem Ask kpsewhich about root and texmfsys trees (the first line of output)
+rem and location of the script (the second line of output)
+rem (4NT shell acts wierd with 'if' statements in a 'for' loop,
+rem so better process this output further in a subroutine)
+for /f "tokens=1-3 delims=;" %%I in (
+ 'kpsewhich --expand-var "$SELFAUTOPARENT;$TEXMFSYSCONFIG;$TEXMFSYSVAR" ^
+ --format texmfscripts "%progname%.pl" "%progname%.tlu" "%progname%.rb" "%progname%.py"'
+) do (
+ call :setcmdenv "%%~I" "%%~J" "%%~K"
+)
+
+rem By now we should have the command to execute (whatever that is), so
+rem pass through all the arguments we have and execute it
+%command% %*
+rem Finish with goto :eof (it will preserve the last set errorlevel)
+goto :eof
+
+REM SUBROUTINES
+
+:setcmdenv selfautoparent texmfsysconfig texmfsysvar
+rem If there is only one argument it must be a script name
+if "%~2"=="" goto :setcmd
+rem Otherwise, it is the first line from kpsewhich, so to set up the environment
+set PERL5LIB=%~f1\tlpkg\tlperl\lib
+set GS_LIB=%~f1\tlpkg\tlgs\lib;%~f1\tlpkg\tlgs\fonts
+path %~f1\tlpkg\tlgs\bin;%~f1\tlpkg\tlperl\bin;%~f1\tlpkg\installer;%~f1\tlpkg\installer\wget;%path%
+if not defined TEX_SYS_PROG goto :eof
+rem Extra stuff for sys version
+set TEXMFCONFIG=%~2
+set TEXMFVAR=%~3
+rem For sys version we might have an executable in the bin dir, so check for it
+if exist "%~f1\bin\win32\%progname%.exe" set command="%~f1\bin\win32\%progname%.exe"
+goto :eof
+
+:setcmd script
+rem Set command based on the script extension
+if /i %~x1==.pl set command=Perl.exe "%~f1"
+if /i %~x1==.tlu set command=TeXLua.exe "%~f1"
+rem For Ruby and Python we additionally check if their interpreter is available
+if /i %~x1==.rb call :chkcmd Ruby.exe "%~f1"
+if /i %~x1==.py call :chkcmd Python.exe "%~f1"
+goto :eof
+
+:chkcmd program script
+set command=%*
+rem If there is no interpreter Ruby or Python, suggest getting one
+if "%~$PATH:1"=="" set command=call :noinst %*
+goto :eof
+
+:noinst program
+echo %1 not found on search path>&2
+echo %~n1 is not distributed with TeX Live and has to be installed separately
+exit /b 1
+
+:noscript
+echo %progname%: no appropriate script or program found>&2
+exit /b 1
diff --git a/Master/bin/win32/texdirflatten.bat b/Master/bin/win32/texdirflatten.bat
index fe949613d7c..42ba109d438 100755
--- a/Master/bin/win32/texdirflatten.bat
+++ b/Master/bin/win32/texdirflatten.bat
@@ -1,8 +1,78 @@
@echo off
-rem tl-w32-starter.bat
-rem universal script starter, batch file part
-rem this program calls the tl-w32-wrapper.texlua
-setlocal
-set ownpath=%~dp0%
-texlua "%ownpath%tl-w32-wrapper.texlua" "%~dpn0" %*
-endlocal
+rem Universal script launcher
+rem
+rem Copyright 2009 by Tomasz M. Trzeciak
+rem Public Domain
+
+rem Make environment changes local
+setlocal enableextensions
+rem Get program/script name
+if not defined progname set progname=%~n0
+rem Check if this is 'sys' version of program
+set TEX_SYS_PROG=
+if /i "%progname:~-4%"=="-sys" (
+ set progname=%progname:~0,-4%
+ set TEX_SYS_PROG=true
+)
+
+rem Default command to execute
+set command=call :noscript
+rem Make sure our dir is on the search path; avoid trailing backslash
+for %%I in ("%~f0\..") do path %%~fI;%path%
+rem Ask kpsewhich about root and texmfsys trees (the first line of output)
+rem and location of the script (the second line of output)
+rem (4NT shell acts wierd with 'if' statements in a 'for' loop,
+rem so better process this output further in a subroutine)
+for /f "tokens=1-3 delims=;" %%I in (
+ 'kpsewhich --expand-var "$SELFAUTOPARENT;$TEXMFSYSCONFIG;$TEXMFSYSVAR" ^
+ --format texmfscripts "%progname%.pl" "%progname%.tlu" "%progname%.rb" "%progname%.py"'
+) do (
+ call :setcmdenv "%%~I" "%%~J" "%%~K"
+)
+
+rem By now we should have the command to execute (whatever that is), so
+rem pass through all the arguments we have and execute it
+%command% %*
+rem Finish with goto :eof (it will preserve the last set errorlevel)
+goto :eof
+
+REM SUBROUTINES
+
+:setcmdenv selfautoparent texmfsysconfig texmfsysvar
+rem If there is only one argument it must be a script name
+if "%~2"=="" goto :setcmd
+rem Otherwise, it is the first line from kpsewhich, so to set up the environment
+set PERL5LIB=%~f1\tlpkg\tlperl\lib
+set GS_LIB=%~f1\tlpkg\tlgs\lib;%~f1\tlpkg\tlgs\fonts
+path %~f1\tlpkg\tlgs\bin;%~f1\tlpkg\tlperl\bin;%~f1\tlpkg\installer;%~f1\tlpkg\installer\wget;%path%
+if not defined TEX_SYS_PROG goto :eof
+rem Extra stuff for sys version
+set TEXMFCONFIG=%~2
+set TEXMFVAR=%~3
+rem For sys version we might have an executable in the bin dir, so check for it
+if exist "%~f1\bin\win32\%progname%.exe" set command="%~f1\bin\win32\%progname%.exe"
+goto :eof
+
+:setcmd script
+rem Set command based on the script extension
+if /i %~x1==.pl set command=Perl.exe "%~f1"
+if /i %~x1==.tlu set command=TeXLua.exe "%~f1"
+rem For Ruby and Python we additionally check if their interpreter is available
+if /i %~x1==.rb call :chkcmd Ruby.exe "%~f1"
+if /i %~x1==.py call :chkcmd Python.exe "%~f1"
+goto :eof
+
+:chkcmd program script
+set command=%*
+rem If there is no interpreter Ruby or Python, suggest getting one
+if "%~$PATH:1"=="" set command=call :noinst %*
+goto :eof
+
+:noinst program
+echo %1 not found on search path>&2
+echo %~n1 is not distributed with TeX Live and has to be installed separately
+exit /b 1
+
+:noscript
+echo %progname%: no appropriate script or program found>&2
+exit /b 1
diff --git a/Master/bin/win32/texdoc.bat b/Master/bin/win32/texdoc.bat
index 92397f07fa6..42ba109d438 100755
--- a/Master/bin/win32/texdoc.bat
+++ b/Master/bin/win32/texdoc.bat
@@ -1,9 +1,78 @@
@echo off
-rem tl-w32-starter.bat
-rem universal script starter, batch file part
-rem this program calls the tl-w32-wrapper.texlua
-rem /!\ special texdoc version: calls a modified wrapper /!\
-setlocal
-set ownpath=%~dp0%
-texlua "%ownpath%tl-w32-texdoc-wrapper.texlua" "%~dpn0" %*
-endlocal
+rem Universal script launcher
+rem
+rem Copyright 2009 by Tomasz M. Trzeciak
+rem Public Domain
+
+rem Make environment changes local
+setlocal enableextensions
+rem Get program/script name
+if not defined progname set progname=%~n0
+rem Check if this is 'sys' version of program
+set TEX_SYS_PROG=
+if /i "%progname:~-4%"=="-sys" (
+ set progname=%progname:~0,-4%
+ set TEX_SYS_PROG=true
+)
+
+rem Default command to execute
+set command=call :noscript
+rem Make sure our dir is on the search path; avoid trailing backslash
+for %%I in ("%~f0\..") do path %%~fI;%path%
+rem Ask kpsewhich about root and texmfsys trees (the first line of output)
+rem and location of the script (the second line of output)
+rem (4NT shell acts wierd with 'if' statements in a 'for' loop,
+rem so better process this output further in a subroutine)
+for /f "tokens=1-3 delims=;" %%I in (
+ 'kpsewhich --expand-var "$SELFAUTOPARENT;$TEXMFSYSCONFIG;$TEXMFSYSVAR" ^
+ --format texmfscripts "%progname%.pl" "%progname%.tlu" "%progname%.rb" "%progname%.py"'
+) do (
+ call :setcmdenv "%%~I" "%%~J" "%%~K"
+)
+
+rem By now we should have the command to execute (whatever that is), so
+rem pass through all the arguments we have and execute it
+%command% %*
+rem Finish with goto :eof (it will preserve the last set errorlevel)
+goto :eof
+
+REM SUBROUTINES
+
+:setcmdenv selfautoparent texmfsysconfig texmfsysvar
+rem If there is only one argument it must be a script name
+if "%~2"=="" goto :setcmd
+rem Otherwise, it is the first line from kpsewhich, so to set up the environment
+set PERL5LIB=%~f1\tlpkg\tlperl\lib
+set GS_LIB=%~f1\tlpkg\tlgs\lib;%~f1\tlpkg\tlgs\fonts
+path %~f1\tlpkg\tlgs\bin;%~f1\tlpkg\tlperl\bin;%~f1\tlpkg\installer;%~f1\tlpkg\installer\wget;%path%
+if not defined TEX_SYS_PROG goto :eof
+rem Extra stuff for sys version
+set TEXMFCONFIG=%~2
+set TEXMFVAR=%~3
+rem For sys version we might have an executable in the bin dir, so check for it
+if exist "%~f1\bin\win32\%progname%.exe" set command="%~f1\bin\win32\%progname%.exe"
+goto :eof
+
+:setcmd script
+rem Set command based on the script extension
+if /i %~x1==.pl set command=Perl.exe "%~f1"
+if /i %~x1==.tlu set command=TeXLua.exe "%~f1"
+rem For Ruby and Python we additionally check if their interpreter is available
+if /i %~x1==.rb call :chkcmd Ruby.exe "%~f1"
+if /i %~x1==.py call :chkcmd Python.exe "%~f1"
+goto :eof
+
+:chkcmd program script
+set command=%*
+rem If there is no interpreter Ruby or Python, suggest getting one
+if "%~$PATH:1"=="" set command=call :noinst %*
+goto :eof
+
+:noinst program
+echo %1 not found on search path>&2
+echo %~n1 is not distributed with TeX Live and has to be installed separately
+exit /b 1
+
+:noscript
+echo %progname%: no appropriate script or program found>&2
+exit /b 1
diff --git a/Master/bin/win32/texdoctk.bat b/Master/bin/win32/texdoctk.bat
index fe949613d7c..42ba109d438 100755
--- a/Master/bin/win32/texdoctk.bat
+++ b/Master/bin/win32/texdoctk.bat
@@ -1,8 +1,78 @@
@echo off
-rem tl-w32-starter.bat
-rem universal script starter, batch file part
-rem this program calls the tl-w32-wrapper.texlua
-setlocal
-set ownpath=%~dp0%
-texlua "%ownpath%tl-w32-wrapper.texlua" "%~dpn0" %*
-endlocal
+rem Universal script launcher
+rem
+rem Copyright 2009 by Tomasz M. Trzeciak
+rem Public Domain
+
+rem Make environment changes local
+setlocal enableextensions
+rem Get program/script name
+if not defined progname set progname=%~n0
+rem Check if this is 'sys' version of program
+set TEX_SYS_PROG=
+if /i "%progname:~-4%"=="-sys" (
+ set progname=%progname:~0,-4%
+ set TEX_SYS_PROG=true
+)
+
+rem Default command to execute
+set command=call :noscript
+rem Make sure our dir is on the search path; avoid trailing backslash
+for %%I in ("%~f0\..") do path %%~fI;%path%
+rem Ask kpsewhich about root and texmfsys trees (the first line of output)
+rem and location of the script (the second line of output)
+rem (4NT shell acts wierd with 'if' statements in a 'for' loop,
+rem so better process this output further in a subroutine)
+for /f "tokens=1-3 delims=;" %%I in (
+ 'kpsewhich --expand-var "$SELFAUTOPARENT;$TEXMFSYSCONFIG;$TEXMFSYSVAR" ^
+ --format texmfscripts "%progname%.pl" "%progname%.tlu" "%progname%.rb" "%progname%.py"'
+) do (
+ call :setcmdenv "%%~I" "%%~J" "%%~K"
+)
+
+rem By now we should have the command to execute (whatever that is), so
+rem pass through all the arguments we have and execute it
+%command% %*
+rem Finish with goto :eof (it will preserve the last set errorlevel)
+goto :eof
+
+REM SUBROUTINES
+
+:setcmdenv selfautoparent texmfsysconfig texmfsysvar
+rem If there is only one argument it must be a script name
+if "%~2"=="" goto :setcmd
+rem Otherwise, it is the first line from kpsewhich, so to set up the environment
+set PERL5LIB=%~f1\tlpkg\tlperl\lib
+set GS_LIB=%~f1\tlpkg\tlgs\lib;%~f1\tlpkg\tlgs\fonts
+path %~f1\tlpkg\tlgs\bin;%~f1\tlpkg\tlperl\bin;%~f1\tlpkg\installer;%~f1\tlpkg\installer\wget;%path%
+if not defined TEX_SYS_PROG goto :eof
+rem Extra stuff for sys version
+set TEXMFCONFIG=%~2
+set TEXMFVAR=%~3
+rem For sys version we might have an executable in the bin dir, so check for it
+if exist "%~f1\bin\win32\%progname%.exe" set command="%~f1\bin\win32\%progname%.exe"
+goto :eof
+
+:setcmd script
+rem Set command based on the script extension
+if /i %~x1==.pl set command=Perl.exe "%~f1"
+if /i %~x1==.tlu set command=TeXLua.exe "%~f1"
+rem For Ruby and Python we additionally check if their interpreter is available
+if /i %~x1==.rb call :chkcmd Ruby.exe "%~f1"
+if /i %~x1==.py call :chkcmd Python.exe "%~f1"
+goto :eof
+
+:chkcmd program script
+set command=%*
+rem If there is no interpreter Ruby or Python, suggest getting one
+if "%~$PATH:1"=="" set command=call :noinst %*
+goto :eof
+
+:noinst program
+echo %1 not found on search path>&2
+echo %~n1 is not distributed with TeX Live and has to be installed separately
+exit /b 1
+
+:noscript
+echo %progname%: no appropriate script or program found>&2
+exit /b 1
diff --git a/Master/bin/win32/texindy.bat b/Master/bin/win32/texindy.bat
index fe949613d7c..42ba109d438 100755
--- a/Master/bin/win32/texindy.bat
+++ b/Master/bin/win32/texindy.bat
@@ -1,8 +1,78 @@
@echo off
-rem tl-w32-starter.bat
-rem universal script starter, batch file part
-rem this program calls the tl-w32-wrapper.texlua
-setlocal
-set ownpath=%~dp0%
-texlua "%ownpath%tl-w32-wrapper.texlua" "%~dpn0" %*
-endlocal
+rem Universal script launcher
+rem
+rem Copyright 2009 by Tomasz M. Trzeciak
+rem Public Domain
+
+rem Make environment changes local
+setlocal enableextensions
+rem Get program/script name
+if not defined progname set progname=%~n0
+rem Check if this is 'sys' version of program
+set TEX_SYS_PROG=
+if /i "%progname:~-4%"=="-sys" (
+ set progname=%progname:~0,-4%
+ set TEX_SYS_PROG=true
+)
+
+rem Default command to execute
+set command=call :noscript
+rem Make sure our dir is on the search path; avoid trailing backslash
+for %%I in ("%~f0\..") do path %%~fI;%path%
+rem Ask kpsewhich about root and texmfsys trees (the first line of output)
+rem and location of the script (the second line of output)
+rem (4NT shell acts wierd with 'if' statements in a 'for' loop,
+rem so better process this output further in a subroutine)
+for /f "tokens=1-3 delims=;" %%I in (
+ 'kpsewhich --expand-var "$SELFAUTOPARENT;$TEXMFSYSCONFIG;$TEXMFSYSVAR" ^
+ --format texmfscripts "%progname%.pl" "%progname%.tlu" "%progname%.rb" "%progname%.py"'
+) do (
+ call :setcmdenv "%%~I" "%%~J" "%%~K"
+)
+
+rem By now we should have the command to execute (whatever that is), so
+rem pass through all the arguments we have and execute it
+%command% %*
+rem Finish with goto :eof (it will preserve the last set errorlevel)
+goto :eof
+
+REM SUBROUTINES
+
+:setcmdenv selfautoparent texmfsysconfig texmfsysvar
+rem If there is only one argument it must be a script name
+if "%~2"=="" goto :setcmd
+rem Otherwise, it is the first line from kpsewhich, so to set up the environment
+set PERL5LIB=%~f1\tlpkg\tlperl\lib
+set GS_LIB=%~f1\tlpkg\tlgs\lib;%~f1\tlpkg\tlgs\fonts
+path %~f1\tlpkg\tlgs\bin;%~f1\tlpkg\tlperl\bin;%~f1\tlpkg\installer;%~f1\tlpkg\installer\wget;%path%
+if not defined TEX_SYS_PROG goto :eof
+rem Extra stuff for sys version
+set TEXMFCONFIG=%~2
+set TEXMFVAR=%~3
+rem For sys version we might have an executable in the bin dir, so check for it
+if exist "%~f1\bin\win32\%progname%.exe" set command="%~f1\bin\win32\%progname%.exe"
+goto :eof
+
+:setcmd script
+rem Set command based on the script extension
+if /i %~x1==.pl set command=Perl.exe "%~f1"
+if /i %~x1==.tlu set command=TeXLua.exe "%~f1"
+rem For Ruby and Python we additionally check if their interpreter is available
+if /i %~x1==.rb call :chkcmd Ruby.exe "%~f1"
+if /i %~x1==.py call :chkcmd Python.exe "%~f1"
+goto :eof
+
+:chkcmd program script
+set command=%*
+rem If there is no interpreter Ruby or Python, suggest getting one
+if "%~$PATH:1"=="" set command=call :noinst %*
+goto :eof
+
+:noinst program
+echo %1 not found on search path>&2
+echo %~n1 is not distributed with TeX Live and has to be installed separately
+exit /b 1
+
+:noscript
+echo %progname%: no appropriate script or program found>&2
+exit /b 1
diff --git a/Master/bin/win32/thumbpdf.bat b/Master/bin/win32/thumbpdf.bat
index fe949613d7c..42ba109d438 100755
--- a/Master/bin/win32/thumbpdf.bat
+++ b/Master/bin/win32/thumbpdf.bat
@@ -1,8 +1,78 @@
@echo off
-rem tl-w32-starter.bat
-rem universal script starter, batch file part
-rem this program calls the tl-w32-wrapper.texlua
-setlocal
-set ownpath=%~dp0%
-texlua "%ownpath%tl-w32-wrapper.texlua" "%~dpn0" %*
-endlocal
+rem Universal script launcher
+rem
+rem Copyright 2009 by Tomasz M. Trzeciak
+rem Public Domain
+
+rem Make environment changes local
+setlocal enableextensions
+rem Get program/script name
+if not defined progname set progname=%~n0
+rem Check if this is 'sys' version of program
+set TEX_SYS_PROG=
+if /i "%progname:~-4%"=="-sys" (
+ set progname=%progname:~0,-4%
+ set TEX_SYS_PROG=true
+)
+
+rem Default command to execute
+set command=call :noscript
+rem Make sure our dir is on the search path; avoid trailing backslash
+for %%I in ("%~f0\..") do path %%~fI;%path%
+rem Ask kpsewhich about root and texmfsys trees (the first line of output)
+rem and location of the script (the second line of output)
+rem (4NT shell acts wierd with 'if' statements in a 'for' loop,
+rem so better process this output further in a subroutine)
+for /f "tokens=1-3 delims=;" %%I in (
+ 'kpsewhich --expand-var "$SELFAUTOPARENT;$TEXMFSYSCONFIG;$TEXMFSYSVAR" ^
+ --format texmfscripts "%progname%.pl" "%progname%.tlu" "%progname%.rb" "%progname%.py"'
+) do (
+ call :setcmdenv "%%~I" "%%~J" "%%~K"
+)
+
+rem By now we should have the command to execute (whatever that is), so
+rem pass through all the arguments we have and execute it
+%command% %*
+rem Finish with goto :eof (it will preserve the last set errorlevel)
+goto :eof
+
+REM SUBROUTINES
+
+:setcmdenv selfautoparent texmfsysconfig texmfsysvar
+rem If there is only one argument it must be a script name
+if "%~2"=="" goto :setcmd
+rem Otherwise, it is the first line from kpsewhich, so to set up the environment
+set PERL5LIB=%~f1\tlpkg\tlperl\lib
+set GS_LIB=%~f1\tlpkg\tlgs\lib;%~f1\tlpkg\tlgs\fonts
+path %~f1\tlpkg\tlgs\bin;%~f1\tlpkg\tlperl\bin;%~f1\tlpkg\installer;%~f1\tlpkg\installer\wget;%path%
+if not defined TEX_SYS_PROG goto :eof
+rem Extra stuff for sys version
+set TEXMFCONFIG=%~2
+set TEXMFVAR=%~3
+rem For sys version we might have an executable in the bin dir, so check for it
+if exist "%~f1\bin\win32\%progname%.exe" set command="%~f1\bin\win32\%progname%.exe"
+goto :eof
+
+:setcmd script
+rem Set command based on the script extension
+if /i %~x1==.pl set command=Perl.exe "%~f1"
+if /i %~x1==.tlu set command=TeXLua.exe "%~f1"
+rem For Ruby and Python we additionally check if their interpreter is available
+if /i %~x1==.rb call :chkcmd Ruby.exe "%~f1"
+if /i %~x1==.py call :chkcmd Python.exe "%~f1"
+goto :eof
+
+:chkcmd program script
+set command=%*
+rem If there is no interpreter Ruby or Python, suggest getting one
+if "%~$PATH:1"=="" set command=call :noinst %*
+goto :eof
+
+:noinst program
+echo %1 not found on search path>&2
+echo %~n1 is not distributed with TeX Live and has to be installed separately
+exit /b 1
+
+:noscript
+echo %progname%: no appropriate script or program found>&2
+exit /b 1
diff --git a/Master/bin/win32/tl-w32-texdoc-wrapper.texlua b/Master/bin/win32/tl-w32-texdoc-wrapper.texlua
deleted file mode 100755
index 69830090663..00000000000
--- a/Master/bin/win32/tl-w32-texdoc-wrapper.texlua
+++ /dev/null
@@ -1,107 +0,0 @@
-#! /usr/bin/env texlua
---*-Lua-*-
-
--- Copyright (C) 2007, 2008 Reinhard Kotucha, Norbert Preining.
--- You may freely use, modify and/or distribute this file.
-
--- Wrapper for scripts.
-
-function fixwin(args_unix)
- if os.type == 'windows' then
- local args_win={} -- new table
- args_win[0]=args_unix[1]
- for i=1, #args_unix do
- args_win[i]='"'..args_unix[i]..'"'
- end
- return args_win
- else
- return args_unix
- end
-end
-
-if string.find(arg[0], '/') then -- UNIX path
- progname = select(1, string.gsub(arg[1], '.*/', ''))
-elseif string.find(arg[0], '\\') then -- Windows path
- progname = select(1, string.gsub(arg[1], '.*\\', ''))
- -- we might have \ and / mixed together ...
- progname = select(1, string.gsub(progname, '.*/', ''))
-else -- no path
- progname = arg[1]
-end
-
-sys=false
-
-if string.find(progname, '-sys$') then
- basename = select(1, string.gsub(progname, '-sys$', ''))
- sys=true
-else
- basename = progname
-end
-
-kpse.set_program_name(progname..".bat", progname)
-TEXDIR=kpse.var_value('SELFAUTOPARENT')
-BINDIR=kpse.var_value('SELFAUTOLOC')
-
-perlbin=TEXDIR..'/tlpkg/tlperl/bin/perl.exe'
-
-os.setenv('PATH', TEXDIR..'/tlpkg/tlgs/bin;'..
- TEXDIR..'/tlpkg/tlperl/bin;'..
- TEXDIR..'/tlpkg/installer;'..
- TEXDIR..'/tlpkg/installer/wget;'..
- os.getenv('PATH'))
-
-os.setenv('WGETRC', TEXDIR..'/tlpkg/installer/wgetrc')
-os.setenv('PERL5LIB', TEXDIR..'/tlpkg/tlperl/lib')
-os.setenv('GS_LIB', TEXDIR..'/tlpkg/tlgs/lib;'..TEXDIR..'/tlpkg/tlgs/fonts')
-
-if sys then
- os.setenv('TEXMFVAR', kpse.var_value('TEXMFSYSVAR'))
- os.setenv('TEXMFCONFIG', kpse.var_value('TEXMFSYSCONFIG'))
- os.setenv('TEX_SYS_PROG', 'true')
-end
-
-if sys and lfs.isfile(BINDIR..'/'..basename..'.exe') then
- command={BINDIR..'/'..basename..'.exe'}
-elseif lfs.isfile(BINDIR..'/'..basename..'-bin.exe') then
- command={BINDIR..'/'..basename..'-bin.exe'}
-elseif lfs.isfile(BINDIR..'/'..basename..'.pl') then
- script=BINDIR..'/'..basename..'.pl'
- command={perlbin, script}
-elseif kpse.find_file(basename..'.pl', 'texmfscripts') then
- script=kpse.find_file(basename..'.pl', 'texmfscripts')
- command={perlbin, script}
-elseif kpse.find_file(basename..'.tlu', 'texmfscripts') then
- script=kpse.find_file(basename..'.tlu', 'texmfscripts')
- command={'texlua', script}
-else
- io.stderr:write(basename..'.bat: '..basename..
- ': No appropriate script found.\n')
- os.exit(1)
-end
-
-for i=2, #arg do
- command[#command+1]=arg[i]
-end
-
-command=fixwin(command)
-
---[[ Prepend an additional hyphen to activate this code.
-for i=0, #command do
- print (command[i])
-end
-os.exit(ret)
---]]
-
--- finally in this special texdoc version we use os.execute to avoid the
--- weird problem with acroread 8.1 or 9. So we turn our nice list
--- back into a straight string
-cmd_line = command[0]
-for i = 2, #command do
- cmd_line = cmd_line .. " " .. command[i]
-end
---[[ debugging: print the command line
-print (cmd_line)
---]]
-
-ret=os.execute(cmd_line)
-os.exit(ret)
diff --git a/Master/bin/win32/tl-w32-wrapper.texlua b/Master/bin/win32/tl-w32-wrapper.texlua
deleted file mode 100755
index 1d0fb92d846..00000000000
--- a/Master/bin/win32/tl-w32-wrapper.texlua
+++ /dev/null
@@ -1,98 +0,0 @@
-#! /usr/bin/env texlua
---*-Lua-*-
-
--- Copyright (C) 2007, 2008 Reinhard Kotucha, Norbert Preining.
--- You may freely use, modify and/or distribute this file.
-
--- Wrapper for scripts.
-
-function fixwin(args_unix)
- if os.type == 'windows' then
- local args_win={} -- new table
- args_win[0]=args_unix[1]
- for i=1, #args_unix do
- args_win[i]='"'..args_unix[i]..'"'
- end
- return args_win
- else
- return args_unix
- end
-end
-
-if string.find(arg[0], '/') then -- UNIX path
- progname = select(1, string.gsub(arg[1], '.*/', ''))
-elseif string.find(arg[0], '\\') then -- Windows path
- progname = select(1, string.gsub(arg[1], '.*\\', ''))
- -- we might have \ and / mixed together ...
- progname = select(1, string.gsub(progname, '.*/', ''))
-else -- no path
- progname = arg[1]
-end
-
-sys=false
-
-if string.find(progname, '-sys$') then
- basename = select(1, string.gsub(progname, '-sys$', ''))
- sys=true
-else
- basename = progname
-end
-
-kpse.set_program_name(progname..".bat", progname)
-TEXDIR=kpse.var_value('SELFAUTOPARENT')
-BINDIR=kpse.var_value('SELFAUTOLOC')
-
-perlbin=TEXDIR..'/tlpkg/tlperl/bin/perl.exe'
-
-os.setenv('PATH', TEXDIR..'/tlpkg/tlgs/bin;'..
- TEXDIR..'/tlpkg/tlperl/bin;'..
- TEXDIR..'/tlpkg/installer;'..
- TEXDIR..'/tlpkg/installer/wget;'..
- os.getenv('PATH'))
-
--- we don't ship the wgetrc anymore, and if it is not present, wget
--- will just die, that is bad!!!
--- os.setenv('WGETRC', TEXDIR..'/tlpkg/installer/wgetrc')
-os.setenv('PERL5LIB', TEXDIR..'/tlpkg/tlperl/lib')
-os.setenv('GS_LIB', TEXDIR..'/tlpkg/tlgs/lib;'..TEXDIR..'/tlpkg/tlgs/fonts')
-
-if sys then
- os.setenv('TEXMFVAR', kpse.var_value('TEXMFSYSVAR'))
- os.setenv('TEXMFCONFIG', kpse.var_value('TEXMFSYSCONFIG'))
- os.setenv('TEX_SYS_PROG', 'true')
-end
-
-if sys and lfs.isfile(BINDIR..'/'..basename..'.exe') then
- command={BINDIR..'/'..basename..'.exe'}
-elseif lfs.isfile(BINDIR..'/'..basename..'-bin.exe') then
- command={BINDIR..'/'..basename..'-bin.exe'}
-elseif lfs.isfile(BINDIR..'/'..basename..'.pl') then
- script=BINDIR..'/'..basename..'.pl'
- command={perlbin, script}
-elseif kpse.find_file(basename..'.pl', 'texmfscripts') then
- script=kpse.find_file(basename..'.pl', 'texmfscripts')
- command={perlbin, script}
-elseif kpse.find_file(basename..'.tlu', 'texmfscripts') then
- script=kpse.find_file(basename..'.tlu', 'texmfscripts')
- command={'texlua', script}
-else
- io.stderr:write(basename..'.bat: '..basename..
- ': No appropriate script found.\n')
- os.exit(1)
-end
-
-for i=2, #arg do
- command[#command+1]=arg[i]
-end
-
-command=fixwin(command)
-
---[[ Prepend an additional hyphen to activate this code.
-for i=0, #command do
- print (command[i])
-end
-os.exit(ret)
---]]
-
-ret=os.spawn(command)
-os.exit(ret)
diff --git a/Master/bin/win32/updmap-sys.bat b/Master/bin/win32/updmap-sys.bat
index fe949613d7c..42ba109d438 100755
--- a/Master/bin/win32/updmap-sys.bat
+++ b/Master/bin/win32/updmap-sys.bat
@@ -1,8 +1,78 @@
@echo off
-rem tl-w32-starter.bat
-rem universal script starter, batch file part
-rem this program calls the tl-w32-wrapper.texlua
-setlocal
-set ownpath=%~dp0%
-texlua "%ownpath%tl-w32-wrapper.texlua" "%~dpn0" %*
-endlocal
+rem Universal script launcher
+rem
+rem Copyright 2009 by Tomasz M. Trzeciak
+rem Public Domain
+
+rem Make environment changes local
+setlocal enableextensions
+rem Get program/script name
+if not defined progname set progname=%~n0
+rem Check if this is 'sys' version of program
+set TEX_SYS_PROG=
+if /i "%progname:~-4%"=="-sys" (
+ set progname=%progname:~0,-4%
+ set TEX_SYS_PROG=true
+)
+
+rem Default command to execute
+set command=call :noscript
+rem Make sure our dir is on the search path; avoid trailing backslash
+for %%I in ("%~f0\..") do path %%~fI;%path%
+rem Ask kpsewhich about root and texmfsys trees (the first line of output)
+rem and location of the script (the second line of output)
+rem (4NT shell acts wierd with 'if' statements in a 'for' loop,
+rem so better process this output further in a subroutine)
+for /f "tokens=1-3 delims=;" %%I in (
+ 'kpsewhich --expand-var "$SELFAUTOPARENT;$TEXMFSYSCONFIG;$TEXMFSYSVAR" ^
+ --format texmfscripts "%progname%.pl" "%progname%.tlu" "%progname%.rb" "%progname%.py"'
+) do (
+ call :setcmdenv "%%~I" "%%~J" "%%~K"
+)
+
+rem By now we should have the command to execute (whatever that is), so
+rem pass through all the arguments we have and execute it
+%command% %*
+rem Finish with goto :eof (it will preserve the last set errorlevel)
+goto :eof
+
+REM SUBROUTINES
+
+:setcmdenv selfautoparent texmfsysconfig texmfsysvar
+rem If there is only one argument it must be a script name
+if "%~2"=="" goto :setcmd
+rem Otherwise, it is the first line from kpsewhich, so to set up the environment
+set PERL5LIB=%~f1\tlpkg\tlperl\lib
+set GS_LIB=%~f1\tlpkg\tlgs\lib;%~f1\tlpkg\tlgs\fonts
+path %~f1\tlpkg\tlgs\bin;%~f1\tlpkg\tlperl\bin;%~f1\tlpkg\installer;%~f1\tlpkg\installer\wget;%path%
+if not defined TEX_SYS_PROG goto :eof
+rem Extra stuff for sys version
+set TEXMFCONFIG=%~2
+set TEXMFVAR=%~3
+rem For sys version we might have an executable in the bin dir, so check for it
+if exist "%~f1\bin\win32\%progname%.exe" set command="%~f1\bin\win32\%progname%.exe"
+goto :eof
+
+:setcmd script
+rem Set command based on the script extension
+if /i %~x1==.pl set command=Perl.exe "%~f1"
+if /i %~x1==.tlu set command=TeXLua.exe "%~f1"
+rem For Ruby and Python we additionally check if their interpreter is available
+if /i %~x1==.rb call :chkcmd Ruby.exe "%~f1"
+if /i %~x1==.py call :chkcmd Python.exe "%~f1"
+goto :eof
+
+:chkcmd program script
+set command=%*
+rem If there is no interpreter Ruby or Python, suggest getting one
+if "%~$PATH:1"=="" set command=call :noinst %*
+goto :eof
+
+:noinst program
+echo %1 not found on search path>&2
+echo %~n1 is not distributed with TeX Live and has to be installed separately
+exit /b 1
+
+:noscript
+echo %progname%: no appropriate script or program found>&2
+exit /b 1
diff --git a/Master/bin/win32/updmap.bat b/Master/bin/win32/updmap.bat
index fe949613d7c..42ba109d438 100755
--- a/Master/bin/win32/updmap.bat
+++ b/Master/bin/win32/updmap.bat
@@ -1,8 +1,78 @@
@echo off
-rem tl-w32-starter.bat
-rem universal script starter, batch file part
-rem this program calls the tl-w32-wrapper.texlua
-setlocal
-set ownpath=%~dp0%
-texlua "%ownpath%tl-w32-wrapper.texlua" "%~dpn0" %*
-endlocal
+rem Universal script launcher
+rem
+rem Copyright 2009 by Tomasz M. Trzeciak
+rem Public Domain
+
+rem Make environment changes local
+setlocal enableextensions
+rem Get program/script name
+if not defined progname set progname=%~n0
+rem Check if this is 'sys' version of program
+set TEX_SYS_PROG=
+if /i "%progname:~-4%"=="-sys" (
+ set progname=%progname:~0,-4%
+ set TEX_SYS_PROG=true
+)
+
+rem Default command to execute
+set command=call :noscript
+rem Make sure our dir is on the search path; avoid trailing backslash
+for %%I in ("%~f0\..") do path %%~fI;%path%
+rem Ask kpsewhich about root and texmfsys trees (the first line of output)
+rem and location of the script (the second line of output)
+rem (4NT shell acts wierd with 'if' statements in a 'for' loop,
+rem so better process this output further in a subroutine)
+for /f "tokens=1-3 delims=;" %%I in (
+ 'kpsewhich --expand-var "$SELFAUTOPARENT;$TEXMFSYSCONFIG;$TEXMFSYSVAR" ^
+ --format texmfscripts "%progname%.pl" "%progname%.tlu" "%progname%.rb" "%progname%.py"'
+) do (
+ call :setcmdenv "%%~I" "%%~J" "%%~K"
+)
+
+rem By now we should have the command to execute (whatever that is), so
+rem pass through all the arguments we have and execute it
+%command% %*
+rem Finish with goto :eof (it will preserve the last set errorlevel)
+goto :eof
+
+REM SUBROUTINES
+
+:setcmdenv selfautoparent texmfsysconfig texmfsysvar
+rem If there is only one argument it must be a script name
+if "%~2"=="" goto :setcmd
+rem Otherwise, it is the first line from kpsewhich, so to set up the environment
+set PERL5LIB=%~f1\tlpkg\tlperl\lib
+set GS_LIB=%~f1\tlpkg\tlgs\lib;%~f1\tlpkg\tlgs\fonts
+path %~f1\tlpkg\tlgs\bin;%~f1\tlpkg\tlperl\bin;%~f1\tlpkg\installer;%~f1\tlpkg\installer\wget;%path%
+if not defined TEX_SYS_PROG goto :eof
+rem Extra stuff for sys version
+set TEXMFCONFIG=%~2
+set TEXMFVAR=%~3
+rem For sys version we might have an executable in the bin dir, so check for it
+if exist "%~f1\bin\win32\%progname%.exe" set command="%~f1\bin\win32\%progname%.exe"
+goto :eof
+
+:setcmd script
+rem Set command based on the script extension
+if /i %~x1==.pl set command=Perl.exe "%~f1"
+if /i %~x1==.tlu set command=TeXLua.exe "%~f1"
+rem For Ruby and Python we additionally check if their interpreter is available
+if /i %~x1==.rb call :chkcmd Ruby.exe "%~f1"
+if /i %~x1==.py call :chkcmd Python.exe "%~f1"
+goto :eof
+
+:chkcmd program script
+set command=%*
+rem If there is no interpreter Ruby or Python, suggest getting one
+if "%~$PATH:1"=="" set command=call :noinst %*
+goto :eof
+
+:noinst program
+echo %1 not found on search path>&2
+echo %~n1 is not distributed with TeX Live and has to be installed separately
+exit /b 1
+
+:noscript
+echo %progname%: no appropriate script or program found>&2
+exit /b 1
diff --git a/Master/bin/win32/vpe.bat b/Master/bin/win32/vpe.bat
index fe949613d7c..42ba109d438 100755
--- a/Master/bin/win32/vpe.bat
+++ b/Master/bin/win32/vpe.bat
@@ -1,8 +1,78 @@
@echo off
-rem tl-w32-starter.bat
-rem universal script starter, batch file part
-rem this program calls the tl-w32-wrapper.texlua
-setlocal
-set ownpath=%~dp0%
-texlua "%ownpath%tl-w32-wrapper.texlua" "%~dpn0" %*
-endlocal
+rem Universal script launcher
+rem
+rem Copyright 2009 by Tomasz M. Trzeciak
+rem Public Domain
+
+rem Make environment changes local
+setlocal enableextensions
+rem Get program/script name
+if not defined progname set progname=%~n0
+rem Check if this is 'sys' version of program
+set TEX_SYS_PROG=
+if /i "%progname:~-4%"=="-sys" (
+ set progname=%progname:~0,-4%
+ set TEX_SYS_PROG=true
+)
+
+rem Default command to execute
+set command=call :noscript
+rem Make sure our dir is on the search path; avoid trailing backslash
+for %%I in ("%~f0\..") do path %%~fI;%path%
+rem Ask kpsewhich about root and texmfsys trees (the first line of output)
+rem and location of the script (the second line of output)
+rem (4NT shell acts wierd with 'if' statements in a 'for' loop,
+rem so better process this output further in a subroutine)
+for /f "tokens=1-3 delims=;" %%I in (
+ 'kpsewhich --expand-var "$SELFAUTOPARENT;$TEXMFSYSCONFIG;$TEXMFSYSVAR" ^
+ --format texmfscripts "%progname%.pl" "%progname%.tlu" "%progname%.rb" "%progname%.py"'
+) do (
+ call :setcmdenv "%%~I" "%%~J" "%%~K"
+)
+
+rem By now we should have the command to execute (whatever that is), so
+rem pass through all the arguments we have and execute it
+%command% %*
+rem Finish with goto :eof (it will preserve the last set errorlevel)
+goto :eof
+
+REM SUBROUTINES
+
+:setcmdenv selfautoparent texmfsysconfig texmfsysvar
+rem If there is only one argument it must be a script name
+if "%~2"=="" goto :setcmd
+rem Otherwise, it is the first line from kpsewhich, so to set up the environment
+set PERL5LIB=%~f1\tlpkg\tlperl\lib
+set GS_LIB=%~f1\tlpkg\tlgs\lib;%~f1\tlpkg\tlgs\fonts
+path %~f1\tlpkg\tlgs\bin;%~f1\tlpkg\tlperl\bin;%~f1\tlpkg\installer;%~f1\tlpkg\installer\wget;%path%
+if not defined TEX_SYS_PROG goto :eof
+rem Extra stuff for sys version
+set TEXMFCONFIG=%~2
+set TEXMFVAR=%~3
+rem For sys version we might have an executable in the bin dir, so check for it
+if exist "%~f1\bin\win32\%progname%.exe" set command="%~f1\bin\win32\%progname%.exe"
+goto :eof
+
+:setcmd script
+rem Set command based on the script extension
+if /i %~x1==.pl set command=Perl.exe "%~f1"
+if /i %~x1==.tlu set command=TeXLua.exe "%~f1"
+rem For Ruby and Python we additionally check if their interpreter is available
+if /i %~x1==.rb call :chkcmd Ruby.exe "%~f1"
+if /i %~x1==.py call :chkcmd Python.exe "%~f1"
+goto :eof
+
+:chkcmd program script
+set command=%*
+rem If there is no interpreter Ruby or Python, suggest getting one
+if "%~$PATH:1"=="" set command=call :noinst %*
+goto :eof
+
+:noinst program
+echo %1 not found on search path>&2
+echo %~n1 is not distributed with TeX Live and has to be installed separately
+exit /b 1
+
+:noscript
+echo %progname%: no appropriate script or program found>&2
+exit /b 1
diff --git a/Master/bin/win32/vpl2ovp.bat b/Master/bin/win32/vpl2ovp.bat
index fe949613d7c..42ba109d438 100755
--- a/Master/bin/win32/vpl2ovp.bat
+++ b/Master/bin/win32/vpl2ovp.bat
@@ -1,8 +1,78 @@
@echo off
-rem tl-w32-starter.bat
-rem universal script starter, batch file part
-rem this program calls the tl-w32-wrapper.texlua
-setlocal
-set ownpath=%~dp0%
-texlua "%ownpath%tl-w32-wrapper.texlua" "%~dpn0" %*
-endlocal
+rem Universal script launcher
+rem
+rem Copyright 2009 by Tomasz M. Trzeciak
+rem Public Domain
+
+rem Make environment changes local
+setlocal enableextensions
+rem Get program/script name
+if not defined progname set progname=%~n0
+rem Check if this is 'sys' version of program
+set TEX_SYS_PROG=
+if /i "%progname:~-4%"=="-sys" (
+ set progname=%progname:~0,-4%
+ set TEX_SYS_PROG=true
+)
+
+rem Default command to execute
+set command=call :noscript
+rem Make sure our dir is on the search path; avoid trailing backslash
+for %%I in ("%~f0\..") do path %%~fI;%path%
+rem Ask kpsewhich about root and texmfsys trees (the first line of output)
+rem and location of the script (the second line of output)
+rem (4NT shell acts wierd with 'if' statements in a 'for' loop,
+rem so better process this output further in a subroutine)
+for /f "tokens=1-3 delims=;" %%I in (
+ 'kpsewhich --expand-var "$SELFAUTOPARENT;$TEXMFSYSCONFIG;$TEXMFSYSVAR" ^
+ --format texmfscripts "%progname%.pl" "%progname%.tlu" "%progname%.rb" "%progname%.py"'
+) do (
+ call :setcmdenv "%%~I" "%%~J" "%%~K"
+)
+
+rem By now we should have the command to execute (whatever that is), so
+rem pass through all the arguments we have and execute it
+%command% %*
+rem Finish with goto :eof (it will preserve the last set errorlevel)
+goto :eof
+
+REM SUBROUTINES
+
+:setcmdenv selfautoparent texmfsysconfig texmfsysvar
+rem If there is only one argument it must be a script name
+if "%~2"=="" goto :setcmd
+rem Otherwise, it is the first line from kpsewhich, so to set up the environment
+set PERL5LIB=%~f1\tlpkg\tlperl\lib
+set GS_LIB=%~f1\tlpkg\tlgs\lib;%~f1\tlpkg\tlgs\fonts
+path %~f1\tlpkg\tlgs\bin;%~f1\tlpkg\tlperl\bin;%~f1\tlpkg\installer;%~f1\tlpkg\installer\wget;%path%
+if not defined TEX_SYS_PROG goto :eof
+rem Extra stuff for sys version
+set TEXMFCONFIG=%~2
+set TEXMFVAR=%~3
+rem For sys version we might have an executable in the bin dir, so check for it
+if exist "%~f1\bin\win32\%progname%.exe" set command="%~f1\bin\win32\%progname%.exe"
+goto :eof
+
+:setcmd script
+rem Set command based on the script extension
+if /i %~x1==.pl set command=Perl.exe "%~f1"
+if /i %~x1==.tlu set command=TeXLua.exe "%~f1"
+rem For Ruby and Python we additionally check if their interpreter is available
+if /i %~x1==.rb call :chkcmd Ruby.exe "%~f1"
+if /i %~x1==.py call :chkcmd Python.exe "%~f1"
+goto :eof
+
+:chkcmd program script
+set command=%*
+rem If there is no interpreter Ruby or Python, suggest getting one
+if "%~$PATH:1"=="" set command=call :noinst %*
+goto :eof
+
+:noinst program
+echo %1 not found on search path>&2
+echo %~n1 is not distributed with TeX Live and has to be installed separately
+exit /b 1
+
+:noscript
+echo %progname%: no appropriate script or program found>&2
+exit /b 1
diff --git a/Master/bin/win32/vpl2vpl.bat b/Master/bin/win32/vpl2vpl.bat
index fe949613d7c..42ba109d438 100755
--- a/Master/bin/win32/vpl2vpl.bat
+++ b/Master/bin/win32/vpl2vpl.bat
@@ -1,8 +1,78 @@
@echo off
-rem tl-w32-starter.bat
-rem universal script starter, batch file part
-rem this program calls the tl-w32-wrapper.texlua
-setlocal
-set ownpath=%~dp0%
-texlua "%ownpath%tl-w32-wrapper.texlua" "%~dpn0" %*
-endlocal
+rem Universal script launcher
+rem
+rem Copyright 2009 by Tomasz M. Trzeciak
+rem Public Domain
+
+rem Make environment changes local
+setlocal enableextensions
+rem Get program/script name
+if not defined progname set progname=%~n0
+rem Check if this is 'sys' version of program
+set TEX_SYS_PROG=
+if /i "%progname:~-4%"=="-sys" (
+ set progname=%progname:~0,-4%
+ set TEX_SYS_PROG=true
+)
+
+rem Default command to execute
+set command=call :noscript
+rem Make sure our dir is on the search path; avoid trailing backslash
+for %%I in ("%~f0\..") do path %%~fI;%path%
+rem Ask kpsewhich about root and texmfsys trees (the first line of output)
+rem and location of the script (the second line of output)
+rem (4NT shell acts wierd with 'if' statements in a 'for' loop,
+rem so better process this output further in a subroutine)
+for /f "tokens=1-3 delims=;" %%I in (
+ 'kpsewhich --expand-var "$SELFAUTOPARENT;$TEXMFSYSCONFIG;$TEXMFSYSVAR" ^
+ --format texmfscripts "%progname%.pl" "%progname%.tlu" "%progname%.rb" "%progname%.py"'
+) do (
+ call :setcmdenv "%%~I" "%%~J" "%%~K"
+)
+
+rem By now we should have the command to execute (whatever that is), so
+rem pass through all the arguments we have and execute it
+%command% %*
+rem Finish with goto :eof (it will preserve the last set errorlevel)
+goto :eof
+
+REM SUBROUTINES
+
+:setcmdenv selfautoparent texmfsysconfig texmfsysvar
+rem If there is only one argument it must be a script name
+if "%~2"=="" goto :setcmd
+rem Otherwise, it is the first line from kpsewhich, so to set up the environment
+set PERL5LIB=%~f1\tlpkg\tlperl\lib
+set GS_LIB=%~f1\tlpkg\tlgs\lib;%~f1\tlpkg\tlgs\fonts
+path %~f1\tlpkg\tlgs\bin;%~f1\tlpkg\tlperl\bin;%~f1\tlpkg\installer;%~f1\tlpkg\installer\wget;%path%
+if not defined TEX_SYS_PROG goto :eof
+rem Extra stuff for sys version
+set TEXMFCONFIG=%~2
+set TEXMFVAR=%~3
+rem For sys version we might have an executable in the bin dir, so check for it
+if exist "%~f1\bin\win32\%progname%.exe" set command="%~f1\bin\win32\%progname%.exe"
+goto :eof
+
+:setcmd script
+rem Set command based on the script extension
+if /i %~x1==.pl set command=Perl.exe "%~f1"
+if /i %~x1==.tlu set command=TeXLua.exe "%~f1"
+rem For Ruby and Python we additionally check if their interpreter is available
+if /i %~x1==.rb call :chkcmd Ruby.exe "%~f1"
+if /i %~x1==.py call :chkcmd Python.exe "%~f1"
+goto :eof
+
+:chkcmd program script
+set command=%*
+rem If there is no interpreter Ruby or Python, suggest getting one
+if "%~$PATH:1"=="" set command=call :noinst %*
+goto :eof
+
+:noinst program
+echo %1 not found on search path>&2
+echo %~n1 is not distributed with TeX Live and has to be installed separately
+exit /b 1
+
+:noscript
+echo %progname%: no appropriate script or program found>&2
+exit /b 1
diff --git a/Master/bin/win32/xindy.bat b/Master/bin/win32/xindy.bat
index fe949613d7c..42ba109d438 100755
--- a/Master/bin/win32/xindy.bat
+++ b/Master/bin/win32/xindy.bat
@@ -1,8 +1,78 @@
@echo off
-rem tl-w32-starter.bat
-rem universal script starter, batch file part
-rem this program calls the tl-w32-wrapper.texlua
-setlocal
-set ownpath=%~dp0%
-texlua "%ownpath%tl-w32-wrapper.texlua" "%~dpn0" %*
-endlocal
+rem Universal script launcher
+rem
+rem Copyright 2009 by Tomasz M. Trzeciak
+rem Public Domain
+
+rem Make environment changes local
+setlocal enableextensions
+rem Get program/script name
+if not defined progname set progname=%~n0
+rem Check if this is 'sys' version of program
+set TEX_SYS_PROG=
+if /i "%progname:~-4%"=="-sys" (
+ set progname=%progname:~0,-4%
+ set TEX_SYS_PROG=true
+)
+
+rem Default command to execute
+set command=call :noscript
+rem Make sure our dir is on the search path; avoid trailing backslash
+for %%I in ("%~f0\..") do path %%~fI;%path%
+rem Ask kpsewhich about root and texmfsys trees (the first line of output)
+rem and location of the script (the second line of output)
+rem (4NT shell acts wierd with 'if' statements in a 'for' loop,
+rem so better process this output further in a subroutine)
+for /f "tokens=1-3 delims=;" %%I in (
+ 'kpsewhich --expand-var "$SELFAUTOPARENT;$TEXMFSYSCONFIG;$TEXMFSYSVAR" ^
+ --format texmfscripts "%progname%.pl" "%progname%.tlu" "%progname%.rb" "%progname%.py"'
+) do (
+ call :setcmdenv "%%~I" "%%~J" "%%~K"
+)
+
+rem By now we should have the command to execute (whatever that is), so
+rem pass through all the arguments we have and execute it
+%command% %*
+rem Finish with goto :eof (it will preserve the last set errorlevel)
+goto :eof
+
+REM SUBROUTINES
+
+:setcmdenv selfautoparent texmfsysconfig texmfsysvar
+rem If there is only one argument it must be a script name
+if "%~2"=="" goto :setcmd
+rem Otherwise, it is the first line from kpsewhich, so to set up the environment
+set PERL5LIB=%~f1\tlpkg\tlperl\lib
+set GS_LIB=%~f1\tlpkg\tlgs\lib;%~f1\tlpkg\tlgs\fonts
+path %~f1\tlpkg\tlgs\bin;%~f1\tlpkg\tlperl\bin;%~f1\tlpkg\installer;%~f1\tlpkg\installer\wget;%path%
+if not defined TEX_SYS_PROG goto :eof
+rem Extra stuff for sys version
+set TEXMFCONFIG=%~2
+set TEXMFVAR=%~3
+rem For sys version we might have an executable in the bin dir, so check for it
+if exist "%~f1\bin\win32\%progname%.exe" set command="%~f1\bin\win32\%progname%.exe"
+goto :eof
+
+:setcmd script
+rem Set command based on the script extension
+if /i %~x1==.pl set command=Perl.exe "%~f1"
+if /i %~x1==.tlu set command=TeXLua.exe "%~f1"
+rem For Ruby and Python we additionally check if their interpreter is available
+if /i %~x1==.rb call :chkcmd Ruby.exe "%~f1"
+if /i %~x1==.py call :chkcmd Python.exe "%~f1"
+goto :eof
+
+:chkcmd program script
+set command=%*
+rem If there is no interpreter Ruby or Python, suggest getting one
+if "%~$PATH:1"=="" set command=call :noinst %*
+goto :eof
+
+:noinst program
+echo %1 not found on search path>&2
+echo %~n1 is not distributed with TeX Live and has to be installed separately
+exit /b 1
+
+:noscript
+echo %progname%: no appropriate script or program found>&2
+exit /b 1
diff --git a/Master/tlpkg/bin/check-wrapper-consistency b/Master/tlpkg/bin/check-wrapper-consistency
index 9f7e71e9e42..caf1cd92f13 100755
--- a/Master/tlpkg/bin/check-wrapper-consistency
+++ b/Master/tlpkg/bin/check-wrapper-consistency
@@ -100,13 +100,9 @@ sub check_w32
for my $k (sort keys %uw) {
my $target = $uw{$k};
next if $target =~ /context/; # does things its own way
- next if $target =~ /dviasm|ebong/; # no .bat for python
- next if $target =~ /epspdf/; # checks for ruby too
- next if $target =~ /latexmk/; # has its own .bat
next if $target =~ /ps4pdf/; # has its own .bat
next if $target =~ /simpdftex/; # shell script
next if $target =~ /tex4ht/; # tex4ht has its own .bat's
- next if $target =~ /texdoc/; # using a modified wrapper
next if $target =~ /tlmgr/; # does things its own way
#print "$k -> $uw{$k}\n";
$diff += system ("cmp $w32dir/$k.bat $w32canonical");