.BRA {
.KET }

; :ts=3
; HDInstall - Install Professional Page onto a hard drive.
;
; Inputs:
;    dest   Directory to install PPage into
;    help   Print instructions
;

ECHO "------------------------------IMPORTANT---------------------------------"
ECHO "------------------------------------------------------------------------"
ECHO "    To Install Professional Page, drag the Install icon into the"
ECHO " disk or drawer on your hard drive where you want PPage to be "
ECHO " located.  Then double-click the icon and the automatic"
ECHO " installation will begin."
ECHO " "
ECHO "------------------------------------------------------------------------"
ECHO "------------------------------------------------------------------------"

IF exists RAM:PP_Inst
    DELETE RAM:PP_Inst all quiet
ENDIF

makedir RAM:PP_Inst
copy ppage_disk1:util/#? RAM:PP_Inst quiet

; selected ppage destination path
CD >RAM:PP_Inst/pp_destpath
ASSIGN PPageInstDest: ""

; if there is already PPage: may use that instead of given path
RAM:PP_Inst/INSTUTIL isdir PPage:
IF NOT WARN
   ECHO "PPage is assigned to the directory " NOLINE
   CD PPage:
   CD
   RAM:PP_Inst/INSTUTIL ask -dy "Do you want to update your existing PPage [Y/N]? Y"
   IF NOT WARN
      ECHO >RAM:PP_Inst/pp_destpath "PPage:/"
;
;     See if there's room for an update install
;
      RAM:PP_Inst/INSTUTIL -espace freespace PPage:
      IF NOT VAL $space GT 1200
         ECHO "Insufficient disk space free on selected drive. "
         ECHO "Please make more room and try again."
         SKIP cleanup
      ENDIF

      RAM:PP_Inst/Instutil isfile "PageInstDest:   "
      IF WARN
          DELETE >nil: PPageInstDest:Install_PPage quiet
          DELETE >nil: PPageInstDest:Install_PPage.info quiet
      ENDIF

      ASSIGN PPageInstDest: PPage:/
      DELETE >nil: PPage:DownLoad quiet
      DELETE >nil: PPage:DownLoad.info quiet

   ELSE
;
;     Don't update existing PPage, instead install where selected.
;     Are they installing to the original floppy ?
;
      RAM:PP_Inst/Instutil isfile "PPageInstDest:   "
      IF NOT WARN
          ECHO "You have attempted to install PPage to the original floppy disk !"
          ECHO "Please consult the file 'Help-Install' before proceeding further."
          ECHO
          ECHO "Installation Aborted. "
          ram:PP_Inst/INSTUTIL ask -dy " Press Return to Continue..."
          skip ppage_end
      ENDIF
;
;     See if there's room for a complete install where selected
;
      RAM:PP_Inst/INSTUTIL -espace freespace PPageInstDest:
      IF NOT VAL $space GT 2750
         ECHO "Insufficient disk space free on selected drive. "
         ECHO "Please make more room and try again."
         SKIP cleanup
      ENDIF

   ENDIF

ELSE

;
;     Are they installing to the original floppy ?
;
    RAM:PP_Inst/Instutil isfile "PPageInstDest:   "
    IF NOT WARN
        ECHO "You have attempted to install PPage to the original floppy disk !"
        ECHO "Please consult the file 'Help-Install' before proceeding further."
        ECHO
        ECHO "Installation Aborted. "
        ram:PP_Inst/INSTUTIL ask -dy " Press Return to Continue..."
        skip ppage_end
    ENDIF
;
;     See if there's room for a complete install where selected
;
   RAM:PP_Inst/INSTUTIL -espace freespace PPageInstDest:
   IF NOT VAL $space GT 2750
      ECHO "Insufficient disk space free on selected drive. "
      ECHO "Please make more room and try again."
      SKIP cleanup
   ENDIF

ENDIF


CD PPageInstDest:
ECHO "*N"
ECHO "Installing PPage to " NOLINE
CD
ECHO
RAM:PP_Inst/INSTUTIL ask -dy "Is this path correct [Y/N]? Y"
IF warn
    SKIP cleanup
ENDIF

;
;       Decompress PPage files
;

ECHO "Installing ..." NOLINE
RAM:PP_Inst/LZ -m -n -N -r x ppage_disk1:Pack/PPage #? PPageInstDest:
ECHO "..." NOLINE
CD PPageInstDest:PPage
RAM:PP_Inst/LZ -m -n -N -r x ppage_disk2:Pack/AE #? PPageInstDest:PPage/
ECHO "..." NOLINE
RAM:PP_Inst/LZ -m -n -N -r x ppage_disk2:Pack/LIB #? Libs:
ECHO "..." NOLINE
RAM:PP_Inst/LZ -m -n -N -r x ppage_disk2:Pack/Data #? PPageInstDest:PPage/
ECHO "..." NOLINE
RAM:PP_Inst/LZ -m -n -N -r x ppage_disk2:Pack/Filters #? PPageInstDest:PPage/
ECHO "..." NOLINE
RAM:PP_Inst/LZ -m -n -N -r x ppage_disk2:Pack/PageGenies #? PPageInstDest:PPage/
ECHO "..." NOLINE

