; $VER: DFA 1.00 (10.02.93)
; Script to install DFA V 1.2

(complete 0)

(set @default-dest "SYS:WBStartup")

(set dest2 (askdir  (prompt "Select the location to install the DFA executable")
       (default @default-dest)
          (help "Choose a destination partition or directory "
                 "to contain the DFA executable.  The install "
                  "program copies the DFA executable 'DFA' "
                  "to the location you choose. "
          )
       )
)

(set answer1
	(askchoice
		(prompt "Choose on which machine DFA is used")
			(choices	"Amiga with MC68000"
						"Amiga with MC68020 and better"
			)
			(help	"Selecting the 'MC68020 and better' option will install "
					"the special version of DFA, which does NOT run on"
					"'vanilla' Amigas"
			)

			(default 0)

	)
)

(if (= answer1 0)
(
	;install DFA 68000

	(message "DFA will be installed in " dest2 )

	(set error
		(trap 4
			(copyfiles (source "DFA/DFA") (dest dest2)  (infos))
		)
	)

	(if (> error 0) (message ("Dos Error %ld detected" @ioerr)))
)
)

(if (= answer1 1)
(
	;install DFA 68000
	(message "DFA (for 68020 and better) will be installed in " dest2 )

	(set error
		(trap 4
			(copyfiles (source "DFA_020/DFA") (dest dest2)  (infos))
		)
	)
	(if (> error 0)
		(message ("Dos Error %ld detected" @ioerr))
	)
)
)

(complete 15)

(if (exists "Locale:")
(
	(set language
		(askoptions
			(prompt "Which languages do you want to get installed?")
			(choices	"Dansk"
						"German"
						"Italian"
						"Nederlands"
						"Svenska"
			)
			(help	"You may choose none, one or more languages. "
					"If you don't have an operation system that "
					"supports locale, please select no language "
					"at all. "
					"Locale support is given in Workbench 2.1 "
					"and better. "
			)
		)
	)

	(if (IN language 0)
	(
		(copyfiles (source "Locale/catalogs/dansk/DFA.catalog")
			(dest "Locale:catalogs/dansk") )
	)
	)

	(complete 17)

	(if (IN language 1)
	(
		(copyfiles (source "Locale/catalogs/deutsch/DFA.catalog")
			(dest "Locale:catalogs/deutsch") )

	)
	)

	(complete 19)

	(if (IN language 1)
	(
		(copyfiles (source "Locale/catalogs/italiano/DFA.catalog")
			(dest "Locale:catalogs/italiano") )

	)
	)

	(complete 21)

	(if (IN language 2)
	(
		(copyfiles (source "Locale/catalogs/nederlands/DFA.catalog")
			(dest "Locale:catalogs/nederlands") )
	)
	)

	(complete 23)

	(if (IN language 2)
	(
		(copyfiles (source "Locale/catalogs/svenska/DFA.catalog")
			(dest "Locale:catalogs/svenska") )
	)
	)
)
)

(complete 25)

(set installrexx
	(askchoice
		(prompt	"Do you want to install the example ARexx scripts?")
		(choices	"Yes"
					"No"
		)
		(help	"The sample ARexx scripts can give you an idea "
				"how to use DFA in connection to ARexx and e.g. "
				"the Cygnus Ed (by ADSG). "
		)

		(default 0)
	)
)

(if (= installrexx 0)
(
	; Install ARexx scripts
	(set rexxdest
		(askdir
			(prompt "Select the directory where to install the ARexx scripts")
			(default "Rexx:")
			(help	"If you want to *use* the Arexx scripts at once, "
					"select an directory that is already within your "
					"Arexx search path."
			)
		)
	)

	(set error
		(trap 4
			(copyfiles (source "rexx") (dest rexxdest) (all) )
		)
	)

	(if (> error 0)
		(message ("Dos Error %ld detected" @ioerr))
	)
)
)

(complete 35)

(if (exists "s/DFA.key")
(
	(copyfiles (source "s/DFA.key") (dest "s:") (infos))
)
)

(complete 40)

