/* Copyright (c) Oracle Corporation 1996.  All Rights Reserved */

/*****************************************************************************
  NAME
    orainst.vrf - Windows 32-bit V3 Installation Verify Script

  DESCRIPTION
    This script verifies the Windows 32-bit installer.

  CREATED
    Siddhartha Agarwal, July 11, 1996

  MODIFIED   MM/DD/YY REASON
  vrajkuma   12/27/96 Made OCSM compliant.
*****************************************************************************/
{ 
  product_label = product_interface_label(current_product);

  ui_product(product_label);

  analyzing_dependencies = instantiate(nls("analyzing_dependencies",
					   "Analyzing %%product_label%% Dependencies..."));

  ui_action(analyzing_dependencies);

   cancelling_install = nls("cancelling_install","Cancelling Installation of %%product_label%%...");



  {
    if (not(distribution))
      signal('UNBOUND_VARIABLE);
  }
    [ 'UNBOUND_VARIABLE:
	{
	  install_from_distribution = nls("install_from_distribution","In order to install the Installer, please run it from distribution media.");
	  signal('FAILURE,install_from_distribution);
	}
    ]


  doit = TRUE;

  if (registered(product_name(current_product)))
    {
      registry = registration(product_name(current_product));
      current_version = product_version(current_product);
      installed_version = registry_version(registry);

      if (earlier_version(registry,current_version))
	{
          version_status = 'upgrade;
	  if (verbose)
	    doit = yesno_dialog(instantiate(reinstall_prompt01),TRUE,
				instantiate(reinstall_content01),
				instantiate(reinstall_help01));
	  else
	    doit = TRUE;

	  if (not(doit))
	    if ((bootstrap) && (product_location(current_product) == ""))
	      information_dialog(instantiate(reinstall_prompt02),
				 instantiate(reinstall_content02),
				 instantiate(reinstall_help02),);
	}
      else if (later_version(registry,current_version))
        {
	  version_status = 'downgrade;	  
	  doit = yesno_dialog(instantiate(reinstall_prompt03),FALSE
			      instantiate(reinstall_content03),
			      instantiate(reinstall_help03));
	  if (not(doit))		      
	    if ((bootstrap) && (product_location(current_product) == ""))
              signal('CANCEL,cancel_prompt01);
        }
      else /* if (not(bootstrap)) */
        {
	  version_status = 'reinstall;
	  if (verbose)
	    doit = yesno_dialog(instantiate(reinstall_prompt04),FALSE,
				instantiate(reinstall_content04),
				instantiate(reinstall_help04));
	  else
	    doit = TRUE;
        }
    }
  else
    version_status = 'new_install;

  installer_ocsa_in_use = nls("installer_ocsa_in_use", "Installing the Installer is not possible while its executables are in use. %carriage_return%Please make sure that the installed Installer and any Oracle Client Software Agents connected to this machine are shut down, and retry this installation.");
  installer_insufficient_space = nls("installer_insufficient_space", "An error occurred during the copying of the Installer binaries due to an unavailability of sufficient space at the destination location : %ORACLE_HOME%\bin. %carriage_return%Please make sure that there is adequate space available at this location, and retry this installation.");
  if (doit)
    {
      installing_executables = nls("installing_executables","Installing %%product_label%% Executables...");
      installing_resources = nls("installing_resources",
				 "Installing %%product_label%% Resources...");
      installing_scripts = nls("installing_scripts",
			       "Installing %%product_label%% Scripts...");
      recording_name = nls("recording_name","Recording Company Name...");

      recording_name_error1 = nls("recording_name_error1","There was a write error recording your name in '%%oracle_home%%\DBS\OI%%nls_abbreviation%%.RES'. Please correct the problem with this file and reinstall the Installer.");

      recording_name_error2 = nls("recording_name_error2","There was a write error recording your name in '%%oracle_home%%\DBS\OIUS.RES'. Please correct the problem with this file and reinstall the Installer.");

      group_sum = sum(exec, nlb,  
                      doc, "moh",
                      res, nls_abbreviation,  
                      dll, nls_abbreviation,
                      script, nls_abbreviation,  
                      deinstl, nls_abbreviation, 
                      prodmsg, nls_abbreviation, 
                      homesel, nls_abbreviation);
      if (platform() == "nt")
        compat_scripts = ntcompat;
      else
        compat_scripts = win95compat;

      group_sum = group_sum + sum(compat_scripts);

      /* MOH and OCSM related specifications */
      moh_icon_groups = list(list(exec)); /* TODO: switch homes icon missing */

      min_ocsm_groups = list(list(res, nls_abbreviation), list(prodmsg, nls_abbreviation), 
                             list(script, nls_abbreviation), list(dll, nls_abbreviation) );
      max_ocsm_groups = list(list(compat_scripts), list(exec), list(deinstl));

      return(group_sum);
    }
  else
    {
      ui_action(instantiate(cancelling_install));
      return(0);
    }
}