LAB afterPPage

ECHO >RAM:PP_Inst/gepath "REXX:"
RAM:PP_Inst/INSTUTIL isdir REXX:
IF NOT WARN
   ECHO "..." NOLINE
;
;       See if there's room for genie files
;
   RAM:PP_Inst/INSTUTIL -espace freespace REXX:
   IF NOT VAL $space GT 590
      ECHO "*N"
      ECHO "Insufficient disk space free for Genie files in Rexx: "
      ECHO "Function Genie files ommitted."
      ECHO "Please make more room and try again."
      SKIP afterREXX
   ENDIF
   RAM:PP_Inst/LZ -m -n -N x ppage_disk2:Pack/REXX #? REXX:
ELSE
   ECHO
   ECHO "You do not have 'Rexx:' assigned to a drawer."
   RAM:PP_Inst/INSTUTIL ask -dy "Install GENIES to 'S:' [Y/N]? Y"
   IF NOT WARN
;
;       See if there's room for genie files
;
       RAM:PP_Inst/INSTUTIL -espace freespace S:
       IF NOT VAL $space GT 590
          ECHO "Insufficient disk space free for Genie files in S: "
          ECHO "Function Genie files ommitted."
          ECHO "Please make more room and try again."
          SKIP afterREXX
       ENDIF

       ECHO "Installing ..."
       RAM:PP_Inst/LZ -m -n -N x ppage_disk2:Pack/REXX #? S:
       ECHO >RAM:PP_Inst/gepath "S:"
   ENDIF
ENDIF

LAB afterREXX

;
;       See if there's room for tutorial files
;
RAM:PP_Inst/INSTUTIL -espace freespace PPageInstDest:
IF NOT VAL $space GT 240
   ECHO "Insufficient disk space free on selected drive for tutorial files. "
   ECHO "Tutorial files ommitted."
   ECHO "Please make more room and try again."
ELSE
    ECHO "*N"
    RAM:PP_Inst/INSTUTIL ask -dy "Do you want to install the tutorial files [Y/N]? Y"
    IF not warn
       ECHO "Installing ..." NOLINE
       RAM:PP_Inst/LZ -m -n -N -r x ppage_disk2:Pack/NewsLetter #? PPageInstDest:PPage/
    ENDIF
ENDIF



CD >RAM:PP_Inst/pathbase
CD RAM:PP_Inst

;
;       Build the PPage.INI file in S:
;
ECHO >d.a "HY  " NOLINE
ECHO >d.b "/Data"
INSTUTIL >d.1 mergenl d.a pathbase d.b

ECHO >d.a "PR  " NOLINE
ECHO >d.b "/Data"
INSTUTIL >d.2 mergenl d.a pathbase d.b

ECHO >d.a "PC  " NOLINE
INSTUTIL >d.3 mergenl d.a pathbase

ECHO >d.a "PG  " NOLINE
ECHO >d.b "/PageGenies"
INSTUTIL >d.4 mergenl d.a pathbase d.b

ECHO >d.a "AE  " NOLINE
INSTUTIL >d.5 mergenl d.a pathbase

ECHO >d.a "TF  " NOLINE
ECHO >d.b "/filters"
INSTUTIL >d.6 mergenl d.a pathbase d.b

ECHO >d.a "GE  " NOLINE
INSTUTIL >d.7 mergenl d.a gepath

ECHO >d.a "PP  " NOLINE
INSTUTIL >d.8 mergenl d.a pathbase

ECHO >d.a "HB  " NOLINE
ECHO >d.b "/Help"
INSTUTIL >d.9 mergenl d.a pathbase d.b

ECHO >d.a "FC  " NOLINE
INSTUTIL >d.10 mergenl d.a pathbase

INSTUTIL isfile s:PPage.ini
IF NOT WARN
   PROTECT s:PPage.ini rwed
   COPY s:PPage.ini d.0
   JOIN d.0 d.1 d.2 d.3 d.4 d.5 d.6 d.7 d.8 d.9 d.10 to s:PPage.ini
ELSE
   JOIN d.1 d.2 d.3 d.4 d.5 d.6 d.7 d.8 d.9 d.10 to s:PPage.ini
ENDIF

PROTECT s:PPage.ini r

; add PSF, FE, FC later

RAM:PP_Inst/INSTUTIL reseticon PPageInstDest:PPage

;
;       Install Amigafonts to FONTS: or PPage:fonts
;
;******************************************************

