.KEY disk/a,adffile/a
.BRA {
.KET }

; Adf Template
; -------------
;
; Date: 2018-12-11
; Author: Henrik Noerfjand Stengaard
;
; AmigaDOS script to template to install amiga os 3.1.4 from adf file
; "disk" argument defines amiga os 3.1.4 adf to install.


; quit, if detect disk doesn't exist
IF NOT EXISTS "{adffile}"
  echo "*e[1mError: Adf file '{adffile}' doesn't exist!*e[0m"
  quit 20
ENDIF

; quit, if detect disk doesn't exist
IF NOT EXISTS "INSTALLDIR:S/Amiga-OS-3.1.4/Detect-{disk}"
  echo "*e[1mError: Detect Amiga OS 3.1.4 {disk} doesn't exist!*e[0m"
  quit 20
ENDIF

; quit, if install disk doesn't exist
IF NOT EXISTS "INSTALLDIR:S/Amiga-OS-3.1.4/Install-{disk}"
  echo "*e[1mError: Install Amiga OS 3.1.4 {disk} doesn't exist!*e[0m"
  quit 20
ENDIF


; mount disk
; ----------

; run mount adf
execute "INSTALLDIR:S/Mount-Adf" "{adffile}"

; fail, if adf is not mounted
IF NOT "$adfmounted" EQ 1 VAL
  echo "*e[1mError: Failed to mount Amiga OS 3.1.4 {disk} adf file!*e[0m"
  quit 20
ENDIF

; run install amiga os 3.1.4 disk
echo "Amiga OS 3.1.4 {disk}..."
Execute "INSTALLDIR:S/Amiga-OS-3.1.4/Install-{disk}"

; run unmount adf
execute "INSTALLDIR:S/Unmount-Adf"
