;$VER: QCInstall v1.01
;By Bo Lincoln 1993-94
;This script uses the installer program to install Quadra Composer to
;your hard drive. 

(complete 0)
(welcome)

;Check kickver
(if (< (/ (getversion) 65536) 37)
	(abort ("You must have kickstart 2.0x + to use this installation "
		"utility, and to run QuadraComposer 2.1")  
	)
)

(message
	("\nThis program lets you install Quadra Composer to your hard ")
	("disk drive. If you don't own one, abort installation immediately. ")
)

(set sdir (pathonly @icon))
;Get dir for drawer
(set tdir (askdir (prompt ("Where do you want to install Quadra Composer 2.1?"))
		(help ("Select a drawer where you want to install the ")
		("Quadra Composer 2.1.\n")
		)
		(default @default-dest)
	)
)
(set @default-dest tdir)

(set ans (askbool 
			(
			(prompt "\nDo you want to make a new drawer called QuadraComposer?")
			(help "")
			)
		)
)
(if 
	(= 1 ans)

	(
		(makedir (tackon tdir "QuadraComposer") (infos))
		(set tdir (tackon tdir "QuadraComposer"))
	)

)
(working ("Copying Quadra Composer"))
;Copy main program
(copyfiles
	(source (tackon sdir "QuadraComposer"))
	(dest tdir)
	(help @copyfiles-help)
	(infos)
)

(complete 40)

(if (exists (tackon sdir "Icons"))
	(if ( askbool 
			(
			(prompt "\nDo you wish to install the icon images?")
			(help "")
			)
		)
	(
		(makedir (tackon tdir "Icons") (infos))
		(if (exists (tackon sdir "Icons") (noreq))
			(
				(copyfiles
					(source (tackon sdir "Icons/"))
					(dest (tackon tdir "Icons/"))
					(all)
					(infos)
				)
			)
		)
	)
	)
)

(complete 45)

(if (OR (exists (tackon sdir "Samples") (noreq)) (exists (tackon sdir "Modules") (noreq))  (exists (tackon sdir "Envelopes") (noreq)))
	(if ( askbool 
			(
			(prompt "\nDo you wish to install some example modules, samples and envelopes?")
			(help "")
			)
		)
	(
		(makedir (tackon tdir "Samples") (infos))
		(makedir (tackon tdir "Modules") (infos))
		(makedir (tackon tdir "Envelopes") (infos))
		(if (exists (tackon sdir "Samples") (noreq))
			(
				(copyfiles
					(source (tackon sdir "Samples/"))
					(dest (tackon tdir "Samples/"))
					(all)
					(infos)
				)
			)
		)
		(if (exists (tackon sdir "Modules") (noreq))
			(
				(copyfiles
					(source (tackon sdir "Modules/"))
					(dest (tackon tdir "Modules/"))
					(all)
					(infos)
				)
			)
		)
		(if (exists (tackon sdir "Envelopes") (noreq))
			(
				(copyfiles
					(source (tackon sdir "Envelopes/"))
					(dest (tackon tdir "Envelopes/"))
					(all)
					(infos)
				)
			)
		)
	)
	)
)

(complete 50)
(if (exists (tackon sdir "Docs") (noreq))
	(
	(set ans (askbool 
				(
				(prompt "\nDo you wish to install the documentation?")
				(help "")
				)
			)
	)
	(if 
		(= 1 ans)
		(
			(makedir (tackon tdir "Docs") (infos))
			(copyfiles
				(source (tackon sdir "Docs/"))
				(dest (tackon tdir "Docs/"))
				(all)
				(infos)
			)
		)
	)
	)
)

(complete 70)
(message
	"\nAnd now the fonts, QC 6 & 8, will be copied..."
)
(copyfiles
	(source (tackon sdir "fonts"))
	(all)
	(dest "FONTS:")
	(fonts)
	(help @copyfiles-help)
)
(complete 75)
(message
	"\nSome replayroutines are included in this package."
	" They will now be installed..."
)

(copyfiles
	(prompt "Select files to copy:")
	(source sdir)
	(dest tdir)
	(choices
		"QCReplay.s"
		"QCFastreplay.s"
		"QCCIAReplay.s"
	)
	(confirm)
	(infos)
	(help @copyfiles-help)
)

(complete 80)
(if (exists "s:QuadraComposer.prefs")
	(if (askbool (prompt "\nIn this version of QuadraComposer, the prefs file will "
						 "be stored in the ENVARC: drawer, instead of S:.\nDo you want to move "
                         "your current prefs file there?"
					)
				(help "")
		)
		(
		(copyfiles
			(source "s:QuadraComposer.prefs")
			(dest "ENVARC:")
			(help @copyfiles-help)
		)
		(delete "s:QuadraComposer.prefs")
		)
	)
)

(complete 85)
(if (exists (tackon sdir "QuadraPlayer"))
	(if ( askbool 
			(
			(prompt "\nThere is a stand-alone module player distributed with QuadraComposer."
					"\nDo you wish to install it?"
			)
			(help "")
			)
		)
		(copyfiles
			(source (tackon sdir "QuadraPlayer"))
			(dest tdir)
			(help @copyfiles-help)
			(infos)
		)
	)
)

(if (exists (tackon sdir "QuadraComposer.key"))
	(
		(message "\nYou are a registered user of QuadraComposer.\n"
				"From this version of QuadraComposer, you will be recognized through the file "
				"ENVARC:QuadraComposer.key. If you want to copy this disk to someone else, "
				"make sure that file is removed from the disk first."
		)
		(copyfiles
			(source (tackon sdir "QuadraComposer.key"))
			(dest "ENVARC:")
			(help @copyfiles-help)
		)
	)
)

(complete 95)
(message
	"\nThis is the last part of this installation. 'reqtools.library' will "
	"be copied to your libs: drawer, if you don't " 
	"already have a later version installed."
)
(copylib
	(prompt "Copying reqtools...")
	(help @copylib-help)
	(source (tackon sdir "libs/reqtools.library"))
	(dest "libs:")
	(confirm)
)
(complete 100)
(exit ("Have fun!"))
