; $VER: Install_DCC_Send 1.3 (28.10.94)
; Description: Installer script for Grapevine IRC client DCC programs

(complete 0)

(welcome "Welcome to the Grapevine DCC installation utility.\n\n"
	"This script installs the DCC.Send, DCC.Move and DCC.Chat clients "
	"for Grapevine IRC."
)

(set dcc_dir
	(askdir
		(prompt "Where are your Grapevine DCC clients located?")
		(help "This is the directory defined in Grapevine under "
			"the Settings/Paths menu item. If you have preserved "
			"the original directory structure, this should be "
			"the directory DCC in Grapevine directory."
		)
		(default @default-dest)
	)
)

(complete 10)

(copylib (source "DCC.Send.AS225")
	(dest dcc_dir)
	(prompt "Installing DCC.Send")
	(help "DCC.Send.AS225 implements the traditional ircII compatible "
		"DCC SEND protocol (you don't need a DCC.Get.AS225, this does "
		"that too).\n\n"
		"(If Installer is saying there is no currently installed version, "
		"even though you have DCC.Send.AS225 installed, " 
		"it is because the version string was not quite correct before. "
		"You can ignore this.)"
	)
	(optional "force" "askuser")
	(confirm)
)

(complete 20)

(copylib (source "DCC.Move.AS225")
	(dest dcc_dir)
	(prompt "Installing DCC.Move")
	(help "DCC.Move.AS225 is a faster protocol that also supports "
		"resume transfer. Currently, no other IRC client besides "
		"Grapevine is known to support this.\n\n"
		"(If Installer is saying there is no currently installed version, "
		"even though you have DCC.Move.AS225 installed, " 
		"it is because the version string was not quite correct before. "
		"You can ignore this.)"
	)
	(optional "force" "askuser")
	(confirm)
)

(complete 30)

(copylib (source "DCC.Chat.AS225")
	(dest dcc_dir)
	(prompt "Installing DCC.Chat")
	(help "DCC.Chat.AS225 implements the ircII DCC CHAT protocol.")
	(optional "force" "askuser")
	(confirm)
)

(complete 40)

(if (not (exists "SYS:Classes"))
	(
		(makedir "SYS:Classes"
			(prompt "Creating directory SYS:Classes..")
			(help "This directory is for keeping custom BOOPSI classes"))
		(copyfiles (source "S:User-Startup") (dest "S") (newname "S:User-Startup.old"))
		(startup (command "Assign LIBS: SYS:Classes ADD\n")
			(prompt (cat "Adding SYS:Classes to LIBS: assign\n"
						"You will need to reboot before DCC.Chat is usable"))
			(help "This is necessary so that the custom classes can be found"))
	)
)

(if (not (exists "SYS:Classes/Gadgets"))
	(makedir "SYS:Classes/Gadgets"
		(prompt "Creating directory SYS:Classes/Gadgets..")
		(help "This directory is for keeping custom BOOPSI gadgets")
	)
)

(complete 45)

(copylib (source "textfield.gadget")
	(dest "SYS:Classes/Gadgets")
	(prompt "Installing textfield.gadget")
	(help "textfield.gadget is needed by DCC.Chat.AS225.")
	(optional "force" "askuser")
	(confirm)
)

(complete 60)

(copyfiles (source "ProcessFile.rexx")
	(dest "REXX:")
	(prompt "Installing ARexx script for file processing")
	(help "ProcessFile.rexx is an ARexx script that automatically "
		"processes a file received by DCC.Send or DCC.Move. It can "
		"for example show text files, play sound samples, etc."
	)
	(optional "force" "askuser")
	(confirm)
)

(complete 70)

(if (askbool
		(prompt "Do you want to enable the file processing ARexx script?")
		(help "If you answer yes, an environment variable PROCESSDCC will "
			"be set so that DCC.Send will run the ProcessFile.rexx script "
			"after a successfull receive."
		)
	)
	(	
		(textfile (dest "ENV:PROCESSDCC") 
			(append "SYS:RexxC/RX REXX:ProcessFile.rexx \"%s\" \"%s\""))
		(textfile (dest "ENVARC:PROCESSDCC") 
			(append "SYS:RexxC/RX REXX:ProcessFile.rexx \"%s\" \"%s\""))
	)
)
	
(complete 75)

(set install_docs
	(askbool
		(prompt "DCC.Send documentation consists of an AmigaGuide file "
			"that explains the features and usage of both DCC.Send.AS225 "
			"and DCC.Move.AS225. Also included is instructions for setting "
			"these programs up for use with TIA (The Internet Adapter).\n\n"
			"Do you want to copy DCC.Send documentation?"
		)
		(help "No additional help available.")
	)
)

(complete 80)

(if install_docs
	(
		(set docs_dir
			(askdir
				(prompt "Where do you wish to copy the documentation?")
				(help "A suggested place for this is where you have placed "
					"Grapevine documentation. If you have preserved the "
					"original directory structure, this should be the "
					"directory Docs in the Grapevine directory."
				)
				(default (expandpath (tackon dcc_dir "/Docs")))
			)
		)

		(complete 85)

		(copyfiles (source "DCC.Send.guide")
			(dest docs_dir)
			(optional "force" "askuser")
			(infos)
		)
	)
)

(complete 90)

(if (askbool
		(prompt "While DCC.Send is now installed and fully usable, it "
				"has some advanced features that you must "
				"configure if you want to use them. Because of this, "
				"you should read at least the configuration section of "
				"the documentation.\n\n"
				"Do you want to see the documentation now?"
		)
		(help "If you answer yes, MultiView will be started to show "
			"the AmigaGuide form documentation."
		)
	)
	(run "SYS:Utilities/MultiView DCC.Send.guide")
)

(set @default-dest dcc_dir)

(complete 100)
