
; Install script for ToolsDaemon

(set old_level @user-level)
(set @default-dest "")

(set reqtoolslib "libs/reqtools.library")
(set catalogdir "Catalogs/")
(set handler "ToolsDaemon-Handler")
(set toolsdaemon "ToolsDaemon")
(set toolsprefs "ToolsPrefs")

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

(set default_lang 4)

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

(set #copying-reqtools     "Copying reqtools.library to Libs:...")
(set #copying-toolsdaemon	"Copying ToolsDaemon to SYS:WbStartup...")
(set #copying-handler		"Copying ToolsDaemon-Handler to L:...")

(set #where-prefs "In which drawer should ToolsPrefs be installed ?")

(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 ToolsDaemon 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\nToolsDaemon installation script.\n"
     "This script installs ToolsDaemon on your Amiga.\n\n"
     "Read the documentation for more information\n"
     "on the distribution of ToolsDaemon.\n\n"
     "ToolsDaemon © 1991-1994 Nico François\n"
     "All rights reserved."
))

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

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

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

(message #install-msg)

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

(copylib
	(prompt "\n" #copying-handler)
	(help @copylib-help)
	(source handler)
	(dest "L:")
	(confirm)
)

(copylib
	(prompt "\n" #copying-toolsdaemon)
	(help @copylib-help)
	(source toolsdaemon)
	(dest "SYS:WbStartup")
	(confirm)
	(infos)
)

(set prefsdir
	(askdir
		(prompt #where-prefs)
		(help @askdir-help)
		(default "SYS:Prefs")
	)
)

(copyfiles
	(source toolsprefs)
	(dest prefsdir)
	(infos)
	(noposition)
)

(if (exists "SYS:Locale")
(
	(if (exists "LOCALE:")
	(
		(user 2)
		(set lang (askoptions (prompt #which-language)
									 (help #which-language-help)
									 (choices
										 "Dansk"
										 "Deutsch"
										 "English"
										 "Français"
										 "Italiano"
										 "Nederlands"
										 "Svenska")
							       (default default_lang)
					 )
		)
		(user old_level)

		(set n 0)
		(while (set language (select n
										"dansk"
										"deutsch"
										"english"
										"français"
										"italiano"
										"nederlands"
										"svenska"
										""))
		(
			(if (IN lang n)
			(
				(if (<> 2 n)
				(
					(makedir (cat "LOCALE:Catalogs/" language))
					(copyfiles (source (cat catalogdir language))
								  (dest (cat "LOCALE:Catalogs/" language))
								  (all)
					)
				))
			))
			(set n (+ n 1))
		))
	))
))
