;
; $VER: Install BurnItDemo V1.01 (13.11.1996)
; This Install-script contains to BurnItDemo V1.07 1996 by DnS
;
(if (= (exists "Env:Language") 1)
	; GetEnv reports "String too long" if the variable doesn't exist! :(
	(set @language (getenv "language"))
)

;**************************************************************************
; Procedures
(procedure copy-catalog
	(set catalog
		(tackon "Catalogs"
		(tackon language "BurnIt.catalog")
		)
	)
	(set destination (tackon "Locale:Catalogs" language))

	(copyfiles
		(prompt (#copy catalog destination))
		(source catalog)
		(dest   destination)
		(help   @copyfiles-help)
	)
)

;**************************************************************************
; English Installation

(set default-lang 1)

(set #bad-kick
	"You must have AmigaOS Release 3.0 or newer to use BurnIt."
)

(set #bad-cpu
	"You must have a 68020 CPU or biger to use BurnIt."
)

(set #welcome
	(cat
		"\n\n\nWelcome to the BurnItDemo installation.\n\n"
		"   BurnIt 1996, DnS."
	)
)

(set #install-parts "Please select the parts you wish to install")

(set #item-BurnIt "BurnIt")

(set #item-BurnIt-guide "BurnIt_E.guide")

(set #item-locale "Translations")

(set #where-BurnIt
	(cat
		"Where do you wish to install BurnIt.\n The directory 'BurnIt' will be created if it is not there."
	)
)

(set #which-language "Which languages should be installed?")

(set #copy "Copying %s to %s...")

(set #help "no help available...")

(set #regis "BurnIt Registration")

;**************************************************************************
; Deutsche Installation

(if (= @language "deutsch")
	(
		(set default-lang 2)

		(set #bad-kick
			(cat
				"Tut mir Leid!\n"
				"Aber Sie men AmigaOS Release 3.0 oder neur haben fr BurnIt."
			)
		)
		(set #bad-cpu
			(cat
				"Tut mir Leid!\n"
				"Aber Sie men eine 68020 CPU oder grer haben fr BurnIt."
			)
		)
		(set #welcome
			(cat
				"\n\n\nWillkommen zu der Installation von BurnItDemo.\n\n"
				"BurnIt 1996 DnS."
			)
		)

		(set #install-parts "Whlen Sie bitte die Teile, die Sie installieren wollen.")

		(set #item-BurnIt "BurnIt")

		(set #item-BurnIt-guide "BurnIt_D.guide")

		(set #item-locale "Kataloge")

		(set #where-BurnIt "Wo wollen sie BurnIt installieren ?\n Ein Verzeichnis 'BurnIt' wird erstellt.")

		(set #which-language "Welche Sprachen sollen installiert werden?")

		(set #copy "Kopiere %s nach %s...")

		(set #help "Keine Hilfe verfgbar...")

		(set #regis "BurnIt registrieren...")

	)
)

;**************************************************************************
; the installaion script

(set @default-dest "")

; Check Kickstart version. Exit if not at least 3.0
(if (< (/ (getversion) 65536) 39)
        (abort #bad-kick)
)

; Check CPU. Exit if < 60020
(if (patmatch "68020" (database "cpu"))
        (abort #bad-cpu)
)

(message #welcome)

(welcome)

(set install-files
	(askoptions
		(prompt #install-parts)
		(help   @askoptions-help)
		(choices
			#item-BurnIt
			#item-BurnIt-guide
			#item-locale
		)
		(default 7)
	)
)

(if (IN install-files 0)
	(set BurnIt-dest
		(askdir
			(prompt  #where-BurnIt)
			(help    @askdir-help)
			(default "Work:")
		)
	)
)

(set where BurnIt-dest)

(if
	(<
		(exists
			(tackon BurnIt-dest "BurnIt")
		)
	2)
	(makedir
		(tackon BurnIt-dest "BurnIt")
		(infos)
	)
)

(set where (tackon BurnIt-dest "BurnIt"))
(set @default-dest where)

(if (IN install-files 1)
	(set guide-dest @default-dest)
)

(set languages 0)

(if (IN install-files 2)
	(set lang
		(askoptions
			(prompt  #which-language)
			(help    @askoptions-help)
			(choices
				"English"
				"Deutsch"
				"Nederlands"
			)
			(default default-lang)
		)
	)
)

; And now do the actual installation

(complete 0)

(if (IN install-files 0)
	(copyfiles
		(prompt (#copy "BurnIt" @default-dest))
		(source "BurnIt")
		(dest   @default-dest)
		(help   @copyfiles-help)
		(noposition)
		(infos)
		(confirm)
	)
)

(if (IN install-files 0)
	(copylib
		(prompt (#copy "asyncio.library" "Libs:"))
		(help @copylib-help)
		(source "asyncio.library")
		(dest "Libs:")
		(confirm)
	)
)

(complete 50)

(if (IN install-files 1)
	(
		(copyfiles
			(prompt (#copy #item-BurnIt-guide guide-dest))
			(source #item-BurnIt-guide)
			(help   @copyfiles-help)
			(dest   guide-dest)
			(newname "BurnIt.guide")
			(infos)
			(noposition)
			(confirm)
		)
	)
)

(complete 75)

(if (IN install-files 2)
	(
		(if (IN lang 1)
			(
				(set language "Deutsch")
				(copy-catalog)
			)
		)
		(if (IN lang 2)
			(
				(set language "Nederlands")
				(copy-catalog)
			)
		)
	)
)
(set BurnIticon-dest (tackon @default-dest "BurnIt"))

(complete 100)
(exit)
