/* Copyright (c) Oracle Corporation 1992.  All Rights Reserved */
/*****************************************************************************
  NAME
    creq72.ins - V3.1.2 installation script for
                   Oracle Designer/2000 Required Files 6.0.10.0.0

  DESCRIPTION
    This script installs Oracle Designer/2000 Required Files 6.0.10.0.0

  OWNER
    Jeremy Williams

  MODIFIED    DD-MMM-YY  Reason
    jewillia  07-NOV-94  Created

*****************************************************************************/
{
  {
  start_ins_list = list(current_script, 'DEBUG_CREQ72, "creq72.bmp");
  EXECUTE_SCRIPT = "START.INS";
  execute("%product_home%\des2k_72.ins");

  if (doit)
    {
      ui_product(product_label);
      ui_action(instantiate(installing_product));

      ins_ratchet = "7.2.96.5.6";

      /* for creq72.ins only show the graphic before installing the dependencies */
      /* this will display the creq72 graphic whilst Developer/2000
         is installing (providing the DEVELOPER_RELEASE and DISCOVERER_RELEASE
         variables are set to false so that they do not display their graphics)
      */

      case_graphics_file = "creq72.bmp";
      EXECUTE_SCRIPT = "DES2_BB.DIS";
      execute("%product_home%\des2k_72.ins");

      EXECUTE_SCRIPT = "INSTALL_DEPENDENCIES.INS";
      execute("%product_home%\des2k_72.ins");

      EXECUTE_SCRIPT = "DES2_START_COPY.INS";
      execute("%product_home%\des2k_72.ins");

      ui_action(instantiate(removing_old));
      EXECUTE_SCRIPT = "DES2_OLD.INS";
      execute("%product_home%\des2k_72.ins");

      if (case_install_files)
        {
          ui_action(instantiate(installing_deinstl));
          copy(deinstl,nls_abbreviation);
          copy(product);

          ui_action(instantiate(installing_registry));
          copy(regfile);

          if (patch_installation)
            {
              ui_action(instantiate(installing_patchset));
              copy(patchset);
              copy(bin);
            }
          else if (not(case_registry_only_install))
            {
              ui_action(instantiate(installing_bin));
              copy(bin);

              ui_action(instantiate(installing_main));
              copy(main);

              ui_action(instantiate(installing_jdk));
              copy(jdk);

              /************************************************
              Add path ORACLE_HOME/REPADM61/jre_home/bin[client] to the path variable
              *************************************************/
              reg_name = "SYSTEM\CurrentControlSet\Control\Session Manager\Environment";
              if(OPERATING_SYSTEM == "nt")
              {
                  PathVal = win32_get_value("HKEY_LOCAL_MACHINE", reg_name, "Path");
                  jdk_path = "%JRE_HOME%\bin";
                  val_in_path = list();
                  val_in_path = explode(PathVal, implode_explode_delimiter);
                  tem_val_in_path = val_in_path;
                  path_modification_not_required = FALSE;
                  while(not(empty(tem_val_in_path)))
                  {
                     path_present = first(tem_val_in_path);
                     tem_val_in_path = rest(tem_val_in_path);
                     if(path_present == jdk_path)
                     {
                         path_modification_not_required = TRUE;
                     }

                  }

                  if(not(path_modification_not_required))
                  {
                     add(val_in_path, jdk_path);
                     path_val = implode(val_in_path, implode_explode_delimiter);
                     win32_set_value("HKEY_LOCAL_MACHINE", reg_name, "Path", path_val);
                  }
              }
              else
              {
                 copy_file("%PRODUCT_HOME%\path.vrf", "%INSTALLER_HOME%\path.vrf");
                 path_to_add = "%JRE_HOME%\bin";
                 pathify(path_to_add);
                 path_changed = execute("%INSTALLER_HOME%\path.vrf");
              }

              reg_name = "SYSTEM\CurrentControlSet\Control\Session Manager\Environment";
              if(OPERATING_SYSTEM == "nt")
              {
                  PathVal = win32_get_value("HKEY_LOCAL_MACHINE", reg_name, "Path");
                  jdk_path = "%JRE_HOME%\bin\client";
                  val_in_path = list();
                  val_in_path = explode(PathVal, implode_explode_delimiter);
                  tem_val_in_path = val_in_path;
                  path_modification_not_required = FALSE;
                  while(not(empty(tem_val_in_path)))
                  {
                     path_present = first(tem_val_in_path);
                     tem_val_in_path = rest(tem_val_in_path);
                     if(path_present == jdk_path)
                     {
                         path_modification_not_required = TRUE;
                     }

                  }

                  if(not(path_modification_not_required))
                  {
                     add(val_in_path, jdk_path);
                     path_val = implode(val_in_path, implode_explode_delimiter);
                     win32_set_value("HKEY_LOCAL_MACHINE", reg_name, "Path", path_val);
                  }
              }
              else
              {
                 copy_file("%PRODUCT_HOME%\path.vrf", "%INSTALLER_HOME%\path.vrf");
                 path_to_add = "%JRE_HOME%\bin\client";
                 pathify(path_to_add);
                 path_changed = execute("%INSTALLER_HOME%\path.vrf");
              }


              /* [jewillia] - add comctl self installing exe */
              /********************************
              Install commctl - overwrite
              any existing version
              ********************************/
              ui_action(instantiate(install_comctl));
              copy(comctl);
              /* if the global variable is already set then leave it else set it to true*/
              {
                if (evaluate("install_common_control",'GLOBAL))
                  {
                    /* leave existing value */
                  }
              }
              ['UNBOUND_VARIABLE: set("install_common_control", TRUE, 'GLOBAL);]

            }
        }

      if (case_install_patch_files)
        {
          EXECUTE_SCRIPT = "INSPATCH.INS";
          execute("%product_home%\des2k_72.ins");
        }

      EXECUTE_SCRIPT = "DES2_END_COPY.INS";
      execute("%product_home%\des2k_72.ins");

      {
        /* register msflxgrd.ocx */
        /* MSFLXGRD_OCX_FILE = "MSFLXGRD.OCX"; */ /* defined with full path in .vrf */
        case_regedit_list = list(MSFLXGRD_OCX_FILE);
        EXECUTE_SCRIPT = "DES2_OCXEDIT.INS";
        execute("%product_home%\des2k_72.ins");
      }

      EXECUTE_SCRIPT = "INSTALL_CHILDREN.INS";
      execute("%product_home%\des2k_72.ins");

      ui_action(instantiate(modify_environment));
      ini_section = product_filename(current_product);

      {
        /* simple variable modification */
        case_modify_list = list();

        /* remove old variables */
        add(case_modify_list,list("JVM_HOME",                 "",                               ora_config, ini_section, 'INI_SECTION, 'REPADM61_SECTION /*, 'REPIDE10_SECTION */ ));

        /* new variables */

        add(case_modify_list,list("CREQ72",                    "%CREQ72%",                      ora_config, ini_section, 'INI_SECTION, 'TOP_LEVEL));

        /* These are set in the user.avf */
        add(case_modify_list,list("REPOS_R10_BULLETINS",       "%REPOS_R10_BULLETINS%",         ora_config, ini_section, 'INI_SECTION, 'TOP_LEVEL));

        add(case_modify_list,list("JVM_TYPE",                  "client"                      ora_config, ini_section, 'INI_SECTION, 'REPADM61_SECTION));
        add(case_modify_list,list("JVM_MIN_HEAP_SIZE",         "-Xms33554432"                ora_config, ini_section, 'INI_SECTION, 'REPADM61_DEFAULT_JVM_THIN_JDBC_SECTION));
        add(case_modify_list,list("JVM_MAX_HEAP_SIZE",         "-Xmx50331648"                ora_config, ini_section, 'INI_SECTION, 'REPADM61_DEFAULT_JVM_THIN_JDBC_SECTION));

        EXECUTE_SCRIPT = "MODIFY_VARIABLES.CMN";
        execute("%product_home%\des2k_72.ins");
      }

      {
        /* execute_variables */
        case_execute_list = list();

        add(case_execute_list,list("JRE_HOME",                 "jre_home",          jdk,     ora_config, ini_section, 'INI_SECTION, 'REPADM61_SECTION));
        add(case_execute_list,list("EXECUTE_JAVA",             "javaexe",           jdk,     ora_config, ini_section, 'INI_SECTION, 'REPADM61_SECTION));
        add(case_execute_list,list("EXECUTE_JAVAW",            "javawexe",          jdk,     ora_config, ini_section, 'INI_SECTION, 'REPADM61_SECTION));

        EXECUTE_SCRIPT = "MODIFY_EXECUTE.INS";
        execute("%product_home%\des2k_72.ins");
      }

      if (not(MMTX_OCX_FILE == ""))
      {
        case_regedit_list = list(MMTX_OCX_FILE);
        EXECUTE_SCRIPT = "DES2_OCXEDIT.INS";
        execute("%product_home%\des2k_72.ins");
      }

      case_dependency_msg_list = list(evaluate("case_install_net_dependencies",'GLOBAL), creq_net_dependency_list, case_dependency_msg_message);
      EXECUTE_SCRIPT = "DEPENDENCY_MSG.INS";
      /* execute("%product_home%\des2k_72.ins"); */ /* this message no longer required */

      case_dependency_msg_list = list(evaluate("case_install_dbtool_dependencies",'GLOBAL), creq_dbtool_dependency_list, case_dependency_msg_message);
      EXECUTE_SCRIPT = "DEPENDENCY_MSG.INS";
      /* execute("%product_home%\des2k_72.ins"); */ /* this message no longer required */

      case_dependency_msg_list = list(evaluate("case_install_dev2000_runtime_dependencies",'GLOBAL), creq_dev2000_dependency_list, case_dependency_msg_message);
      EXECUTE_SCRIPT = "DEPENDENCY_MSG.INS";
      /* execute("%product_home%\des2k_72.ins"); */ /* this message no longer required */

      ui_action(instantiate(registering_product));
      EXECUTE_SCRIPT = "DES2_REF.INS";
      execute("%product_home%\des2k_72.ins");

      case_graphics_file = "creq72.bmp";
      EXECUTE_SCRIPT = "DES2_BB.REM";
      execute("%product_home%\des2k_72.ins");

    }

  }
  [
    'UNREGISTERED_PRODUCT: continue();
    'CANCEL: signal('FAILURE, instantiate(halt_installation));
  ]

  EXECUTE_SCRIPT = "END.INS";
  execute("%product_home%\des2k_72.ins");

}
