; Scalos Installation Script (c)1997 fOX! (17.09.1997)

(set languages-default 1)

;WICHTIG !!!!!!!!!!!!!!!!!!!
;APPNAME=Scalos
;im InstallIcon


;===[ ENGLISH ]==============================================================

(set language-default 1)

(set guides-default 1)

(set #bad-kick "You must be using Kickstart 3.0+ to install Scalos")

(set #bad-cpu "You require at least a 68020 or higher processor to run Scalos")

(set #bad-mui "Requires MUI 3.6+")

(set #install-start
	(cat
		"\n\nWelcome to Scalos Installation\n\n"
		"Done by fOX!/ALiENDESiGN\n\n"
	)
)
(set #install-exit
	(cat
		"Thank you for installing Scalos ..."
	)
)

(set #where-scalos "Where would you like to install Scalos? (no Scalos directory will be created!)")

(set #where-scalos-help
	(cat
		"Scalos will be installed directly into the"
		" desired directory. An assign Scalos: is made"
		" right after the creation of the directory"
	)
)

(set #where-scalosprefs "Where is the place for the preferences editors?")

(set #where-scalosprefs-help
	(cat
		"This is the destination directory of all Scalos preferences"
		" editors!\n\n Normaly ALL Scalos preferences editors are in Scalos:Prefs !"
	)
)

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

(set #languages-select-help
	(cat
		"Please select your favourite language that should be"
		" copied to your Locale: directory?"
	)
)

(set #guides-select	"Which guides should be installed?")

(set #guides-select-help
	(cat
		"Please select your favourite language that should be"
		" copied to the Scalos home directory?"
	)
)

(set #moduletype-select "Which Moduletype (see help) should be installed?")

(set #moduletype-select-help
	(cat
		"The Moduletype is the kind of userinterface that"
		" you'll see when you for example delete files..."
	)
)

(set #plugin-select "Do you want to install some useful tools and plugins for Scalos")

(set #plugin-select-help
	(cat
		"One plugin for example might be useful for you if you want"
		" a sorted cleanup of the icons..."
	)
)

(set #autostart-select "Do you want to install Scalos as Workbench replacement?")

(set #autostart-select-help
	(cat
		"If you select YES this installscript will rename the current"
		" LoadWB to LoadWB.orig and install a tiny replacement to load"
		" Scalos intead of the original Workbench"
	)
)

(set #startup-scalos "Scalos: assign is about add to you user-startup")

(set #startup-scalos-help
	(cat
		"An Assign Scalos: will be added to your user-startup"
	)
)

(set #copy-scalos "Copying Scalos (Mainprogram)...")

(set #copy-scalosprefs "Copying Scalos Preferences...")

(set #copy-libs1 "Copying Library: iconobject.library ...")
(set #copy-libs2 "Copying Library: mcpgfx.library ...")
(set #copy-libs3 "Copying Library: preferences.library ...")
(set #copy-libs7 "Copying Library: newicon.library ...")

(set #copy-libs4 "Copying Datatype: amigaiconobject.datatype ...")
(set #copy-libs5 "Copying Datatype: iconobject.datatype ...")
(set #copy-libs6 "Copying Datatype: newiconobject.datatype ...")

(set #copy-muilib "Copying MCPFrame.mcc ...")

(set #copy-modules "Copying selected modules...")

(set #copy-classes "Copying required datatypes (Classes)...")

(set #copy-datatypes "Copying required datatypes (Devs)...")

(set #copy-catalog "Copying desired translations...")

(set #copy-presets "Copying Presets...")

(set #copy-plugins "Copying Plugins...")

(set #copy-tools "Copying Tools...")

(set #copy-guides "Copying Guides...")

(set #copy-loadwb "Copying LoadWB replacement...")

(set #rename-loadwborg "Renaming of original LoadWB...")

(set #rename-loadwbscalos "Renaming/Installing Scalos-LoadWB...")

(set #register-thank
	(cat
		"Thank you for registering Scalos\n\n"
		"I appreciate your support!\n\n"
		"Keep on supporting aMIGa!"
	)
)

(set #mypleasure "My Pleasure!")

(set #nomui
	(cat
		"The Install-Script couldn't find a installed MUI-Version!\n\n"
		"MUI 3.6 or higher is required to run Scalos(Prefs)\n\n"
		"Would you like to continue the installation?"
	)
)

(set #nomui-help
	(cat
		"MUI is an enhanced userinterface! You can get a"
		" Shareware version via Aminet!"
	)
)

(set #makedir-scalos "Creating Scalos-Destination...")

(set #makedir-scalos "Creating Prefs-Destination...")


;===[ GERMAN ]==============================================================
(if (= @language "deutsch")
	(
	(set languages-default 2)
	)
)
(if (= @language "deutsch")
	(
	(set guides-default 2)
	)
)
;============================== PROGRAM-START================================

(set @default-dest "")

;Check Kickstart (>= v3.0) Version.

(if (< (/ (getversion) 65536) 39)
	(abort #bad-kick)
)
(set processor (database "cpu"))
(if (< processor "68020")
	(abort #bad-cpu)
)

;(set muilib-path 0)
;(if (exists "MUI:Libs/muimaster.library" (NOREQ))
;	(set muilib-path "MUI:Libs/muimaster.library")
;	(if (exists "Libs:muimaster.library")
;		(set muilib-path "Libs:muimaster.library")
;		(if	(NOT
;				(askbool
;					(prompt #nomui)
;					(help   #nomui-help)
;				)
;			)
;			(abort #bad-mui)
;		)
;	)
;)

;(if muilib-path
;	(if (< (/ (getversion "Libs:muimaster.library") 65536) 17)
;		(abort #bad-mui)
;	)
;)

(message #install-start)
(welcome)

(complete 0)

;===[ select Scalos Destination ]============================================

(if (exists "Scalos:" (NOREQ))
 (
 	(set firstinstall 0)
 	(set scalos-dest "Scalos:")
 )
 (	(set firstinstall 1)
 	(set scalos-dest
		(askdir
			(prompt	#where-scalos)
			(help	#where-scalos-help "\n\n" @askdir-help)
			(default "SYS:Scalos")
			(newpath)
		)
	)
	(if (not (exists scalos-dest))
		(makedir scalos-dest
			(prompt #makedir-scalos)
			(help	@makedir-help)
		)
	)
	(makeassign "Scalos" scalos-dest)
 )
)


(set scalosprefs-dest
	(askdir
		(prompt	#where-scalosprefs)
		(help	#where-scalosprefs-help "\n\n" @askdir-help)
		(default "Scalos:Prefs")
		(newpath)
	)
)

(set languages
	(askoptions
		(prompt	#languages-select)
		(help	#languages-select-help "\n\n" @askoptions-help)
		(choices
			"English (built in)"
			"Deutsch"
			"Français"
			"ÃeÓtina"
			"Dansk"
		)
		(default languages-default)
	)
)

(set guides
	(askoptions
		(prompt	#guides-select)
		(help	#guides-select-help "\n\n" @askoptions-help)
		(choices
			"English"
			"Deutsch"
			"Italian"
		)
		(default guides-default)
	)
)

;Preparation for MUI-Library
(if (not (exists "MUI:" (noreq)))
	(set mui-dest
		(askdir
			(prompt	#where-muilib)
			(help	#where-muilib-help "\n\n" @askdir-help)
			(default "Libs:MUI")
		)
	)
	(set mui-dest "MUI:Libs/MUI")
)

(if (not
	(askchoice
		(prompt	#moduletype-select)
		(help	#moduletype-select-help "\n\n" @askoptions-help)
		(choices
			"MUI"
			"Class Act"
		)
		(default 0)
	)
     )
	(set module-path "Modules_MUI")
	(set module-path "Modules_CA")

)

(set plugin
	(askbool
		(prompt #plugin-select)
		(help #plugin-select-help)
		(default 1)
	)
)

(set autostart 0)
(if (AND (OR (exists "S:Scalos.key" (NOREQ)) (exists "S/Scalos.key" (NOREQ))) (NOT (exists "C:LoadWB.orig" (NOREQ))))
	(set autostart
		(askbool
			(prompt #autostart-select)
			(help #autostart-select-help)
			(default 1)
		)
	)
)


;===[ Real Installation ]====================================================

;Create Scalos: Assign
(if firstinstall
 (
	(makedir scalos-dest
		(prompt	#makedir-scalos)
		(help	#makedir-scalos-help "\n\n" @makedir-help)
		(infos)
	)
	(startup @app-name
		(prompt	#startup-scalos)
		(help	#startup-scalos-help "\n\n" @startup-help)
		(command 'Assign Scalos: \"' scalos-dest '\"\n')
	)
 )
)

(complete 5)

;Copy Scalos-Mainfile
(copyfiles
	(prompt	#copy-scalos)
	(source	"Scalos")
	(dest	scalos-dest)
	(files)
	(infos)
)

(complete 10)

;Copy Prefs
(if (not (exists scalosprefs-dest (NOREQ)))
	(
		(makedir scalosprefs-dest
			(prompt #makedir-prefs)
			(help	@makedir-help)
		)
	)
)

(copyfiles
	(prompt	#copy-scalosprefs)
	(source	"Prefs/")
	(dest	scalosprefs-dest)
	(infos)
	(all)
)

(complete 20)

(copylib
	(prompt	#copy-libs1)
	(source	("Libs/iconobject.library"))
	(dest	"Libs:")
	(help	@copylib-help)
	(confirm)
)

(copylib
	(prompt	#copy-libs2)
	(source	("Libs/mcpgfx.library"))
	(dest	"Libs:")
	(help	@copylib-help)
	(confirm)
)

(copylib
	(prompt	#copy-libs3)
	(source	("Libs/preferences.library"))
	(dest	"Libs:")
	(help	@copylib-help)
	(confirm)
)

(copylib
	(prompt	#copy-libs7)
	(source	("Libs/newicon.library"))
	(dest	"Libs:")
	(help	@copylib-help)
	(confirm)
)

(complete 30)

;Copy MUI Lib:
(copylib
	(prompt	#copy-muilib)
	(source "Libs/MUI/MCPFrame.mcc")
	(dest	mui-dest)
	(help	@copylib-help)
	(confirm)
)

(complete 40)

;Copy Required/Selected Modules
(copyfiles
	(prompt	#copy-modules)
	(source	module-path)
	(dest	(tackon scalos-dest "Modules"))
	(all)
)

(complete 50)

(copylib
	(prompt	#copy-libs4)
	(source	("Classes/Datatypes/amigaiconobject.datatype"))
	(dest	"SYS:Classes/Datatypes")
	(help	@copylib-help)
	(confirm)
)

(copylib
	(prompt	#copy-libs5)
	(source	("Classes/Datatypes/iconobject.datatype"))
	(dest	"SYS:Classes/Datatypes")
	(help	@copylib-help)
	(confirm)
)

(copylib
	(prompt	#copy-libs6)
	(source	("Classes/Datatypes/newiconobject.datatype"))
	(dest	"SYS:Classes/Datatypes")
	(help	@copylib-help)
	(confirm)
)

(complete 60)

;Copy "Devs/Datatypes/#?" To "Devs:Datatypes"
(copyfiles
	(prompt	#copy-datatypes)
	(source	"Devs/Datatypes")
	(dest	"Devs:Datatypes")
	(infos)
	(all)
)

(complete 70)

;Copy of the catalog files (with version check)
(if (= (exists "Locale:") 2)
	(
		(set n 0)
		(while
			(set language
				(select n
					"English"
					"Deutsch"
					"français"
					"ÃeÓtina"
					"Dansk"
					""
				)
			)
			(
				(if (IN languages n)
					(if (<> 0 n)   ; No catalog for english strings...
						(
							(set catalogs (tackon "Locale/Catalogs" (tackon language "Scalos")))
							(set destination (tackon "Locale:Catalogs" (tackon language "Scalos")))
							(makedir destination)
;-------------------------------------------------------------------------------------------
							(
								(set lala 0)
								(while
									(set scaloscat
										(select lala
											"Scalos_Delete.catalog"
											"Scalos_ECommand.catalog"
											"Scalos_NewDrawer.catalog"
											"Scalos_OpenLocation.catalog"
											"Scalos_Rename.catalog"
											"Scalos_ETrashcan.catalog"
											"Scalos.catalog"
											"ScalosPattern.catalog"
											"ScalosPrefs.catalog"
											"ScalosPalette.catalog"
											"ScalosMenu.catalog"
											""
										)
									)
									(
										(if (exists (tackon catalogs scaloscat)) 
											(copylib
												(prompt	#copy-catalog)
												(source	(tackon catalogs scaloscat))
												(dest	destination)
												(help	@copylib-help)
												(confirm)
											)
										)
										(set lala (+ lala 1))
									)
								)
							)
;-----------------------------------------------------------------------------------------------
						)
					)
				)
				(set n (+ n 1))
			)
		)
	)
)

;Copy of the guide files
(
	(set n 0)
		(while
			(set guide
				(select n
					"Scalos_eng.guide"
					"Scalos_ger.guide"
					"Scalos_ita.guide"
					""
				)
			)
			(
				(copyfiles
				(prompt	#copy-guides)
				(source	guide)
				(dest	scalos-dest)
				(files)
				(infos)
			)
			(set n (+ n 1))
		)
	)
)

(complete 80)

;Copy presets
(copyfiles
	(prompt	#copy-presets)
	(source	"Presets")
	(dest	"SYS:Prefs/Presets")
	(infos)
	(all)
)

;Copy Plugin + Tools
(if plugin
	(
		(copyfiles
			(prompt	#copy-plugins)
			(source	"PlugIns")
			(dest	(tackon scalos-dest "Plugins"))
			(infos)
			(all)
		)
		(copyfiles
			(prompt	#copy-tools)
			(source	"Tools")
			(dest	(tackon scalos-dest "Tools"))
			(infos)
			(all)
		)
	)
)

(complete 90)

;Installing LoadWB-Replacement
(if autostart
	(
		(copyfiles
			(prompt #copy-loadwb)
			(source	"LoadWB.Scalos")
			(dest	"C:")
		)
		(if	(rename "C:LoadWB" "C:LoadWB.orig"
				(prompt #rename-loadwborg)
			)
			(rename "C:LoadWB.scalos" "C:LoadWB"
				(prompt #rename-loadwbscalos)
			)
		)
	)
)

(if (exists "S/Scalos.key" (NOREQ))
	(
		(askbool
			(prompt	#register-thank)
			(help	@askbool-help)
			(choices #mypleasure #mypleasure)
		)
		(copyfiles
			(prompt #copy-scaloskey)
			(source	"S/Scalos.key")
			(dest	"S:")
		)
	)
)

(complete 100)

(EXIT #install-exit)
                                                                                                                                                                                                                                                                                                                                               