(if (exists "s/DFA.key")
(
	(set installadrfile
		(askchoice
			(prompt	"Do you want to install the default address file (into s:) ?")
			(choices	"Yes"
						"No"
			)
			(help	"The default address file is named 'adr.file' and "
					"will be copied into the 's:' drawer. "
					"It contains the author's address which could be "
					"useful in some cases (Bug reports etc.) "
					"However, if you do already have such a file within "
					"your 's:' drawer you may not want to overwrite it. "
			)
			(default 0)
		)
	)

	(if (IN installadrfile 0)
	(
		(message "Default address file (adr.file) will be installed in 's:' ")

		(set error
			(trap 4
				(copyfiles (source "s/adr.file") (dest "s:") (infos) )
			)
		)

		(if (> error 0)
			(message ("Dos Error %ld detected" @ioerr))
		)
	)
	)
)
else
(
	; No Keyfile => public version => Must copy default address file

	(set error
		(trap 4
			(copyfiles (source "s/adr.file") (dest "s:") (infos) )
		)
	)
)
)
(set doclanguage
	(askchoice
		(prompt "Choose which documentation you want to be installed")
		(choices	"English documentation"
					"German documentation"
		)
		(help	"You may either select the English or the German "
				"documentation. "
		)
		(default 0)
	)
)

