;$VER: AsimCDFS Install 1.2 (25.11.92) 
;Copyright ©1992 Asimware Innovations

(set #autoMount 2)
(set #CDDefault_NC "CD0" )
(set #isPioneer 0)
(set #supportLUN 1)
(set #mountFlags 0 )

(set #wbversion (getversion))
(set #wbversion (/ #wbversion 65536) )

(complete 0)

(if (< (getdiskspace "SYS:") 66560)
	(abort "\n\nApproximately 65K of disk space is needed on your SYS: volume."
			 "\n\nYou only have " (/ (getdiskspace "SYS:") 1024)	"K free.\n\n"
			 "Delete or transfer some files from the SYS: volume and try again." )
)

(askdisk
	(prompt "Please insert the disk labeled \"AsimCDFS_Install\".")
	(help	"AsimCDFS FileSystem and other utilities will be copied "
			"from this disk into your system.")
	(dest  "AsimCDFS_Install")
	(newname "AsimCDFSInst")
)

(set #theirlevel @user-level )
(user 2)

(complete 0 )
(set #IsAmiga
	(askbool
		(prompt "\n\nIs AsimCDFS being installed on an Amiga or a CDTV?" )
		(default 1 )
		(choices "Amiga" "CDTV" )
		(help "\n\nIf AsimCDFS is being used in conjunction with a CDTV unit "
				"then note this with the CDTV gadget.\n\n "
				"As well, make sure you do not choose CD0 as the AmigaDOS "
				"device name since the CDTV unit will already have "
				"allocated that particular name." )
	)
)

(complete 5 )
(if (not #IsAmiga) 
	((set #CDDefault_NC "CD1" )
	(set #SCSIDevice "cdtv.device")
	(set #SCSIUnit 0)
	(set #mountFlags 1)
	)
)

(if #IsAmiga
	(set #isPioneer 
		(askbool
			(prompt "\n\n\nIs your CDRom drive a Pioneer DRM-600?" )
			(default 0)
			(choices "Pioneer DRM-600" "Other CDRom")
			(help "\n\nIf you are using AsimCDFS with a Pioneer DRM-600, indicate this "
					"in your choice.\n\nThis drive is a high-performance 6-disc minichanger and "
					"is not common." )
		)
	)
)


(complete 10 )
(if #isPioneer
	(
	(set #CDDevice_NC 
			(askstring
				(prompt "\n\nWhat name would you like base name of the CDRom devices to be?\n\n(The trailing colon MUST NOT be present.  See addendum for explanation.)" )
				(default "CD" )
				(help "\n\nThis is the base name under which AmigaDOS will reference the "
						"CDRom as.  As you are installing AsimCDFS for a Pioneer 6-disc changer "
						", 6 such devices named <basename>0 through <basename>5 will be mounted (ie.  CD0, CD1, ..., CD5) "
						"\n\nThe trailing : (colon) or the 0 through 5 MUST NOT be present." )
			)
		)

	(set #supportLUN
		(askbool
			(prompt "\n\nDoes your SCSI controller support LUNs?\n\n(see addendum file for more info)" )
			(default 1 )
			(choices "Yes" "No" )
			(help "\n\nConsult your SCSI controller manual or contact the manufacturer "
					"directly to determine if your controller supports LUNs.  For example, the GVP Series controllers do support LUNs, while the Commodore 2091 does not." )
		)
	)
	
	(if (not #supportLUN)
		(set #mountFlags 0x04))
	)
)

(if (not #isPioneer)
	((set #CDDevice_NC 
		(askstring
			(prompt "\n\nWhat name would you like the CDRom to appear as?\n\n(The trailing colon MUST NOT be present)" )
			(default #CDDefault_NC )
			(help "\n\nThis is the name under which AmigaDOS will reference the "
					"CDRom as.  While usually "
					#CDDefault_NC
					", it can be any name you choose. "
					"\n\nThe trailing : (colon) MUST NOT be present." )
		)
	)

	(set #CDDevice (cat #CDDevice_NC ":") ))
)


(complete 15 )
(if #IsAmiga
	((set #SCSIDevice 
		(askstring
			(prompt "\n\nWhat is the name of the device driver for your SCSI controller card?" )
			(default "scsi.device" )
			(help "\n\nThis is the name of the device driver for your particular "
					"SCSI card.  For example, the Commodore 2091/590/Amiga3000 has "
					"a name of \"scsi.device\".\n\nConsult either the AsimCDFS User's Guide "
					"or contact the SCSI Controller's manufacturer." )
		)
	)
	
(complete 18 )
	(set #SCSIUnit 
		(asknumber
			(prompt "\n\nWhat is the SCSI unit # of your CDRom drive?" )
			(default 4 )
			(help "\n\nThis is the unit # of the CDRom drive.  This is usually a "
					"numerical value between 0 and 6.\n\n"
					"Consult the CDRom drive documentation for instructions on "
					"determining the unit #." )
		)
	))
)

(user #theirlevel)
(complete 20 )

(set #numBuffers
	(asknumber
		(prompt "\n\nHow many 48K buffers should AsimCDFS have?" )
		(default 2 )
		(help "\n\nThis is how many 48K buffers AsimCDFS will allocate for the drive. "
				"Since CDRom drives, by their nature, have slow access-times, "
				"a good way to gain speed is via buffering.\n\nIf you have extra "
				"memory, it would be in your best interest to up this value." )
	)
)

(complete 25 )
(set #instCDFS
	(askbool
		(prompt "\n\nShould AsimCDFS FileSystem be installed?")
		(help "\n\nThis is meat-and-potatoes of the package.  This program will "
				"provide the translation between the CDRom filesystem and "
				"what AmigaDOS expects.\n\nThis is an essential step in the installation "
				"process.\n")
		(default 1)
	)
)

(complete 30 )
(if #instCDFS 
	((protect "l:AsimCDFS" "rwed" )
	(copyfiles
		(prompt "\n\nCopying AsimCDFS FileSystem to the l: directory.\n" )
		(source "AsimCDFSInst:l/AsimCDFS")
		(dest "l:")
		(confirm)
		(help "\n\nThis will copy over the AsimCDFS FileSystem program to your "
			"l: directory\n\nThis is an essential step in the installation "
			"process.\n" )
	)

(complete 35 )
	(set #autoMount
		(askbool
			(prompt "\n\nShould AsimCDFS be automatically started upon bootup?")
			(help "\n\nIf you would like, a command will be inserted into your "
					"\"S:Startup-Sequence\" or \"S:User-Startup\" file to "
					"automatically start AsimCDFS upon bootup." )
			(default 1)
		)
	)


(complete 40 )
	(if #isPioneer
		((set #startupCommand1 (cat "mount " #CDDevice_NC "0: from devs:MountList." #CDDevice_NC "\n") )
		(set #startupCommand2 (cat "mount " #CDDevice_NC "1: from devs:MountList." #CDDevice_NC "\n") )
		(set #startupCommand3 (cat "mount " #CDDevice_NC "2: from devs:MountList." #CDDevice_NC "\n") )
		(set #startupCommand4 (cat "mount " #CDDevice_NC "3: from devs:MountList." #CDDevice_NC "\n") )
		(set #startupCommand5 (cat "mount " #CDDevice_NC "4: from devs:MountList." #CDDevice_NC "\n") )
		(set #startupCommand6 (cat "mount " #CDDevice_NC "5: from devs:MountList." #CDDevice_NC "\n") )
		(set #startupWait "wait sec=4\n" )
		
		(if #autoMount
			((protect "S:User-Sequence" "rwed" )
			
			(startup "AsimCDFS"
				(command #startupCommand1 )
				(command #startupWait)
				(command #startupCommand2 )
				(command #startupWait)
				(command #startupCommand3 )
				(command #startupWait)
				(command #startupCommand4 )
				(command #startupWait)
				(command #startupCommand5 )
				(command #startupWait)
				(command #startupCommand6 )
				(prompt "Inserting MOUNT commands into the startup-sequence")
				(help "\n\nThe command \"MOUNT " #CDDevice "0: FROM DEVS:MOUNTLIST." #CDDevice_NC "\" is being inserted into your "
						"\"S:Startup-Sequence\" or \"S:User-Startup\" file to "
						"automatically start AsimCDFS upon bootup." )
			))
		))
	)

	(if (not #isPioneer)
		((set #startupCommand (cat "mount " #CDDevice " from devs:MountList." #CDDevice_NC) )
		(if #autoMount
			((protect "S:User-Sequence" "rwed" )
			
			(startup "AsimCDFS"
				(command #startupCommand )
				(prompt "Inserting MOUNT command into the startup-sequence")
				(help "\n\nThe command \"MOUNT " #CDDevice " FROM DEVS:MOUNTLIST." #CDDevice_NC "\" is being inserted into your "
						"\"S:Startup-Sequence\" or \"S:User-Startup\" file to "
						"automatically start AsimCDFS upon bootup." )
			))
		))
	)
	
	(if (= #wbversion 33 )
		((set #replace12Mount
			(askbool
				(prompt "You are using WorkBench 1.2\n\nIf this is true, AsimCDFS cannot be mounted "
							"due to the 1.2 mount command.  It is EXTREMELY suggested that you replace "
							"the MOUNT command in your C: directory with the one contained on this install disk.\n\n"
							"Would you like that to be done now?")
				(help "The MOUNT command supplied with WorkBench 1.2 does not support "
						"the FROM parameter.  It needs to be replaced with the 1.3 MOUNT command." )
				(default 1)
			)	
		)
		(if #replace12Mount
			(copyfiles
				(prompt "\n\nCopying 1.3 MOUNT command to the C: directory" )
				(source "AsimCDFSInst:c/Mount")
				(dest "C:")
				(help "\n\nThis will copy over the 1.3 Mount command to your C: directory." )
				(confirm)
			)
		)
		)
	)
	
(complete 50 )
	(protect (cat "devs:MountList." #CDDevice_NC) "rwed" )

	(if #isPioneer
		(textfile
			(dest (cat "devs:MountList." #CDDevice_NC) )
			(append "/************************************************************/\n"
					  "/*  AsimCDFS MountList entry -- ©1992 Asimware Innovations  */\n"
					  "/************************************************************/\n")
			(append #CDDevice_NC "0:\n")
			(append "	Device         = " #SCSIDevice "\n" )
			(append "	Unit           = 0" #SCSIUnit "\n" )
			(append "	Buffers        = " (* #numBuffers 96) "\n")
			(append "	Flags          = " #mountFlags "\n" )
			(append "	FileSystem     = l:AsimCDFS\n")
			(append "	BufMemType     = 5\n")
			(append "	DosType        = 0x662dabac\n")
			(append "	GlobVec        = -1\n")
			(append "	Mount          = " #autoMount "\n")
			(append "	Reserved       = 0\n")
			(append "	LowCyl         = 0\n")
			(append "	HighCyl        = 999\n")
			(append "	Surfaces       = 1\n")
			(append "	BlocksPerTrack = 32\n")
			(append "	Priority       = 10\n")
			(append "	StackSize      = 5000\n")
			(append "#\n\n")
			(append #CDDevice_NC "1:\n")
			(append "	Device         = " #SCSIDevice "\n" )
			(append "	Unit           = 1" #SCSIUnit "\n" )
			(append "	Buffers        = " (* #numBuffers 96) "\n")
			(append "	Flags          = " #mountFlags "\n" )
			(append "	FileSystem     = l:AsimCDFS\n")
			(append "	BufMemType     = 5\n")
			(append "	DosType        = 0x662dabac\n")
			(append "	GlobVec        = -1\n")
			(append "	Mount          = " #autoMount "\n")
			(append "	Reserved       = 0\n")
			(append "	LowCyl         = 0\n")
			(append "	HighCyl        = 999\n")
			(append "	Surfaces       = 1\n")
			(append "	BlocksPerTrack = 32\n")
			(append "	Priority       = 10\n")
			(append "	StackSize      = 5000\n")
			(append "#\n\n")
			(append #CDDevice_NC "2:\n")
			(append "	Device         = " #SCSIDevice "\n" )
			(append "	Unit           = 2" #SCSIUnit "\n" )
			(append "	Buffers        = " (* #numBuffers 96) "\n")
			(append "	Flags          = " #mountFlags "\n" )
			(append "	FileSystem     = l:AsimCDFS\n")
			(append "	BufMemType     = 5\n")
			(append "	DosType        = 0x662dabac\n")
			(append "	GlobVec        = -1\n")
			(append "	Mount          = " #autoMount "\n")
			(append "	Reserved       = 0\n")
			(append "	LowCyl         = 0\n")
			(append "	HighCyl        = 999\n")
			(append "	Surfaces       = 1\n")
			(append "	BlocksPerTrack = 32\n")
			(append "	Priority       = 10\n")
			(append "	StackSize      = 5000\n")
			(append "#\n\n")
			(append #CDDevice_NC "3:\n")
			(append "	Device         = " #SCSIDevice "\n" )
			(append "	Unit           = 3" #SCSIUnit "\n" )
			(append "	Buffers        = " (* #numBuffers 96) "\n")
			(append "	Flags          = " #mountFlags "\n" )
			(append "	FileSystem     = l:AsimCDFS\n")
			(append "	BufMemType     = 5\n")
			(append "	DosType        = 0x662dabac\n")
			(append "	GlobVec        = -1\n")
			(append "	Mount          = " #autoMount "\n")
			(append "	Reserved       = 0\n")
			(append "	LowCyl         = 0\n")
			(append "	HighCyl        = 999\n")
			(append "	Surfaces       = 1\n")
			(append "	BlocksPerTrack = 32\n")
			(append "	Priority       = 10\n")
			(append "	StackSize      = 5000\n")
			(append "#\n\n")
			(append #CDDevice_NC "4:\n")
			(append "	Device         = " #SCSIDevice "\n" )
			(append "	Unit           = 4" #SCSIUnit "\n" )
			(append "	Buffers        = " (* #numBuffers 96) "\n")
			(append "	Flags          = " #mountFlags "\n" )
			(append "	FileSystem     = l:AsimCDFS\n")
			(append "	BufMemType     = 5\n")
			(append "	DosType        = 0x662dabac\n")
			(append "	GlobVec        = -1\n")
			(append "	Mount          = " #autoMount "\n")
			(append "	Reserved       = 0\n")
			(append "	LowCyl         = 0\n")
			(append "	HighCyl        = 999\n")
			(append "	Surfaces       = 1\n")
			(append "	BlocksPerTrack = 32\n")
			(append "	Priority       = 10\n")
			(append "	StackSize      = 5000\n")
			(append "#\n\n")
			(append #CDDevice_NC "5:\n")
			(append "	Device         = " #SCSIDevice "\n" )
			(append "	Unit           = 5" #SCSIUnit "\n" )
			(append "	Buffers        = " (* #numBuffers 96) "\n")
			(append "	Flags          = " #mountFlags "\n" )
			(append "	FileSystem     = l:AsimCDFS\n")
			(append "	BufMemType     = 5\n")
			(append "	DosType        = 0x662dabac\n")
			(append "	GlobVec        = -1\n")
			(append "	Mount          = " #autoMount "\n")
			(append "	Reserved       = 0\n")
			(append "	LowCyl         = 0\n")
			(append "	HighCyl        = 999\n")
			(append "	Surfaces       = 1\n")
			(append "	BlocksPerTrack = 32\n")
			(append "	Priority       = 10\n")
			(append "	StackSize      = 5000\n")
			(append "#\n\n")
		)
	)

(complete 52 )
	(if (not #isPioneer)
		(textfile
			(dest (cat "devs:MountList." #CDDevice_NC) )
			(append "/************************************************************/\n"
					  "/*  AsimCDFS MountList entry -- ©1992 Asimware Innovations  */\n"
					  "/************************************************************/\n")
			(append #CDDevice "\n")
			(append "	Device         = " #SCSIDevice "\n" )
			(append "	Unit           = " #SCSIUnit "\n" )
			(append "	Buffers        = " (* #numBuffers 96) "\n")
			(append "	Flags          = " #mountFlags "\n" )
			(append "	FileSystem     = l:AsimCDFS\n")
			(append "	BufMemType     = 5\n")
			(append "	DosType        = 0x662dabac\n")
			(append "	GlobVec        = -1\n")
			(append "	Mount          = " #autoMount "\n")
			(append "	Reserved       = 0\n")
			(append "	LowCyl         = 0\n")
			(append "	HighCyl        = 999\n")
			(append "	Surfaces       = 1\n")
			(append "	BlocksPerTrack = 32\n")
			(append "	Priority       = 10\n")
			(append "	StackSize      = 5000\n")
			(append "#\n")
		)
	)
(complete 53 )

)
)

(complete 60 )

(set #instTunes
	(askbool
		(prompt "\n\nShould AsimTunes CDAudio controller be installed?")
		(help "\n\nThis will copy over the AsimTunes CDAudio controller "
				"program to your SYS:Utilities directory\n\nIf you do not "
				"wish the AsimTunes program to be transferred to your system, "
				"skip this step.\n" )
		(default 1)
	)
)

(complete 65 )
(if #instTunes
	((protect "SYS:Utilities/AsimTunes" "rwed" )
	(protect "SYS:Utilities/AsimTunes.info" "rwed" )
	(copyfiles
		(prompt "\n\nCopying AsimTunes CDAudio controller program to the "
				  "SYS:Utilities directory.\n" )
		(source "AsimCDFSInst:AsimTunes")
		(dest "SYS:Utilities")
		(infos)
		(help "\n\nThis will copy over the AsimTunes CDAudio controller "
				"program to your SYS:Utilities directory\n\nIf you do not "
				"wish the AsimTunes program to be transferred to your system, "
				"skip this step.\n" )
		(confirm)
	)
	(tooltype
		(dest "SYS:Utilities/AsimTunes" )
		(settooltype (cat "DEVICE" #CDDevice) )
		(noposition)
	)
	
(complete 70 )
	(protect "fonts:AsimTunes" "rwed" )
	(protect "fonts:AsimTunes.font" "rwed" )
	(protect "fonts:AsimTunes/8" "rwed" )
	(protect "fonts:AsimTunes/20" "rwed" )
	(copyfiles
		(prompt "\n\nCopying AsimTunes fonts to the FONTS: directory\n" )
		(source "AsimCDFSInst:fonts")
		(dest "fonts:" )
		(all)
		(help "\n\nThis will copy over the fonts needed for AsimTunes.\n\n"
				"They will be placed into your fonts: directory.\n\n" )
		(confirm)
	))
)


(complete 80 )

(set #instFork
	(askbool
		(prompt "\n\nShould AsimFork HFS Fork selector be installed?")
		(help "\n\nThis will copy over the AsimFork HFS Fork selector "
				"program to your c: directory\n\nIf you do not "
				"wish the AsimFork program to be transferred to your system, "
				"skip this step.\n" )
		(default 1)
	)
)

(complete 85 )
(if #instFork
	((protect "c:AsimFork" "rwed" )
	(copyfiles
		(prompt "\n\nCopying AsimFork HFS Fork selector program to the c: "
				  "directory.\n" )
		(source "AsimCDFSInst:AsimFork")
		(dest "c:")
		(help "\n\nThis will copy over the AsimFork HFS Fork selector "
				"program to your c: directory\n\nIf you do not "
				"wish the AsimFork program to be transferred to your system, "
				"skip this step.\n" )
		(confirm)
	)
	
(complete 90 )
	(protect "SYS:Utilities/AsimFork_Data.info" "rwed" )
	(protect "SYS:Utilities/AsimFork_Resource.info" "rwed" )
	(protect "SYS:Utilities/AsimFork_Inquire.info" "rwed" )
	(protect "SYS:Utilities/AsimFork_Interactive.info" "rwed" )
	(copyfiles
		(prompt "\n\nCreating AsimFork_Data icon in the SYS:Utilities directory.\n" )
		(source "AsimCDFSInst:AsimFork.info")
		(dest "SYS:Utilities" )
		(newname "AsimFork_Data.info")
		(help "\n\nThis will create an icon in the SYS:Utilities directory "
				"for running the AsimFork utility to automatically select "
				"the HFS Data Fork\n\nIf you do not "
				"wish the AsimFork_Data icon to be created, "
				"skip this step.\n" )
		(confirm)
	)
	(tooltype
		(dest "SYS:Utilities/AsimFork_Data" )
		(settooltype (cat "DEVICE" #CDDevice) )
		(settooltype (cat "FORK" "DATA") )
		(setdefaulttool "c:AsimFork" )
		(noposition)
	)
	
(complete 93 )
	(copyfiles
		(prompt "\n\nCreating AsimFork_Resource icon in the SYS:Utilities directory.\n" )
		(source "AsimCDFSInst:AsimFork.info")
		(dest "SYS:Utilities" )
		(newname "AsimFork_Resource.info")
		(help "\n\nThis will create an icon in the SYS:Utilities directory "
				"for running the AsimFork utility to automatically select "
				"the HFS Resource Fork\n\nIf you do not "
				"wish the AsimFork_Resource icon to be created, "
				"skip this step.\n" )
		(confirm)
	)
	(tooltype
		(dest "SYS:Utilities/AsimFork_Resource" )
		(settooltype (cat "DEVICE" #CDDevice) )
		(settooltype (cat"FORK" "RES") )
		(setdefaulttool "c:AsimFork" )
		(noposition)
	)
	
	
(complete 95 )
	(copyfiles
		(prompt "\n\nCreating AsimFork_Inquire icon in the SYS:Utilities directory.\n" )
		(source "AsimCDFSInst:AsimFork.info")
		(dest "SYS:Utilities" )
		(newname "AsimFork_Inquire.info")
		(help "\n\nThis will create an icon in the SYS:Utilities directory "
				"for running the AsimFork utility to inform you of which "
				"HFS fork will be accessed.\n\nIf you do not "
				"wish the AsimFork_Inquire icon to be created, "
				"skip this step.\n" )
		(confirm)
	)
	(tooltype
		(dest "SYS:Utilities/AsimFork_Inquire" )
		(settooltype (cat "DEVICE" #CDDevice) )
		(settooltype (cat "FORK" "?") )
		(setdefaulttool "c:AsimFork" )
		(noposition)
	)
	
	
(complete 97 )
	(copyfiles
		(prompt "\n\nCreating AsimFork_Interactive icon in the SYS:Utilities directory.\n" )
		(source "AsimCDFSInst:AsimFork.info")
		(dest "SYS:Utilities" )
		(newname "AsimFork_Interactive.info")
		(help "\n\nThis will create an icon in the SYS:Utilities directory "
				"for running the AsimFork utility to open up an Intuition window "
				"allowing you to interactively select which HFS fork is "
				"to be accessed.\n\nIf you do not "
				"wish the AsimFork_Interactive icon to be created, "
				"skip this step.\n" )
		(confirm)
	)
	(tooltype
		(dest "SYS:Utilities/AsimFork_Interactive" )
		(settooltype (cat "DEVICE" #CDDevice) )
		(settooltype (cat "FORK" "INTERACTIVE") )
		(setdefaulttool "c:AsimFork" )
		(noposition)
	))
)

(complete 100 )

(if (= #autoMount 0 )
	(message "\n\nUse the CLI command:\n\n  MOUNT " #CDDevice " FROM DEVS:MOUNTLIST." #CDDevice_NC "\n\nto activate AsimCDFS." )
)

(if (= #wbversion 37)
	(message "\n\nEnsure that the MOUNT command is present in your C: directory.\n\nIf needed, it can be found in the 2.0c directory of this installation disk.")
)

(if (or (= #wbversion 33) (= #wbversion 34) )
	(message "\n\nEnsure that the following commands:\n\nIF\nMOUNT\nENDIF\n\nare present in your C: directory.\n\nIf needed, they can be found in the C: directory of this installation disk.")
)

(set @default-dest "" )
