;;
;;      $Source: Devel:epsonsc/inst/RCS/InstallScript,v $
;;      $Author: tsarna $
;;    $Revision: 37.16 $
;;        $Date: 1995/10/03 11:41:49 $
;;
;;        EnPrint Installation Script
;;
;;    (C) Copyright 1994,1995 Endicor Technologies, Inc.
;;        All Rights Reserved.
;;

;$VER: Install 37.16

(complete 0)

; prefs only if running 2.04 or better
(if (< (/ (getversion) 65536) 37)
   (abort "You must have Workbench 2.04 or later to use " 
          "This version of the EnPrint software."
   )
)

(welcome "Welcome to the EnPrint installation utility\n"
)

(set olddir (getassign "StylusColor"))
(if
   (or 
      (or
         (strlen olddir)
         (exists "SYS:Prefs/StylusColor")
      )
      (or
         (exists "ENVARC:StylusColor")
         (exists "ENV:StylusColor")
      )
   )
   (if
      (askbool
         (prompt
            "\nYou have an old version of the Endicor Epson Stylus "
            "Color driver installed. We strongly recommend "
            "deleting this old version.\n\n "
            "Would you like to do that now?"
         )
         (help
            "Select \"Yes\" to delete the old V1.x"
            "driver files or \"No\" to leave them."
         )
      )
      (
         (if (strlen olddir)
            (makeassign "StylusColor")
            (run (cat "Delete \"" olddir "(|.info)\" ALL FORCE QUIET"))
         )
         (run "Delete ENVARC:StylusColor ALL FORCE QUIET")
         (run "Delete ENV:StylusColor ALL FORCE QUIET")
         (run "Delete SYS:Prefs/StylusColor(|.info) ALL FORCE QUIET")
         (run "Delete DEVS:printers/EpsonStylusColo(r|r020|r030|r040)(|.info) ALL FORCE QUIET")
         (run "Delete DEVS:printers/EpsonStylusColor(|.info) ALL FORCE QUIET")
         (run "Avail >NIL: FLUSH ALL FORCE QUIET")
         (startup "EpsonStylusColor"
            (prompt "Select \"Proceed\" to have the StylusColor: "
                    "assign removed from your user-startup file "
            )
            (help "You should select \"Proceed\" to remove the "
                  "Assignment of StylusColor: that no longer "
                  "applies"
            )
            (command "; *** YOU CAN DELETE THESE THREE LINES NOW ***")
         )
      )
   )
)

(complete 10)

(set ddestdir
   (tackon
      (askdir
         (prompt
            "\nIn which disk (or drawer) should the EnPrint drawer "
            "be created or updated? This drawer will hold the "
            "documentation and other driver-related files. (the "
            "driver itself will be installed in the standard location)"
         )
         (help @askdir-help)
         (default "SYS:")
      )
      "EnPrint"
   )
)
(if (NOT (exists ddestdir))
   (makedir ddestdir
      (infos)
   )
)
(makeassign "EnPrint" ddestdir)

(complete 15)

(set btdef (getassign "BIG_T"))
(if (NOT (strlen btdef))
   (
      (if (NOT (exists "EnPrint:BIG_T"))
         (makedir "EnPrint:BIG_T")
      )
      (set btdef "EnPrint:BIG_T")
   )  
)

(set btdestdir
   (askdir
      (prompt
         "A directory named BIG_T: is needed to store data when using spooling "
         "and for the EnPrint printing program. This directory must "
         "have space for ~20M when using spooling, and ~3M otherwise. "
         "If your T: directory is on RAM: and has enough space you "
	 "may use it. Otherwise, create a directory somewhere else."
      )
      (help @askdir-help)
      (default btdef)
   )
)
(if (NOT (exists btdestdir))
   (makedir btdestdir
      (infos)
   )
)
(makeassign "BIG_T" btdestdir)

(complete 20)

(if (exists "ENV:ESCP2OutSpecial")
   (set ovar (getenv "ESCP2OutSpecial"))
   ;else
   (set ovar "{creq}")
)
(set odef 0)
(if (patmatch "#?buffer#?" ovar)
   (set odef (BITOR odef 1))
)
(if (patmatch "#?creq#?" ovar)
   (set odef (BITOR odef 2))
)

