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

/*****************************************************************************
  NAME
    rdb60.ins - Installation script for Oracle ODBC Driver for Rdb

  DESCRIPTION
    This script installs the Oracle ODBC Driver for Rdb.

  MODIFIED    MM/DD/YY    Reason
   pgupta     09/29/97    Created
*****************************************************************************/

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

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

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

        win32_register_map_variable("OCA60");
        win32_register_map_variable("RDB60");

        /******************
        Install the product
        *******************/
        overwrite_mode = 'UPDATE;

        ui_product(instantiate(display_product_label));

        ui_action(instantiate(install_files));
        copy(deinst);


        /************************************************************
        Delete the Old Program Group if present and Install the new
        Program Group
        *************************************************************/

        if(exists("%OCA60%\Drivers\ODBCTST.EXE"))
        {
          D2K60_DRIVERS = D2K60_DRIVERS_OLD;
          windows_delete_icons(exe);
          windows_delete_icons(rdbfiles);
          D2K60_DRIVERS = D2K60_DRIVERS_NEW;
        }
        ui_action(instantiate(install_exe));
        copy(exe);

        ui_action(instantiate(install_dll));
        copy(dll, "%operating_system%");

        ui_action(instantiate(install_files));
        copy(rdbfiles);
        copy(kanji);

        ui_action(instantiate(install_files));
        copy(msodbc);
        /******************/

        overwrite_mode = 'ALWAYS;

        /***************************************
        Install System Support Files if required
        ****************************************/
           if(install_required_product)
               install(REQUIRED_PRODUCT);
        /***************************************/

        /*********************************
        Register and Reference the product
        and remove delold.
        **********************************/
        EXECUTE_SCRIPT = "REGISTER_REFERENCE_PRODUCT";
        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);
        }
        /*********************/

        /*****************************************
        Modify environment variables in ORACLE.INI
        ******************************************/
        if(modify_product_home)
        {
            modify(install_variable, RDB60, ora_config);
            win32_register_key("$ORACLE","",install_variable,'REPLICATE);
        }
        /*****************************************/



        permit_retry_operations = FALSE;

        {win32_asynchronous_spawn("%OCA60%%dir_separator%DRIVERS%dir_separator%rdbcnv32.exe");}                    /* rdbcnv32.exe sets up the environment variables in different files, like SYSTEM.INI */
        ['NO_RESPONSE: continue();]
    }
    [
         'UNREGISTERED_PRODUCT: continue();
         'CANCEL: signal('FAILURE, instantiate(halt_installation));
    ]
}