(if (= doclanguage 0)
(
	; english
	(if (exists "s/DFA.key")
	(
		(set docparts
			(askoptions
				(prompt	"Choose the kind of documentation you would "
						"like to get installed"
				)
				(choices	"ASCII documentation "
							"AmigaGuide documentation "
							"TeX documentation (.DVI file) "
				)
	            (help	"The ASCII documentation can be read by "
						"usual ASCII text readers. "
						""
						"The AmigaGuide documentation will only "
						"be usefull, if you have an amigaguide "
						"reader like 'Amigaguide' or 'Multiview' "
						"The AmigaGuide file will be used from within "
						"the program as well, if it is present. "
						""
						"The DVI file makes only sense if you have "
						"a TeX package or at least parts of it installed. "
				)
			)
		)

		(if (IN docparts 0)
		(
			; ASCII docs
			(set docdest
				(askdir
					(prompt "Select the location to install the ASCII documentation")
					(help	"Choose a destination partition or directory "
							"to contain the ASCII documentation. "
							"The install program will copy the ASCII documentation "
							"to this directory."
					)
					(default "Work:")
				)
			)

			(working "Extracting ASCII documentation from archive")
			(run "c/lha e Documentation/Documentation.lha dfa_english.doc %s" docdest)
			(run "c/lha e Documentation/Documentation.lha dfa_english.doc.info %s" docdest)

			(complete 60)

		)
		)

		(if (IN docparts 1)
		(
			; AMIGAGUIDE docs
			(set docdest
				(askdir
					(prompt "Select the location to install the Amigaguide documentation")
					(help	"Choose a destination partition or directory "
							"to contain the Amigaguide documentation. "
							"The install program will copy the Amigaguide documentation "
							"to this directory."
					)
					(default "Work:")
				)
			)

			(working "Extracting Amigaguide documentation from archive")
			(run "c/lha e Documentation/Documentation.lha dfa_english.guide %s" docdest)
			(run "c/lha e Documentation/Documentation.lha dfa_english.guide.info %s" docdest)

			(complete 80)

		)
		)

		(if (IN docparts 2)
		(
			; DVI docs
			(set docdest
				(askdir
					(prompt "Select the location to install the TeX documentation")
					(help	"Choose a destination partition or directory "
							"to contain the TeX documentation. "
							"The install program will copy the TeX documentation "
							"to this directory."
					)
					(default "Work:")
				)
			)

			(working "Extracting TeX documentation from archive")
			(run "c/lha e Documentation/Documentation.lha dfa_english.dvi %s" docdest)
			(run "c/lha e Documentation/Documentation.lha dfa_english.dvi.info %s" docdest)
		)
		)

	)
	(
		; else NO KEYFILE -> unregistered version without TeX
		(set docparts
			(askoptions
				(prompt	"Choose the kind of documentation you would "
						"like to get installed"
				)
				(choices	"ASCII documentation "
							"AmigaGuide documentation "
				)
	            (help	"The ASCII documentation can be read by "
						"usual ASCII text readers. "
						""
						"The AmigaGuide documentation will only "
						"be usefull, if you have an amigaguide "
						"reader like 'Amigaguide' or 'Multiview' "
						"The AmigaGuide file will be used from within "
						"the program as well, if it is present. "
				)
			)
		)

		(if (IN docparts 0)
		(
			; ASCII docs
			(set docdest
				(askdir
					(prompt "Select the location to install the ASCII documentation")
					(help	"Choose a destination partition or directory "
							"to contain the ASCII documentation. "
							"The install program will copy the ASCII documentation "
							"to this directory."
					)
					(default "Work:")
				)
			)

			(copyfiles (source "Documentation/dfa_english.doc") (dest docdest) (infos) )

			(complete 70)
		)
		)

		(if (IN docparts 1)
		(
			; AMIGAGUIDE docs
			(set docdest
				(askdir
					(prompt "Select the location to install the Amigaguide documentation")
					(help	"Choose a destination partition or directory "
							"to contain the Amigaguide documentation. "
							"The install program will copy the Amigaguide documentation "
							"to this directory."
					)
					(default "Work:")
				)
			)

			(copyfiles (source "Documentation/dfa_englishguide") (dest docdest) (infos) )

		)
		)

	)
	)
)
(
	; german doc wanted
	(if (exists "s/DFA.key")
	(
		(set docparts
			(askoptions
				(prompt	"Choose the kind of documentation you would "
						"like to get installed"
				)
				(choices	"ASCII documentation "
							"AmigaGuide documentation "
							"TeX documentation (.DVI file) "
				)
	            (help	"The ASCII documentation can be read by "
						"usual ASCII text readers. "
						""
						"The AmigaGuide documentation will only "
						"be usefull, if you have an amigaguide "
						"reader like 'Amigaguide' or 'Multiview' "
						"The AmigaGuide file will be used from within "
						"the program as well, if it is present. "
						""
						"The DVI file makes only sense if you have "
						"a TeX package or at least parts of it installed. "
				)
			)
		)

		(if (IN docparts 0)
		(
			; ASCII docs
			(set docdest
				(askdir
					(prompt "Select the location to install the ASCII documentation")
					(help	"Choose a destination partition or directory "
							"to contain the ASCII documentation. "
							"The install program will copy the ASCII documentation "
							"to this directory."
					)
					(default "Work:")
				)
			)

			(working "Extracting ASCII documentation from archive")
			(run "c/lha e Anleitung/Anleitung.lha dfa.dok %s" docdest)
			(run "c/lha e Anleitung/Anleitung.lha dfa.dok.info %s" docdest)

			(complete 60)
		)
		)

		(if (IN docparts 1)
		(
			; AMIGAGUIDE docs
			(set docdest
				(askdir
					(prompt "Select the location to install the Amigaguide documentation")
					(help	"Choose a destination partition or directory "
							"to contain the Amigaguide documentation. "
							"The install program will copy the Amigaguide documentation "
							"to this directory."
					)
					(default "Work:")
				)
			)

			(working "Extracting Amigaguide documentation from archive")
			(run "c/lha e Anleitung/Anleitung.lha dfa.guide %s" docdest)
			(run "c/lha e Anleitung/Anleitung.lha dfa.guide.info %s" docdest)

			(complete 80)
		)
		)

		(if (IN docparts 2)
		(
			; DVI docs
			(set docdest
				(askdir
					(prompt "Select the location to install the TeX documentation")
					(help	"Choose a destination partition or directory "
							"to contain the TeX documentation. "
							"The install program will copy the TeX documentation "
							"to this directory."
					)
					(default "Work:")
				)
			)

			(working "Extracting TeX documentation from archive")
			(run "c/lha e Anleitung/Anleitung.lha dfa.dvi %s" docdest)
			(run "c/lha e Anleitung/Anleitung.lha dfa.dvi.info %s" docdest)
		)
		)

	)
	(
		; else
		(set docparts
			(askoptions
				(prompt	"Choose the kind of documentation you would "
						"like to get installed"
				)
				(choices	"ASCII documentation "
							"AmigaGuide documentation "
				)
	            (help	"The ASCII documentation can be read by "
						"usual ASCII text readers. "
						""
						"The AmigaGuide documentation will only "
						"be usefull, if you have an amigaguide "
						"reader like 'Amigaguide' or 'Multiview' "
						"The AmigaGuide file will be used from within "
						"the program as well, if it is present. "
				)
			)
		)
		(if (IN docparts 0)
		(
			; ASCII docs
			(set docdest
				(askdir
					(prompt "Select the location to install the ASCII documentation")
					(help	"Choose a destination partition or directory "
							"to contain the ASCII documentation. "
							"The install program will copy the ASCII documentation "
							"to this directory."
					)
					(default "Work:")
				)
			)

			(copyfiles (source "Anleitung/dfa.dok") (dest docdest) (infos) )

			(complete 70)
		)
		)

		(if (IN docparts 1)
		(
			; AMIGAGUIDE docs
			(set docdest
				(askdir
					(prompt "Select the location to install the Amigaguide documentation")
					(help	"Choose a destination partition or directory "
							"to contain the Amigaguide documentation. "
							"The install program will copy the Amigaguide documentation "
							"to this directory."
					)
					(default "Work:")
				)
			)

			(copyfiles (source "Anleitung/dfa.guide") (dest docdest) (infos) )

		)
		)

	)
	)
)
)

(complete 100)

