; script to install MagicSelector 

(set Opt 7)
(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")
		(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/")
)
)

(complete 40)
(set Opt 4)

(set installfiles
	(askoptions
		(prompt "Which of the following locale should be installed ?")
		(help @askoptions-help)
		(choices "Norsk" "Deutsch" "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/")
)
)

(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)

(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"
            "Do NOT try to change the WBPattern setting when\n"
            "using MagicSelector it will cause double\n"
            "background patterns at the Startup. Have Fun !\n")


(exit)
