@echo off

rem :: ========================================================================
rem :: This script will install or upgrade AiR-BOOT.
rem :: However, an upgrade will only work if the installed version is older.
rem :: To force the installer to write the code, use the /forcecode flag.
rem :: ========================================================================

rem :: Do not interfere with system environment
setlocal

rem :: Default to EN if language not specified
if "%ablang%"=="" set ablang=en

rem :: Check if we are not on some WindowsNT system
if "%os2_shell%"=="" goto not_os2

rem :: Create temporary directory and copy installer and lang-specific loader
if not exist os2.%ablang% md os2.%ablang%
copy install\os2\airboot2.exe os2.%ablang%
copy loaders\airbt-%ablang%.bin os2.%ablang%\airboot.bin

rem :: Now run the installer from there
cd os2.%ablang%
airboot2.exe %1 %2 %3 %4 %5 %6 %7 %8 %9
cd ..

rem :: Remove the temporary stuff
if exist os2.%ablang% del /n os2.%ablang%\*.*
if exist os2.%ablang% rd os2.%ablang%
goto end

rem :: Probably WindowsNT, user must do language stuff themselves
:not_os2
echo.
echo ERROR: This does not look like an OS/2 system !
echo        For WindowsNT [EN], go to install\winnt and run 'airbootw.exe'.
echo        For other languages see this script on how to do it.
echo        Aborting...
goto end

rem :: Done
:end
