; DiskManager 4.0 Installer Script
; by Andrew Woods

(procedure InstallDMnew
	(
		(set ecdir
			(askdir
				(prompt "Please select a drawer to install into")
				(help   "Choose somewhere that you want to run DiskManager 4.0 from. The Installer will NOT create a new drawer.")
				(default "Work:")
			)
		)
		(copyfiles
			(prompt "Copying DiskManager 4.0...")
			(source "DM4.0:")
			(dest   ecdir)
			(infos)
			(all)
		)
	)
)

(procedure InstallDMold
	(
		(set ecdir
			(askdir
				(prompt "Please select your DM3 drawer")
				(help   "Choose the drawer (not the DiskManagerIII file)")
				(default "Work:")
			)
		)
		(copyfiles
			(prompt "Copying DiskManager 4.0...")
			(source "DM4.0:DM4.0")
			(dest   ecdir)
			(infos)
		)
		(copyfiles
			(prompt "Copying DiskManager 4.0 help...")
			(source "DM4.0:DM4.guide")
			(dest   ecdir)
			(infos)
		)
		(copyfiles
			(prompt "Copying History file...")
			(source "DM4.0:history.doc")
			(dest   ecdir)
			(infos)
		)
		(copyfiles
			(prompt "Copying History file viewer...")
			(source "DM4.0:ppmore")
			(dest   ecdir)
		)
		(copyfiles
			(prompt "Copying Help file viewer...")
			(source "DM4.0:viewguide")
			(dest   ecdir)
		)
		(copyfiles
			(prompt "Copying Author's Notes...")
			(source "DM4.0:authornotes.doc")
			(dest   ecdir)
			(infos)
		)
	)
)

(if (< (/ (getversion) 65536) 37)
(
	(abort "You need WB2 or above to run DiskManager 4.0")
))

(set mainopt
	(askchoice
		(prompt "Select the type of installation")
		(help   "Depending on whether you own an older copy of DiskManager will affect how the installation should proceed. If you have some existing V3.0 datafiles then you will choose the second option, but if you want to start from scratch and create a new database then choose the second option. If you want to run off this disk but need the libraries in place then this option will place the libraries for you")
		(choices "DM4.0 for new user"
						 "DM4.0 for existing (V3.0) user"
		)
	)
)

(if (= mainopt 0)
	(InstallDMnew)
)
(if (= mainopt 1)
	(InstallDMold)
)

(message "Now DiskManager 4.0 is ready to rock!")
