/* Copyright (c) Oracle Corporation 1996.  All Rights Reserved */
/*****************************************************************************
  NAME
    xc60.ins - V3 installation script for the Oracle Express Connection editor

  DESCRIPTION
    This script installs the Oracle Express Connection editor

  MODIFIED    MM/DD/YY   Reason
  pgupta      06/12/98   Created
*****************************************************************************/
{
    if (doit)
    {
        /*****************************
        Set the VRF-INS script ratchet
        ******************************/
        ins_ratchet = "6.0.0.0.0";

        execute("%installer_home%%dir_separator%%operating_system%.ins");

        permit_retry_operations  = TRUE;
        permit_ignore_operations = TRUE;
        permit_process_operations= TRUE;



        /******************
        Install the product
        *******************/
        ui_product(instantiate(display_product_label));

        ui_action(instantiate(install_files));
        copy(deinst);
        copy(Base);
        copy(BaseIcon);
        copy(Help);
/*        copy(XConnect); I am moving this line to down to preserve the old Xconnect.ini file*/
        copy(gCopyFile);
        copy(gInstUtil);
        copy(gLogFile);
        /******************/

        permit_retry_operations = FALSE;

        /**************************
        Modify Config Variables....
        ***************************/
        ui_action(instantiate(modify_variables));

        modify("GSINSTALLDIR", GSINSTALLDIR, ora_config, product_filename(current_product));     /* add GSINSTALLDIR in Registry */
        win32_register_key("$ORACLE","","GSINSTALLDIR",'REPLICATE);

        modify("GSCONNECTDIR", GSCONNECTDIR, ora_config, product_filename(current_product));     /* add GSCONNECTDIR in Registry */
        win32_register_key("$ORACLE","","GSCONNECTDIR",'REPLICATE);
        /**************************/
        if(exists("%GSCONNECTDIR%\xconnect.ini.bak"))
	  {
	     remove_file("%GSCONNECTDIR%\Xconnect.ini.bak");
    	  }
	  if(exists("%GSCONNECTDIR%\xconnect.ini"))
	  {
	     move_file("%GSCONNECTDIR%\Xconnect.ini","%GSCONNECTDIR%\Xconnect.ini.bak");
	  }
        copy(XConnect); /* I have moved this section from up to preserve old Xconnect.ini file.*/
        if(exists("%GSCONNECTDIR%\MAKEINI.BAT"))
        {
	    remove_file("%GSCONNECTDIR%\MAKEINI.BAT");
        }
        xconnect_file = "%GSCONNECTDIR%\Xconnect.ini";
	  {modify("ConnectionPath","%GSCONNECTDIR%",xconnect_file,"General");}
	  ['INVALID_FILE_NAME, 'PERMISSION_DENIED, 'WRITE_ERROR, 'OS_ERROR: continue();] 
	 
/*  Following scripts are commended out because the function of MAKEINI.BAT is done using install scripts now for the win95/98 issue noticed in iDS. 
        {win32_asynchronous_spawn("MAKEINI.BAT %GSCONNECTDIR%");}
        ['NO_RESPONSE, 'INVALID_FILE_NAME, 'FILE_NOT_FOUND, 'MEMORY_ERROR: continue();]*/

 
        /*******************
        Install dependencies
        ********************/
        while(not(empty(install_dependency_list)))
        {
            next_dependency = first(install_dependency_list);
            install_dependency_list = rest(install_dependency_list);

            install(next_dependency);
        }
        /*******************/

        /***************************************************************
         Registering map variables except Installer_home and oracle_home
        ****************************************************************/
        win32_register_map_variable("GSINSTALLDIR");
        win32_register_map_variable("GSCONNECTDIR");

         /*********************************
          Register and Reference the product
         **********************************/
         ui_product(instantiate(display_product_label));
         ui_action( instantiate(install_register) );

         register(current_product);
         reference(current_product);
         /*********************************/

        remove(delold);    

        permit_retry_operations = TRUE;


        /*********************
        Reference dependencies
        **********************/
        ui_product(instantiate(display_product_label));
        ui_action(instantiate(reference_dependencies));
        reference(GUI_PRODUCT, current_product);
        /*********************/

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