/* Copyright (c) Oracle Corporation 1996.  All Rights Reserved */
/*****************************************************************************
  NAME
    tutil60.ins - V3 installation script for the Tools Utilities 6.0

  DESCRIPTION
    This script installs the Tools Utilities 6.0

  MODIFIED    MM/DD/YY   Reason
*****************************************************************************/
{
    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;


         win32_register_OCSM_product();
        /********************************************
        Rename preferences files if already installed
        *********************************************/
        if (rename_prefs)
        {
             
                copy_file("%ORACLE_HOME%%dir_separator%CAUPREFS.ORA", "%ORACLE_HOME%%dir_separator%CAUPREFS.OLD");
		if(exists("%ORACLE_HOME%%dir_separator%CAGPREFS.ORA"))
		   copy_file("%ORACLE_HOME%%dir_separator%CAGPREFS.ORA", "%ORACLE_HOME%%dir_separator%CAGPREFS.OLD");
	}
        /********************************************/

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

        ui_action(instantiate(install_dei));
        copy(deinst);

        /******************/

        permit_retry_operations = FALSE;

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

        if (set_vgs60)
        {
            modify("VGS60", VGS60, ora_config, product_filename(current_product));     /* add vgs60 in Registry */
            win32_register_key("$ORACLE","","VGS60",'REPLICATE);
        }

        if (set_de60)
        {
            modify("DE60", DE60, ora_config, product_filename(current_product));     /* add de60 in Registry */
            win32_register_key("$ORACLE","","DE60",'REPLICATE);
        }

        if (set_ca_gprefs)
        {
            modify("CA_GPREFS", CA_GPREFS, ora_config, product_filename(current_product));     /* add CA_GPREFS in Registry */
            win32_register_key("$ORACLE","","CA_GPREFS",'REPLICATE);
        }

        if (set_ca_uprefs)
        {
            modify("CA_UPREFS", CA_UPREFS, ora_config, product_filename(current_product));     /* add CA_UPREFS in Registry */
            win32_register_key("$ORACLE","","CA_UPREFS",'REPLICATE);
        }

        if (set_qt_player)
        {
            modify("QT_PLAYER", QT_PLAYER, ora_config, product_filename(current_product));     /* add QT_PLAYER in Registry */
            win32_register_key("$ORACLE","","QT_PLAYER",'REPLICATE);
        }
        /**************************/

        /****************************************
        Initialize Open Interfaces Variables....
        *****************************************/
        if (set_dev2000_sourcecontrol)
        {
            modify("DEV2000_SOURCECONTROL", DEV2000_SOURCECONTROL, ora_config);     /* add DEV2000_SOURCECONTROL in Registry */
            win32_register_key("$ORACLE","","DEV2000_SOURCECONTROL",'REPLICATE);
        }

        if (set_dev2000_project)
        {
            modify("DEV2000_PROJECT", DEV2000_PROJECT, ora_config);                 /* add DEV2000_PROJECT in Registry */
            win32_register_key("$ORACLE","","DEV2000_PROJECT",'REPLICATE);
        }

        if (set_dev2000_scviewer)
        {
            modify("DEV2000_SCVIEWER", DEV2000_SCVIEWER, ora_config);                 /* add DEV2000_SCVIEWER in Registry */
            win32_register_key("$ORACLE","","DEV2000_SCVIEWER",'REPLICATE);
        }

        if (set_dev2000_scconvert)
        {
            modify("DEV2000_SCCONVERT", DEV2000_SCCONVERT, ora_config);                 /* add DEV2000_SCCONVERT in Registry */
            win32_register_key("$ORACLE","","DEV2000_SCCONVERT",'REPLICATE);
        }
        /****************************************/

        /**********************************
         Add DOC20 to Registry here because
         all products will use it
        **********************************/
        modify("DOC60", DOC60, ora_config);       /* add DOC60 in Registry */
        win32_register_key("$ORACLE","","DOC60",'REPLICATE);

        /*******************
        Install dependencies
        ********************/
        ui_product(instantiate(display_product_label));
        ui_action(instantiate(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("VGS60");
        win32_register_map_variable("DE60");
        win32_register_map_variable("CA_UPREFS");
        win32_register_map_variable("CA_GPREFS");

        /****************************
         Registering map file groups
        *****************************/
        win32_register_OCSM_group(deinst,'MINMODE);

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

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

        remove(delold);                                                    /* remove any outdated files if install was successful */

        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));
    ]
}