ECHO "*N"
RAM:PP_Inst/INSTUTIL ask -dy "Install PPage Bitmap fonts to FONTS: directory [Y/N]? Y"
IF NOT warn
;
;       See if there's room for bm fonts
;
   RAM:PP_Inst/INSTUTIL -espace freespace S:
   IF NOT VAL $space GT 1190
      ECHO "Insufficient disk space free for bitmap fonts in FONTS: "
      ECHO "*N"
   ELSE
      ECHO "Installing Bitmap fonts to FONTS:"
      RAM:PP_Inst/LZ -m -n -N -r x ppage_disk2:Pack/BMfonts #? FONTS:
      SKIP afterbmfonts
   ENDIF
ENDIF

RAM:PP_Inst/INSTUTIL ask -dy "Install PPage Bitmap fonts to PPage directory [Y/N]? Y"
IF NOT warn
;
;       See if there's room for bm fonts
;
    RAM:PP_Inst/INSTUTIL -espace freespace PPageInstDest:
    IF NOT VAL $space GT 1190
       ECHO "*N"
       ECHO "Insufficient disk space free for bitmap fonts: "
       ECHO "*N"
       SKIP afterbmfonts
    ENDIF

    ECHO "Installing Bitmap fonts to PPage/Fonts directory. "
    ECHO "*N"
    IF NOT EXISTS "PPageInstDest:PPage/Fonts"
       MAKEDIR "PPageInstDest:PPage/Fonts"
    ENDIF

    ;
    ;       Decompress AmigaFonts files
    ;
    RAM:PP_Inst/LZ -m -n -N -r x ppage_disk2:Pack/BMfonts #? PPageInstDest:PPage/fonts/

    ;
    ;       Make a couple of IconX files to switch between PPage and normal fonts.
    ;
    CD PPageInstDest:PPage/fonts
    CD >RAM:PP_Inst/path2

    CD RAM:PP_Inst
    ECHO >SelPP.1 "Echo *"Selecting Professional Page fonts: *" NOLINE"
    ECHO >SelPP.2 "Assign FONTS: " NOLINE
    TYPE >SelPP.3 RAM:PP_Inst/path2
    ECHO >Sel.Done "Echo *"Done.*""

    JOIN SelPP.1 SelPP.2 SelPP.3 Sel.Done AS "PPageInstDest:PPage/PPageFonts"
    COPY ppage_disk2:Icons/PPageFonts.info "PPageInstDest:PPage/PPageFonts.info"

    ECHO >SelAm.1 "Echo *"Selecting Amiga fonts: *" NOLINE"
    ECHO >SelAm.2a "Assign FONTS: " NOLINE
    CD FONTS:
    CD >RAM:PP_Inst/SelAm.2b
    CD RAM:PP_Inst

    JOIN SelAm.1 SelAm.2a SelAm.2b Sel.Done AS "PPageInstDest:PPage/AmigaFonts"
    COPY PPage_Disk2:Icons/AmigaFonts.info "PPageInstDest:PPage/AmigaFonts.info"
ENDIF   ; copy FONTS

LAB afterbmfonts

;
;       See if there's room for HelpBook files
;
RAM:PP_Inst/INSTUTIL -espace freespace PPageInstDest:
IF NOT VAL $space GT 1200
   ECHO
   ECHO "Insufficient free space on selected drive for HelpBook files. "
   ECHO "Help Book ommitted."
   ECHO "Please make more room and try again if you want the HelpBook Installed."
ELSE
    ECHO "*N"
    RAM:PP_Inst/INSTUTIL ask -dy "Do you want to install the HelpBook [Y/N]? Y"
    IF not warn
       ECHO "Installing ..." NOLINE
       RAM:PP_Inst/LZ -m -n -N -r x ppage_disk3:Pack/HelpBook #? PPageInstDest:PPage/
;       RAM:PP_Inst/INSTUTIL reseticon Help
    ENDIF
ENDIF

;
;       Install FontMan
;
RAM:PP_Inst/INSTUTIL -espace freespace PPageInstDest:
IF NOT VAL $space GT 450
   ECHO
   ECHO "Insufficient free space on selected drive for FontManager. "
   ECHO "FontManager ommitted."
   ECHO "Please make more room and retry if you want FontManager Installed."
ELSE
   CD PPageInstDest:
   ECHO "*N"
   ECHO
   RAM:PP_Inst/INSTUTIL ask -dy "Do you want to install the FontManager [Y/N]? Y"
   IF NOT WARN
      ECHO "Installing..."
      RAM:PP_Inst/LZ -m -n -N -r x ppage_disk3:Pack/FontMan #? PPageInstDest:PPage/
   ENDIF
ENDIF

;
;       Clean up and die
;
LAB cleanup

delete >nil: PPageInstdest:Install_PPage.info quiet
delete >nil: PPageInstdest:Install_PPage quiet
ECHO
ECHO "Installation Finished. "
ECHO
ECHO "If you have not yet done so, you should now install your CGFonts."
ECHO
ram:PP_Inst/INSTUTIL ask -dy " Press Return to Continue..."

LAB ppage_end
delete >nil: ram:PP_Inst all quiet
assign PPageInstDest:


