; Digital Universe Demo installation script

(transcript "Installing The Digital Universe, Demo version...")
(complete 0)

(set @default-dest (expandpath @execute-dir))

(set whattoinstall
	(askchoice
		(prompt "Do you wish to install \"The Digital Universe Demo\" in-place, or at "
			"a user-specified location?")
		(help @askchoice-help)
		(choices "In-place" "User-specified location")
	)
)

(if (= whattoinstall 1) (
	(set heredir @default-dest)
	(set @default-dest
		(askdir
			(prompt "Where do you wish to install \"The Digital Universe Demo\"? "
				"A new directory named \"DigitalUniverseDemo\" will be created automatically "
				"in the location you choose.")
			(help @askdir-help)
			(default @default-dest)
		)
	)
	(set @default-dest (tackon @default-dest "DigitalUniverseDemo"))
(complete 10)
	(copyfiles
		(help @copyfiles-help)
		(source heredir)
		(dest @default-dest)
		(all)
		(infos)
	)
))

(complete 70)
(makeassign "DU" @default-dest)
; Add assign to user-startup
(startup "DigitalUniverse"
	(prompt "Adding DU: assign to user-startup")
	(help @startup-help)
	(command "assign DU: \"" @default-dest "\"")
)

(set programversion 0)
(if (= (run "c:cpu check 68881") 0) (set programversion 1))
(if (= (run "c:cpu check 68040") 0) (set programversion 1))
(set programversion
	(askchoice
		(prompt "Which version of the main program do you wish to install? "
			"This installation program has done its best to determine "
			"the version you need, but if it made a mistake, click on the "
			"corrected button below before pressing \"Proceed\"")
		(help "If your system has a math chip or is running on a 68040 (not the 68EC040), "
			"the \"68020+/68881+\" version of the software will be the quickest. "
			"If you are running an Amiga without a math chip, choose \"68000\".\n\n"
			"\"The Digital Universe\" will crash if you use a version not "
			"intended for your particular machine!  In most cases, this "
			"installation script will determine the appropriate version "
			"of the software for you.")
		(choices "68000" "68020+/68881+")
		(default programversion)
	)
)

(if (= programversion 0)
	(
		(rename "DU:DUDemo.000" "DU:DUDemo")
		(delete "DU:DUDemo.881")
	)
	(
		(rename "DU:DUDemo.881" "DU:DUDemo")
		(delete "DU:DUDemo.000")
	)
)

(delete "DU:DUDemoNoIntro")
(run "c:MakeLink from DU:DUDemoNoIntro to DU:DUDemo")

(complete 80)
(copylib
	(prompt "Copying iff.library")
	(help @copylib-help)
	(source "DU:libs/iff.library")
	(dest "libs:")
)
(delete "DU:libs/iff.library")
(complete 90)
(copyfiles
	(prompt "Copying the custom font")
	(help @copyfiles-help)
	(source "DU:fonts")
	(dest "fonts:")
	(all)
)
(delete "DU:fonts/DU/9")
(delete "DU:fonts/DU")
(delete "DU:fonts/DU.font")
(delete "DU:fonts")

(complete 95)
(message "Please ensure that you have read the README-FIRST and "
	"ProductInfo documents before attempting to start "
	"\"The Digital Universe\", as they contain some additional information "
	"about how to use and operate the software.")
(complete 100)
(exit "Done installation of \"The Digital Universe Demo\".")
