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

;
; The main command file for PPage installation.
; Checks argument validity, calls other command files to do the work,
; and prints messages.
;
; Inputs:
;    second  Where to find stuff
;    dest    Partition to install PPage into
;
;
; This installation procedure can be executed in two ways:
;
; For initial installation, the SECOND option should not be given.
; In this case:
; - Install-1 will be called to perform the basic installation.  It will
;   create {dest$SYS}:PPage/, and copy the PPage program and ALL of the
;   "PPage Utilities" diskette into {dest$SYS}:PPage/.
; - Install-2 will be called, with {dest$SYS}:PPage/ as its source directory.
;   Its job is to move things (fonts, printer device, and Preferences)
;   to their working locations.
;
; The other option is useful when Install-1 has already run successfully,
; and all that is needed is to run Install-2.  In this case, the {second}
; parameter should be given, and is the partition which was given as {dest$SYS}:
; when the initial installation was performed, with "PPage/" appended.
; - Install-1 will NOT be executed.
; - Install-2 will be executed, with {second} as its source directory.
;


IF "{help}" eq "HELP"
   PPage:showme PPageUtil:Misc/HELP-Install
   QUIT
ENDIF

IF NOT EXISTS {dest$SYS}:
   ECHO " "
   ECHO " ****** Couldn't find Hard Disk partition {dest$SYS}: ******"
   ECHO " "
   ECHO " For help, type"
   ECHO "      EXECUTE PPageUtil:Misc/HDInstall help"
   ECHO " "

   QUIT
ENDIF

IF NOT "{second}" EQ ""
   IF NOT EXISTS {second}
      ECHO " "
      ECHO " ****** Couldn't find directory {second} ******"
      ECHO " "
      ECHO " For help, type"
      ECHO "      EXECUTE PPageUtil:Misc/HDInstall help"
      ECHO " "

      QUIT
   ENDIF
ENDIF

ECHO " "
PPageUtil:misc/ASK -dy "Install Professional Page onto {dest$SYS}: ? [Y/N]? Y"

IF warn

   ECHO " "
   ECHO " Installation aborted!"
   ECHO " "
   QUIT

ELSE

   ;
   ; Copy some programs to RAM: to speed things up.
   ;
   COPY     C:Copy	       RAM:
   RAM:COPY C:Echo	       RAM:
   RAM:COPY C:If	       RAM:
   RAM:COPY C:Else	       RAM:
   RAM:COPY C:Endif	       RAM:
   RAM:COPY C:Makedir	       RAM:
   RAM:COPY C:Execute	       RAM:
   RAM:COPY PPageUtil:Misc/ask RAM:
   CD RAM:


   ECHO " "
   ECHO " "
   ECHO " ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~"
   ECHO " "
   ECHO " Begin installation of Professional Page onto {dest$SYS}:"


   IF "{second}" eq ""

      EXECUTE PPageUtil:Misc/Install-1	PPageUtil:  {dest$SYS}:
      EXECUTE PPageUtil:Misc/Install-2	{dest$SYS}:PPage/ {dest$SYS}:

   ELSE

      ECHO " "
      ECHO "     Skipping main installation procedure..."

      EXECUTE PPageUtil:Misc/Install-2	{second} {dest$SYS}:

   ENDIF

   ECHO " "
   ECHO " "
   ECHO " --------------------------------------------------------------------"
   ECHO "  Please add the following commands to the file s:Startup-sequence:"
   ECHO " "
   ECHO "  ASSIGN PPage: {dest$SYS}:PPage"
   ECHO "  ASSIGN PPageUtil: {dest$SYS}:Page"
   ECHO " "
   ECHO " --------------------------------------------------------------------"
   ECHO " "
   ECHO " "
   ECHO " Installation of Professional Page complete."
   ECHO " "
   ECHO " ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~"
   ECHO " "

ENDIF	 ; Install PPage on dest ?


