/* Copyright (c) Oracle Corporation 1996.  All Rights Reserved */

/****************************************************************************
  NAME
    forms60.ins - V3 installation script for Forms 6.0 package

  DESCRIPTION
    This script installs Forms 6.0 package.

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

{
    if (doit)
    {
        /*****************************
        Set the VRF-INS script ratchet
        ******************************/
        ins_ratchet = "6.0.8.13.0";

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

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


        /************************************************
        Add path ORACLE_HOME/JDK/bin to the path variable
        *************************************************/

        if(not(OPERATING_SYSTEM == "nt"))
        {
           
           add(reboot, 'AUTOEXEC);
        }

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

        ui_action(instantiate(install_files));
        copy(deinst);
        copy(msg);
        copy(reg);
        /******************/


        /******************************************
        Install all the components of the PARENT
        *******************************************/
        EXECUTE_SCRIPT = "INSTALL_COMPONENTS";
        execute("%installer_home%%dir_separator%d2kr2ins.usr");
        /******************************************/

        /*************************************
        Set the install_variable in Registry
        **************************************/

        modify("FORMS60", FORMS60, ora_config, product_filename(current_product));
        win32_register_key("$ORACLE","","FORMS60",'REPLICATE);


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

        copy_file("%FORMS60%\forms.reg", "%INSTALLER_HOME%\forms.reg");
	if (exists("%INSTALLER_HOME%\forms.reg"))
	{
           FORMS_REG_VAR = implode(explode("%ORACLE_HOME%", "\", 'STRINGSONLY), "\\");
           
           instantiate_file("%INSTALLER_HOME%\forms.reg", "%INSTALLER_HOME%\forms_tem.reg");
           move_file("%INSTALLER_HOME%\forms_tem.reg", "%INSTALLER_HOME%\forms.reg");

           /* Register forms in the registry by executing forms.reg */
           {spawn("REGEDIT.EXE /s %INSTALLER_HOME%\forms.reg");} 
           ['NO_RESPONSE, 'INVALID_FILE_NAME, 'FILE_NOT_FOUND, 'MEMORY_ERROR: continue();]
           remove_file("%INSTALLER_HOME%\forms.reg");
	}
        permit_retry_operations = FALSE;

        /*******************
         Install dependencies
        ********************/
        EXECUTE_SCRIPT = "INSTALL_DEPENDENCIES";
        execute("%installer_home%%dir_separator%d2kr2ins.usr");
        /*******************/

        /*********************************
        Register and Reference the product
        and remove delold
        **********************************/
        EXECUTE_SCRIPT = "REGISTER_REFERENCE_PRODUCT";
        execute("%installer_home%%dir_separator%d2kr2ins.usr");


        /********************************************************************
        Reference all the components of the PARENT
        *********************************************************************/
        child_products_to_reference = all_child_products(current_product);
        EXECUTE_SCRIPT = "REFERENCE_COMPONENTS";
        execute("%installer_home%%dir_separator%d2kr2ins.usr");
        /********************************************************************/


        /*********************
        Reference dependencies
        **********************/
        ui_action(instantiate(reference_dependencies));

        while(not(empty(dependency_list)))
        {
            {reference(first(dependency_list), current_product);}
            ['UNREGISTERED_PRODUCT: continue();]

            dependency_list = rest(dependency_list);
        }
        /*********************/

        permit_retry_operations = FALSE;

    } /*END if doit*/
    [
        'UNREGISTERED_PRODUCT: continue();
        'CANCEL: signal('FAILURE, instantiate(halt_installation));
    ]
}
