; Install script for PowerSnap

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

(set catalogdir "Catalogs/")
(set handler "PowerSnap-handler")
(set powersnap "PowerSnap")

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

(set default_lang 4)

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

(set #copying-powersnap		"Copying PowerSnap to SYS:WbStartup...")
(set #copying-handler		"Copying PowerSnap-handler to L:...")

(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 PowerSnap 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\nPowerSnap installation script.\n"
     "This script installs PowerSnap on your Amiga.\n\n"
     "Read the documentation for more information\n"
     "on the distribution of PowerSnap.\n\n"
     "PowerSnap  1991-1994 Nico Franois\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-handler)
	(help @copylib-help)
	(source handler)
	(dest "L:")
	(confirm)
)

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

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

		(set n 0)
		(while (set language (select n
										"dansk"
										"deutsch"
										"english"
										"franais"
										"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))
		))
	))
))
