
; Install script for GMS (Workbench 2.0)

(set old_level @user-level)

(set gms_mailer "/Bin/GMS_mailer_MUI")
(set gmslib "/Libs/GMS.library")
(set gms_configlib "/Libs/GMS_config.library")
(set gms_mailerlib "/Libs/GMS_mailer.library")
(set gms_mailer_rexxlib "/Libs/GMS_mailer_rexx.library")
(set gmsdir "/")
(set catalogdir "/Locale/Catalogs/")

;=============================================================================
; English strings

(set default_lang 4)

(set #bad-kick
(cat "You must be using Kickstart 2.04 to install using this script!"
))

(set #copying-gms_bmailer     "Copying GMS_Mailer to GMS:Bin...")

(set #copying-gms             "Copying GMS.library to GMS:Libs...")
(set #copying-gms_config      "Copying GMS_config.library to GMS:Libs...")
(set #copying-gms_mailer      "Copying GMS_mailer.library to GMS:Libs...")
(set #copying-gms_mailer_rexx "Copying GMS_mailer_rexx.library to GMS:Libs...")

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

(set #drawer-gms
(cat "\nA GMS drawer does already exist in the selected "
	" directory. By selecting \"Proceed\", you"
	" indicate that you want to update the GMS"
	" installation with the most recent version.\n"
	"Several GMS specific files will be overwritten!"
))

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

(set #copy-contrib "\nInstall supplied Extra scripts in GMS:Contrib ?")
(set #copy-contrib-help
(cat "\nThis will install some extra scripts "
	"that are included in the GMS distribution."
))

(set #copy-configs "\nInstall supplied example configs in GMS:Config ?")
(set #copy-configs-help
(cat "\nThis will install some example configs "
	"that are included in the GMS distribution."
))

(set #copy-edoc "\nInstall supplied English AmigaGuide manual ?")
(set #copy-doc-help
(cat "\nThis will install AmigaGuide manuals "
	"that are included in the GMS distribution."
))

(set #which-language
(cat "\nWhich languages should be installed ?"
))
(set #which-language-help
(cat "\nThe Amiga can be operated in many different"
	  " languages. If you want GMS to use the same"
          " language as the Amiga Workbench"
	  " then a catalog file must be copied to your"
	  " harddisk for each language supported.\n\n"
	  "To reduce the amount of space consumed by the"
	  " language files, you can select to have only the"
	  " files of specific languages copied.\n\n"
	  "Simply check the boxes of the languages you wish"
	  " to have available on your system.\n\n"
	  @askoptions-help
))

(set #install-msg
(cat "\n\GMS installation script.\n"
	"This script installs GMS on your Amiga.\n\n"
	"Read the README file for more information\n"
	" on the distribution of GMS.\n\n"
	"GMS © 1994-96 Mirko Viviani\n"
	"All rights reserved."
))

(set #gms-startup "\nSome required commands will be added to your \"s:user-startup\" file.")

(set #gms-exit "\nPlease reboot your computer before trying to start any GMS programs.")

;=============================================================================
; make sure we are running under a 2.04 ROM

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

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

(message #install-msg)

(welcome)

(if (<> (exists "GMS:" (noreq)) 0)
(
	(set @default-dest "GMS:/")
))
(
	(set @default-dest "SYS:")
)

(set gmsdestdir
	(tackon
		(askdir
			(prompt #where-gms)
			(help @askdir-help)
			(default @default-dest)
		)
		"GMS"
	)
)

(if (= (exists gmsdestdir) 2)
	(message #drawer-gms)
)
(
	(makedir gmsdestdir
		(help @makedir-help)
		(infos)
	)
)

(set @default-dest gmsdestdir)

;***** Create dirs
(complete 10)

(makedir (tackon gmsdestdir "Bin") (infos))
(makedir (tackon gmsdestdir "Config") (infos))
(makedir (tackon gmsdestdir "Contrib") (infos))
(makedir (tackon gmsdestdir "Docs") (infos))
(makedir (tackon gmsdestdir "Externals") (infos))
(makedir (tackon gmsdestdir "Libs") (infos))
(makedir (tackon gmsdestdir "Locale") (infos))
(makedir (tackon gmsdestdir "Locale/Catalogs"))
(makedir (tackon gmsdestdir "Rexx") (infos))

;***** GMS_mailer_MUI
(complete 20)

(copyfiles
	(prompt "\n" #copying-gms_bmailer)
	(source gms_mailer)
	(dest (tackon gmsdestdir "Bin"))
	(help @copyfiles-help)
	(optional <nofail> <force>)
	(infos)
)

;***** GMS Library
(complete 30)

(copylib
	(prompt "\n" #copying-gms)
	(help @copylib-help)
	(source gmslib)
	(dest (tackon gmsdestdir "Libs"))
	(confirm)
)

;***** GMS_config Library
(complete 40)

(copylib
	(prompt "\n" #copying-gms_config)
	(help @copylib-help)
	(source gms_configlib)
	(dest (tackon gmsdestdir "Libs"))
	(confirm)
)

;***** GMS_mailer Library
(complete 50)

(copylib
	(prompt "\n" #copying-gms_mailer)
	(help @copylib-help)
	(source gms_mailerlib)
	(dest (tackon gmsdestdir "Libs"))
	(confirm)
)

;***** GMS_mailer_rexx Library
(complete 60)

(copylib
	(prompt "\n" #copying-gms_mailer_rexx)
	(help @copylib-help)
	(source gms_mailer_rexxlib)
	(dest (tackon gmsdestdir "Libs"))
	(confirm)
)

;***** Externals
(complete 62)

(copyfiles
	(source "/Externals")
	(dest (tackon gmsdestdir "Externals"))
	(help @copyfiles-help)
	(all)
)

;***** Rexx Scripts
(complete 70)

(if
	(askbool
		(prompt #copy-arexx)
		(help #copy-arexx-help)
		(default 1)
	)
	(
		(copyfiles
			(source "/Rexx")
			(dest (tackon gmsdestdir "Rexx"))
			(help @copyfiles-help)
			(infos)
			(all)
		)
	)
)

;***** Contrib
(complete 72)

(if
	(askbool
		(prompt #copy-contrib)
		(help #copy-contrib-help)
		(default 1)
	)
	(copyfiles
		(source "//Contrib")
		(dest (tackon gmsdestdir "Contrib"))
		(help @copyfiles-help)
		(infos)
		(all)
	)
)

;***** Example Configs
(complete 80)

(if
	(askbool
		(prompt #copy-configs)
		(help #copy-configs-help)
		(default 1)
	)
	(
		(copyfiles
			(source "/Config")
			(dest (tackon gmsdestdir "Config"))
			(help @copyfiles-help)
			(all)
		)
	)
)

;***** English Doc
(complete 85)

(if
	(askbool
		(prompt #copy-edoc)
		(help #copy-doc-help)
		(default 1)
	)
	(
		(copyfiles
			(source "/Docs/English/GMS_mailer.guide")
			(dest (tackon gmsdestdir "Docs/English"))
			(help @copyfiles-help)
			(infos)
		)
		(if (< (/ (getversion) 65536) 39)
		(
			(tooltype
				(dest (tackon gmsdestdir "Docs/English/GMS_mailer.guide"))
				(setdefaulttool "SYS:Utilities/AmigaGuide")
			)
		))
	)
)

;***** Italian Doc
(complete 90)

;(if
;	(askbool
;		(prompt #copy-idoc)
;		(help #copy-doc-help)
;		(default 1)
;	)
;	(
;		(copyfiles
;			(source "/Docs/Italiano/GMS_Mailer.guide")
;			(dest (tackon gmsdestdir "Docs/Italiano"))
;			(help @copyfiles-help)
;			(infos)
;		)
;		(if (< (/ (getversion) 65536) 39)
;		(
;			(tooltype
;				(dest (tackon gmsdestdir "Docs/Italiano/GMS_Mailer.guide"))
;				(setdefaulttool "SYS:Utilities/AmigaGuide")
;			)
;		))
;	)
;)

(copyfiles
	(source "/Docs")
	(dest (tackon gmsdestdir "Docs"))
	(help @copyfiles-help)
	(infos)
)

(if (> (/ (getversion) 65536) 38)
(
	(tooltype
		(dest (tackon gmsdestdir "Docs/Registration_Form"))
		(setdefaulttool "SYS:Utilities/MultiView")
	)
))

(copyfiles
	(source "/README")
	(dest gmsdestdir)
	(help @copyfiles-help)
	(infos)
)
(if (> (/ (getversion) 65536) 38)
(
	(tooltype
		(dest (tackon gmsdestdir "README"))
		(setdefaulttool "SYS:Utilities/MultiView")
	)
))

;***** Startup-Sequence
(complete 95)

(startup "GMS"
	(prompt #gms-startup)
	(help @startup-help)
	(command "if exists \"" gmsdestdir "\"\n")
	(command "   assign GMS: \"" gmsdestdir "\"\n")
	(command "   assign add LIBS:   GMS:Libs\n")
	(command "   assign add REXX:   GMS:Rexx\n")
	(command "   path add GMS:Bin\n")
	(command "endif")
)

;***** Finished
(complete 100)

(exit #gms-exit)
