@ECHO OFF
REM INST.BAT - The purpose of this batch file is to ease installation of FreeDOS.
REM Written and modified by Jeremy Davis and B Blaauw  (2002)

REM initialize the header displayed at the top of the screen (update each release)
SET line1=FreeDOS˙Installation FreeDOS˙Ripcord˙Beta˙8˙[Nikita]˙Distribution ˙
SET HEADER=for %%x in ( %line1% ) do echo %%x

CLS
%HEADER%
rem Default to using a monochrome monitor...
SET COLOR=MONO
choice /N /C:YN"Enable monochrome (/MONO) mode [YN]?"
IF ERRORLEVEL 2 SET COLOR=EGAVGA

CLS
%HEADER%
rem Default to using a full install set...
set DISTRO=FULL
set instoption=/ism
choice /C:FM "Do you wish to do a [F]ULL or [M]INI install"
IF ERRORLEVEL 2 SET DISTRO=MINI

IF "%DISTRO%"=="MINI" set instoption=%instoption% /df INSTALL.MIN
IF "%COLOR%"=="MONO" set instoption=%instoption% /mono

rem run xkeyb if needed
CALL LDXKEYB.BAT

CLS
%HEADER%
IF "%COLOR%"=="MONO" GOTO STDPROMPTS

rem run fancy tool
CD INSTALL
DrvMngr
CD ..
IF ERRORLEVEL 1 GOTO ABORTINST
GOTO DO_INST


:STDPROMPTS
ECHO If you have not already created a DOS partition then you should
ECHO run FDISK now, otherwise you may omit this step.  
ECHO ˙  Follow the on-screen prompts to create a new primary partition
ECHO ˙  and mark it as active.  After running FDISK you will need to reboot.
ECHO ˙  Just boot off the install boot floppy again, & select no this prompt.
ECHO.
choice "Would you like to run FDISK now"
IF ERRORLEVEL 2 GOTO POSTFDSK
IF "%COLOR%"=="MONO" FDISK /MONO
IF NOT "%COLOR%"=="MONO" FDISK
REM Normal FDISK executed whenever Color unset value or non-MONO value

:POSTFDSK
REM We CLS here since if the person ran FDISK but didn't change
REM anything, then the screen is cleared but the cursor is midway down.
CLS
%HEADER%
ECHO If you just created a new partition for FreeDOS then you must FORMAT
ECHO it now.  You may also format the partition if you wish to wipe it clean.
ECHO WARNING: All data on your C: drive will be lost, so only select YES
ECHO ˙        if you are sure. (You must also type 'Y' at Format's prompt).
ECHO.

SET DRIVES=C D E F G H I J K L M N O P Q R S T U V W X Y Z
SET DRIVE=C:
SET FMTOPTION=/Q /U /V:FREEDOS
REM above code allows INST.BAT to be called with arguments of which drive(s) should be formatted

choice "Format your C: drive now"
IF ERRORLEVEL 2 GOTO MAKEBOOT
choice "Would you like to do a Quick format (skip bad sector checking)"
IF ERRORLEVEL 2 SET FMTOPTION=/U /V:FREEDOS
GOTO LOOP

:LOOP
if not "%1"=="" SET DRIVE=%1
for %%x in ( %DRIVES% ) do if "%DRIVE%"=="%%x:" format %DRIVE% %FMTOPTION%
if not "%1"=="" shift
if "%1"=="" goto ENDFORMAT
goto LOOP

:ENDFORMAT
pause

:MAKEBOOT
CLS
%HEADER%
ECHO You now need to make the drive bootable (that is copy the KERNEL and
ECHO COMMAND to it along with setting up the boot record).
ECHO.

choice "Run SYS C: now to do this"
IF ERRORLEVEL 2 GOTO DO_INST
sys a: c:
ECHO.
pause


:DO_INST
REM  Run INSTALL now

CLS
%HEADER%
ECHO %DISTRO% installation selected.
ECHO.
REM ECHO For the source you may specify \ (or full path, e.g. A:\)
ECHO For the source you may specify %cdrom%\FREEDOS\INSTALL\DISKSETS
ECHO You will also be prompted where to install FreeDOS,
ECHO most people will choose C:\FDOS (or C:\DOS).
ECHO.

pause

cls
CD INSTALL
INSTALL %instoption% /src %cdrom%\FREEDOS\INSTALL\DISKSETS
ECHO.
ECHO Your hard drive should be ready to boot FreeDOS,
ECHO (optional:) please copy the sample CONFIG.SYS & AUTOEXEC.BAT
ECHO to C:\ & edit as needed, and then reboot.
set PROMPT=$P$G
GOTO END

:ABORTINST
CLS
ECHO "Install Aborted!"
REM if exist a:\director.bat del a:\director.bat
SET CLI_END=yes
GOTO done

:END
FOR %%x in ( ˙ Enjoy˙FreeDOS! ˙ ) DO echo %%x
:done
%cdrom%
CD \
REM let INSTALL.BAT call END.BAT
