; script to install GPFax

        ; set up a error cleanup routine

(onerror
        (makeassign "GPFax_Disk" (safe))
)

(complete 0)

        ; just in case the installation was restarted

(makeassign "GPFax_Disk" (safe))                ; start fresh

        ; see if this is really an update




(set is_update 0)
(set GPFax_dest (getassign "GPFax" "a"))


        ; if update, be sure they want program in same place

(if GPFax_dest
        (if (askbool
                        (prompt "Your current copy of GPFax appears to be located in the drawer named \""
                                        GPFax_dest
                                        "\". Do you want the update installed in that drawer?"
                        )
                        (help
                                "The installer has determined that you may already have a "
                                "copy of GPFax installed on your system. If this is wrong or "
                                "you want the update installed elsewhere, select NO as an "
                                "answer. Otherwise, select YES."
                        )
                        (default 1)
                )

                (set is_update 1)               ; if user wants in same place

                (set GPFax_dest                 ; if user wants in different place
                        (tackon
                                (askdir
                                        (prompt "A In which disk or drawer should GPFax be installed?")
                                        (help @askdir-help)
                                        (default @default-dest)
                                )
                                "GPFax"
                        )
                )
        )


; else if not an update, get a location for program
;
        (set GPFax_dest
                (tackon
                        (askdir
                                (prompt "B In which disk or drawer should GPFax be installed?")
                                (help @askdir-help)
                                (default @default-dest)
                        )
                        "GPFax"
                )
        )
)


        ; now lock on to volume 'GPFax'

(askdisk
        (prompt "Please insert \n the master program disk \n labeled \"GPFax\".")
        (help   "The GPFax program and other options will be copied "
                        "from the \"GPFax\" into your system.")
        (dest  "GPFax")
        (newname "GPFax_Disk")
)

        ; make GPFax drawer & icon if not there

(if (not is_update)
        (makedir GPFax_dest (infos))
)

        ; at this point we have a valid destination, so we tell installer where
        ; the application will end up so the exit page will be correct -- also,
        ; the installation log file (if any) will be copied to the destination
(set @default-dest GPFax_dest)


(set whichfiles
        (askoptions
                (prompt "Please select the files to be copied")
                (help   "This allows you to select only certain parts of the GPFax "
                        "system to be installed on your hard drive. For normal installation "
                        "select all the items")
                (choices "GPFax program, printer driver & fonts"
                         "ViewFax program"
                         "Update Notes"
                         "Sample Fax files"
                         "ARexx Examples")

        )
)


(if     (in whichfiles 0)
        (
                (copyfiles
                        (source "GPFax_Disk:GPFax")
                        (dest GPFax_dest)
                        (infos)
                )

                (copyfiles
                        (source "GPFax_Disk:devs/printers/gpfax.driver")
                        (dest "DEVS:printers")
                        (infos)
                )

                (copyfiles
                        (source "GPFax_Disk:fonts")
                        (dest "FONTS:")
                        (all)
                )

                (copyfiles
                        (source "GPFax_Disk:DataMessage.txt")
                        (dest GPFax_dest)
                )

        )
)

(complete 50)

(if     (in whichfiles 1)
        (copyfiles
                (source "GPFax_Disk:ViewFax")
                (dest GPFax_dest)
                (infos)
        )
)

(complete 75)

(if     (in whichfiles 2)
        (copyfiles
                (source "GPFax_Disk:Updates")
                (dest GPFax_dest)
                (infos)
        )
)

(complete 80)


(tooltype
        (dest GPFax_dest)
        (noposition)
)


(makedir (tackon GPFax_dest "FAX_OUT")  (infos))

(makedir (tackon GPFax_dest "FAX_IN")   (infos))


(if     (in whichfiles 3)
        (
                (copyfiles
                        (source "GPFax_Disk:Fax_in")
                        (dest (tackon GPFax_dest "Fax_in"))
                        (all)
                        (infos)
                )
                (copyfiles
                        (source "GPFax_Disk:Fax_in")
                        (dest (tackon GPFax_dest "Fax_in"))
                        (all)
                        (infos)
                )
        )
)

(if     (in whichfiles 4)
        (
                (copyfiles
                        (source "GPFax_Disk:Rexx_samples")
                        (dest (tackon GPFax_dest "Rexx_samples"))
                        (all)
                        (infos)
                )
        )
)

(complete 95)

        ; modify S:User-Startup

(startup "GPFax"
        (prompt
                "Some instructions need to be added to the \"S:user-startup\" "
                "so that your system will be properly configured to use GPFax.")
        (help "Do this or GPFax won't work!!")
        (command
                "ASSIGN GPFax: \"" GPFax_dest "\"\n"
        )
)

        ; reinitialize assigns

(if (not @pretend)
        (makeassign "GPFax" GPFax_dest)

)


(complete 100)

        ; cleanup

(makeassign "GPFax_Disk" (safe))

        ; this is not strictly necessary, but doesn't hurt -- there is always
        ; a default (exit) at the end of any script

(exit)

