PROC delete_critical_files (
  status : var of status = $optional
  )


*IF $variable(rav$proc_doc,declared)<>'UNKNOWN'

" This is one of several procedures created to simplify the installation process.
" These procedures are kept in the OSF$SITE_COMMAND_LIBRARY and therefore will
" receive minimal support.
"
" The purpose of this procedure is to submit a batch job to delete files critical
" to a proper upgrade.  This procedure is called out in the upgrade chapter of the
" SRB.
*IFEND


  create_variable delete_job k=string v=$unique
  create_variable ignore_status k=status
  create_variable local_status k=status


COLLECT_TEXT $fname(delete_job) until='END_COLLECT'
  JOB jc=system
    WHEN any_fault DO
      put_line $strrep(osv$status) o=$response
    WHENEND

    create_variable local_status k=status

    TASK r=3
      delete_file f=$system.osf$operator_library
      delete_file f=$system.$account_log
      delete_file f=$system.$engineering_log
      delete_file f=$system.$history_log
      delete_file f=$system.$statistic_log
      delete_file f=$system.$system_log
    TASKEND
    display_log o=$user.delete_critical_files_log status=local_status
    change_catalog_entry f=$user.delete_critical_files_log nr=3
    IF local_status.normal THEN
      terminate_output n=output
    ELSE
      put_line $strrep(local_status) o=$response
    IFEND
  JOBEND
END_COLLECT

  include_file $fname(delete_job) status=local_status
  delete_file $fname(delete_job) status=ignore_status

  EXIT_PROC WITH local_status WHEN NOT local_status.normal

PROCEND delete_critical_files
