; script to install MagicSelector 

(set Opt 15)
(complete 0)
(set destdir "Sys:Prefs") 
(set destdir2 "Sys:WBStartup") 

(set installfiles
	(askoptions
		(prompt "Which of the following optional programs/helpfile should be installed ?")
		(help @askoptions-help)
		(choices "MagicSelector" "MagicSelector Preferences" "MagicSelector.Guide" "MagicSelector Mosaic Doc. (Needs AMosaic)")
		(default Opt)
	)
)

(complete 20)

;Copy program files to destination.

(if (BITAND installfiles 1)
(copyfiles
	(source "WBStartup/MagicSelector")
	(dest destdir2)
)
)

(if (BITAND installfiles 1)
(copyfiles
	(source "WBStartup/MagicSelector.info")
	(dest destdir2)
)	
)


(if (BITAND installfiles 2)
(copyfiles
	(source "Preferences/MagicSelector")
	(dest destdir)
)
)

(if (BITAND installfiles 2)
(copyfiles
	(source "Preferences/MagicSelector.info")
	(dest destdir)
)	
)


(if (BITAND installfiles 4)
(
	(makedir ("Help:English")
	)

(copyfiles
	(source "Help/MagicSelector.guide")
	(dest "help:english/")
)
)
)

(if (BITAND installfiles 4)
(copyfiles
	(source "Help/MagicSelector.guide.info")
	(dest "help:english/")
)
)

(if (BITAND installfiles 8)
(
     (set Mosaic_dest
        (tackon
        (askdir
        (prompt "In which disk or drawer should the MagicSelector Mosaic Documentation be installed? (A drawer WILL be created there.)")
        (help @askdir-help)
        (default @default-dest)
        )"MagicSelector Mosaic")
        )

	    (makedir Mosaic_dest (infos))

		(copyfiles
			(prompt "Copying all Patterns ?")
			(help @copyfiles-help)
			(source "Mosaic/")
			(dest Mosaic_dest)
			(pattern "#?")
			(infos)
)
)
)

(complete 40)
(set Opt 16)

(set installfiles
	(askoptions
		(prompt "Which of the following locale should be installed ?")
		(help @askoptions-help)
		(choices "Norsk" "Deutsch" "Svenska" "Italiano" "English (built-in)")
		(default Opt)
	)
)

(if (BITAND installfiles 1)
(copyfiles
	(source "Preferences/Catalogs/Norsk/MagicSelector.Catalog")
	(dest "Locale:Catalogs/Norsk/")
)
)

(if (BITAND installfiles 2)
(copyfiles
	(source "Preferences/Catalogs/Deutsch/MagicSelector.Catalog")
	(dest "Locale:Catalogs/Deutsch/")
)
)

(if (BITAND installfiles 4)
(copyfiles
	(source "Preferences/Catalogs/Svenska/MagicSelector.Catalog")
	(dest "Locale:Catalogs/Svenska/")
)
)

(if (BITAND installfiles 8)
(copyfiles
	(source "Preferences/Catalogs/Italiano/MagicSelector.Catalog")
	(dest "Locale:Catalogs/italiano/")
)
)


(set Opt 3)

(complete 60)

(set installfiles
	(askoptions
		(prompt "Do you want to install some Background Patterns/Sound Samples ?")
		(help @askoptions-help)
		(choices "Triumph Patterns" "Sound")
		(default Opt)
	)
)

(if (BITAND installfiles 1)
(
     (set Patterns_dest
        (tackon
        (askdir
        (prompt "In which disk or drawer should the Triumph Patterns be installed? (A drawer WILL be created there.)")
        (help @askdir-help)
        (default @default-dest)
        )"Triumph Patterns")
        )

	    (makedir Patterns_dest (infos))

		(copyfiles
			(prompt "Copying all Patterns ?")
			(help @copyfiles-help)
			(source "Triumph Patterns/")
			(dest Patterns_dest)
			(pattern "#?")
			(infos)
			(files)
			(confirm)
)
)
)

(complete 80)

(if (BITAND installfiles 2)
(
     (set Samples_dest
        (tackon
        (askdir
        (prompt "In which disk or drawer should the Samples be installed? (A drawer WILL be created there.)")
        (help @askdir-help)
        (default @default-dest)
        )"Samples")
        )

	    (makedir Samples_dest (infos))

		(copyfiles
			(prompt "Copying all Samples ?")
			(help @copyfiles-help)
			(source "Samples/")
			(dest Samples_dest)
			(pattern "#?")
			(infos)
			(files)
			(confirm)
)
)
)

(copyfiles
	(source "WBPattern.prefs")
	(dest "ENVARC:SYS/")
)

(copyfiles
	(source "WBPattern.prefs")
	(dest "ENV:SYS/")
)

(copyfiles
	(source "Sound.prefs")
	(dest "ENVARC:SYS/")
)

(copyfiles
	(source "Sound.prefs")
	(dest "ENV:SYS/")
)

;Correct @default-dest so that final information is correct.
(set @default-dest destdir)

(run "ConvertPrefs")
(run "avail flush")
(run "WBStartup/MagicSelector")

(complete 100)

(message "\nYou have to start up MagicSelector Preferences to\n"
            "get the MagicSelector package to work at the next\n"
            " reboot.\n\n"
            "The MagicSelector configuration file have been updated to version 1.50\n\n"
            "Do NOT try to change the WBPattern setting when\n"
            "using MagicSelector it will cause double\n"
            "background patterns at the Startup.\n\n"
            "This Software package is shareware!\n"
)


(exit)
