.KEY dest,help/s
.BRA {
.KET }

; :ts=3
; HDInstall - Install everything onto a hard drive.
;
; Inputs:
;    dest   Directory to install A2000 Pro into
;    help   Print instructions
;

;
; Some preliminary setup.
;
ASSIGN PSInstUtil: ""         ; Hook we can use when disk has been removed
ASSIGN PSInstOrig: ""         ; Save initial directory

; Make sure he's running WB 1.3!
; Under 1.3, the "1 gt 2" test fails; we proceed to "FAILAT 10".
; Under 1.2, however, the IF command itself dies, since GT is not defined;
; execution is not suspended, and the ECHO and SKIP are seen.
FAILAT 21
IF >NIL: 1 gt 2
        ECHO "*NVersion 1.3 of the Amiga Workbench software *E[;1mmust*E[m be"
        ECHO "present before this installation can proceed.*N"
   SKIP wrapup
ENDIF
FAILAT 10

; Start with a fresh copy, to avoid any screwups
IF EXISTS RAM:PSInstall
   DELETE RAM:PSInstall/#? quiet
ELSE
   MAKEDIR RAM:PSInstall
ENDIF


C:COPY             C:Copy         RAM:PSInstall
RAM:PSInstall/Copy C:Cd           RAM:PSInstall
RAM:PSInstall/Copy C:Assign       RAM:PSInstall
RAM:PSInstall/Copy C:Echo         RAM:PSInstall
RAM:PSInstall/Copy C:FailAt       RAM:PSInstall
RAM:PSInstall/Copy C:If           RAM:PSInstall
RAM:PSInstall/Copy C:Else         RAM:PSInstall
RAM:PSInstall/Copy C:Endif        RAM:PSInstall
RAM:PSInstall/Copy C:Makedir      RAM:PSInstall
RAM:PSInstall/Copy C:Execute      RAM:PSInstall
CD ram:PSInstall              ; Search it without adding it to path

COPY PSInstUtil:Misc/DiskMount    RAM:PSInstall
COPY PSInstUtil:Misc/InstUtil     RAM:PSInstall
COPY PSInstUtil:Misc/#?Install-Proc RAM:PSInstall quiet
COPY PSInstUtil:Misc/Icons/#?.info RAM:PSInstall quiet
COPY PSInstUtil:Misc/showme RAM:PSInstall
COPY PSInstUtil:Misc/HELP-Install RAM:PSInstall

Assign PSInstPgm: :           ; Make sure these start fresh, too.

;
; Make sure needed system assignments exist.
;
INSTUTIL isdir T:
IF WARN
   INSTUTIL isdir RAM:T
   IF WARN
      MAKEDIR ram:T
   ENDIF
   ASSIGN T: ram:T
ENDIF

INSTUTIL isdir ENV:
IF WARN
   INSTUTIL isdir RAM:ENV
   IF WARN
      MAKEDIR ram:ENV
   ENDIF
   ASSIGN ENV: ram:ENV
ENDIF


;
; HELP processing
;
IF "{help}" eq "HELP"
   SKIP showme
ENDIF


INSTUTIL ask -dy "Do you need instructions [Y/N]? Y"
IF WARN
   SKIP noshow
ENDIF

LAB showme
   RAM:PSInstall/showme RAM:PSInstall/HELP-Install
LAB noshow


