
; Install script for GMS (Workbench 2.1 or higher)

(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-idoc "\nInstall supplied Italian 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-95 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.")

;=============================================================================
; Italian strings

(if (= @language "italiano")
(
(set default_lang 16)

(set #bad-kick
(cat "E' necessario il Kickstart 2.04 per installare!"
))

(set #copying-gms_bmailer     "Copio GMS_Mailer in GMS:Bin...")

(set #copying-gms             "Copio GMS.library in GMS:Libs:...")
(set #copying-gms_config      "Copio GMS_Config.library in GMS:Libs:...")
(set #copying-gms_mailer      "Copio GMS_Mailer.library in GMS:Libs:...")
(set #copying-gms_mailer_rexx "Copio GMS_Mailer_rexx.library in GMS:Libs:...")

(set #where-gms
(cat "Dove vorresti installare GMS ?\n"
	"(Verrà creato il drawer)"
))

(set #drawer-gms
(cat "Il drawer GMS nella directory selezionata esiste"
	" già. Selezionando \"Proceed\", verrà installata"
	" la versione più recente di GMS.\n"
	"Alcuni files saranno cancellati!"
))

(set #copy-arexx "\nInstallo gli script ARexx in GMS:Rexx ?")
(set #copy-arexx-help
(cat "\nQuesto installerà alcuni script ARexx "
	"che sono inclusi nella distribuzione di GMS."
))

(set #copy-contrib "\nInstallo gli script extra in GMS:Contrib ?")
(set #copy-contrib-help
(cat "\nQuesto installerà alcuni extra script "
	"che sono inclusi nella distribuzione di GMS."
))

(set #copy-configs "\nInstallo le configurazioni di esempio in GMS:Config ?")
(set #copy-configs-help
(cat "\nQuesto installerà alcune configurazioni di esempio "
	"che sono incluse nella distribuzione di GMS."
))

(set #copy-edoc "\nInstallo il manuale Inglese AmigaGuide ?")
(set #copy-idoc "\nInstallo il manuale Italiano AmigaGuide ?")
(set #copy-doc-help
(cat "\nQuesto installerà i manuali AmigaGuide "
	"che sono inclusi nella distribuzione di GMS."
))

(set #which-language
(cat "\nQuali lingue devono essere installate? "
))

; string needs to be changed (see english string)
(set #which-language-help
(cat "\nAmiga può operate con lingue differenti. "
	"Per ogni lingua supportata saranno copiati "
	"numerosi file sul vostro disco fisso.\n\n"
	"Per ridurre lo spazio occupato da questi "
	"file, potete installare solo quelli di una "
	"lingua specifica.\n\n"
	"Segnate solo i riquadri delle lingue che volete "
	"siano disponibili sul vostro sistema.\n\n"
	@askoptions-help
))

(set #install-msg
(cat "\n\nScript di installazione di GMS.\n"
	"Questo script installa GMS sul tuo Amiga.\n\n"
	"Leggi il file README per alcune informazioni\n"
	" riguardo la distribuzione di GMS.\n\n"
	"GMS © 1994-95 Mirko Viviani\n"
	"Tutti i diritti riservati."
))

(set #gms-startup "\nAlcuni comandi saranno aggiunti al file \"s:user-startup\".")

(set #gms-exit "\nResetta il computer prima di eseguire GMS.")

))

;=============================================================================
; 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
(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)
)

;***** Catalogs
(complete 65)

(set lang (askoptions
		(prompt #which-language)
		(help #which-language-help)
		(choices
			"Deutsch"
			"Español"
			"English"
			"Italiano"
			"Nederlands")
		(default default_lang)
	)
)

(set n 0)
(while (set language (select n
			"deutsch"
			"español"
			"english"
			"italiano"
			"nederlands"
			"")
	)
	(
		(if (IN lang n)
		(
			(if (<> 0 n)
			(
				(makedir (tackon gmsdestdir (cat "Locale/Catalogs/" language)))
				(copyfiles (source (tackon catalogdir language))
					(dest (tackon gmsdestdir (cat "Locale/Catalogs/" language)))
					(help @copyfiles-help)
					(all)
				)
			))
		))
		(set n (+ n 1))
	)
)

;***** 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 75)

(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 80)

(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/Registration_Form")
	(dest (tackon gmsdestdir "Docs"))
	(help @copyfiles-help)
	(infos)
)

(copyfiles
	(source "//Docs/Registration_Form.Australia")
	(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 LOCALE: GMS:Locale\n")
	(command "   assign add REXX:   GMS:Rexx\n")
	(command "   path add GMS:Bin\n")
	(command "endif")
)

;***** Finished
(complete 100)

(exit #gms-exit)
