; SlowBoot Install script for use with CBM installer.
; $VER: SlowBoot_Install <<VERSION>>

(set @default-dest "")

(set txt_welcome 
	(cat "This script will install SlowBoot onto a floppy disk\n\n"
	     "Do you wish to continue?"
	)
)
(set txt_GetBoot
	(cat "Please enter the name of your boot partition\n\n"
	     "For example: DH0:"
	)
)
(set txt_GetFloppy
	(cat "Please enter the floppy drive which will be used to create "
	     "the bootdisk\n\n"
	     "For example: DF0:"
	)
)
(set txt_GetDelay
	(cat "If the drive has not spun up, how long do you wish to delay "
	     "before rebooting?\n\n"
	     "For example: 1 second (probably best)"
	)
)
(set txt_Quick
	(cat "How do you wish to format the disk?")
)


(set help_GetBoot
	(cat "Please enter the name of the partition that you booted from. "
	     "This is normally DH0: but you can check by typing "info" at a "
	     "shell. This will produce a list of units and there actual "
	     "names.\n\n"
	     "NEVER enter SYS: for this option.\n\n"
	     @askstring-help
	)
)
(set help_GetFloppy
	(cat "Please enter either DF0:, DF1:, DF2: or DF3:\n\n"
	     @askstring-help
	)
)
(set help_GetDelay
	(cat "Enter the delay, in seconds\n\n"
	     @asknumber-help
	)
)
(set help_Quick
	(cat "If the disk has been formatted before then select Quick, otherwise "
	     "pick Full\n\n"
	     @askbool-help
	)
)


(message txt_welcome)

(set bootdev
	(askstring
		(prompt txt_GetBoot)
		(help help_GetBoot)
		(default "DH0:")
	)
)

(set floppy
	(askstring
		(prompt txt_GetFloppy)
		(help help_GetFloppy)
		(default "DF0:")
	)
)

(set bootdelay
	(asknumber
		(prompt txt_GetDelay)
		(help help_GetDelay)
		(range 0 9999999)
		(default 1)
	)
)

(if
	(askbool
		(prompt txt_Quick)
		(help help_Quick)
		(choices "Quick" "Full")
		(default 1)
	)
	(
		(run "SYS:System/Format <>CON:////Format/AUTO DRIVE " floppy " NAME Boot FFS NOICONS QUICK")
	)
	(
		(run "SYS:System/Format <>CON:////Format/AUTO DRIVE " floppy " NAME Boot FFS NOICONS")
	)
)

(run "Install " floppy " FFS")

(copyfiles
	(source "data/disk.info")
	(dest floppy)
)

(makedir (tackon floppy "C"))
(makedir (tackon floppy "S"))
(makedir (tackon floppy "DEVS"))

(copyfiles
	(source "SlowBoot")
	(dest (tackon floppy "c"))
)

(if
	(exists "DEVS:system-configuration" 
		(noreq)
	)
	(copyfiles
		(source "DEVS:system-configuration")
		(dest (tackon floppy "DEVS"))
	)
)

(textfile
	(dest (tackon floppy "S/startup-sequence"))
	(append 
		(cat "; SlowBoot startup-sequence version <<VERSION>>\n"
		     ";\n"
		     "C:SlowBoot >NIL: " bootdev " WAIT " bootdelay "\n"
		     "EndShell >NIL:\n"
		)
	)
)
	

