;TypeSmith 2.5a ONLINE UPDATE PATCH INSTALLATION SCRIPT
;COPYRIGHT ©1994 SOFT-LOGIK PUBLISHING CORPORATION

;SEE IF TYPESMITH IS ASSIGNED
(set TSdest (getassign "TypeSmith" "a"))
(if
	(= TSdest "")
	(abort "TypeSmith: is not assigned. You must properly install TypeSmith 2.5 before applying this update patch.")
)

(message "\n\nThis will create TypeSmith 2.5a from your TypeSmith 2.5 TSprogram floppy disk and the patch file included with this installation script. Your disk will not be modified.\n\nIf the patch is successfully applied, 2.5a will be saved as TypeSmith:TypeSmith. Your copy of 2.5 will be preserved as TypeSmith:TypeSmith2.5.")

;REQUEST DISK
(askdisk
	(prompt "\n\n\nPlease insert the disk labeled \"TSprogram\".")
	(help
		"You must insert your TypeSmith 2.5 floppy disk in a drive to complete the installation. If you are missing this disk or if the installer does not accept the disk, contact Soft-Logik Publishing technical support for assistance.")
	(dest "TSprogram")
)
(copyfiles (source "TSprogram:lhex") (dest "ram:") (nogauge))

;UPDATE TYPESMITH
(working "Patching TypeSmith 2.5 to 2.5a...")
(run "ram:lhex >NIL: <NIL: -qfw=ram: x TSpatch.LHA")
(delete "TSpatch.LHA" (safe))
(run "spatch >NIL: <NIL: -oram:TypeSmithA -pram:TypeSmith.pch TSprogram:TypeSmith")
(if (exists "ram:TypeSmithA")
	(
		(rename "TypeSmith:TypeSmith" "TypeSmith:TypeSmith2.5")
		(copyfiles (source "ram:TypeSmithA") (dest TSdest))
		(rename "TypeSmith:TypeSmithA" "TypeSmith:TypeSmith")
		(delete "ram:TypeSmithA" (safe))
	)
	(abort "Patch was not successful. Cause was probably lack of RAM, a bad disk, or an incorrect version of TypeSmith.")
)
(delete "ram:TypeSmith.pch" (safe))

;INSTALL CONVERT.TSRX
(if (exists "TypeSmith:Rexx/Convert.tsrx")
	(
		(copyfiles (source "Convert.tsrx") (dest "TypeSmith:Rexx"))
		(delete "Convert.tsrx" (safe))
	)
)

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

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

;REMOVE THE LHEX PROGRAM
(delete "ram:lhex" (safe))
(delete "spatch" (safe))
(delete "Install-TypeSmith2.5a.info" (safe))

;GEE, THAT WAS FUN
(exit "TypeSmith 2.5a installed!")