;
; Make sure that the destination exists, that its name is
; in a useable form (ie. that it ends with a '/' if it's a directory),
; and that the user in fact wants to install into it.
;
IF NOT EXISTS {dest$SYS:}
   ECHO "*N ********** Couldn't find Hard Disk drawer {dest$SYS:} **********"
   SKIP forhelp
ENDIF

INSTUTIL isdir {dest$SYS:}
IF WARN
   CD RAM:PSInstall
   ECHO "*N ********** {dest$SYS:} is not a drawer! **********"
LAB forhelp
   ECHO "*N For help, type"
   ECHO "      EXECUTE A2000_A:Misc/HDInstall help"
   ECHO "*N or double-click on the *"Help*" icon in this drawer*N"
   SKIP wrapup
ENDIF
CD RAM:PSInstall

ECHO >ram:PSInstall/DestPath1 "{dest$SYS:}"
INSTUTIL <ram:PSInstall/DestPath1 >ram:PSInstall/DestPath2 fixdir


;TransWrite
LAB transwrite

ECHO "*N Answering *"No*" to the following question will cancel"
ECHO " the installation of the following program.*N"
INSTUTIL ask -dy "Install TransWrite onto {dest$SYS:} [Y/N]? Y"
IF warn
   ECHO " Installation aborted!*N"
   SKIP goldfile
ENDIF


ECHO "*N*N ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*N"
ECHO " Begin installation of TransWrite onto {dest$SYS:}*N"

EXECUTE <ram:PSInstall/DestPath2 >nil: ram:PSInstall/TW_Install-Proc ?

ECHO "*N --------------------------------------------------------------------"
ECHO "*N*N Installation of TransWrite complete."

;GoldFile
LAB goldfile

ECHO "*N Answering *"No*" to the following question will cancel"
ECHO " the installation of the following program.*N"
INSTUTIL ask -dy "Install GoldFile onto {dest$SYS:} [Y/N]? Y"
IF warn
   ECHO " Installation aborted!*N"
   SKIP music2000
ENDIF


ECHO "*N*N ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*N"
ECHO " Begin installation of GoldFile onto {dest$SYS:}*N"

EXECUTE <ram:PSInstall/DestPath2 >nil: ram:PSInstall/GF_Install-Proc ?

ECHO "*N --------------------------------------------------------------------"
ECHO "*N*N Installation of GoldFile complete."
ECHO "*N Please remove the GoldFile floppy disk from the drives."
ECHO "*N ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*N"

;Music2000
LAB music2000

Assign PSInstPgm:
ECHO "*N Answering *"No*" to the following question will cancel"
ECHO " the installation of the following program.*N"
INSTUTIL ask -dy "Install Music2000 onto {dest$SYS:} [Y/N]? Y"
IF warn
   ECHO " Installation aborted!*N"
   SKIP paint2000
ENDIF


ECHO "*N*N ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*N"
ECHO " Begin installation of Music2000 onto {dest$SYS:}*N"

EXECUTE <ram:PSInstall/DestPath2 >nil: ram:PSInstall/M2000_Install-Proc ?

ECHO "*N --------------------------------------------------------------------"
ECHO "*N*N Installation of Music2000 complete."

;Paint2000
LAB paint2000

ECHO "*N Answering *"No*" to the following question will cancel"
ECHO " the installation of the following program.*N"
INSTUTIL ask -dy "Install Paint2000 onto {dest$SYS:} [Y/N]? Y"
IF warn
   ECHO " Installation aborted!*N"
   SKIP mediashow
ENDIF


ECHO "*N*N ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*N"
ECHO " Begin installation of Paint2000 onto {dest$SYS:}*N"

EXECUTE <ram:PSInstall/DestPath2 >nil: ram:PSInstall/P2000_Install-Proc ?

ECHO "*N --------------------------------------------------------------------"
ECHO "*N*N Installation of Paint2000 complete."

;MediaShow
LAB mediashow

ECHO "*N Answering *"No*" to the following question will cancel"
ECHO " the installation of the following program.*N"
INSTUTIL ask -dy "Install MediaShow onto {dest$SYS:} [Y/N]? Y"
IF warn
   ECHO " Installation aborted!*N"
   SKIP advantage
ENDIF


ECHO "*N*N ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*N"
ECHO " Begin installation of MediaShow onto {dest$SYS:}*N"

EXECUTE <ram:PSInstall/DestPath2 >nil: ram:PSInstall/MS_Install-Proc ?

ECHO "*N --------------------------------------------------------------------"
ECHO "*N*N Installation of MediaShow complete."
ECHO "*N Please remove the MediaShow floppy disk from the drives."
ECHO "*N ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*N"

;Advantage
LAB advantage

Assign PSInstPgm:
ECHO "*N Answering *"No*" to the following question will cancel"
ECHO " the installation of the following program.*N"
INSTUTIL ask -dy "Install Advantage onto {dest$SYS:} [Y/N]? Y"
IF warn
   ECHO " Installation aborted!*N"
   SKIP crossdos
ENDIF


ECHO "*N*N ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*N"
ECHO " Begin installation of Advantage onto {dest$SYS:}*N"

EXECUTE <ram:PSInstall/DestPath2 >nil: ram:PSInstall/ADV_Install-Proc ?

ECHO "*N --------------------------------------------------------------------"
ECHO "*N*N Installation of Advantage complete."
;ECHO "*N Please remove the Advantage floppy disk from the drives."
ECHO "*N ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*N"

;CrossDOS
LAB crossdos

ECHO "*N Answering *"No*" to the following question will cancel"
ECHO " the installation of the following program.*N"
INSTUTIL ask -dy "Install CrossDOS [Y/N]? Y"
IF warn
   ECHO " Installation aborted!*N"
   SKIP pagesetterii
ENDIF


ECHO "*N*N ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*N"
ECHO " Begin installation of CrossDOS onto {dest$SYS:}*N"

EXECUTE <ram:PSInstall/DestPath2 >nil: ram:PSInstall/CDOS_Install-Proc ?

ECHO "*N --------------------------------------------------------------------"
ECHO "*N*N Installation of CrossDOS complete."
ECHO "*N Please remove the CrossDOS floppy disk from the drives."
ECHO "*N ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*N"

;PageSetterII
LAB pagesetterii

Assign PSInstPgm:

CD RAM:PSInstall

ECHO "*N Answering *"No*" to the following question will cancel"
ECHO " the installation of the following program.*N"
INSTUTIL ask -dy "Install PageSetterII onto {dest$SYS:} [Y/N]? Y"
IF warn
   ECHO " Installation aborted!*N"
   SKIP wrapup
ENDIF

ECHO "*N*N ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*N"
ECHO " Begin installation of PageSetterII onto {dest$SYS:}*N"

EXECUTE <ram:PSInstall/DestPath2 >nil: ram:PSInstall/PSII_Install-Proc ?

ECHO "*N --------------------------------------------------------------------"
ECHO "*N*N Installation of PageSetterII complete."
ECHO "*N Please remove the PageSetterII floppy disk from the drives."
ECHO "*N ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*N"

;
; Clean up after ourselves
; Can't depend on anything but PSInstOrig: and PSInstUtil:,
; since we can come here from right after their definition.
;
LAB wrapup

; C:SETENV >NIL: check A2000_A:
; CD df0:
; CD >RAM:PSInstall/VolumeCheck
CD RAM:PSInstall
; C:SETENV >NIL: <RAM:PSInstall/VolumeCheck PSInstVC ?
; IF NOT $PSInstVC eq $check
        Assign PSInstPgm:
        EXECUTE RAM:PSInstall/DiskMount Installation A2000_A: PSInstPgm:
; ENDIF

CD PSInstOrig:
Assign PSInstOrig:
Assign PSInstPgm:
DELETE >NIL: RAM:PSInstall all quiet

PSInstUtil:Misc/InstUtil ask "Press RETURN."
Assign PSInstUtil:


