; DrawStudio Installer Utility
;
; This script is Copyright ©1995-1997 Graham Dean and Andy Dean
;

(
	; Welcome

	(message "Welcome to DrawStudio, the premier drawing and "
		"illustration package for the Amiga range of computers.\n\n"
		"v2.0.0\n\n"
		"©1995-1997 Graham Dean and Andy Dean")


	; Ask where to install it...

	(set destdir
		(askdir
			(prompt "Select where you would like to install "
				"DrawStudio. A drawer called 'DrawStudio' will "
				"be created here.")
			(help "DrawStudio and all necessary files will be "
				"installed in the directory of your choice. You "
				"may wish to create a new directory for "
				"DrawStudio by using the 'Make New Drawer' "
				"gadget.\n")
			(default @default-dest)
			(disk)
		)
	)

	(set destdir
		(tackon destdir "DrawStudio")
	)

	(set @default-dest destdir)

	; See whether this directory exists, if so warn the user

	(if (exists @default-dest) 
		(
			(if (= 0 (askbool
					(prompt "The 'DrawStudio' directory "
						"already exists, overwrite?")
					(help "You may stop the install to "
						"avoid overwriting your current "
						"version of DrawStudio.\n\n"
						"Continuing the install will "
						"overwrite your current files "
						"and you will loose your current "
						"preferences.")
					(choices "Yes" "Quit")
				))

				(

				; User wishes to quit

				(exit (quiet))
				)

			)
		)
	)

	(message "DrawStudio will be installed in " @default-dest)        

	(complete 0)

	; Shall we install the FPU version ?

	(set fpuversion
		(askchoice
			(prompt "Choose which version of DrawStudio to install "
				"based on your processor. Only choose the"
				"\"FPU optimised\" version of the program "
				"if you know your Amiga has a Floating "
				"Point Unit (i.e. a maths coprocessor). "
				"If you are unsure, install the standard "
				"version.")
			(help "If you are running an Amiga without "
				"a floating point unit (FPU), choose "
				"the standard version of DrawStudio. "
				"If you have an FPU, or a 68040 or 68060 "
				"processor, choose the FPU optimised "
				"version.")
			(choices "Standard" "FPU optimised")
		)
	)

	; Language

	(set language
		(askchoice
			(prompt "Choose your language")
			(help "DrawStudio is fully localised for the "
				"languages displayed. Choose the language "
				"you wish the program to use.")
			(choices "English" "Deutsch")
		)
	)

	; Set up decompressor to work with

	(working "Setting up files...")

	(copyfiles
		(source ("DrawStudio_1:"))
		(dest ("T:"))
		(choices "LX" "pcefis")
	)

	(working "Installing DrawStudio Program...")

	; Create the directory if it doesn't exist

	(if (= 0 (exists @default-dest))
		(
			(makedir @default-dest
				(prompt "Creating 'DrawStudio' directory")
				(infos)
			)
		)
	)

	; DISK 1

	(complete 10)

	(working "Decompressing DrawStudio directory (part 1)...")

	(run ("t:pcefis DrawStudio_1:DSdir1.lha \"%s\"" @default-dest))

	(complete 30)

	(working "Decompressing DrawStudio executable...")

	(if (= 0 fpuversion)
		(
			(run ("t:pcefis DrawStudio_1:DrawStudioNON.lha \"%s\""
				@default-dest))
		)

		(
			(askdisk (dest "DrawStudio_2") (assigns)
			(prompt "Please insert disk DrawStudio_2")
			(help "Insert Disk 2 in any drive. You may "
				"remove Disk 1, it will not be needed again."))

			(working "Decompressing DrawStudio program...")

			(run ("t:pcefis DrawStudio_2:DrawStudio881.lha \"%s\""
				@default-dest))
		)
	)
	
	; DISK 2

	(complete 60)

	(askdisk (dest "DrawStudio_2") (assigns)
	(prompt "Please insert disk DrawStudio_2")
	(help "Insert Disk 2 in any drive. You may "
		"remove Disk 1, it will not be needed again."))

	(working "Decompressing DrawStudio directory (part 2)...")

	(run ("t:pcefis DrawStudio_2:DSdir2.lha \"%s\""
		@default-dest))


	; Locale

	(complete 90)

	(askdisk (dest "DrawStudio_2") (assigns)
	(prompt "Please insert disk DrawStudio_2")
	(help "Insert Disk 2 in any drive. You may "
		"remove Disk 1, it will not be needed again."))

	(working "Decompressing DrawStudio locale...")

	(if (= 0 language)
		(
			(run ("t:pcefis DrawStudio_2:LanguageEng.lha \"%s\""
				@default-dest))
		)
		(
			(run ("t:pcefis DrawStudio_2:LanguageDeu.lha \"%s\""
				@default-dest))
		)
	)

	; Say goodbye

	(set endmessage (cat "Many thanks for choosing DrawStudio and "
		"supporting the Amiga.\n\n"
		"If you have any questions, "
		"please contact: LH Publishing, 13 Gairloch Avenue, "
		"Bletchley, MK2 3DH, ENGLAND\n\n"
		"or visit our Web pages at\n\n"
		"http://www.ajdean.demon.co.uk/~studio/ds.html\n\n"
		"Many thanks - Graham and Andy Dean"))

	(complete 100)

	(message endmessage)

	; Cleanup

	(delete ("t:LX"))
	(delete ("t:pcefis"))
)
