(delopts "force")		;Unprotect destination files automatically
(user 2)			;Ask them all the questions.  Sorry.

; Set up a error cleanup routine
;
(onerror)
(complete 0)

(set df0 (if (getassign "DF0" "d") ("DF0:") ("Drive not available")))
(set df1 (if (getassign "DF1" "d") ("DF1:") ("Drive not available")))
(set df2 (if (getassign "DF2" "d") ("DF2:") ("Drive not available")))
(set df3 (if (getassign "DF3" "d") ("DF3:") ("Drive not available")))
(set drive "!#@")
(until (getassign drive "d")
    (SET drive
        (cat "DF"
            (askchoice
                (prompt "Which floppy should I install to?")
                (help   "DICE Needs to format a floppy to hold the installed"
                        "version.  You will be prompted to insert a floppy in"
                        "this drive as a part of the installation process"
                )
                (choices (df0) (df1) (df2) (df3))
                (default 0)
            )
        )
    )
)

(set drivename (cat drive ":"))
(if (not
        (askbool
            (prompt "Please insert a floppy into " drivename
                    " for formatting to receive the DICE installation\n"
                    "Note: All information on this diskette will be lost"
                    "Select Proceed to continue, Cancel to abort"
            )
            (help   "You need to put a disk into drive " drivename
                    " in order for DICE to be able to format it and then"
                    "put the DICE programs on it"
            )
            (choices "Proceed" "Cancel")
        )
    )
    (exit)
)

(working "Formatting floppy in drive " drivename)
(textfile
    (dest "ram:nl_file")
    (append "")
    (safe)
)

(run "format <ram:nl_file drive " drivename " name Dice_3.0 NOICONS")

(delete "ram:nl_file" (safe))

(makeassign "DCC"      dice_dest)
(makeassign "DTMP"     "dcc:dtmp")
(makeassign "DINCLUDE" "dcc:include")

(debug "did it")
(exit)
;***********************************************************************
; Begin the joys of installation. Setup Dice drawer and icon if not there.
; At this point we have a valid destination, so we tell installer where
; the application will end up so the exit page will be correct -- also,
; the installation log file (if any) will be copied to the destination.
;***********************************************************************
(set @default-dest dice_dest)
    (
        (makedir dice_dest (infos))
	(makedir (tackon dice_dest "Bin"     ) (infos))
	(makedir (tackon dice_dest "Tools"   ) (infos))
	(makedir (tackon dice_dest "Config"  ) (infos))
	(makedir (tackon dice_dest "User"    ) (infos))
	(makedir (tackon dice_dest "Examples") (infos))
	(makedir (tackon dice_dest "dtmp"))
	(makedir (tackon dice_dest "lib"))
	(makedir (tackon dice_dest "doc"))
	(makedir (tackon dice_dest "s"))
	(makedir (tackon dice_dest "Rexx"))
	(makedir (tackon dice_dest "Include"))
	(makedir (tackon dice_dest "Dlib"))
    )


(exit)
