
; Install script for Reflex 1.0 - Fido 4D Outbound Manager
; Install script for Workbench 2.04
; © Copyright Uffe Holst Christiansen, 1996
; $VER: Reflex_install_kick_2.04 1.0 (17.11.96)

(set old_level @user-level)

(set tritonlib "/libs/triton.library")
(set tritonbetalib "/libs_beta/triton.library")
(set easyrexxlib "/libs/easyrexx.library")
(set traplistlib "/libs/traplist.library")
(set reqtoolslib "/libs/reqtools.library")
(set reflexdir "/")

;=============================================================================
; English strings for Reflex installation

(set default_lang 2)

(set #bad-kick
(cat "You must be using Kickstart 2.04 or higher to install Reflex!"
))

(set #copying-trition      "Copying triton.library to 'LIBS:'...")
(set #ex-triton            "Examining triton.library...")
(set #copying-easyrexx     "Copying easyrexx.library to 'LIBS:'...")
(set #ex-easyrexx          "Examining easyrexx.library...")
(set #copying-traplist     "Copying traplist.library to 'LIBS:'...")
(set #ex-traplist          "Examining traplist.library...")
(set #copying-reqtools     "Copying reqtools.library to 'LIBS:'...")
(set #ex-reqtools          "Examining reqtools.library...")

(set #where-reflex
(cat "Where would you like to install Reflex?\n"
     "(A drawer will be created)"
))

(set #copy-arexx "\nInstall supplied ARexx scripts in REXX: ?")
(set #copy-arexx-help
(cat "\nThis will install some ARexx scripts "
     "that are included in the Reflex distribution."
))

(set #install-msg
(cat "\n\nReflex\nFido 4D Outbound Manager\n\n"
     "This script installs Reflex on your Amiga.\n\n"
     "Read the README file for more information\n\n"
     "Reflex © 1995-96 Uffe Holst Christiansen\n"
     "All rights reserved."
))

(set #auto-startup
(cat "Should Reflex startup automatically?"
))
(set #auto-startup-help
(cat "\nIt is recommended that you have Reflex running"
     " in the background all the time and invoke it"
     " with its hotkey.\n"
     "\nReflex can either be automatically started from"
     " the WBStartup drawer or from the s:user-startup"
     " script. Naturally you can also choose that"
     " Reflex will not startup automatically."
))
(set #startup-wbstartup "Startup Reflex from WBStartup drawer")
(set #startup-user-startup "Startup Reflex from s:user-startup")
(set #startup-nostartup "No automatic startup")

(set #add-part "Add Reflex directory to command path?")
(set #add-part-help
(cat "\nAdding the Reflex directory to the command path means"
     " Reflex can be accessed without having to specify the"
	 " full command path."
))

(set #tritonbeta
(cat "A beta release of Triton 2.0 is available and included"
     " in the distribution. I have experienced no problems with"
     " this beta release, but still it is a beta, so use it at"
     " your own risk.\n"
     "\nInstall beta release of 'triton.library'?\n"
     "\n(This will overwrite the previously install non-beta version)"
))
;=============================================================================
; make sure we are running under a 2.04 ROM

(if (< (/ (getversion) 65536) 37)
(
    (abort #bad-kick)
))

;=============================================================================

(message #install-msg)

(welcome)

(set reflexdestdir
	(tackon
		(askdir
			(prompt #where-reflex)
			(help @askdir-help)
			(default @default-dest)
		)
		"Reflex"
	)
)

(set @default-dest reflexdestdir)

(working #ex-triton)

(copylib
	(prompt "\n" #copying-triton)
	(help @copylib-help)
	(source tritonlib)
	(dest "LIBS:")
	(confirm)
)

(if
	(askbool
		(prompt #tritonbeta)
		(help #tritonbeta)
		(default 1)
	)
	(
		(working #ex-triton)
		(copylib
			(prompt "\n" #copying-triton)
			(help @copylib-help)
			(source tritonbetalib)
			(dest "LIBS:")
			(confirm)
		)
	)
)

(working #ex-easyrexx)

(copylib
	(prompt "\n" #copying-easyrexx)
	(help @copylib-help)
	(source easyrexxlib)
	(dest "LIBS:")
	(confirm)
)

(working #ex-traplist)

(copylib
	(prompt "\n" #copying-traplist)
	(help @copylib-help)
	(source traplistlib)
	(dest "LIBS:")
	(confirm)
)

(working #ex-reqtools)

(copylib
	(prompt "\n" #copying-reqtools)
	(help @copylib-help)
	(source reqtoolslib)
	(dest "LIBS:")
	(confirm)
)

(makedir reflexdestdir (infos))
(makedir (tackon reflexdestdir "Catalogs"))

; copy Reflex executable
(copyfiles
	(source (tackon reflexdir "Reflex"))
	(dest reflexdestdir)
	(infos)
)

; copy Reflex AmigaGuide help
(copyfiles
	(source (tackon reflexdir "Reflex.guide"))
	(dest reflexdestdir)
	(infos)
)

; Add correct tooltype for Multiview-less systems
(tooltype
	(dest (tackon reflexdestdir "Reflex.guide"))
	(setdefaulttool "AmigaGuide")
)

; copy Reflex ARexx documentation
(copyfiles
	(source (tackon reflexdir "Reflex.ARexx.doc"))
	(dest reflexdestdir)
	(infos)
)

; copy README
(copyfiles
	(source (tackon reflexdir "README"))
	(dest reflexdestdir)
	(infos)
)

; copy Reflex.regform
(copyfiles
	(source (tackon reflexdir "Reflex.regform"))
	(dest reflexdestdir)
	(infos)
)

(if
	(askbool
		(prompt #copy-arexx)
		(help #copy-arexx-help)
		(default 1)
	)
	(
		(copyfiles
			(source (tackon reflexdir "Rexx"))
			(dest "REXX:Reflex")
			(all)
		)
	)
)

(user 2)
(set autostartup (askchoice (prompt #auto-startup)
							(help #auto-startup-help)
							(choices
								#startup-wbstartup
								#startup-user-startup
								#startup-nostartup)
							(default 0)
				 )
)
(user old_level)

; startup from WBStartup drawer
(if (= autostartup 0)
(
	(copyfiles  (source (tackon reflexdir "Reflex.project.icon"))
				(dest "SYS:WBStartup")
				(newname "Reflex.info")
	)
	(tooltype
		(dest "SYS:WBStartup/Reflex")
		(settooltype "DONOTWAIT" "")
		(setdefaulttool (tackon reflexdestdir "Reflex"))
	)

))

(user 2)
(set addpath (askbool (prompt #add-part)
					  (help #add-part-help)
					  (default 1)
			 )
)
(user old_level)

(if (= autostartup 1)
(
	(if addpath
	(
		(startup "Reflex"
			(prompt "Some commands will be added to your \"s:user-startup\" file.")
			(help @startup-help)
			(command (cat "    Path >NIL: \"" reflexdestdir "\" ADD\n"))
			(command (cat "    Run >NIL: <NIL: \"" (tackon reflexdestdir "Reflex\"")))
		)
	)
	(
		(startup "Reflex"
			(prompt "A command will be added to your \"s:user-startup\" file.")
			(help @startup-help)
			(command (cat "    Run >NIL: <NIL: \"" (tackon reflexdestdir "Reflex\"")))
		)
	))
)
(
	(if addpath
	(
		(startup "Reflex"
			(prompt "A command will be added to your \"s:user-startup\" file.")
			(help @startup-help)
			(command (cat "    Path >NIL: \"" reflexdestdir "\" ADD"))
		)
	))
))
