;PAGESTREAM 3.0a ONLINE UPDATE PATCH INSTALLATION SCRIPT
;COPYRIGHT ©1994 SOFT-LOGIK PUBLISHING CORPORATION

;SEE IF PAGESTREAM3 AND SOFTLOGIK ARE ASSIGNED AND EVERYTHING EXISTS
(set PGSdest (getassign "PageStream3" "a"))
(set SLdest (getassign "SoftLogik" "a"))
(if (OR (= PGSdest "") (= SLdest ""))
    (abort "PageStream3: and/or SoftLogik: are not assigned. You must properly install PageStream3 before applying this update patch.")
)
(set @default-dest PGSdest)
(if (<> (exists "PageStream3:PageStream3") 1)
    (abort "PageStream3 is not in the PageStream3: directory. You must properly install PageStream3 before applying this update patch.")
)
(if (<> (exists "SoftLogik:Libs") 2)
    (abort "The SoftLogik:Libs directory is missing. You must properly install PageStream3 before applying this update patch.")
)
(if (<> (exists "SoftLogik:Engines") 2)
    (abort "The SoftLogik:Engines directory is missing. You must properly install PageStream3 before applying this update patch.")
)
(if (<> (exists "SoftLogik:Printers") 2)
    (abort "The SoftLogik:Printers directory is missing. You must properly install PageStream3 before applying this update patch.")
)
(if (<> (exists "SoftLogik:Filters") 2)
    (abort "The SoftLogik:Filteres directory is missing. You must properly install PageStream3 before applying this update patch.")
)
(if (<> (exists "SoftLogik:Effects") 2)
    (abort "The SoftLogik:Effects directory is missing. You must properly install PageStream3 before applying this update patch.")
)

;SEE WHAT THE USER WANTS TO INSTALL
(set ALLflag 0)
(set SMAflag 1)

(message "\n\nThis will update your hard drive installation of PageStream 3.0 to version 3.0a.\n\nYour original PageStream3 disks will not be modified.")
(set install_mode
    (askchoice
        (prompt
            "\nSelect an installation option.\n\nChoose `All' if you have a full PageStream3 installation. Choose `Smart' if you have a custom or minimum PageStream3 installation.\n")
        (choices "All New and Improved 3.0a Files" "Smart Install")
        (default 0)
        (help
            "Smart Install will check to see if a file exists before copying the new one to your hard drive. Thus, if you deleted the HP.printer driver because you didn't need it, the new one will not be installed.")
    )
)

;SET FLAGS FOR NEW STUFF IF SMART INSTALL
(if (= install_mode SMAflag)
    (set epsonflag
        (askbool
            (prompt
                "Do you want to install the new custom Epson printer driver?\n\nThis driver also can be used for some Canon printers.")
            (help
                "This driver can be used on most Epson compatible printers and some Canon BubbleJet printers instead of using PageStream3's Preference driver with your AmigaDOS driver.")
            (default 1)
        )
    )
)

;COPY THE LHEX PROGRAM TO RAM:
(copyfiles
    (source "PageStream3Disk1:lhex")
    (dest "ram:")
    (nogauge)
)

;UPDATE LIBS
(working "Installing Updated Libraries...")
(run "ram:lhex >NIL: <NIL: -qfw=SoftLogik:Libs x Libs.lha")
(delete "Libs.LHA" (safe))

;UPDATE FONT ENGINES
(working "Installing Updated Font Engines...")
(run "ram:lhex >NIL: <NIL: -qfw=SoftLogik:Engines x Engines.lha")
(delete "Engines.LHA" (safe))

