; $Id: Prelude Install (english) by Thomas Wenzel
; $VER: PreludeInstall 2.0 (24.11.98)


;------------------------------------------------------------------------------
(procedure P_WELCOME
	(if (not (askbool
		(prompt		"\n"
							"Welcome!\n"
							"\n"
							"Most of the programs on this CD don't need any specific "
              "installation procedure. You can copy them anywhere you "
              "like or start them directly from the CD. "
              "\n"
              "If you want to use AHI you have to install it BEFORE "
              "starting this installation. AHI is not included on this CD\n"
							"\n"
							"Do you whish to install the drivers and control programs?"
		)
		(help     " You can abort the installation now.")
		))
		(
						(abort ("Installation aborted." ""))
		)
	)
)	
;------------------------------------------------------------------------------
(procedure P_ASK_COMPONENTS
	(set #components
		(askoptions
			(prompt "Please select the components to install.\n"
              "The sekdprelude.library is only needed if you intend "
              "to run Samplitude 3.0.\n")
			(choices "Mixer" "PreludeReset" "prelude.library" "AHI driver" "sekdprelude.library")
			(default 15)
			(help	"\n\n"
            "Mixer:\n"
            "This is a commodity to control the settings of Prelude's "
            "onboard analog mixer. It will be placed in your WBStartup "
            "drawer so that it will be active each time you start your "
            "Amiga.\n"
            "\n"
            "PreludeReset:\n"
            "This program will reset and initialize the Prelude and load "
            "the saved mixer settings. It will be called from your user-"
            "startup each time you boot.\n"
            "\n"
						"Almost every program included on the CD makes "
            "use of the prelude.library. It is strongly recommended "
            "to install it.\n\n"
            "The sekdprelude.library is only needed if you intend to "
            "run Samplitude 3.0.\n\n")
		)
	)
)
;------------------------------------------------------------------------------
(procedure P_ASK_PLAY16
	(set #play16
		(askbool
			(prompt "\n\nDo you wish to configure Play16 to automatically play "
              "via the Prelude each time you use it? If yes "
              "I will create the corresponding environment variable.\n")
			(help	"")
			(default 1)
		)
	)
)
;------------------------------------------------------------------------------
(procedure P_CREATE_DESTDIR #destdir
	(
		(if (NOT (exists #destdir))
			(
				(makedir #destdir)
			)
		)
	)
)
;------------------------------------------------------------------------------
(procedure P_INSTALL_COMPONENTS
	(

		(if (= (bitand #components 1) 1)
			(
				(copyfiles
					(source "Programs/Prelude/Mixer/")
					(pattern "Mixer(|.info)")
					(dest "SYS:WBStartup/")
				)
			)
		)

		(if (= (bitand #components 2) 2)
			(
				(copyfiles
					(source "Programs/Prelude/Tools/PreludeReset")
					(dest "C:")
					(newname "PreludeReset")
				)

				(P_CREATE_DESTDIR "ENV:Prelude")
				(copyfiles
					(source "ENVARC/Prelude/Prelude.prefs")
					(dest "ENV:Prelude/")
				)
				(P_CREATE_DESTDIR "ENVARC:Prelude")
				(copyfiles
					(source "ENVARC/Prelude/Prelude.prefs")
					(dest "ENVARC:Prelude/")
				)
				(startup
					("Prelude")
					(command "C:PreludeReset")
				  (prompt "\n\n"
						"Installer will modify your S:User-Startup file. "
					  "Following lines will be appended to it:\n\n"
					  "C:PreludeReset")
				  (help @startup-help)
				)
			)
		)

		(if (= (bitand #components 4) 4)
			(
				(copylib
					(confirm)
					(help @copylib-help)
					(prompt "Installing prelude.library")
					(source "Libs/prelude.library")
					(dest "Libs:")
				)
			)
		)

		(if (= (bitand #components 8) 8)
			(
				(copylib
					(confirm)
					(help @copylib-help)
					(prompt "Installing prelude.audio")
					(source "devs/AHI/prelude.audio")
					(dest "Devs:AHI/")
				)
        (copyfiles
          (source "devs/AudioModes/PRELUDE")
          (dest "Devs:AudioModes")
        )
				(P_CREATE_DESTDIR "ENV:sys")
				(copyfiles
					(source "ENVARC/sys/ahi.prefs")
					(dest "ENV:sys/")
				)
				(P_CREATE_DESTDIR "ENVARC:sys")
				(copyfiles
					(source "ENVARC/sys/ahi.prefs")
					(dest "ENVARC:sys/")
				)
			)
		)

		(if (= (bitand #components 16) 16)
			(
				(copylib
					(confirm)
					(help @copylib-help)
					(prompt "Installing sekdprelude.library")
					(source "Libs/sekdprelude.library")
					(dest "Libs:")
				)
			)
		)

		(copylib
			(confirm)
			(help @copylib-help)
			(prompt "Installing asyncio.library")
			(source "Libs/asyncio.library")
			(dest "Libs:")
		)
	)
)
;------------------------------------------------------------------------------
(procedure P_PREPARE_PLAY16
	(
		(if (= #play16 1)
			(
				(copyfiles
					(source "Programs/Play16/Play16")
					(dest "SYS:c")
				)
				(run "setenv Play16/Output PRELUDE")
				(run "setenv ENVARC:Play16/Output PRELUDE")
			)
		)
	)
)

;==============================================================================
(if (< @installer-version (+ (* 43 65536) 3))
(
	(if (not (askbool
		(prompt		" You have an old version of the Installer. I'll probably"
		          " need version 43.3 or greater. You can continue anyway"
		          " but there is no guarantee it will work as it's supposed"
		          " to do.\n"
		          " Do you wish to continue anyway?")
		(help 		" The version of Installer you use is too old. You can"
		          " find a more recent version on the Internet, for example"
		          " on Aminet, in the util/misc directory. The current"
		          " file name is \"Installer-43_3.lha\":\n"
		          " <URL:ftp://ftp.germany.aminet.org/pub/aminet/util/misc/Installer-43_3.lha")
	))
	(
		(abort ("Installation aborted." ""))
	))
))

(complete 0)
(P_WELCOME)
(P_ASK_COMPONENTS)
(complete 25)
(P_ASK_PLAY16)
(complete 50)
(P_INSTALL_COMPONENTS)
(complete 75)
(P_PREPARE_PLAY16)
(complete 100)
(set @default-dest "SYS:")
