; ************************************************
; *
; * LightSocket - HD Install Script
; *
; * $VER: Install-LightSocket 1.0
; *
; * Script written by Graham Waddell
; *
; * Notes:
; *	STATDIR=[<>/stats]  ;Must be created!
; *
; ************************************************
(message "\n\nThank you for purchasing LightSocket!\nPlease take the time to read the\n manual and fill out the\nregistration card.")

(set @app-name		"LightSocket Install")
(set @default-dest	"")

(set ToolSource		"LightSocket")
(set ToolDirPrompt	"Where should the LightSocket drawer be created?")
(set ToolCopyPrompt	"Copying files...")
(set CtrlCopyPrompt	"Copying network controllers...")
(set CtrlSource		"LightSocket/Controllers")

(set ToolDir
	(askdir
		(prompt ToolDirPrompt)
		(help	@askdir-help)
		(default "SYS:")
	)
)

; Ask Which Controller

(set CtrlHelp "The Controller files are necessary so that LightSocket can 'talk' to your network.\n\nYou can install only one of these.")

(set controller
	(askchoice 
		(prompt "Which Network Controller should be installed?")
		(choices "Envoy" "Enlan" "Enlan2" "AmiTCP" "ScreamerNet" "None of the above")
		(help CtrlHelp)
		(default 5)
	)
)
(if (<> controller 5)
	(set controllername (select controller "EnvoyCtrl" "EnlanCtrl" "Enlan2Ctrl" "AmiTCPCtrl" "ScreamerCtrl") )
)

; Copy ParNetCtrl?

(set ParNetCtrlHelp
	(cat 
		"The ParNetCtrl file allows LightSocket to use a machine ParNet'ed off of the LightSocket machine to render."
	)
)

(set ParNetcontroller
	(askbool 
		(help ParNetCtrlHelp)
		(prompt "Do you want to install the 'ParNetCtrl' file so that LightSocket can render on a ParNet'ed machine?")
		(choices "Install" "I Don't Need It")
		(default 1)
	)
)

; Copy LocalCtrl?

(set LocalCtrlHelp
	(cat 
		"The LocalCtrl file allows LightSocket to use THIS machine to render (without unnecessary network overhead).  Install it if this machine should be able to render."
		"\n\nNote:  LightSocket's network controllers will NOT talk to this machine.  If you need to render on it, you MUST install this part."
	)
)

(set localcontroller
	(askbool 
		(help LocalCtrlHelp)
		(prompt "Do you want to install the 'LocalCtrl' file so that LightSocket can render on THIS machine?")
		(choices "Install" "I Don't Need It")
		(default 1)
	)
)

(makedir (tackon ToolDir "LightSocket") )

(set ToolDir (tackon ToolDir "LightSocket") )

(set CtrlDir (tackon	ToolDir "Controllers") )

(copyfiles
	(prompt ToolCopyPrompt)
	(help	@copyfiles-help)
	(source ToolSource)
	(dest	ToolDir)
	(files)
	(infos)
	(pattern "#?")
)

(delete (tackon ToolDir "Config" ) )
(delete (tackon ToolDir "Config.info" ) )
(delete (tackon ToolDir "Graph" ) )
(delete (tackon ToolDir "Graph.info" ) )

; Make default statistics directory

(makedir (tackon (ToolDir) "Stats") )


; Copy the Controllers Now

(if (= localcontroller 1)
	(copyfiles
		(prompt CtrlCopyPrompt)
		(help	@copyfile-help)
		(source (tackon CtrlSource "LocalCtrl"))
		(dest	CtrlDir)
	)
)

(if (= ParNetcontroller 1)
	(copyfiles
		(prompt CtrlCopyPrompt)
		(help	@copyfile-help)
		(source (tackon CtrlSource "ParNetCtrl"))
		(dest	CtrlDir)
	)
)

(if (<> controller 5)
	(copyfiles
		(prompt	CtrlCopyPrompt)
		(help	@copyfiles-help)
		(source (tackon CtrlSource controllername))
		(dest	CtrlDir)
	)
)

(set cfghelp
	(cat
		"This will load the Config program, which\n"
		"allows you to choose which network machines\n"
		"should be used with LightSocket.\n"

	)
)

(set runcfg (askbool
	(help		cfghelp)
	(prompt		"Would you like to run the Config program now?")
	(default	1)
	)
)

(set @execute-dir	ToolDir)

(if runcfg
	(run		"Config")
)

(message "\n\nDon't forget to install the LightSocket client\non the remote machines via Install-Client!\n\nNote: Ignore this for Enlan and ScreamerNet.\nThey do not use clients.")
