@echo off
REM Install latex2html for fpTeX.
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 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 Get program ID and top directory
REM ========================================================================
REM notify user of creation
cls
echo.
echo It appears that the LaTeX2HTML folders were successfully created.
echo I will now search for fpTeX.
echo.
var\choose anykey "Read the message above and hit any key to continue"
cls
REM Set the fpTeX ID
set id=fpt
if not "%id%" == "fpt" goto enverr
REM Search for a TeX top directory
set top=C:\PROGRA~1\TEXLIVE\
if not "%top%" == "C:\PROGRA~1\TEXLIVE\" goto enverr
if not exist %top% goto asktop
echo A TeX folder was found, with DOS name:
echo %top%
echo Unless you have more than one version of fpTeX installed, this should be
echo the one. (Note that Program Files shows up as PROGRA~1).
var\choose yn "Proceed with this version of fpTeX:y"
if errorlevel 2 goto asktop
if errorlevel 1 goto havtop
goto err
:asktop
echo.
echo Unable to find a fpTeX installation in C:\Program Files\TeXLive. You will
echo need to manually enter the correct location. (Note that this program must
echo use DOS names. For example, "Program Files" will be converted to
echo PROGRA~1 for DOS):
echo.
var\askdir top Please enter the folder of your TeX program:
if errorlevel 1 goto err
call asktmp.bat
if "%top%" == "" goto enverr
if not exist %top% goto perr
cls
:havtop
var\clrerr
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 Move the style files into position
REM ========================================================================
set stys=latex2html\
if not "%stys%" == "latex2html\" goto enverr
set sty=%top%texmf\tex\latex\
if not "%sty%" == "%top%texmf\tex\latex\" goto enverr
if exist %sty% goto calsty
echo.
echo *** Style files directory
echo %sty%
echo does not exist?? It is supposed to in any recent fpTeX.
var\choose yn "Are you sure the top directory is right"
if errorlevel 2 goto asktop
if errorlevel 1 goto calsty
goto err
:calsty
var\clrerr
set stat=y
if not "%stat%" == "y" goto enverr
call var\copysty.bat
if "%stat%" == "" goto err
REM ========================================================================
REM Search for the bin directory
REM ========================================================================
set bin=%top%bin\win32\
if not "%bin%" == "%top%bin\win32\" goto enverr
if exist %bin% goto havbin
echo *** Program files directory
echo %bin%
echo does not exist?? It is supposed to in any recent fpTeX.
var\choose yn "Are you sure the top directory is right"
if errorlevel 2 goto asktop
if errorlevel 1 goto askbin
goto err
:havbin
REM check whether it contains latex.exe
:chkbin
if exist %bin%latex.exe goto binok
echo.
echo *** The latex executable
echo %bin%latex.exe
echo does not exist. It must be there to use this easy install. Please
echo select one of the numbers below:
echo.
echo 1) Enter another top folder than %top%.
echo 2) Enter another programs folder than %bin%.
echo 3) Abort this install to install with l2hingen.bat instead
echo.
var\choose 123 "Press the correct number from the list above"
if errorlevel 3 goto err
if errorlevel 2 goto askbin
if errorlevel 1 goto asktop
goto err
:askbin
echo.
var\askdir bin Programs directory: %bin%
if errorlevel 1 goto err
call asktmp.bat
if "%bin%" == "" goto enverr
if not exist %bin% goto perr
goto chkbin
:binok
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 %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 Refresh the file name database
REM ========================================================================
echo.
echo I will now attempt to refresh the TeX data base to be aware of the
echo new style files by trying to run mktexlsr.
echo.
var\choose anykey "Press any key"
cls
if not exist %bin%mktexlsr.exe goto pini3
echo %bin%mktexlsr.exe
%bin%mktexlsr.exe
if errorlevel 1 goto pini3
goto piniend
:pini3
echo.
echo *** ERROR Unable to refresh the fpTeX file name data base.
echo You may not have administrator privileges. Please go into Start/
echo Programs/TeXLive/Maintenance and Rebuild ls-R filenames databases.
echo If there are no error messages, that should fix it. Otherwise, log
echo in with administrative privileges and try running mktexlsr that way.
echo Installation is further pretty much done.
echo.
var\choose anykey "After reading the above error message, hit any key"
cls
:piniend
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\asktest.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