(set opts (askoptions
   (prompt
      "Two special options for EnPrint can be set by an environment "
      "variable. The two options are graphics spooling, and an extra "
      "cancel requester. Select Help below for more information.\n\n"
      "Which options would you like set\nin your user-startup file?"
   )
   (help
      "Graphics spooling:\n\n"
      "This option causes graphics output to be buffered to disk "
      "one page at a time during processing, then printed. This option "
      "requires enough free space in the directory BIG_T: is assigned "
      "to for storage of one complete page of graphics output. This "
      "can be up to 20 megabytes of space for a full page 720dpi color "
      "print, but usually compression will reduct this to 12-18 "
      "megabytes. This option is useful if banding is experienced on "
      "output due to the ink drying unevenly during processing delays. "
      "This option avoids this problem.\n\n"
      "Cancel requester:\n\n"
      "This option causes an \"Abort Printing?\" requester to be "
      "displayed on Workbench. This is useful when printing with "
      "programs (like GraphicDump) that don't provide a cancel "
      "requester of their own.\n\n"
      "After installation, read EnPrint.guide for even more "
      "information on these and other options availible. See "
      "The section entitled \"Special Output Hooks\"."
   )
   (choices "Graphics Spooling (takes 20M)" "EnPrint Cancel Requester")
   (default odef)
))

(if (and (in opts 0) (in opts 1))
   (set hook "{creq}{buffer}{creq}")
   (if (in opts 0)
      (set hook "{buffer}")
      (if (in opts 1)
         (set hook "{creq}")
         (set hook "")
      )
   )
)

(set us (cat
   "Assign EnPrint: " ddestdir "\nAssign BIG_T: " btdestdir "\n"
))
(set stus (cat
   "SetEnv ESCP2OutSpecial \"" hook "\"\n"
))

(startup "EnPrint"
   (prompt
      "\nSome instructions need to be added to the system startup file(s):\n\n"
      ";BEGIN EnPrint\n" us ";END EnPrint\n"
   )
   (help "This will add some lines to user-startup script to assign "
	"EnPrint: to the directory you specified before."
   )
   (command us)
)
(complete 25)
(run stus)
(startup "EnPrint_Stylus"
   (prompt
      "\nSome more instructions need to be added to the system startup file(s):\n\n"
      ";BEGIN EnPrint_Stylus\n" stus ";END EnPrint_Stylus\n"
   )
   (help "This will add some lines to user-startup script to enable "
	"the special output option(s) you have selected."
   )
   (command stus)
)

(complete 30)

(working
   "\n\nDecompressing files from floppy for installation."
   "\n\nThis can take a while -- please be patient."
)
(if (run "LHEX -qfw=BIG_T: x EnPrint.LHA")
   (abort "\nError dearchiving driver\nfiles -- floppy corrupt?!!!")
)

(complete 40)

(copylib (source "BIG_T:arc/Drivers/EpsonStylusCOLOR")
   (dest "DEVS:printers")
   (optional "force" "askuser")
   (infos)
)
(complete 42)
(copylib (source "BIG_T:arc/Drivers/EpsonStylusCOLOR_II")
   (dest "DEVS:printers")
   (optional "force" "askuser")
   (infos)
)
(complete 44)
(copylib (source "BIG_T:arc/Drivers/EpsonStylusIIsBlack")
   (dest "DEVS:printers")
   (optional "force" "askuser")
   (infos)
)
(complete 46)
(copylib (source "BIG_T:arc/Drivers/EpsonStylusIIsColor")
   (dest "DEVS:printers")
   (optional "force" "askuser")
   (infos)
)
(complete 48)
(copylib (source "BIG_T:arc/Drivers/EpsonStylusPro")
   (dest "DEVS:printers")
   (optional "force" "askuser")
   (infos)
)
(complete 50)
(copylib (source "BIG_T:arc/Progs/EnPrintPrefs")
   (dest "Sys:Prefs")
   (optional "force" "askuser")
   (infos)
)
(complete 52)
(copylib (source "BIG_T:arc/Progs/ConfEd")
   (dest ddestdir)
   (optional "force" "askuser")
   (infos)
)
(complete 54)
(copylib (source "BIG_T:arc/Progs/StylusCalib")
   (dest ddestdir)
   (optional "force" "askuser")
   (infos)
)
(complete 56)
(copylib (source "BIG_T:arc/Progs/ESCP2Out")
   (dest ddestdir)
   (optional "force" "askuser")
   (infos)
)
(complete 58)
(copylib (source "BIG_T:arc/Progs/MakePic")
   (dest ddestdir)
   (optional "force" "askuser")
   (infos)
)
(complete 60)
(copylib (source "BIG_T:arc/Progs/IFFLoad")
   (dest ddestdir)
   (optional "force" "askuser")
   (infos)
)
(complete 62)
(copylib (source "BIG_T:arc/Progs/Manip")
   (dest ddestdir)
   (optional "force" "askuser")
   (infos)
)
(complete 64)
(copylib (source "BIG_T:arc/Progs/EnPrint")
   (dest ddestdir)
   (optional "force" "askuser")
   (infos)
)
(complete 66)
(copylib (source "BIG_T:arc/Progs/AspectWhiz")
   (dest ddestdir)
   (optional "force" "askuser")
   (infos)
)
(complete 68)
(copyfiles (source "BIG_T:arc/TimberWolf.IFF")
   (dest ddestdir)
   (optional "force" "askuser")
   (infos)
)
(complete 70)
(copylib (source "BIG_T:arc/EnPrint.guide")
   (dest ddestdir)
   (optional "force" "askuser")
   (infos)
)
(complete 72)
(copyfiles (source "BIG_T:arc/EnPrintStylus.FW")
   (dest ddestdir)
   (optional "force" "askuser")
   (infos)
)
(complete 74)
(copylib (source "BIG_T:arc/Epson.guide")
   (dest ddestdir)
   (optional "force" "askuser")
   (infos)
)
(complete 76)
(copylib (source "README.FIRST")
   (dest ddestdir)
   (optional "force" "askuser")
   (infos)
)
(complete 78)
(copylib (source "BIG_T:arc/Progs/EpsonSpecial")
   (dest ddestdir)
   (optional "force" "askuser")
   (infos)
)

