$! DORMANT.INS
$! Installation procedure for DORMANT.
$! Darrell Blair, 17-Apr-1990
$!
$! Initialize the symbols
$	SET NOVERIFY
$	WRITE SYS$OUTPUT ">>> Initializing installation variables...."
$	BOOL_HELP_RESIDENT = "NO"
$	BOOL_VAXC_RESIDENT = "NO"
$	BOOL_SOURCE_RESIDENT = "NO"
$	BOOL_OBJECT_RESIDENT = "NO"
$	SOURCE_FILE = "DORMANT.C"
$	OBJECT_FILE = "DORMANT.OBJ"
$	HELP_FILE = "DORMANT.HLB"
$	BUILD_TYPE = "object"
$	DEFAULT_DIR = F$ENVIRONMENT("DEFAULT")
$!
$! Determine if VAX C compiler is on the system
$	IF F$SEARCH("SYS$SYSTEM:VAXC.EXE") .EQS. ""
$	THEN
$		WRITE SYS$OUTPUT ">>> VAX C compiler NOT resident on this system...."
$		REQUIRED_FILES = "DORMANT.OBJ"
$	ELSE
$		WRITE SYS$OUTPUT ">>> VAX C compiler IS resident on this system...."
$		REQUIRED_FILES = "DORMANT.C"
$		BOOL_VAXC_RESIDENT = "YES"
$	ENDIF
$!
$! Determine if "Required" files are on the system
$	IF F$SEARCH(SOURCE_FILE) .NES. "" THEN $ BOOL_SOURCE_RESIDENT = "YES"
$	IF F$SEARCH(OBJECT_FILE) .NES. "" THEN $ BOOL_OBJECT_RESIDENT = "YES"
$	IF BOOL_OBJECT_RESIDENT .EQS. "NO"
$	THEN
$		WRITE SYS$OUTPUT ">>> Object file could not be located...."
$		WRITE SYS$OUTPUT ">>> Referencing the source and compiler...."
$		IF BOOL_SOURCE_RESIDENT .EQS. "NO" .OR. BOOL_VAXC_RESIDENT .EQS. "NO"
$		THEN
$			WRITE SYS$OUTPUT ">>> Source or compiler not located...."
$			WRITE SYS$OUTPUT ">>> Please verify your DORMANT files are present...."
$			EXIT
$		ELSE
$			BUILD_TYPE = "source"
$		ENDIF
$	ELSE
$		WRITE SYS$OUTPUT ">>> Object file located...."
$		WRITE SYS$OUTPUT ">>> DORMANT will build from ''BUILD_TYPE' file...."
$	ENDIF
$!
$! Determine if "Nice to Have" files are on the system
$	IF F$SEARCH(HELP_FILE) .NES. "" 
$	THEN
$		WRITE SYS$OUTPUT ">>> DORMANT HELP file has been located...."
$		BOOL_HELP_RESIDENT = "YES"
$		ADD_COMMANDS = "DORMANT and DORMANT_HELP"
$	ELSE
$		WRITE SYS$OUTPUT ">>> DORMANT HELP file has NOT been located.  Continuing...."
$		ADD_COMMANDS = "DORMANT"
$	ENDIF
$!
$! Modify the command definition file
$	WRITE SYS$OUTPUT ">>> Creating the command definition file...."
$	OPEN/WRITE OUTFILE DORMANT.CLD
$	WRITE OUTFILE "DEFINE VERB DORMANT"
$	WRITE OUTFILE "	IMAGE ''DEFAULT_DIR'DORMANT"
$	WRITE OUTFILE "	QUALIFIER WATCH, VALUE(TYPE=$NUMBER)
$	WRITE OUTFILE "	QUALIFIER WARNING, VALUE(TYPE=$NUMBER)
$	CLOSE/NOLOG OUTFILE
$!
$! Build the Image
$	WRITE SYS$OUTPUT ">>> Building the DORMANT image from ''BUILD_TYPE'..."
$	IF BUILD_TYPE .EQS. "source"
$	THEN
$		WRITE SYS$OUTPUT ">>> Compiling, please wait...."
$		CC DORMANT
$		WRITE SYS$OUTPUT ">>> Linking, please wait...."
$		LINK DORMANT
$	ELSE
$		WRITE SYS$OUTPUT ">>> Linking, please wait...."
$		LINK DORMANT
$	ENDIF
$!
$! Modify LOGIN.COM
$	WRITE SYS$OUTPUT ">>> Adding the ''ADD_COMMANDS' command to your LOGIN.COM...."
$	OPEN/READ INFILE SYS$LOGIN:LOGIN.COM
$	OPEN/WRITE OUTFILE SYS$LOGIN:LOGIN.TMP
$	WRITE OUTFILE "$! The following was setup by the DORMANT automantic installation procedure."
$	WRITE OUTFILE "$ SET COMMAND ''DEFAULT_DIR'DORMANT"
$	IF BOOL_HELP_RESIDENT .EQS. "YES" THEN WRITE OUTFILE "$ DORMANT_HELP :== HELP/LIBRARY=''DEFAULT_DIR'DORMANT DORMANT"
$	WRITE OUTFILE "$!"
$	READ_LOGIN:
$		READ/END=LOGIN_DONE INFILE RECORD
$		WRITE OUTFILE RECORD
$	GOTO READ_LOGIN
$	LOGIN_DONE:
$	CLOSE/NOLOG INFILE
$	CLOSE/NOLOG OUTFILE
$	RENAME/NOLOG SYS$LOGIN:LOGIN.TMP; SYS$LOGIN:LOGIN.COM;
$!
$! Set Command Tables
$	WRITE SYS$OUTPUT ">>> Adding the ''ADD_COMMANDS' command to the process command tables...."
$	SET COMMAND DORMANT
$	IF BOOL_HELP_RESIDENT .EQS. "YES" THEN DORMANT_HELP :== HELP/LIBRARY='DEFAULT_DIR'DORMANT DORMANT
$!
$! Completion message
$!
$! Cleanup to save space and Exit
$	WRITE SYS$OUTPUT ">>> DORMANT installation procedure completed successfully...."
$	IF BOOL_SOURCE_RESIDENT .EQS. "YES" THEN DELETE/NOLOG DORMANT.C;*
$	PURGE/NOLOG DORMANT.*
$	WRITE SYS$OUTPUT ">>> TYPE DORMANT_HELP for help on using DORMANT...."
$	EXIT
$!
