;DATASTORE 1.0r2 ONLINE UPDATE PATCH INSTALLATION SCRIPT
;COPYRIGHT ©1995 DIGITA INTERNATIONAL AND SOFT-LOGIK PUBLISHING CORPORATION

(message "\n\nThis will update your hard drive installation of Datastore 1.0 to 1.0 release 2 (1.0r2). It requires that Datastore 1.0 be installed on your hard drive.\n\nYour original Datastore disk will not be modified by this update.")

;GET DATASTORE DIRECTORY
(set DSdest
	(askdir
		(prompt
			"Where is Datastore installed?\n "
			"Click on the Datastore drawer.\n")
                (help
			"\n\nYou must select the Datastore drawer so that "
			"this installer can update the installation.")
                (default @default-dest)
        )
)
(set temp1 (tackon DSdest "DSProg"))
(set temp2 (tackon DSdest "Datastore"))
(if (AND (<> (exists temp1) 1) (<> (exists temp2) 1))
	(abort "Datastore 1.0 is not located in this directory.")
)
(set @default-dest DSdest)
(makeassign "Datastore" DSdest (safe))

;UPDATE HELP
(set helpdest (tackon DSdest "Help"))
(if (= (exists helpdest) 2)
	(
		(working "Updating help files...")
		(copyfiles (source "Trouble.guide") (dest helpdest) (nogauge))
		(copyfiles (source "Design.guide") (dest helpdest) (nogauge))
		(copyfiles (source "Basics.guide") (dest helpdest) (nogauge))
	)
)

;UPDATE DATABASES
(set dbdest (tackon DSdest "Databases"))
(set picdest (tackon DSdest "Pictures"))
(if (AND (= (exists dbdest) 2) (= (exists picdest) 2))
	(
		(working "Adding Amiga Shopper sample database...")
		(copyfiles (source "Amiga Shopper Guide") (dest dbdest) (nogauge))
		(copyfiles (source "Shopper Logo") (dest picdest) (nogauge))
	)
)

;UPDATE DATASTORE
(working "Patching Datastore 1.0 to 1.0r2...\n\nThis will take a couple of minutes...")
(run "spatch >NIL: <NIL: -oDatastore:Datastore1.0r2 -pDatastore.patch Datastore:Datastore")
(if (exists "Datastore:Datastore1.0r2")
	(
		(delete "Datastore:Datastore")
		(rename "Datastore:Datastore1.0r2" "Datastore:Datastore")
	)
	(abort "Patch was not successful. Datastore file could not be patched due to incorrect version, lack of hard drive space, or RAM.")
)
(run "spatch >NIL: <NIL: -oDatastore:DSProg1.0r2 -pDSProg.patch Datastore:DSProg")
(if (exists "Datastore:DSProg1.0r2")
	(
		(delete "Datastore:DSProg")
		(rename "Datastore:DSProg1.0r2" "Datastore:DSProg")
	)
	(abort "Patch was not successful. DSprog file could not be patched due to incorrect version, lack of hard drive space, or RAM.")
)

;GEE, THAT WAS FUN
(exit "Datastore updated to version 1.0r2!")
