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

/*****************************************************************************
  NAME
    rmts60.ins - V3 installation script for Oracle Reports Server.

  DESCRIPTION
    This script installs Windows Oracle Reports Server

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

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

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

        permit_retry_operations  = TRUE;
        permit_ignore_operations = TRUE;
        permit_process_operations= TRUE;
        /****************************************************************
        Display the "SCALABLE SERVER-BASED REPORTING"
        billboard if not already displayed, and if Developer release
        *****************************************************************/
        if(exists("%installer_home%%dir_separator%d2bb_12.bmp"))
        {
            if(DEVELOPER2000_RELEASE)
            {
                if(not(DEV2K_BB12))
                {
                    DEV2K_BB12 = TRUE;
                    ui_graphics("%installer_home%%dir_separator%d2bb_12.bmp");
                }
            }
        }
        /****************************************************************/

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

        ui_action(instantiate(install_files));
        copy(user);
	
        ui_action(instantiate(install_files));
        copy(java);

        ui_action(instantiate(install_dll));
        copy(dll);

        ui_action(instantiate(install_exe));
        copy(exe);
        copy(deinst);
        /******************/

        permit_retry_operations = FALSE;

        /***********************************
        Install Reports Runtime, if required
        ************************************/
        if(child_in_control)
            if(install_component)
                install(COMPONENT_PRODUCT);
        /***********************************/

        {
            if(modify_reports60_jni_dll)
            {
                modify("REPORTS60_JNI_DLL", reports60_jni_dll_var, ora_config, product_filename(product_parent(current_product)));
                win32_register_key("$ORACLE","","REPORTS60_JNI_DLL",'REPLICATE);
            }
        }
        [ 'UNBOUND_ENVIRONMENT_VARIABLE, 'FILE_NOT_FOUND: continue(); ]

        {
            if(modify_reports60_classpath)
            {
                modify("REPORTS60_CLASSPATH", reports60_classpath_var, ora_config, product_filename(product_parent(current_product)));
                win32_register_key("$ORACLE","","REPORTS60_CLASSPATH",'REPLICATE);
            }
        }

        [ 'UNBOUND_ENVIRONMENT_VARIABLE, 'FILE_NOT_FOUND: continue(); ]

        {
            if(modify_reports60_db_auth)
            {
                modify("REPORTS60_DB_AUTH", reports60_db_auth_var, ora_config, product_filename(product_parent(current_product)));
                win32_register_key("$ORACLE", "", "REPORTS60_DB_AUTH", 'REPLICATE);
            }
        }
        [ 'UNBOUND_ENVIRONMENT_VARIABLE, 'FILE_NOT_FOUND: continue(); ]

        {
            if(modify_reports60_sys_auth)
            {
                modify("REPORTS60_SYS_AUTH", reports60_sys_auth_var, ora_config, product_filename(product_parent(current_product)));
                win32_register_key("$ORACLE", "", "REPORTS60_SYS_AUTH", 'REPLICATE);
            }
        }
        [ 'UNBOUND_ENVIRONMENT_VARIABLE, 'FILE_NOT_FOUND: continue(); ]


        permit_retry_operations = TRUE;
        /***************************************************************
         Registering map variables except Installer_home and oracle_home
        ****************************************************************/
         win32_register_map_variable("RW60");
         win32_register_map_variable("DOC60");
         win32_register_map_variable("D2KOR60_GROUP");

        /*********************************
        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));

        {reference(COMPONENT_PRODUCT, current_product);}                   /* reference runtime */
        ['UNREGISTERED_PRODUCT: continue();]

        {reference(current_product,product_parent(current_product));}  /* reference parent */
        ['UNREGISTERED_PRODUCT: continue();]
        /*********************/

        permit_retry_operations = FALSE;
     TNS_file_location = "%oracle_home%\NET80\admin\tnsnames.ora";
     make_directory("%oracle_home%\NET80");
     make_directory("%oracle_home%\NET80\admin");
     create_file(TNS_file_location);
     modify("%reports__server_name%,%reports__server_name%.world","(ADDRESS=(PROTOCOL=tcp)(HOST=%hostname%)(PORT=%port_number%))",TNS_file_location, "=");
/*   temp_var=current_directory();
     change_directory("%ORACLE_HOME%\bin");
     spawnerror = spawn("rwmts60 -install %reports__server_name% autostart=yes batch=yes ");
     change_directory("%temp_var%"); */


     if(configureProcesses)
     {
      TNS_message = nls("TNS_message",
"[INFO]The following TNS name for the Reports Server has been defined in the
%TNS_file_location% file : %reports__server_name%.world.
");
      modify("",TNS_message, reports_config_instruction_file);
      reports_service_message = nls("reports_service_message",
"[ACTION] NT service Oracle Reports Server [%reports__server_name%] has been created and
started for the Reports Multitier Server.If you need to run Reports directly to printers in the
environment (i.e. with DESTYPE=PRINTER),you will need to stop the Reports Server Service,
then re-start it under an NT user with access to the required printers. This can be done using
the Services tool on the Windows Control Panel.
");
      modify("",reports_service_message, reports_config_instruction_file);
     }
    }
    [
         'UNREGISTERED_PRODUCT: continue();
         'CANCEL: signal('FAILURE, instantiate(halt_installation));
    ]
}
