@echo off
REM Install LaTeX2HTML and emTeX.
REM ========================================================================
REM check whether we have l2hmtx.exe or emTeX is already there
REM ========================================================================
REM move to the C:\ top directory
C:
cd \
if not exist C:\EMTEX\BIN\rsx.exe goto mustmtx
if not exist C:\EMTEX\BIN\tex386.exe goto mustmtx
if not exist C:\EMTEX\BIN\dvips.exe goto mustmtx
if not exist C:\EMTEX\TEXINPUT\LATEX2E\ goto mustmtx
if not exist C:\TEXFONTS\PS\BLUESKY\LOGO9.PFB goto mustmtx
if exist C:\EMTEX\TEXINPUT\html.sty goto nomust
if exist C:\EMTEX\TEXINPUT\LATEX2E\l2h\html.sty goto nomust
:mustmtx
if exist l2hmtx.exe goto endmust
echo.
echo *** The l2hmtx.exe file is not in the top C: disk folder. Download this
echo file first, then try again.
goto err
:nomust
if exist l2hmtx.exe goto endmust
cls
echo.
echo *** This installation will keep your existing version of emTeX. If you
echo want to restore emTeX, you must download l2hmtx.exe and put it in the
echo top C: folder. To abort this installation hold down the [Ctrl] key and
echo hit [c]. Then enter [y]. To proceed without restoring emTeX just hit
echo [Enter].
pause
:endmust
REM ========================================================================
REM Uncompress l2hfu3.exe
REM ========================================================================
REM move to the C:\ top directory
C:
cd \
REM skip extraction if the argument is skip
if "%1" == "skip" goto skip
REM must have l2hfu3.exe
if exist C:\l2hfu3.exe goto havzip
echo.
echo *** The l2hfu3.exe file is not in the top C: disk folder. Download this
echo file first, then try again.
goto err
:havzip
REM reset the errorlevel on 98
l2hfu3.exe -z
if errorlevel 1 goto perr
REM Move existing l2h directories out of the way.
if exist C:\l2h\ goto wrnol2h
if exist C:\l2hs\ goto wrnol2h
if exist C:\l2hins\ goto wrnol2h
if exist C:\l2hsup\ goto wrnol2h
goto endol2h
:wrnol2h
cls
echo WARNING: One or more of the folders C:\l2h[s], C:\l2hsup, and C:\l2hins
echo already exist. These directories will be moved to a folder
echo l2hold unless you abort now. To abort, hold down the [Ctrl]
echo key and hit [c]. Then enter [y]. Otherwise just hit [Enter].
pause
cls
if not exist C:\l2holder\ goto noolder
echo *** A folder C:\l2holder exists! Move that folder elsewhere, then try
echo again.
goto err
:noolder
if exist C:\l2hold\ move C:\l2hold C:\l2holder
if errorlevel 1 goto errol2h
mkdir C:\l2hold
if errorlevel 1 goto errol2h
if exist C:\l2holder\ move C:\l2holder C:\l2hold
if errorlevel 1 goto errol2h
if exist C:\l2h\ move C:\l2h C:\l2hold
if errorlevel 1 goto errol2h
if exist C:\l2hs\ move C:\l2hs C:\l2hold
if errorlevel 1 goto errol2h
if exist C:\l2hsup\ move C:\l2hsup C:\l2hold
if errorlevel 1 goto errol2h
if exist C:\l2hins\ move C:\l2hins C:\l2hold
if errorlevel 1 goto errol2h
REM see whether we really got rid of them
if exist C:\l2h\ goto errol2h
if exist C:\l2hs\ goto errol2h
if exist C:\l2hins\ goto errol2h
if exist C:\l2hsup\ goto errol2h
if exist C:\l2holder\ goto errol2h
goto endol2h
:errol2h
echo *** Unable to move your old l2h files out of the way. Installation cannot
echo continue.
goto perr
:endol2h
REM Warn about copyright
cls
echo.
echo WARNING: This install includes a variety of copyrighted programs from
echo many sources and is STRICTLY FOR PERSONAL USE. It should not be
echo redistributed in any form.
echo.
echo WARNING: These programs come with ABSOLUTELY NO WARRANTY OF ANY KIND.
echo.
echo If you need to abort installation for the above reasons, hold down the
echo [Ctrl] key and hit [c]. Then enter [y]. Otherwise just hit [Enter].
pause
cls
REM unzip the latex2html files
echo.
echo I am ready to create the following LaTeX2HTML folders:
echo.
echo C:\l2hsup: Contains essential programs and the docs in l2hdocs
echo C:\l2h: LaTeX2HTML binaries and files
echo C:\l2hins: Installation files for if you want to modify l2h yourself
echo.
echo If you want to abort installation for some reason, hold down the
echo [Ctrl] key and hit [c]. Then enter [y]. Otherwise just hit [Enter].
pause
cls
l2hfu3.exe
if errorlevel 1 goto errnl2h
cls
:skip
REM see whether we really got them (at least some files)
if not exist C:\l2h\bin\latex2html.bat goto errnl2h
if not exist C:\l2hsup\l2hcrop.exe goto errnl2h
if not exist C:\l2hins\texinputs\html.sty goto errnl2h
if not exist C:\l2hsup\var\choose.exe goto errchoos
goto endnl2h
:errnl2h
echo *** Unable to create the LaTeX2HTML files. Installation cannot continue.
goto perr
:errchoos
echo *** Your version of l2hfu3.exe is outdated. This script needs the current
echo version.
goto err
:endnl2h
REM ========================================================================
REM unzip l2hmtx.exe
REM ========================================================================
if not exist C:\EMTEX\BIN\rsx.exe goto noaskmtx
if not exist C:\EMTEX\BIN\tex386.exe goto noaskmtx
if not exist C:\EMTEX\BIN\dvips.exe goto noaskmtx
if not exist C:\EMTEX\TEXINPUT\LATEX2E\ goto noaskmtx
if not exist C:\TEXFONTS\PS\BLUESKY\LOGO9.PFB goto noaskmtx
if exist C:\EMTEX\TEXINPUT\html.sty goto askmtx
if exist C:\EMTEX\TEXINPUT\LATEX2E\l2h\html.sty goto askmtx
goto noaskmtx
:askmtx
if not exist l2hmtx.exe goto donemtx
\l2hsup\var\choose yn "Keep your existing installation of emTeX"
if errorlevel 2 goto noaskmtx
if errorlevel 1 goto donemtx
goto err
:noaskmtx
\l2hsup\var\clrerr
if exist l2hmtx.exe goto domtx
echo *** Must have l2hmtx.exe in the top folder?? Was it moved?
goto err
:domtx
REM Move an existing EMTEX or texfonts directory out of the way.
if exist C:\EMTEX\ goto wrnomtx
if exist C:\texfonts\ goto wrnomtx
goto enderrom
:wrnomtx
echo WARNING: An emTeX directory C:\EMTEX and/or a fonts directory C:\texfonts
echo already exists. These directories will be moved to a folder
echo mtxold unless you abort now.
echo.
\l2hsup\var\choose akey "Hit [Enter] to continue ([Esc] to abort installation)"
if errorlevel 1 goto err
cls
if not exist C:\mtxolder\ goto noolderm
echo *** A folder C:\mtxolder exists! Move that folder elsewhere, then try
echo again.
goto err
:noolderm
if exist C:\mtxold\ move C:\mtxold C:\mtxolder
if errorlevel 1 goto erromtx
mkdir C:\mtxold
if errorlevel 1 goto erromtx
if exist C:\mtxolder\ move C:\mtxolder C:\mtxold
if errorlevel 1 goto erromtx
if exist C:\EMTEX\ move C:\EMTEX C:\mtxold
if errorlevel 1 goto erromtx
if exist C:\texfonts\ move C:\texfonts C:\mtxold
if errorlevel 1 goto erromtx
REM see whether we really got rid of them
if exist C:\EMTEX\ goto erromtx
if exist C:\texfonts\ goto erromtx
if exist C:\mtxolder\ goto erromtx
goto enderrom
:erromtx
echo *** Unable to move your old emTeX files out of the way. Installation
echo cannot continue.
goto err
:enderrom
REM unzip the emtex files
echo.
echo I am ready to create the following two folders:
echo.
echo EMTEX: contains emTeX and some documentation in DOC and DIST
echo texfonts: contains fonts from various sources
echo.
\l2hsup\var\choose akey "Hit [Enter] to continue ([Esc] to abort installation)"
if errorlevel 1 goto err
cls
l2hmtx.exe
if errorlevel 1 goto err
REM see whether we really got them (at least some files)
if not exist C:\EMTEX\BIN\rsx.exe goto errnmtx
if not exist C:\EMTEX\BIN\tex386.exe goto errnmtx
if not exist C:\EMTEX\BIN\dvips.exe goto errnmtx
if not exist C:\EMTEX\TEXINPUT\LATEX2E\ goto errnmtx
if not exist C:\TEXFONTS\PS\BLUESKY\LOGO9.PFB goto errnmtx
if exist C:\EMTEX\TEXINPUT\html.sty goto donemtx
if exist C:\EMTEX\TEXINPUT\LATEX2E\l2h\html.sty goto donemtx
:errnmtx
echo *** Unable to create the emTeX files. Installation cannot continue.
goto err
:donemtx
\l2hsup\var\clrerr
REM ========================================================================
REM Prepare the further installation
REM ========================================================================
cd \l2hsup
if errorlevel 1 goto err
set stat=y
if not "%stat%" == "y" goto enverr
call var\inini.bat
if "%stat%" == "" goto err
REM ========================================================================
REM Set program ID
REM ========================================================================
REM notify user of creation
cls
echo.
echo It appears that the LaTeX2HTML and emTeX folders were successfully
echo created.
echo.
var\choose anykey "Read the message above and hit any key to continue"
cls
REM Set the emTeX ID
set id=mtx
if not "%id%" == "mtx" goto enverr
REM ========================================================================
REM Move the latex2html files into position
REM ========================================================================
set stat=y
if not "%stat%" == "y" goto enverr
call var\copyfils.bat
if "%stat%" == "" goto err
REM ========================================================================
REM Try to create non-EPS versions of the configuration files
REM ========================================================================
call var\creaneps
REM ========================================================================
REM Save the bin directory for adding to the path
REM ========================================================================
REM Save the binary directory
if exist C:\l2hsup\initbin.txt del C:\l2hsup\initbin.txt
if not exist C:\l2hsup\initbin.txt goto dobpt
echo *** Unable to remove the existing initbin.txt??
goto err
:dobpt
echo Ensuring that %bin% will be in the PATH...
echo C:\EMTEX\BIN\ > C:\l2hsup\initbin.txt
if exist C:\l2hsup\initbin.txt goto havbpt
echo *** Unable to create initbin.txt?? Installation cannot continue.
goto err
:havbpt
REM ========================================================================
REM Create the latexl2h.bat file
REM ========================================================================
REM Copy it
if exist latexl2h.bat del latexl2h.bat
if not exist latexl2h.bat goto dollh
echo *** Unable to remove the existing latexl2h.bat??
goto err
:dollh
copy /y latexl2h.%id% latexl2h.bat
if exist latexl2h.bat goto havllh
echo *** Unable to create latexl2h.bat?? Installation cannot continue.
goto err
:havllh
REM ========================================================================
REM Create the secondary init file
REM ========================================================================
if exist init2.bat del init2.bat
if not exist init2.bat goto sic
echo *** Unable to delete init2.bat??
goto err
:sic
copy init%id%.bat init2.bat
if exist init2.bat goto sich
echo *** Unable to create init2.bat?? Installation cannot continue.
goto err
:sich
REM ========================================================================
REM Finish up
REM ========================================================================
REM Clean up
if exist tmp.bat del tmp.bat
if exist asktmp.bat del asktmp.bat
set top=
set bin=
set stat=
if exist var\uninsta2.txt del var\uninsta2.txt
if exist uninsta2.bat move /y uninsta2.bat var\uninsta2.txt
REM Tell the user to test the installation, exiting at the same time
var\asktest2.bat
goto end
:perr
echo An unexpected error occurred. On Windows XP or NT, make sure that you
echo are logged on with administrator privileges. Check disk status and
echo whether some installed files may have read-only attributes.
goto err
:enverr
echo *** Out of environment space! On Windows 98-ME, right click the icon,
echo select Properties / Memory, and increase the initial environment.
echo This should not happen on Windows XP. If it does anyway, do Start /
echo Run / CMD and enter "set", then tell l2h@dommelen.net how much stuff
echo is there.
:err
echo The installation failed!
pause
:end