; Installer Script for TinyMeter V4.0

(set @default-dest (""))

(set @cpu (database "cpu"))

(set @source-file "TinyMeter")

(if (= @cpu "68020")
    (set @source-file "TinyMeter.020")
)

(if (= @cpu "68030")
    (set @source-file "TinyMeter.020")
)

(if (= @cpu "68040")
    (set @source-file "TinyMeter.020")
)

(if (= @cpu "68060")
    (set @source-file "TinyMeter.020")
)

(set @destdir
	(askdir
		(prompt "Where should I copy the TinyMeter main program ?")
		(help "SYS:WBStartup is the best place. Simply click proceed.")
		(default "SYS:WBStartup/")
	)
)

(set @prefsdir
	(askdir
		(prompt "Where should I copy the TinyMeter preferences program?")
		(help "SYS:Prefs is the best place, since TinyMeter can only call it, when its there.")
		(default "SYS:Prefs/")
	)
)

(set langchoice
	(askoptions
		(prompt "Which languages should be installed?")
		(help "Where's the problem?")
		(choices "Deutsch" "Italiano" "Polski")
		(default 0)
	)
)

(set iconchoice
	(askchoice
		(prompt "Which icons do you use")
		(help "Where's the problem?")
		(choices "MagicWB" "NewIcons")
		(default 0)
	)
)

(set instchoice
	(askoptions
		(prompt "What should be installed?")
		(help "Where's the problem?")
		(choices "Example settings" "Fonts for Clocks" "Background patterns" "Documentation")
		(default 8)
	)
)

(if (<> 0 (BITAND instchoice 8))
    (set @helpdir
	    (askdir
		    (prompt "Where should the documentation be installed?")
		    (help "HELP: is the best place. Simply click proceed.")
		    (default "HELP:")
	    )
    )
)

(if (<> 0 (BITAND instchoice 2))
    (set @fontdir
	    (askdir
		    (prompt "Where should the fonts be installed?")
		    (help "FONTS: is the best place. Simply click proceed.")
		    (default "FONTS:")
	    )
    )
)

(if (<> 0 (BITAND instchoice 2))
    (set @dofixfont
	    (askbool
		    (prompt "Should I do FixFonts for you?")
		    (help "This is not important. Simply click no.")
	    )
    )
)

(if (<> 0 (BITAND instchoice 4))
    (set @pattdir
	    (askdir
		    (prompt "Where should the background patterns be installed?\n (example settings-file uses SYS:Prefs/Patterns!)")
		    (help "SYS:Prefs/Patterns is the best place.")
		    (default "SYS:Prefs/")
	    )
    )
)

(copyfiles
	(prompt "Installing the files." )
	(help "Where's the problem?" )
	(source @source-file )
	(infos)
	(newname "TinyMeter")
	(dest @destdir)
)

(copyfiles
	(prompt "Installing TinyMeter.")
	(help "Where's the problem?")
	(source "Prefs/TinyMeter")
	(infos)
	(newname "TinyMeter")
	(dest @prefsdir)
)

(if (<> 0 (BITAND langchoice 1))
	(copyfiles
		(prompt "Installing catalog")
		(help "Where's the problem?")
		(source "Catalogs/deutsch/TinyMeterPrefs.catalog")
		(dest "LOCALE:Catalogs/deutsch/")
	)
)
(if (<> 0 (BITAND langchoice 2))
	(copyfiles
		(prompt "Installing catalog")
		(help "Where's the problem?")
		(source "Catalogs/italiano/TinyMeterPrefs.catalog")
		(dest "LOCALE:Catalogs/italiano/")
	)
)
(if (<> 0 (BITAND langchoice 4))
	(copyfiles
		(prompt "Installing catalog")
		(help "Where's the problem?")
		(source "Catalogs/polski/TinyMeterPrefs.catalog")
		(dest "LOCALE:Catalogs/polski/")
	)
)
(if (<> 0 (BITAND iconchoice 1))
	(copyfiles
		(prompt "Installing NewIcons")
		(help "Where's the problem?")
		(source "ArtWork/newicons/TinyMeter.info")
		(dest @destdir)
	)
)
(if (<> 0 (BITAND iconchoice 1))
	(copyfiles
		(prompt "Installing NewIcons")
		(help "Where's the problem?")
		(source "ArtWork/newicons/TinyMeterPrefs.info")
		(newname "TinyMeter.info")
		(dest @prefsdir)
	)
)

(if (<> 0 (BITAND instchoice 1))
    (copyfiles
	    (prompt "Installing example settings-file in ENV:")
	    (help "Where's the problem?")
	    (source "Examples/MagicWB.tm")
	    (newname "TinyMeter")
	    (dest "ENV:")
    )
)

(if (<> 0 (BITAND instchoice 1))
    (copyfiles
	    (prompt "Installing example settings-file in ENVARC:")
	    (help "Where's the problem?")
	    (source "Examples/MagicWB.tm")
	    (newname "TinyMeter")
	    (dest "ENVARC:")
    )
)

(if (<> 0 (BITAND instchoice 2))
    (copyfiles
	    (prompt "Installing additional fonts.")
	    (help "Where's the problem?")
	    (source "ArtWork/Fonts/")
	    (all)
	    (dest @fontdir)
    )
)

(if (<> 0 (BITAND instchoice 2))
    (if @dofixfont
	    (run "SYS:System/FixFonts"
		    (prompt "Doing FixFonts... May take a while...")
		    (help "Where's the problem?")
	    )
    )
)

(if (<> 0 (BITAND instchoice 4))
    (copyfiles
	    (prompt "Installing additional background patterns.")
	    (help "Where's the problem?")
	    (source "ArtWork/Patterns/")
	    (all)
	    (dest @pattdir)
    )
)

(if (<> 0 (BITAND instchoice 8))
    (copyfiles
	    (prompt "Installing documentation")
	    (help "Where's the problem?")
	    (source "TinyMeter.guide")
	    (infos)
	    (dest @helpdir)
    )
)

(copylib
	(prompt "Installing screennotify.library")
	(help "Where's the problem?")
	(source "Libs/screennotify.library")
	(dest "LIBS:")
	(confirm)
)

(exit
	"Have phun with this nice piece of soft!!!\n\nNow you should start TinyMeter, setup the position and size and press S to save these settings.\n\nAfter that, start the TinyMeter preferences to setup TinyMeter to your personal taste.\n\nIf there are any problems, don't hesitate to contact the author!"
)