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

/*****************************************************************************
  NAME
    rrun60.ins - V3 installation script for Oracle Report 6.0 Runtime

  DESCRIPTION
    This script installs Oracle Report 6.5 Runtime.

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

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

        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_13.bmp"))
        {
            if(DEVELOPER2000_RELEASE)
            {
                if(not(DEV2K_BB13))
                {
                    DEV2K_BB13 = TRUE;
                    ui_graphics("%installer_home%%dir_separator%d2bb_13.bmp");
                }
            }
        }
        /****************************************************************/

        /******************
        Install the product
        *******************/
        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("%ORACLE_HOME%/bin/rwrun60.exe"))
        {
          D2KOR60_GROUP = D2K60_GROUP_OLD;
          windows_delete_icons(exe);
          D2KOR60_GROUP = D2KOR60_GROUP_NEW;
        }
        /************************************************************/

        ui_action(instantiate(install_exe));
        copy(exe);

        ui_action(instantiate(install_files));
        copy(demo);
        copy(oci);
        copy(prtdefs);

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

        ui_action(instantiate(install_files));
        copy(msg);
        copy(res);
        copy(jar);

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

        /***********************************
        Install Reports Language Supplement
        ************************************/
        if(child_in_control)
        {
            install_rrun=TRUE;
            install(w32repl60);
        }
        /*********************************
        Register and Reference the product
        and remove delold
        **********************************/
        EXECUTE_SCRIPT = "REGISTER_REFERENCE_PRODUCT";
        execute("%installer_home%%dir_separator%d2kr2ins.usr");
        /**********************************/

        permit_retry_operations = FALSE;

        /*************
        Install Parent
        **************/
        if(install_parent)           
            install(product_parent(current_product));
        /*************/

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

        /*****************************************
         Modify environment variables in registry
        ******************************************/
        EXECUTE_SCRIPT = "MODIFY_ENVIRONMENT";
        if (nls_abbreviation == "us")
        {
           ini_path_list = ini_path_list1;
           modify_reports60_path = execute("%product_home%%dir_separator%d2kr2ins.usr");
           {
             /* put variable REPORTS60_PATH in the Registry */
             if(modify_reports60_path) 
             {
                reports60_path_var = translate("REPORTS60_PATH", "%installer_home%%dir_separator%varfile.tmp");
                modify("REPORTS60_PATH", reports60_path_var, ora_config, product_filename(product_parent(current_product)));
                win32_register_key("$ORACLE","","REPORTS60_PATH",'REPLICATE);
             }
           }
           [ 'UNBOUND_ENVIRONMENT_VARIABLE, 'FILE_NOT_FOUND: continue(); ]
        }
        else
        {

           ini_path_list = ini_path_list1;
           modify_reports60_path = execute("%product_home%%dir_separator%d2kr2ins.usr");
           {
             if(modify_reports60_path) 
             {
                reports60_path_var = translate("REPORTS60_PATH", "%installer_home%%dir_separator%varfile.tmp");
                modify("REPORTS60_PATH", reports60_path_var, ora_config, product_filename(product_parent(current_product)));
                win32_register_key("$ORACLE","","REPORTS60_PATH",'REPLICATE);
             }
           }
           [ 'UNBOUND_ENVIRONMENT_VARIABLE, 'FILE_NOT_FOUND: continue(); ]

           ini_path_list = ini_path_list2;
           modify_reports60_path = execute("%product_home%%dir_separator%d2kr2ins.usr");
           {
             if(modify_reports60_path) 
             {
                reports60_path_var = translate("REPORTS60_PATH", "%installer_home%%dir_separator%varfile.tmp");
                modify("REPORTS60_PATH", reports60_path_var, ora_config, product_filename(product_parent(current_product)));
                win32_register_key("$ORACLE","","REPORTS60_PATH",'REPLICATE);
             }
           }
           [ 'UNBOUND_ENVIRONMENT_VARIABLE, 'FILE_NOT_FOUND: continue(); ]
        }


           ini_path_list = ini_path_list3;
           modify_reports60_path = execute("%product_home%%dir_separator%d2kr2ins.usr");

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


        {
            if(modify_reports60_jni_lib)
            {
                modify("REPORTS60_JNI_LIB", reports60_jni_lib_var, ora_config, product_filename(product_parent(current_product)));
                win32_register_key("$ORACLE","","REPORTS60_JNI_LIB",'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(); ]


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

        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");

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

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

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

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

         /* Register Reports in the registry database */
        {win32_asynchronous_spawn("%REGEXE% /s %RW60%\rwsxs60.REG");}  
        ['NO_RESPONSE, 'INVALID_FILE_NAME, 'FILE_NOT_FOUND, 'MEMORY_ERROR: continue();]

        {win32_asynchronous_spawn("%ORACLE_HOME%%dir_separator%BIN%dir_separator%REGSVR32.EXE /s rwsxa60.ocx");}
        ['NO_RESPONSE, 'INVALID_FILE_NAME, 'FILE_NOT_FOUND, 'MEMORY_ERROR: continue();]
    }
    [
         'UNREGISTERED_PRODUCT: continue();
         'CANCEL: signal('FAILURE, instantiate(halt_installation));
    ]
}
