; $VER: InstallPPaint7_Update 1.2
; Cloanto PPaint 7 Update Installer Script
; Copyright © 1996, 1997 Cloanto Italia srl
; Cloanto is a registered trademark of Cloanto Italia srl
; "Installer and Installer project icon Copyright © 1991-1993 Commodore-Amiga, Inc. All Rights Reserved
;  Reproduced and distributed under license from Commodore"
; New installer icon design Copyright © 1994 Cloanto Italia srl

(set #which-dir
	"Please indicate the directory where Personal Paint 7.x is installed:")

(set #which-dir-help
	(cat "\nThis program updates the \"PPaint\" v. 7.0 or 7.1 program file."
	"\n\nPlease specify the full path of the installed Personal "
	"Paint software, including the final \"PPaint\" directory name "
	"(or other, if a different drawer name was used).\n\n"
	@askdir-help))

(set #message-ppaintnotok
	"\nThis update was not designed for the selected Personal Paint program file. It will not be updated.")

(set #error-ppaint
	"\nPersonal Paint 7.x program file could not be found. It will not be updated.")

(set #busy-ppaint
	"Updating Personal Paint 7.x program file.")

(if (AND (<> (getassign "PSUITEROOT" "a") "") (<> (getassign "KARACDROOT" "a") "")) (set ppaint_dest "") (set ppaint_dest (getassign "PPaint" "a")))
(if (<> (getassign "PCDPPAINT" "a") "") (set ppaint_dest (getassign "PCDPPAINT" "a")))
(if (AND (<> (getdevice ppaint_dest)(getdevice "RAM:"))(< (getdiskspace ppaint_dest) 10240)) (set ppaint_dest ""))
(if (= ppaint_dest "") (set ppaint_dest @default-dest))

(set ppaint_dest (askdir
	(prompt #which-dir)
	(help #which-dir-help)
	(default ppaint_dest)
	(newpath)
))

(set target1 (tackon ppaint_dest "PPaint"))
(if (<> (exists target1) 1) (if (= (exists target1) 2) (set ppaint_dest target1)))
(set @default-dest ppaint_dest)

(set target1 (tackon ppaint_dest "PPaint"))
(if (<> (exists target1) 1) (message #error-ppaint) (
	(if (AND (AND (AND (AND (<> (getsize target1) 681608) (<> (getsize target1) 684056)) (<> (getsize target1) 368100)) (<> (getsize target1) 684788)) (<> (getsize target1) 368416)) (message #message-ppaintnotok) (

		(if (= (getsize target1) 681608) (
			(working #busy-ppaint)
			(set runstring (cat "spatch >NIL: <NIL: \"-o" target1 "\" -pPP70-71_standard.pch \"" target1 "\""))
			(run runstring)
		))

		(if (= (getsize target1) 684056) (
			(working #busy-ppaint)
			(set runstring (cat "spatch >NIL: <NIL: \"-o" target1 "\" -pPP70-71_deploded.pch \"" target1 "\""))
			(run runstring)
		))

		(if (= (getsize target1) 368100) (
			(working #busy-ppaint)
			(set runstring (cat "spatch >NIL: <NIL: \"-o" target1 "\" -pPP70-71_imploded.pch \"" target1 "\""))
			(run runstring)
		))

		(if (= (getsize target1) 684788) (
			(working #busy-ppaint)
			(set runstring (cat "spatch >NIL: <NIL: \"-o" target1 "\" -pPP71-71b_standard.pch \"" target1 "\""))
			(run runstring)
		))

		(if (= (getsize target1) 368416) (
			(working #busy-ppaint)
			(set runstring (cat "spatch >NIL: <NIL: \"-o" target1 "\" -pPP71-71b_imploded.pch \"" target1 "\""))
			(run runstring)
		))
		(exit)
	))
))

(exit (quiet))
