; Install Draw 2000 on Hard Drive (Script for Installer)
; by Patricia Cummings

;  Ask User OpSys Version
(set sysver
	(askchoice
		(prompt "Which version of the Workbench are you using?")
		(help (cat "   The Draw 2000 software is compatible with either"
			" 2.x or earlier (1.2 and 1.3) versions of Workbench.\n\n"
			@askchoice-help))
		(choices "Version 1.2 or 1.3" "Version 2.x")
		(default 0)
	)
)

; Establish user installation path
(set d2dir
	(askdir
		(prompt "Where would you like to install Draw 2000 Version 2?")
		(help @askdir-help)
		(default @default-dest)
	)
)

(complete 0)

(set @default-dest d2dir)
(makedir d2dir (infos))

(complete 5)

; Install plain or math-coprocessor version
; Assume that if they are running WB1.3, default to Draw2000,
; otherwise default to Draw2000M
(set mathver
	(askchoice
		(prompt "Which version of the Draw 2000 program would you like to"
			" install?  A brief description of each is available in"
			" \"Help\".  NOTE: You MUST have a math coprocessor chip"
			" to use the Math Version!")
		(help (cat "   The basic version of the program, \"Draw2000\","
			" will work on any 68000/68020/68030 Amiga computer."
			" The \"Draw2000M\" version requires that you have"
			" an advanced Amiga (68020/68030) with a math"
			" co-processor chip installed in it.  If you wish, you"
			" can install both, then delete one if the other"
			" is more useful on your system\n\n" 
			@askchoice-help))
		(choices "Install Basic Draw2000 Version" 
			"Install Draw2000M for Math Co-Processor"
			"Install Both")
		(default sysver)
	)
)

(complete 10)

; Copy executable files and icons
(askdisk 
	(prompt "Please insert the \"Draw 2000\" disk in any drive.")
	(dest "Draw 2000")
	(help @askdisk-help)
)

(if (< mathver 2)
	(if (= mathver 1)
		(
			(copyfiles
				(prompt "Copy Program files for Math Co-Processor version.")
				(help @copyfiles-help)
				(source "Draw 2000:draw2000")
				(dest d2dir)
				(pattern "Draw2000M#?")
				(infos)
				(confirm)
			)
			(copyfiles
				(prompt "Copy icon information for this version.")
				(help @copyfiles-help)
				(source "Draw 2000:draw2000")
				(dest d2dir)
				(pattern "#?M.#?")
				(infos)
				(confirm)
			)
		)
		(
			(copyfiles
				(prompt "Copy Program files for Basic Draw 2000 version.")
				(help @copyfiles-help)
				(source "Draw 2000:draw2000")
				(dest d2dir)
				(pattern "Draw2000")
				(infos)
				(confirm)
			)
			(copyfiles
				(prompt "Copy drawing icon information.")
				(help @copyfiles-help)
				(source "Draw 2000:draw2000")
				(dest d2dir)
				(pattern "drawing.icon")
				(infos)
				(confirm)
			)
			(copyfiles
				(prompt "Copy part icon information.")
				(help @copyfiles-help)
				(source "Draw 2000:draw2000")
				(dest d2dir)
				(pattern "part.icon")
				(infos)
				(confirm)
			)
		)
	)
	(copyfiles
		(prompt "Copy all files for both versions.")
		(help @copyfiles-help)
		(source "Draw 2000:draw2000")
		(dest d2dir)
		(all)
		(infos)
		(confirm)
	)
)

(complete 50)

; Install choice of plotter files
(askdisk 
	(prompt "Please insert the \"Draw 2000 Data\" disk in any drive.")
	(dest "D2000 Data")
	(help @askdisk-help)
)

(copyfiles
	(prompt "Install your choice of Plotter files.  Please see \"Help\""
		" for more information about available choices.")
	(source "D2000 Data:Plotters")
	(dest (tackon d2dir "Plotters"))
	(all)
	(confirm 0)
	(help (cat "   You can deselect any plotter you don't want."
		" For use with the PLT: device, be sure to"
		" install one of the HP plotters -- HP7475 is a good one."  
		" For use with a PostScript printer or for saving EPS"
		" files, be sure to install the LaserWriter.PS"
		" file.\n\n" @copyfiles-help))
)

