; $VER: Install-HydraNexus V1.1 (24.1.96)
; Installation script to install HydraNEXUS to hard disk using the 
; Installer utility
; Copyright Optonica Limited 1996 All Rights Reserved

(welcome "Install HydraNEXUS-2")

; source directory path
(set sourceName
	(pathonly @icon)
)

; destination directory path = <user-select>
(set destName
	(tackon
		(askdir
			(prompt "Where shall I place the HydraNEXUS directory?")
			(help @askdir-help)
			(default @default-dest)
		)
		"HydraNEXUS"
	)
)

; if dir doesn't exist, create it (with icon file)
(if (= (exists destName) 0)
	(makedir destName (safe) (infos))
)

; set dest dir
(set @default-dest destName)

; Copy all files that belong in the HydraNEXUS directory

(copyfiles
	(help @copyfiles-help)
	(source (tackon sourceName "HydraNEXUS"))
	(dest destName)
	(all)
)

; Modify HydraNEXUS icon colours
(tooltype (dest (tackon destName "HydraNEXUS"))
	 (swapcolors)
)

; Copy each of the required library files (only done if it is a LATER version)

(working "Copying Libraries into Libs: directory")
(set sourceLibs (tackon sourceName "Libs"))
(foreach
	sourceLibs
	"#?.library"
	(copylib
		(help @copylib-help)
		(source (tackon sourceLibs @each-name))
	(dest "Libs:")
	)
)

; install network service programs
(set service-help "The Network service enables Envoy/Enlan network support facilities within HydraNEXUS including File Transfer, Screen Grabbing, Chat and Mail")
(transcript "Ask Install InfoNEXUS Service" )

(set InsService (askbool (prompt "Install InfoNEXUS network server?") (help service-help) (default 0)))
(if (= InsService 1)
	(
		(transcript "Installing Extras" )
		(copyfiles
			(help @copyfiles-help)
			(source (tackon sourceName "Extras"))
			(dest destName)
			(all)
		)

		(if (= (exists "Enlan:") 2)
			(
				(transcript "Installing Enlan Service")
				(set IsEnvoy 0)
				(set servicedir "Enlan:Servers")
				(copyfiles
					(help @copyfiles-help)
					(source (tackon sourceName "Enlan"))
					(dest servicedir)
					(all)
				)
			)
			(
				(transcript "Installing Envoy Service")
				(set IsEnvoy 1)
				(set servicedir "SYS:Envoy/Services")
				(if (= (exists servicedir) 0)
					(
						(set envoydir
							(askdir
								(prompt "Where are your Envoy files located ?")
								(help @askdir-help)
								(default @default-dest)
							)
						)
						(set servicedir (tackon envoydir "Services"))
						(if (<> (exists servicedir) 2)
							(set servicedir envoydir)
						)
					)
				)
				(copyfiles
					(help @copyfiles-help)
					(source (tackon sourceName "Envoy"))
					(dest servicedir)
					(all)
				)
			)
		)
	)	
)

(if (= InsService 1)
	(
		(if (= IsEnvoy 1)
			(message "\nThe installation of HydraNEXUS is now complete.\n\n"
   	   		   "To enable the InfoNEXUS.service (see manual for more details) use the ENVOY services configuration tool found in the Envoy/configuration directory.\n\n"
						"NOTE Under OS2.x the Services Configuration program may misbehave, the ADD and DELETE buttons are obscured with a string gadget from the list view, a narrow portion of these buttons remain revealed and usable\n"
			)
		)
		(message	"Three 8SVX samples are included, these may be replaced with your favorite sound.\n"
					"Please note to keep them short\n\n"
					"HydraNEXUS.PosSnd - Sound on Key Presses\n"
					"HydraNEXUS.NegSnd - Sound on Illegal operations\n"
					"InfoNEXUS.MailSnd - Sound on receipt of mail\n\n"
		)
	)
	(
		(message "\nThe installation of HydraNEXUS is now complete.\n\n"
					"Two 8SVX samples are included, these may be replaced with your favorite sound.\n"
					"Please note to keep them short\n\n"
					"HydraNEXUS.PosSnd - Sound on Key Presses\n"
					"HydraNEXUS.NegSnd - Sound on Illegal operations\n\n"
		)
	)
)
