;Install script for Adagis v4.1
;Š 1996 Stv
;
;Ask for everything needed
;
(set #directory
	(askdir
		(prompt "Where do you want to install Adagis files ?\n(a drawer 'Adagis4' WILL be created)")
		(help @askdir-help)
		(default "Sys:")
	)
)
(set #programdir
	(askdir
		(prompt "Where do you want to install Adagis executable ?\n(no drawer will be created)")
		(help @askdir-help)
		(default "Sys:WBStartup")
	)
)
(set #adddocs
	(askbool
		(prompt "\n\nShould I copy the documentation ?")
		(help @askbool-help)
	)
)
(set #icon
	(askchoice
		(help @askchoice-help)
		(prompt "Select which Adagis icon you want to install")
		(choices "NewIcon-Style1" "NewIcon-Style2" "NewIcon-Style3" "MWB-Style 1" "MWB-Style 2" "IGFX-Style")
		(default 3)
	)
)
(set #icondrawer
	(askchoice
		(help @askchoice-help)
		(prompt "Select which Adagis drawer icon you want to install")
		(choices "NewIcon-Style1" "MWB-Style 1")
		(default 1)
	)
)
(set #addons
	(askchoice
		(help @askchoice-help)
		(prompt "Which AddOn do you want to use ?\nPlease refer to docs for more info about AddOns")
		(choices "Adagis format AddOn" "IntuiCookie format AddOn")
		(default 0)
	)
)
(set #havedata
	(askbool
		(prompt "\n\nAdagis distribution has changed, and no sample cookie files are included in this archive.\n\n"
			 "Please download the file 'Adagisv10_dat.lha' which contains a collection of adages in english,"
			 "catalan and spanish. Without these files, Adagis is useless...\n\n"
			 "Do you have a cookie-file installed from a previous version of Adagis (or IC) ?")
		(help @askbool-help)
	)
)
(if (= 1 #havedata)
	(set #datafile
		(askfile
			(prompt "Please locate your Adagis data file.")
			(help @askfile-help)
			(default "s:adagis.data")
		)
	)
	(message
		"\n\nPlease don't forget to config Adagis through the AdagisPrefs program once you have your cookie-file installed"
	)
)
(set #locales
	(askoptions
		(prompt "Which catalogs do you want to install ?")
		(help @askoptions-help)
		(choices "Spanish" "Catalan")
		(default %00)
	)
)
;
; Now the real installation process starts !
;
(set #fullinstdir (tackon #directory "Adagis4"))				; The install dir
(set @default-dest #fullinstdir)								; Def install dir.
(makedir
	(#fullinstdir)
	(prompt "Going to create the Adagis dir")
	(help @makedir-help)
	(infos)
)
(copyfiles
	(source "/files/AddOns")
	(dest (tackon #fullinstdir "AddOns"))
	(prompt "Going to copy the AddOns dir")
	(all)
	(infos)
	(help @copyfiles-help)
)
(copyfiles
	(source "/files/rexx")
	(dest (tackon #fullinstdir "Rexx"))
	(prompt "Going to copy the sample rexx programs dir")
	(all)
	(help @copyfiles-help)
)
(copyfiles
	(source "/files/bin/adagisprefs")
	(dest #fullinstdir)
	(prompt "Going to copy the prefs programs")
	(infos)
	(help @copyfiles-help)
)
(if (= 1 #adddocs)											; Install documentation ?
	(copyfiles
		(source "/docs/adagis4.eng.guide")
		(dest #fullinstdir)
		(prompt "Going to copy the english documentation of Adagis")
		(help @copyfiles-help)
		(infos)
	)
)
(copyfiles													; Install Adagis executable.
	(source "/files/bin/Adagis")
	(dest #programdir)
	(prompt "Going to copy the Adagis executable")
	(help @copyfiles-help)
)
(select #icon
	(set #iconfile "/icons/NewIcon_Style1.info")
	(set #iconfile "/icons/NewIcon_Style2.info")
	(set #iconfile "/icons/NewIcon_Style3.info")
	(set #iconfile "/icons/MWB_Style1.info")
	(set #iconfile "/icons/MWB_Style2.info")
	(set #iconfile "/icons/IGFX_Style.info")
)
(copyfiles													; Install Adagis icon.
	(source #iconfile)
	(dest #programdir)
	(newname "Adagis.info")
	(prompt "Going to copy the Adagis info file")
	(help @copyfiles-help)
)
(select #icondrawer
	(set #iconfile "/icons/NewIcon_Drawer1.info")
	(set #iconfile "/icons/MWB_Drawer1.info")
)
(debug "Iconfile " #iconfile)
(copyfiles													; Install Adagis drawer icon.
	(source #iconfile)
	(dest #directory)
	(newname "Adagis4.info")
	(prompt "Going to copy the Adagis drawer info file")
	(help @copyfiles-help)
)
(tooltype
	(dest (tackon #programdir "Adagis"))
	(settooltype "ADAGISPREFS" (tackon #fullinstdir "AdagisPrefs"))
	(prompt "Modifying ADAGISPREFS tooltype")
	(help @tooltype-help)
)
(if (= 0 #addons)
	(set #addonfile (tackon #fullinstdir "AddOns/adagis_adagis.addon"))
	(set #addonfile (tackon #fullinstdir "AddOns/adagis_ic.addon"))
)
(run ('/files/bin/cdac "%s" "%s"' #datafile #addonfile )
	(prompt 'About to create default config')
	(help @run-help)
)
(if (in #locales 0)
	(copyfiles
		(source "/files/locale/catalogs/espaņol")
		(dest "locale:catalogs/espaņol")
		(prompt "Installing catalogs")
		(all)
		(help @copyfiles-help)
	)
)
(if (in #locales 1)
	(copyfiles
		(source "/files/locale/catalogs/catalā")
		(dest "locale:catalogs/catalā")
		(prompt "Installing catalogs")
		(all)
		(help @copyfiles-help)
	)
)
