From:	CSBVAX::MRGATE!@KL.SRI.Com:BOB%HOWARD@cc.utah.edu@SMTP 13-SEP-1987 06:51
To:	EVERHART
Subj:	checksum/verify program (3 of 4)

Received: from CC.UTAH.EDU by KL.SRI.COM with TCP; Sun 13 Sep 87 02:35:43-PDT
Date: Sun, 13 Sep 87 03:37 MST
From: BOB%HOWARD@cc.utah.edu
Subject: checksum/verify program (3 of 4)
To: info-vax@KL.SRI.COM
X-VMS-To: INFOVAX

X$!------------------------------------------------------------------------------
X$!
X$!  DCL and HELP - See if we can mess with the DCL tables and Help library
X$!
X$!------------------------------------------------------------------------------
X$
X$  do_help:
X$
X$       vmi$callback ASK p$help -
X          "Do you want the help files added to the system help library" -
X          "YES" bd
X$
X$
X$
X$!------------------------------------------------------------------------------
X$!
X$!  PURGE - Find out if the user wants to purge old files
X$!
X$!------------------------------------------------------------------------------
X$
X$       say " "
X$       vmi$callback SET PURGE ask
X$
X$
X$!------------------------------------------------------------------------------
X$!
X$!  SET IVP - Disable any IVP
X$!
X$!------------------------------------------------------------------------------
X$
X$       vmi$callback SET IVP no
X$
X$
X$!------------------------------------------------------------------------------
X$!
X$!  ALL DONE - Tell him that were done asking questions
X$!
X$!------------------------------------------------------------------------------
X$
X$       say ""
X$       say ""
X$       say -
V   "    All of the questions for the installation of CHECKSUM/VERIFY have been 
Xasked."
X$       say "    The installation is continuing..."
X$       say ""
X$
X$!------------------------------------------------------------------------------
X$!
X$!  CHECK DISK - See if there is enough disk space 
X$!
X$!------------------------------------------------------------------------------
X$
X$       vmi$callback CHECK_NET_UTILIZATION k$ 'p$net_utilization
X$       if .not. k$ then vmi$callback MESSAGE e netblocks -
X             "''p$name requires ''p$net_utilization blocks after installation."
X$       if .not. k$ then goto failed
X$
X$       vmi$callback SET SAFETY conditional 'p$peak_utilization
X$       
X$
X$
X$!------------------------------------------------------------------------------
X$!
X$!  BUILD LOGIN.COM - Build login.com file
X$!
X$!------------------------------------------------------------------------------
X$
X$       open/write k$temp vmi$kwd:cksver_login.com
X$
X$       write k$temp "$! cksver_login.com - system login.com file"
X$       write k$temp "$"
X$       write k$temp "$ check*sum  :== $''k$product_dir'checksum"
X$       write k$temp "$ ver*ify    :== $''k$product_dir'verify"
X$       write k$temp "$"
X$       write k$temp "$ exit"
X$
X$       close k$temp
X$
X$
X$
X$!------------------------------------------------------------------------------
X$!
X$!  CREATE MAIN DIRECTORY - Create the main product directory
X$!
X$!------------------------------------------------------------------------------
X$
X$       if f$locate("SYS$SYSROOT",k$dir) .eqs. f$length(k$dir) then -
X                goto not_system_dir
X$
X$
X$       k$dir = f$parse(k$product_dir,,,"DIRECTORY","SYNTAX_ONLY") - "[" - "]"
X$       vmi$callback CREATE_DIRECTORY system 'k$dir
X$       goto get_subdir
X$
X$
X$  not_system_dir:
X$       vmi$callback CREATE_DIRECTORY user 'k$dir
X$
X$
X$
X$!------------------------------------------------------------------------------
X$!
X$!  CREATE SUBDIRECTORIES - Create any subdirectories before we get into 
X$!                          safty mode.
X$!
X$!------------------------------------------------------------------------------
X$
X$  get_subdir:
X$
X$       if f$extract(0,12,k$rec) .nes. ".DIRECTORIES" then goto move_files
X$
X$
X$  create_dir:
X$
X$       k$rec = ""
X$
X$
X$  read_loop_2:
X$
X$       read/end=kitdata_eof k$kitdata k$string
X$       k$line = k$line + 1
X$       k$string = f$edit(k$string,"UNCOMMENT,COMPRESS,TRIM,UPCASE")
X$
X$       k$rec = k$rec + k$string
X$       if k$rec .eqs. "" then goto read_loop_2
X$       if f$extract(f$length(k$rec) - 1,1,k$rec) -
X        .nes. "-" then goto make_dir
X$
X$       k$rec == f$extract(0,f$length(k$rec) - 1,k$rec)
X$       goto read_loop_2
X$
X$  make_dir:
X$
X$       if f$extract(0,1,k$rec) .eqs. "." then goto move_files
X$
X$       k$subdir = f$edit(f$element(0," ",k$rec),"TRIM")
X$       k$cond = f$edit(f$element(1," ",k$rec),"TRIM")
X$
X$       if k$cond .nes. "" then goto cr_dir
X$
X$       vmi$callback MESSAGE s BADDIRSYN -
X        "Invalid of incomplete directory syntax in KITDATA.DAT line ''k$line "
X$       say "    ''k$rec "
X$       goto failed
X$
X$
X$  cr_dir:
X$
X$       if .not.'k$cond then goto create_dir
X$
X$       k$subdir = k$subdir - "["
X$       k$dir = k$product_dir - "]" + k$subdir
X$
X$       if f$locate("SYS$SYSROOT",k$dir) .eqs. f$length(k$dir) then -
X                goto not_sys_dir
X$
X$
X$       k$dir = f$parse(k$dir,,,"DIRECTORY","SYNTAX_ONLY") - "[" - "]"
X$       vmi$callback CREATE_DIRECTORY system 'k$dir
X$       goto create_dir
X$
X$
X$  not_sys_dir:
X$       vmi$callback CREATE_DIRECTORY user 'k$dir
X$
X$       goto create_dir
X$
X$
X$!------------------------------------------------------------------------------
X$!
X$!  MOVE FILES  -  read in files from KITDATA.DAT and move them to the 
X$!                 right place.
X$!
X$!------------------------------------------------------------------------------
X$
X$  move_files:
X$
X$       open/write k$filelist vmi$kwd:filelist.txt
X$
X$       k$current_saveset = "A"
X$       k$saveset_loaded = 1
X$
X$
X$  get_next_file:
X$
X$       k$rec = ""
X$
X$  read_loop_3:
X$
X$       read/end=kitdata_eof k$kitdata k$string
X$       k$line = k$line + 1
X$       k$string = f$edit(k$string,"UNCOMMENT,COMPRESS,TRIM,UPCASE")
X$
X$       k$rec = k$rec + k$string
X$       if k$rec .eqs. "" then goto read_loop_3
X$       if f$extract(f$length(k$rec) - 1,1,k$rec) -
X        .nes. "-" then goto get_directive
X$
X$       k$rec == f$extract(0,f$length(k$rec) - 1,k$rec)
X$       goto read_loop_3
X$
X$  
X$  get_directive:
X$
X$!      show symbol k$rec
X$!      inquire keep "keep going"
X$!      if keep .nes. "" then set ver
X$
X$       if f$extract(0,4,k$rec) .nes. ".END" then goto check_saveset
X$
X$       close k$kitdata
X$       close k$filelist
X$
X$       vmi$callback FIND_FILE k$ vmi$root:[sysexe]sortmerge.exe "" s k$found
X$
X$       if k$found .eqs. "S" then -
X                sort vmi$kwd:filelist.txt vmi$kwd:filelist.txt
X$
X$       say ""
X$       say ""
X$       say -
X    "    Your VMS system will now be updated to include the following new and"
X$       say "    modified files: "
X$       say ""
X$       say ""
X$
X$       type vmi$kwd:filelist.txt
X$
X$       say ""
X$       say ""
X$
X$
X$       goto done_with_files
X$
X$
X$  check_saveset:
X$
X$       if f$extract(0,8,k$rec) .nes. ".SAVESET" then goto do_file
X$
X$       k$current_saveset = f$edit(f$element(1," ",k$rec),"TRIM")
X$       k$saveset_loaded = 0
X$
X$       if k$current_saveset .nes. "" then goto get_next_file
X$
X$       vmi$callback MESSAGE s BADSAVESET -
X        "Missing Saveset identification in KITDATA.DAT line ''k$line "
X$       say "    ''k$rec "
X$
X$       goto failed
X$
X$
X$  do_file:
X$
X$       k$final_dir = f$edit(f$element(0," ",k$rec),"TRIM")
X$       k$file = f$edit(f$element(1," ",k$rec),"TRIM")
X$       k$cond = f$edit(f$element(2," ",k$rec),"TRIM")
X$       k$special = f$edit(f$element(3," ",k$rec),"TRIM")
X$
X$       if k$cond .nes. "" then goto have_enough
X$
X$       vmi$callback MESSAGE s BADFILESPEC -
X        "Missing or incomplete file specification in KITDATA.DAT line ''k$line "
X$       say "    ''k$rec "
X$       goto failed
X$
X$
X$  have_enough:
X$
X$       if .not.'k$cond then goto get_next_file
X$
X$       if k$saveset_loaded then goto determine_dir
X$
X$       vmi$callback RESTORE_SAVESET 'k$current_saveset
X$       k$saveset_loaded = 1
X$
X$
X$  determine_dir:
X$
X$       if f$extract(0,1,k$final_dir) .nes. "[" then goto check_system_dir
X$
X$       k$sub_dir = k$final_dir - "[" - "]"
X$       k$final_dir = k$product_dir - "]" + k$sub_dir + "]"
X$       k$nice_dir = k$final_dir
X$
X$       goto check_special
X$
X$
X$  check_system_dir:
X$
X$       if k$final_dir .eqs. "NONE" then goto no_directory
X$
X$       K$SYS_DIRS = "SYSCBI SYSERR SYSEXE SYSHLP SYSLIB SYSMAINT" -
X        + " SYSMGR SYSMSG SYSTEST SYSUPD SYSHLP.EXAMPLES"
X$
X$       if f$locate(k$final_dir,k$sys_dirs) .ne. f$length(k$sys_dirs) -
X                then goto valid_system_dir
X$
X$       vmi$callback MESSAGE s BADSYSDIR -
X        "Invalid system directory specified in KITDATA.DAT line ''k$line "
X$       say "    ''k$cmd "
X$
X$       goto failed
X$
X$
X$  valid_system_dir:
X$
X$       k$sys_log = "SYS$INSTRUCTION SYS$ERRORLOG SYS$SYSTEM SYS$HELP " -
X        + "SYS$LIBRARY SYS$MAINTENANCE SYS$MANAGER SYS$MESSAGE " -
X        + "SYS$TEST SYS$UPDATE SYS$EXAMPLES"
X$
X$       k$i = -1
X$
X$  loop_start:
X$       k$i = k$i + 1
X$
X$       if f$element(k$i," ",k$sys_dirs) .nes. k$final_dir then -
X                goto loop_start
X$
X$       k$nice_dir = f$element(k$i," ",k$sys_log)
X$       k$final_dir = "vmi$root:[''k$final_dir]"
X$
X$       say ""
X$       vmi$callback MESSAGE i SYSFILE -
X        "    This product adds the file ''k$file to the "
X$       vmi$callback MESSAGE i SYSFILE -
X        "    system directory ''k$nice_dir "
X$       say ""
X$
X$       k$nice_dir = k$nice_dir + ":"
X$
X$       goto check_special
X$
X$
X$  no_directory:
X$
X$       k$final_dir = ""
X$
X$
X$  check_special:
X$
X$       if k$special .eqs. "" then goto move_it
X$
X$       if k$special .nes. "SYSTEM_DCL" then goto check_for_help
X$
X$       if k$final_dir .eqs. "" then goto update_dcl
X$
X$       say ""
X$       say "    The command for ''p$name will not be added to the system DCL"
X$       say "    tables. The file ''k$file is being placed in the "
X$       say "    directory ''k$final_dir and will have to be"
X$       say "    enabled with the SET COMMAND command at a later time."
X$       say ""
X$
X$       goto move_it
X$
X$
X$  update_dcl:
X$
X$       vmi$callback PROVIDE_DCL_COMMAND 'k$file
X$
X$       k$string = -
X        f$fao("    !50AS     [!AS]","SYS$LIBRARY:DCLTABLES.EXE","modified")
X$       write k$filelist k$string
X$
X$       goto get_next_file
X$
X$
X$  check_for_help:
X$
X$       if k$special .nes. "SYSTEM_HELP" then goto check_for_startup
X$
X$       if k$final_dir .eqs. "" then goto update_help
X$
X$       say ""
X$       say "    The help for ''p$name will not be added to the system help"
X$       say "    library. The file ''k$file is being placed in the "
X$       say "    directory ''k$final_dir and can be added to"
X$       say "    the system help files at a later time."
X$       say ""
X$
X$       goto move_it
X$
X$
X$  update_help:
X$
X$       vmi$callback PROVIDE_DCL_HELP 'k$file
X$
X$       k$string = -
X        f$fao("    !50AS     [!AS]","SYS$HELP:HELPLIB.HLB","modified")
X$       write k$filelist k$string
X$
X$       goto get_next_file
X$
X$
X$  check_for_startup:
X$
X$       if k$special .nes. "SYSTEM_STARTUP" then goto check_for_login
X$
X$       say ""
V$       say "    This product requires that the file ''k$file be included in th
Xe"
V$       say "    system startup file SYSTARTUP.COM so that it can be executed a
Xt"
X$       say "    system boot time."
X$       say ""
X$
X$       goto move_it
X$
X$
X$  check_for_login:
X$
X$       if k$special .nes. "SYSTEM_LOGIN" then goto bad_special
X$
X$       say ""
V$       say "    This product requires that the file ''k$file be included in th
Xe"
X$       say "    system login file SYLOGIN.COM so that it can be executed when"
X$       say "    users login to the system."
X$       say ""
X$
X$       goto move_it
X$
X$
X$  bad_special:
X$
X$       vmi$callback MESSAGE s BADSPECIAL -
X        "Unknown special file qualifier in KITDATA.DAT line ''k$line "
X$       say "    'k$rec "
X$
X$       goto failed
X$
X$
X$  move_it:
X$
X$       if f$locate("SYS$SYSROOT",k$final_dir) .nes. f$length(k$final_dir) -
X                then k$final_dir = "VMI$ROOT" + k$final_dir -"SYS$SYSROOT"
X$
X$
X$       if f$parse("''k$file'",,,"TYPE","SYNTAX_ONLY") .eqs. ".EXE" then -
X                goto move_image
X$
X$       vmi$callback PROVIDE_FILE k$ 'k$file 'k$final_dir
X$       goto update_list
X$
X$
X$  move_image:
X$
X$       vmi$callback PROVIDE_IMAGE k$ 'k$file 'k$final_dir
X$
X$
X$ update_list:
X$
X$       k$full = k$nice_dir + k$file
X$
X$       k$string = -
X        f$fao("    !50AS     [!AS]",k$full,"new")
X$       write k$filelist k$string
X$
X$
X$       if k$special .eqs. "SYSTEM_STARTUP" then -
X                vmi$callback SET STARTUP 'k$file
X$
X$       goto get_next_file
X$
X$
X$
X$  kitdata_eof:
X$
X$       vmi$callback MESSAGE s ENDOFFILE -
X                "KITDATA.DAT file missing .END directive"
X$
X$       goto failed
X$       exit vmi$_failure
X$
X$
X$  done_with_files:
X$
X$       exit vmi$_success
X$
X$
X$  failed:
X$       close k$kitdata
X$       close/error=null k$filelist
X$  null:
X$
X$       exit vmi$_failure
X$
X$
X$!------------------------------------------------------------------------------
X$!
X$!  HELP - Entry point for help
X$!
X$!------------------------------------------------------------------------------
X$
X$
X$  HELP_NEW_DIR:
X$       type sys$input:
X    You must choose a directory in which CKSVER will be installed. The 
X    directory can reside on the system disk or any other disk which is 
X    permanently mounted.  By default, the product is installed in the
X    directory SYS$SYSROOT:[CHECKSUM].
X
X$       exit
X$
X$
X$
X$!------------------------------------------------------------------------------
X$!
X$!  IVP - If there is one
X$!
X$!------------------------------------------------------------------------------
X$
X$IVP:
X$       vmi$callbask MESSAGE i noivp
X           "CHECKSUM/VERIFY does not have an Installation Verification Program."
X$       exit vmi$_success
X$  exit
$ GoSub Convert_File
$ Goto Part4