(if (NOT (exists "EnPrint:Config"))
   (makedir "EnPrint:Config")
)
(if (NOT (exists "EnPrint:Config/Defaults"))
   (makedir "EnPrint:Config/Defaults")
)
(if (NOT (exists "EnPrint:Printers"))
   (makedir "EnPrint:Printers")
)
(if (NOT (exists "EnPrint:Dithers"))
   (makedir "EnPrint:Dithers")
)

(complete 80)

(message 
      "\nNext you will be asked which configuration files to install. "
      "\n\nIf have already installed an older version of EnPrint "
      "you probably have customized your configurations "
      "and sould deselect the ones which you don't want overwritten. "
      "If you are installing EnPrint for the first time you "
      "should select all files so that the default configurations "
      "will be installed."
)

(copyfiles (source "BIG_T:arc/Config")
   (prompt "Which configurations should be installed?")
   (help
      "Check a file if you want the install program to install it, "
      "Potentially overwriting an already installed version in the "
      "process. Make a file unchecked if you do not wish it to be "
      "installed."
   )
   (dest "EnPrint:Config")
   (optional "force" "askuser")
   (confirm average)
   (all)
)
(if (run "Copy BIG_T:arc/Config/#?.#? EnPrint:Config/Defaults")
   (abort "Unable to install default configurations!")
)
(complete 82)
(copyfiles (source "BIG_T:arc/Printers")
   (dest "EnPrint:Printers")
   (optional "force" "askuser")
   (all)
)
(complete 84)
(copyfiles (source "BIG_T:arc/Dithers")
   (dest "EnPrint:Dithers")
   (optional "force" "askuser")
   (all)
)

(complete 88)
(copylib (source "Installer")
   (dest "C:")
   (optional "force" "askuser")
   (infos)
)
(complete 90)
(copylib (source "BIG_T:arc/ag/AmigaGuide")
   (dest "Sys:Utilities")
   (optional "force" "askuser")
   (infos)
)
(complete 92)
(copylib (source "BIG_T:arc/ag/WDisplay")
   (dest "Sys:Utilities")
   (optional "force" "askuser")
   (infos)
)
(complete 94)
(copylib (source "BIG_T:arc/ag/amigaguide.library")
   (dest "libs:")
   (optional "force" "askuser")
   (infos)
)
(complete 96)
(copylib (source "BIG_T:arc/ag/help.guide")
   (dest "s:")
   (optional "force" "askuser")
   (infos)
)

(complete 98)

(working "\nDeleteing temporary files.")
(run "Delete BIG_T:arc ALL FORCE QUIET")

(complete 99)

(message
   "\nNOTE: Several people have reported strange problems with printing "
   "after installation which went away after powering the system down. "
   "We believe we have traced this to an error in the Installer program "
   "by Commodore. We recommend that you proceed to exit this program "
   "and then reboot before continuing. We are looking for a better "
   "workaround."
)

(complete 100)

(run "Run <nil: >nil: Sys:Utilities/More EnPrint:README.FIRST")

(message
   "\nInstallation Complete!\n\n"
   "Please read the README.FIRST file now!\n\n"
   "DON'T FORGET to send in your registration card for full "
   "upgrade and techincal support!"
)

;(message
;   "\nBETA NOTE:\n\nPlease read the file README.BETA on the disk!"
;)
   
(exit (quiet))
