; *************************************************************************
; ******************  FIRDesigner Installation Script  ********************
; *************************************************************************
;
; $VER: FIRDesigner.install 1.1 (04.03.96)
;
; Copyright ©1996 Harald Zottmann
;
; *************************************************************************
;


; ------------------------------------------------------------------------
; Find out about program version.

	(set vernum-fir    (getversion "FIRDesigner"))
	(set version-fir   (/ vernum-fir 65536))
	(set revision-fir  (- vernum-fir (* version-fir 65536) ) )

; ------------------------------------------------------------------------
; Set default destination directory.

	(set def-fir-dir "SYS:")

; ------------------------------------------------------------------------
; Init some strings.

	(set #yes-msg "Yes")
	(set #no-msg "No")

	(set #bad-kick-msg 
		"The FIRDesigner requires AmigaOS 2.04 or better !"
	)

	(set #hello-msg
		(cat
		("Welcome to the FIRDesigner V%ld.%ld\n\n" version-fir revision-fir)
		"This script will install the FIRDesigner and "
		"related files on your Amiga.\n\n"
		"You will need to answer a few questions such as "
		"where you would like the program installed.\n\n"
		"If you do not wish to install the FIRDesigner at this time, "
		"select the 'Abort Install' button now. "
		)
	)

	(set #goodbye-msg
		(cat
		"The installation of the FIRDesigner is now complete. "
		"Have a look at the guides to get more information "
		"about this powerful tool.\n\n" 
		"Don`t forget to register if you use the FIRDesigner "
		"frequently. See the docs for more information.\n\n"
		"Have fun..."
		)
	)

	(set #shortbye-msg
		(cat
		"Don`t forget to register if you use the FIRDesigner "
		"frequently. See the docs for more information.\n\n"
		"Have fun..."
		)
	)

	(set #fir-askdir-msg 
		(cat
		"Select the directory to install the FIRDesigner in. "
		"If you want to create a new directory for this "
		"application, do so now.\n"
		)
	)

	(set #processor-msg
		(cat
		"The FIRDesigner is optimized for the listed "
		"processor types. Please indicate "
		"which processor you have in your machine."
		"\n--------------------------\n"
		"The Installer found out that you have a\n"
		"MC " (database "cpu") " CPU\n"
		)
	)

	(set #processor-help
		(cat
		"There are three optimized versions of "
		"the FIRDesigner available. "
		"Simply specify the processor (CPU) of your machine. "
		"For example if you have a stock A1200 or "
		"A4000/030, choose MC 68020. For an A4000/040 "
		"you may choose MC 68040. Older machines without "
		"accelerator boards, like A500 or A2000 must "
		"choose the MC 68000. "
		"The Installer program however found out that "
		"your machine is equipped with a MC "
		(database "cpu") " CPU. "
		"If you are not sure about that, choose the "
		"MC 68000 version, that runs on every machine."
		)
	)


; ************************************************************************
; Begin actual installation
; ************************************************************************

; ------------------------------------------------------------------------
; Check for KickV37 or better.

	(if (< (/ (getversion) 65536) 37)
		(
		(abort #bad-kick-msg)
		)
	)


; ------------------------------------------------------------------------
; Print the welcome message.

	(message #hello-msg)


; ------------------------------------------------------------------------
; Ask the user where we should install the FIRDesigner.

	(if (= 0 @user-level)
		(
		(set firdir        (tackon @default-dest "FIRDesigner") )
		(set @default-dest firdir)
		(makedir firdir)
		(copyfiles (source "/FIRDesigner") (dest firdir) (infos) (all))
		(exit (#shortbye-msg)) 
		)
	)


	(set firdir
		(askdir
			(prompt #fir-askdir-msg)
			(help @askdir-help)
			(default def-fir-dir)
		)
	)

	(set @default-dest firdir)

; ------------------------------------------------------------------------
; Ask which processor version to be installed.

	(set procversion
		(askchoice
			(prompt #processor-msg)
			(help #processor-help)
			(choices
				"MC 68000"
				"MC 68020"
				"MC 68040"
			)
			(default 0)
		)
	)
	(if (= 0 procversion)
		((copyfiles (source "FIRDesigner") (dest firdir) (infos))
		)
	)
	(if (= 1 procversion)
		((copyfiles (source "FIRDesigner_020")  (dest firdir))
		 (copyfiles (source "FIRDesigner.info") (dest firdir))
		 (rename (tackon firdir "FIRDesigner_020") (tackon firdir "FIRDesigner"))
		)
	)
	(if (= 2 procversion)
		((copyfiles (source "FIRDesigner_040")  (dest firdir))
		 (copyfiles (source "FIRDesigner.info") (dest firdir))
		 (rename (tackon firdir "FIRDesigner_040") (tackon firdir "FIRDesigner"))
		)
	)

; ------------------------------------------------------------------------
; Install the documentation.

        (copyfiles (source "FIRDesigner.guide")         (dest firdir) (infos) )
        (copyfiles (source "FIRDesigner.readme")        (dest firdir) (infos) )

; ------------------------------------------------------------------------
; Install the examples.

        (copyfiles (source "Bandpass.FIR")            (dest firdir) )
        (copyfiles (source "Differentiator.FIR")      (dest firdir) )
        (copyfiles (source "Hilbert.FIR")             (dest firdir) )
        (copyfiles (source "Lowpass.FIR")             (dest firdir) )
        (copyfiles (source "Highpass.FIR")            (dest firdir) )
        (copyfiles (source "Multipass.FIR")           (dest firdir) )
        (copyfiles (source "Notch.FIR")               (dest firdir) )


; ------------------------------------------------------------------------
; Print the goodbye message

        (message #goodbye-msg)

