; -------------------------------------------------------------------------
; $VER: Alcuin-Install 1.0 (28.1.96)
;
; Installer-Script for Alcuin V1.0
; Copyright © 1996 by Stephan Schupfer


;================================= ENGLISH ==================================

(set #install-start
	(cat
		"\nWelcome to the Alcuin installation utility!\n\n"
		"This script installs Alcuin on your Amiga.\n"
		"Alcuin is SHAREWARE. Using it means registering.\n"
		"Read the docs for more info.\n\n"
		"© 1996 by Stephan Schupfer\n"
		"All rights reserved\n"
		)
	)
(set #install-exit
	(cat
		"Thank you for installing Alcuin ...\n"
		"... and remember: don't forget to register."
		)
	)
(set #bad-kick "You must be using Kickstart 2.0 or higher to install Alcuin\n\n\n")
(set #Alcuin-dir "\nWhere would you like to copy the Alcuin directory?")
(set #Alcuin-icons "\nInstall what style of icons?")
(set #Alcuin-docs "\nSelect documentation")
(set #Alcuin-doc "\nInstall documentation")
(set #Alcuin-fonts "\nInstall fonts")
(set #Alcuin-cats "\nSelect catalog")
(set #Alcuin-cat "\nInstall catalog")
(set #Alcuin-icon "\nInstall MWB-icons")
(set #Alcuin-c "\nInstall utilities")
(set #Alcuin-startup "\nDo you want Installer to make the required changes to your s:user-startup script ?")
(set #Copy-main "\nInstall Alcuin main")
(set #Copy-docs "\nInstall Alcuin Docs")
(set #icons-help "This option is for people that have installed MagicWB.\n\nInstead of copying MagicWB icons over the original icons, you may select MagicWB here, and a special set of icons, especially designed for Alcuin will be installed.\n\nNOTE: MagicWB is Copyright © 1992-1994 by Martin Huttenloher.")
(set #docs-help "Alcuin documentation:\n\n * Documentation in AmigaGuide format.\n   Read this document for more information about\n   Alcuin\n * Orderform\n   Use this to register Alcuin.")
(set #cat-help "The default language of Alcuin is english. So if you don't install any catalog file, you can use Alcuin in english.\n\nUnfortunately there is only one language available at the moment. But this will (hopefully) change in future versions.")
(set #startup-help "Alcuin requires some additions to your s:user-startup script, that Installer is about to make.")
(set #text-main "\nDo you want to install Alcuin main file?")
(set #text-docs "\nDo you want to install Alcuin documentation files?")
(set #text-font "\nDo you want to install Alcuin font files?")
(set #text-cat "\nDo you want to install Alcuin catalog files?")
(set #text-icon "\nDo you want to install Alcuin icons?")
(set #text-util "\nDo you want to install Alcuin utilities?")
(set #imain-help "This installs the Alcuin main programm.")
(set #idocs-help "This installs the documentation files, which we recommend to study.")
(set #ifont-help "For proper function, Alcuin need some font files.")
(set #icat-help "Here you can select some other languages than the programmed english language.")
(set #iicon-help "If you have selected MWB-Icons, they will be installed here")
(set #iutil-help "The utilities are necessary for creating the ROM image and the card files.")
(set default_language 1)

;===[ German Documentation ]=================================================

(if (= @language "deutsch")
	(
	(set #install-start
		(cat
			"\nWillkommen zur Alcuin Installation\n\n"
			"Es wird nun Alcuin auf Ihrem Amiga installiert.\n"
			"Alcuin ist SHAREWARE. Lassen Sie sich registrieren.\n"
			"Für weitere Informationen lesen Sie bitte die Anleitung\n\n"
			"© 1996 by Stephan Schupfer\n"
			"All rights reserved\n"
			)
		)
	(set #install-exit
		(cat
			"Danke, daß Sie Alcuin installiert haben ...\n"
			"... vergessen Sie nicht, sich registrieren zu lassen."
			)
		)
	(set #bad-kick "Sie müssen Kickstart 2.0 oder höher verwenden um Alcuin zu installieren\n\n\n")
	(set #Alcuin-dir "\nWohin soll das Verzeichnis Alcuin kopiert werden?")
	(set #Alcuin-icons "\nWelches Aussehen der Icons wünschen Sie?")
	(set #Alcuin-docs "\nWelche Dokumentation wünschen Sie?")
	(set #Alcuin-doc "\ninstalliere Dokumentation")
	(set #Alcuin-fonts "\ninstalliere Fonts")
	(set #Alcuin-cats "\nWelche catalog Dateien wünschen Sie?")
	(set #Alcuin-cat "\ninstalliere catalog Dateien")
	(set #Alcuin-icon "\ninstalliere MWB-icons")
	(set #Alcuin-c "\ninstalliere utilities")
	(set #Alcuin-startup "\nSoll der Installer sie notwendigen Änderungen in Ihrer s:user-startup Datei vornehmen?")
	(set #Copy-main "\ninstalliere Alcuin Hauptprogramm")
	(set #Copy-docs "\ninstalliere Alcuin Dokumention")
	(set #icons-help "Diese Option ist für Leute, welche MagicWB installiert haben.\n\nAnstelle die MagicWB Icons später über die original Icons zu kopieren, können Sie hier auswählen welche Icons Sie installieren möchten.\n\nNOTE: MagicWB is Copyright © 1992-1994 by Martin Huttenloher.")
	(set #docs-help "Die Dokumentation von Alcuin:\n\n * Dokumentation im AmigaGuide format.\n   Für mehr Informationen über Alcuin, bitte lesen\n   Sie hier nach.\n * Bestellformular\n   Verwenden Sie dieses Formular um sich für Alcuin\n   registrieren zu lassen.")
	(set #cat-help "Alcuin ist in Englisch programmiert. Sollten Sie eine andere Sprache bevorzugen so können Sie hier eine entsprechende catalog Datei auswählen.\n\nLeider ist momentan nur eine weiter Sprache zur Auswahl vorhanden, was sich aber in Zukunft ändern wird (soll).")
	(set #startup-help "Alcuin benötigt einige Zusätze zu Ihrer s:user-startup Datei, welche der Installer nun vornehmen kann.")
	(set #text-main "\nWollen Sie die Alcuin Hauptdatei installieren?")
	(set #text-docs "\nWollen Sie die Alcuin Dokumentation installieren?")
	(set #text-font "\nWollen Sie die Alcuin Fonts installieren?")
	(set #text-cat "\nWollen Sie die Alcuin Catalogdateien installieren?")
	(set #text-icon "\nWollen Sie die Alcuin Icons installieren?")
	(set #text-util "\nWollen Sie die Alcuin Utilities installieren?")
	(set #imain-help "Hier wird das Programm Alcuin installiert.")
	(set #idocs-help "Hier wird die Dokumentation, deren Studium Ihnen empfohlen wird, installiert.")
	(set #ifont-help "Zum Betrieb von Alcuin sind eigene Zeichensätze notwendig, die hier installiert werden.")
	(set #icat-help "Hier können Sie andere Sprachen, als die einprogrammierte, englische Sprache auswählen.")
	(set #iicon-help "Sollten Sie MWB-Icons gewählt haben, werden hier die notwendigen Icondateien überschrieben.")
	(set #iutil-help "Die Utilities sind Programme, die zur Erstellung der ROM Datei, und zur Erzeugung der Einsteckkarten Dateien notwendig sind.")
	(set default_language 2)
	)
)

;============================== VARS ================================
(set sPath (expandpath (pathonly @icon)))
(set sourcePath (cat sPath "//"))

;============================== PROGRAM-START================================

(complete 0)
(set @default-dest "")
; Check Kickstart (>= v2.0) Version.
(if (< (/ (getversion) 65536) 37)
	(abort #bad-kick)
)
(message #install-start)

(welcome)

;Ask for directory
(set m-dest (askdir (prompt #Alcuin-dir)
	(help @askdir-help)
	(default "SYS:")
	)
)
; Ask for style of icons
(set icons (askchoice (prompt #Alcuin-icons)
           (help #icons-help)
           (choices "Original Workbench" "MagicWB")
           (default 0)
           )
)
(procedure install-main
; Install Alcuin main
(makedir (tackon m-dest "Alcuin") (infos))
(set main-dest (cat m-dest "Alcuin/"))
(copyfiles (source (tackon sourcePath "Alcuin"))
	(prompt #Copy-main)
	(dest main-dest)
	(infos)
	)
(if (= icons 1)
	(copyfiles (source (tackon sourcePath "MWBIcons/Alcuin.info"))
		(dest main-dest)
		(newname "Alcuin.info")
		)
    )
)
(if (< @user-level 2)
	(install-main)
	(if (askbool 
		(prompt #text-main)
		(help #imain-help)
		)
		(install-main)
		)
	)
(complete 20)
(procedure install-docs
; Install Alcuin Docs
(set docum (askoptions (prompt #Alcuin-docs)
	(help #docs-help)
	(choices "English"
			 "Deutsch")
	(default default_language)
	)
)
(set n 0)
(while (set docu (select n "English"
						   "Deutsch"
                           ""))
(
	(if (in docum n)
		(
			(makedir (cat main-dest "Docs") (infos) (prompt #Alcuin-doc))
			(makedir (cat main-dest (cat "Docs/" docu)))
			(copyfiles (source (tackon sourcePath (cat "Docs/" docu )))
				(dest (cat main-dest (cat "Docs/" docu)))
				(infos)
				(all)
				)
			(if (= icons 1)
				(copyfiles (source (tackon sourcePath (cat "MWBIcons/Docs/" docu )))
					(dest (cat main-dest (cat "Docs/" docu)))
					(infos)
					(all)
					)
			    )
		)
	)
	(set n (+ n 1))
	)
)
)
(if (< @user-level 2)
	(install-docs)
	(if (askbool 
		(prompt #text-docs)
		(help #idocs-help)
		)
		(install-docs)
		)
	)
(complete 40)
; Install Alcuin Fonts
(procedure install-font
(copyfiles (source (tackon sourcePath "fonts"))
	(prompt #Alcuin-fonts)
	(dest "FONTS:")
	(all)
	(noposition)
	)
)
(if (< @user-level 2)
	(install-font)
	(if (askbool 
		(prompt #text-font)
		(help #ifont-help)
		)
		(install-font)
		)
	)
(complete 60)
; Install Alcuin catalog
(procedure install-catalog
(set a (- default_language 1))
(set catalogs (askoptions (prompt #Alcuin-cats)
	(help #cat-help)
	(choices "Deutsch"
             )
	(default a)
	)
)
(set n 0)
(while (set catalog (select n "Deutsch"
							  ""))
	(
	(if (in catalogs n)
		(
			(copyfiles (source (tackon sourcePath (tackon "Catalogs" (tackon catalog "Alcuin.catalog"))))
				(prompt #Alcuin-cat)
				(dest (cat "LOCALE:Catalogs/" catalog))
				(noposition)
				)
		)
	)
	(set n (+ n 1))
	)
)
)
(if (< @user-level 2)
	(install-catalog)
	(if (askbool 
		(prompt #text-cat)
		(help #icat-help)
		)
		(install-catalog)
		)
	)
(complete 80)
(procedure install-icons
; Install Alcuin icons
(if (= icons 1)
	(
	(copyfiles (source (tackon sourcePath "MWBIcons/Alcuin_Port1.info" ))
		(prompt #Alcuin-icon)
		(dest main-dest)
		(infos)
		)
	(copyfiles (source (tackon sourcePath "MWBIcons/Alcuin_Port2.info" ))
		(dest main-dest)
		(infos)
		)
	(copyfiles (source (tackon sourcePath "MWBIcons/Alcuin_RAM.info" ))
		(dest main-dest)
		(infos)
		)
	(copyfiles (source (tackon sourcePath "MWBIcons/Alcuin_ROM.info" ))
		(dest main-dest)
		(infos)
		)
	(copyfiles (source (tackon sourcePath "MWBIcons/Alcuin_State.info" ))
		(dest main-dest)
		(infos)
		)
	)
)
)
(if (< @user-level 2)
	(install-icons)
	(if (askbool 
		(prompt #text-icon)
		(help #iicon-help)
		)
		(install-icons)
		)
	)
(complete 85)
(procedure install-utils
; Install Alcuin Utilities
(makedir (cat main-dest "c") (prompt #Alcuin-c))
(copyfiles (source (tackon sourcePath "c"))
	(dest (cat main-dest "c"))
	(noposition)
	(all)
	)
)
(if (< @user-level 2)
	(install-utils)
	(if (askbool 
		(prompt #text-util)
		(help #iutil-help)
		)
		(install-utils)
		)
	)
(complete 95)
; Add to startup
(set startup-addition 
	(cat
		"assign Alcuin: \"" main-dest "\"\n"
		"path Alcuin:c add\n"
	)
)
(if (askbool 
	(prompt #Alcuin-startup)
	(help #startup-help)
	)
	(startup @app-name
		(command startup-addition)
		(prompt #Alcuin-startup)
		(help #startup-help)
		)
)
(complete 100)
(exit #install-exit)
