;PAGESTREAM 3.1/3.2 TUNEUP #3 INSTALLATION SCRIPT
;COPYRIGHT ©1996 SOFTLOGIK PUBLISHING CORPORATION

;QUIT PROGRAMS
(message "\n\nStop now if you haven't read the Read.1st! file for important instructions.\n\nIf PageStream, BME or PageLiner are running now, quit them before continuing.")
(run "avail flush" (safe))

;USE ASSIGNS TO AVOID THE STUPID INSTALLER'S CRASH BUG
(run "CD PageStream3:" (safe))
(run "CD SoftLogik:" (safe))
(run "assign fonts: softlogik:fonts add" (safe))

;CONFIRM CORRECT VERSION IS INSTALLED, SET DESTINATION
(message ("\n\nThis TuneUp will update some of your PageStream 3.1 or 3.2 program files.\n\nYour original PageStream3 disks will not be modified by this update.\n\nYou MUST have 3.1 or 3.2 installed to use this TuneUp."))
(if (<> (exists "PageStream3:PageStream3") 1)
	(abort "PageStream3 is not in the PageStream3: directory. You must properly install PageStream 3.1 or 3.2 before installing this TuneUp.")
)
;get destination
(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 PageStream 3.1 or 3.2 before installing this TuneUp.")
)
(set @default-dest PGSdest)

;MAKE REQUIRED DIRECTORIES IF THEY DON'T EXIST
(if (<> (exists "SoftLogik:Libs") 2) (makedir "SoftLogik:Libs" (infos)))
(if (<> (exists "SoftLogik:Engines") 2) (makedir "SoftLogik:Libs" (infos)))
(if (<> (exists "SoftLogik:Filters") 2) (makedir "SoftLogik:Filters" (infos)))
(if (<> (exists "SoftLogik:Printers") 2) (makedir "SoftLogik:Printers" (infos)))
(if (<> (exists "PageStream3:Scripts") 2) (makedir "PageStream3:Scripts" (infos)))
(if (= (exists "PageStream3:Scripts/PageStream3.scripts") 1) (rename "PageStream3:Scripts/PageStream3.scripts" "PageStream3:Scripts/PageStream3.scripts.bak"))


;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 FILTERS
(working "Installing Updated Filters...")
(run "ram:lhex >NIL: <NIL: -qfw=SoftLogik:Filters x Filters.lha")
(delete "Filters.LHA" (safe))

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

;UPDATE PRINTERS
(working "Installing Updated Printer Drivers...")
(run "ram:lhex >NIL: <NIL: -qfw=SoftLogik:Printers x Printers.lha")
(delete "Printers.LHA" (safe))

;UPDATE SCRIPTS
(working "Installing Updated Scripts...")
(run "ram:lhex >NIL: <NIL: -qfw=PageStream3:Scripts x Scripts.lha")
(delete "Scripts.LHA" (safe))
(message "\n\nYour PageStream3:Scripts/PageStream3.scripts file has been renamed to PageStream3.scripts.bak and a new version has been installed. Load the old version if you need old scripts that you have created.")


;REMOVE THE LHEX PROGRAM
(delete "ram:lhex" (safe))

;DONE
(exit "Finished installing TuneUp #3.")