; install/not install samples
(set samples
	(askbool
		(prompt "Do you want to install the sample Drawings and Parts?")
		(help "   The sample drawings provided include Draw 2000"
			" drawings called GEAR DESIGN and DRAW COVER, and a DXF-format"
			" drawing originally produced in AUTOCAD, called COLUMBIA.DXF. "
			" The sample part lists provided are called GEAR.part and"
			" T-SQUARE.part")
		(choices "Install Samples" "Do Not Install Samples")
		(default 1)
	)
)

; if installing drawings and parts, establish user path for drawings
(if (= samples 1)
	(
		(set drawdir
			(askdir
				(prompt
				"Where would you like the sample Drawings to be installed?")
				(help @askdir-help)
				(default (tackon d2dir "Drawings"))
			)
		)
		(makedir drawdir (infos))

		(copyfiles
			(prompt "Copying Drawings files.")
			(help @copyfiles-help)
			(source "D2000 Data:Drawings")
			(dest drawdir)
			(infos)
			(all)
			(confirm 0)
		)

		(complete 70)

		(set partdir
			(askdir
				(prompt
				"Where would you like the sample Parts to be installed?")
				(help @askdir-help)
				(default (tackon d2dir "Parts"))
			)
		)

		(makedir partdir (infos))

		(copyfiles
			(prompt "Copying Parts files.")
			(help @copyfiles-help)
			(source "D2000 Data:Parts")
			(dest partdir)
			(infos)    
			(all)
			(confirm 0)
		)
	)
)

(complete 80)

; Install/not install PLT device
(set PLTin
	(askbool
		(prompt "Do you want to install the PLT device?")
		(help "   This step copies the device to the devs: directory, and"
			" sets up your StartupII file to mount PLT automatically."
			" It also adds the mount information to your MountList."
			" You can skip this step if you do not expect to use the PLT"
			" device -- for example, if you have a plotter.")
		(choices "Install PLT Device" "Do Not Install PLT Device")
		(default 1)
	)
)

(if (= PLTin 1)
	(
		(copyfiles
			(prompt "Copy the PLT device handler to your L: directory.")
			(help @copyfiles-help)
			(source "Draw 2000:l")
			(dest "L:") 
			(pattern "PLT-hand#?")
		)
		(copyfiles
			(prompt "Copy the draw configuration files to your devs:"
				" directory.")
			(help @copyfiles-help)
			(source "Draw 2000:devs")
			(dest "devs:") 
			(pattern "draw#?")
		)
		(run "join devs:MountList devs:draw.mountlist as RAM:MountList")
		(run "rename devs:MountList devs:MountList.old")
		(copyfiles
			(prompt "Place altered MountList in your devs: directory.")
			(help @copyfiles-help)
			(source "RAM:")
			(dest "devs:")
			(pattern "MountList")
		)
		(if (= sysver 0)
			(
				(run "rename s:StartupII s:StartupII.old")
				(textfile
					(prompt
						"Add \"mount PLT:\" command to your StartupII file.")
					(help @copyfiles-help)
					(dest "s:StartupII")
					(include "Draw 2000:s/mountstring")
					(include "S:StartupII.old")
					(confirm)
				)
			)
			(
				(run "rename s:User-Startup s:User-Startup.old")
				(textfile
					(prompt
						"Add mount PLT: command to your User-Startup file.")
					(help @copyfiles-help)
					(dest "s:User-Startup")
					(include "Draw 2000:s/mountstring")
					(include "S:UserStartup.old")
					(confirm)
				)
			)
		)
	)
	(
		(copyfiles
			(prompt "Copy Draw 2000 configuration file to devs:")
			(help @copyfiles-help)
			(source "Draw 2000:devs")
			(dest "DEVS:")
			(pattern "draw-con#?")
		)
	)
)

(complete 95)

(copyfiles
	(prompt "Copy the Stroke font to your fonts: directory.")
	(help @copyfiles-help)
	(Source "Draw 2000:fonts")
	(dest "Fonts:")
	(all)
)

(complete 100)

(exit)

