;PAGESTREAM 3.0b 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:Filters 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.0b. It requires that PageStream 3.0 be installed on your hard drive first. If you have 3.0a and not 3.0, you cannot use this patch. You must download the PS3BA1.LHA archive instead.\n\nYour original PageStream3 disks will not be modified by this update.")
(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.0b 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)
			)
		)
		(set fargoflag
			(askbool
				(prompt
					"Do you want to install the new custom Fargo printer driver?")
				(help
					"This driver can be used on the Fargo Primera printer with or without the dye sublimation option.")
				(default 1)
			)
		)
	)
)

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

;UPDATE LIBS
(working "Patching Libraries...")
(run "ram:lhex >NIL: <NIL: -qfw=ram: x LibsPatch.lha")
(delete "LibsPatch.LHA" (safe))
(run "spatch >NIL: <NIL: -oSoftLogik:Libs/app.library -pram:app.pch SoftLogik:Libs/SoftLogik_App.library")
(if (exists "SoftLogik:Libs/app.library")
	(
		(delete "SoftLogik:Libs/SoftLogik_App.library")
		(rename "SoftLogik:Libs/app.library" "SoftLogik:Libs/SoftLogik_App.library")
	)
)
(delete "ram:app.pch" (safe))
(run "spatch >NIL: <NIL: -oSoftLogik:Libs/obj.library -pram:obj.pch SoftLogik:Libs/SoftLogik_Obj.library")
(if (exists "SoftLogik:Libs/obj.library")
	(
		(delete "SoftLogik:Libs/SoftLogik_Obj.library")
		(rename "SoftLogik:Libs/obj.library" "SoftLogik:Libs/SoftLogik_Obj.library")
	)
)
(delete "ram:obj.pch" (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))

(if (OR (= install_mode ALLflag) (= fargoflag 1))
	(run "ram:lhex >NIL: <NIL: -qfw=SoftLogik:Printers x Fargo.lha")
)
(delete "Fargo.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/ArtExpressionEPS.gfilter"))
	(run "ram:lhex >NIL: <NIL: -qfw=SoftLogik:Filters x ArtExpression.lha")
)
(delete "ArtExpression.LHA" (safe))

(if (OR (= install_mode ALLflag) (exists "SoftLogik:Filters/Excellence.tfilter"))
	(run "ram:lhex >NIL: <NIL: -qfw=SoftLogik:Filters x Excellence.lha")
)
(delete "Excellence.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 "SoftLogik:Filters/FreehandEPS.gfilter"))
	(run "ram:lhex >NIL: <NIL: -qfw=SoftLogik:Filters x Freehand.lha")
)
(delete "Freehand.LHA" (safe))

(if (OR (= install_mode ALLflag) (exists "SoftLogik:Filters/IllustratorEPS.gfilter"))
	(run "ram:lhex >NIL: <NIL: -qfw=SoftLogik:Filters x Illustrator.lha")
)
(delete "Illustrator.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/ProDrawClip.gfilter"))
	(run "ram:lhex >NIL: <NIL: -qfw=SoftLogik:Filters x ProDraw.lha")
)
(delete "ProDraw.LHA" (safe))

(if (OR (= install_mode ALLflag) (exists "SoftLogik:Filters/ProWrite.tfilter"))
	(run "ram:lhex >NIL: <NIL: -qfw=SoftLogik:Filters x ProWrite.lha")
)
(delete "ProWrite.LHA" (safe))

(if (OR (= install_mode ALLflag) (exists "SoftLogik:Filters/Word.tfilter"))
	(run "ram:lhex >NIL: <NIL: -qfw=SoftLogik:Filters x Word.lha")
)
(delete "Word.LHA" (safe))

(if (OR (= install_mode ALLflag) (exists "SoftLogik:Filters/WordPerfect.tfilter"))
	(run "ram:lhex >NIL: <NIL: -qfw=SoftLogik:Filters x WordPerfect.lha")
)
(delete "WordPerfect.LHA" (safe))

(if (OR (= install_mode ALLflag) (exists "SoftLogik:Filters/Wordworth.tfilter"))
	(run "ram:lhex >NIL: <NIL: -qfw=SoftLogik:Filters x Wordworth.lha")
)
(delete "Wordworth.LHA" (safe))

(run "ram:lhex >NIL: <NIL: -qfw=SoftLogik:Filters x Filters.lha")
(delete "Filters.LHA" (safe))

(if (OR (= install_mode ALLflag) (exists "PageStream3:BME"))
	(run "ram:lhex >NIL: <NIL: -qfw=SoftLogik:Effects x Effects.lha")
)
(delete "Effects.LHA" (safe))

;UPDATE MACROS
(if (<> (exists "PageStream3:Macros") 2) (makedir "PageStream3:Macros" (infos)))
(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 "Patching PageStream 3.0 to 3.0b...\n\nThis will take about one to five minutes.")
(run "ram:lhex >NIL: <NIL: -qfw=ram: x PGSpatch.LHA")
(delete "PGSpatch.LHA" (safe))
(run "spatch >NIL: <NIL: -oPageStream3:PageStream3.0b -pram:PageStream.pch PageStream3:PageStream3")
(if (exists "PageStream3:PageStream3.0b")
	(
		(delete "PageStream3:PageStream3")
		(rename "PageStream3:PageStream3.0b" "PageStream3:PageStream3")
	)
)
(delete "ram:PageStream.pch" (safe))

;UPDATE PAGELINER
(if (exists "PageStream3:PageLiner")
	(
		(working "Patching PageLiner 2.0 to 2.0a...")
		(run "ram:lhex >NIL: <NIL: -qfw=ram: x PLpatch.LHA")
		(delete "PLpatch.LHA" (safe))
		(run "spatch >NIL: <NIL: -oPageStream3:PageLiner2.0a -pram:PageLiner.pch PageStream3:PageLiner")
		(if (exists "PageStream3:PageLiner2.0a")
			(
				(delete "PageStream3:PageLiner")
				(rename "PageStream3:PageLiner2.0a" "PageStream3:PageLiner")
			)
		)
	)
)
(delete "ram:PageLiner.pch" (safe))

;INSTALL TIPS
(if (<> (exists "PageStream3:Help") 2) (makedir "PageStream3:Help" (infos)))
(run "ram:lhex >NIL: <NIL: -qfw=PageStream3:Help x Tips.LHA")
(delete "Tips.LHA" (safe))

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

;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 "spatch" (safe))
(delete "Install-PageStream3.0b.info" (safe))

(message "You MUST update any font path containing a PostScript font. Run PageStream3, choose Settings/Fonts, select the StudioFonts path and click on the Update gadget. Repeat for the SerialsFonts path, IQEfonts path and any other PostScript font paths you may have.\n\nThis is important!\n\nNot doing this will lead to problems.")

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