;UPDATE PRINTER DRIVERS
(working "Installing Updated Printer Drivers...")
(if (OR (= install_mode ALLflag) (exists "SoftLogik:Printers/HP.printer"))
    (run "ram:lhex >NIL: <NIL: -qfw=SoftLogik:Printers x HP.lha")
)
(delete "HP.LHA" (safe))
(if (OR (= install_mode ALLflag) (exists "SoftLogik:Printers/PostScript.printer"))
    (run "ram:lhex >NIL: <NIL: -qfw=SoftLogik:Printers x PostScript.lha")
)
(delete "PostScript.LHA" (safe))
(if (OR (= install_mode ALLflag) (exists "SoftLogik:Printers/Preference.printer"))
    (run "ram:lhex >NIL: <NIL: -qfw=SoftLogik:Printers x Preference.lha")
)
(delete "Preference.LHA" (safe))
(if (OR (= install_mode ALLflag) (exists "SoftLogik:Printers/IFFILBM.printer"))
    (run "ram:lhex >NIL: <NIL: -qfw=SoftLogik:Printers x IFFILBM.lha")
)
(delete "IFFILBM.LHA" (safe))
(if (OR (= install_mode ALLflag) (= epsonflag 1))
    (run "ram:lhex >NIL: <NIL: -qfw=SoftLogik:Printers x Epson.lha")
)
(delete "Epson.LHA" (safe))

;UPDATE FILTERS AND EFFECTS
(working "Installing Updated Filters and Effects...")
(run "ram:lhex >NIL: <NIL: -qfw=SoftLogik:Filters x Filters.lha")
(delete "Filters.LHA" (safe))
(if (OR (= install_mode ALLflag) (exists "SoftLogik:Filters/PageStream2.dfilter"))
    (run "ram:lhex >NIL: <NIL: -qfw=SoftLogik:Filters x PageStream2.lha")
)
(delete "PageStream2.LHA" (safe))
(if (OR (= install_mode ALLflag) (exists "SoftLogik:Filters/ProPage.dfilter"))
    (run "ram:lhex >NIL: <NIL: -qfw=SoftLogik:Filters x PPage.lha")
)
(delete "PPage.LHA" (safe))
(if (OR (= install_mode ALLflag) (exists "SoftLogik:Filters/FinalWriter.tfilter"))
    (run "ram:lhex >NIL: <NIL: -qfw=SoftLogik:Filters x FWriter.lha")
)
(delete "FWriter.LHA" (safe))
(if (OR (= install_mode ALLflag) (exists "PageStream3:BME"))
    (run "ram:lhex >NIL: <NIL: -qfw=SoftLogik:Effects x Trace.lha")
)
(delete "Trace.LHA" (safe))

;UPDATE MACROS
(if (OR (= install_mode ALLflag) (exists "PageStream3:Macros/TechReport.Rexx"))
    (run "ram:lhex >NIL: <NIL: -qfw=PageStream3:Macros x Macros.lha")
)
(delete "Macros.LHA" (safe))

;INSTALL CORRECT BME ICON
(run "ram:lhex >NIL: <NIL: -qfw=PageStream3: x bmeinfo.lha")
(delete "bmeinfo.lha" (safe))

;UPDATE PAGESTREAM3
(working "Decompressing Program File...")
(run "ram:lhex >NIL: <NIL: -qfw=PageStream3: x PS3.lha")
(delete "PS3.lha" (safe))
(if (exists "PageStream3:PageStream3.0a")
    (
        (delete "PageStream3:PageStream3")
        (rename "PageStream3:PageStream3.0a" "PageStream3:PageStream3")
    )
)

;INSTALL README
(run "ram:lhex >NIL: <NIL: -qfw=PageStream3: x Read.LHA")
(delete "Read.LHA" (safe))

;DISPLAY README (Try 3 different ways!)
(run "ram:lhex >NIL: <NIL: -qfw=PageStream3: x Read.LHA")
(delete "Read.LHA" (safe))
(IF (> (run "Sys:Utilities/MultiView PageStream3:ReadMe.Now") 0)
    (IF (> (run "Sys:Utilities/AmigaGuide PageStream3:ReadMe.Now") 0)
        (run "More PageStream3:ReadMe.Now")
    )
)

;REMOVE THE LHARC PROGRAM
(delete "ram:lhex" (safe))
(delete "Install-PageStream3.0a.info" (safe))

;GEE, THAT WAS FUN
(exit "PageStream 3.0a installed!")
