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

/****************************************************************************
  NAME
    Frunw60.ins - V3 installation script for Windows NT Forms Server6.0 package

  DESCRIPTION
    This script installs Windows NT Webforms Runtime 6.0 package.

  MODIFIED  MM/DD/YY    Reason
    pgupta  11/11/97    Created
*****************************************************************************/

{
    /**********************************************************************
    Only allow user to install this product if they are running NT 4.0)
    **********************************************************************/
   if (NT_version < "4.0")
     doit = FALSE;

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

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

        permit_ignore_operations = TRUE;
        permit_process_operations= TRUE;



     /****************************************************************
      Set Registry Variables
     ****************************************************************/

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


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


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


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

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

     if((configureProcesses)||member(selected_products,w32rmts60))
     {
	if(exists("%ORACLE_HOME%\bin\ifsrv60.exe")) {
	  temp_var=current_directory();
        change_directory("%ORACLE_HOME%\bin");
	  {spawnerror = spawn("ifsrv60 -uninstall Forms60Server batch=yes");}
	  [ 'INVALID_FILE_NAME, 'OS_ERROR: continue(); ]
	  
        change_directory("%temp_var%");
      }
     } 
        permit_retry_operations  = TRUE;
        /******************
        Install the product
        *******************/
        ui_product(instantiate(display_product_label));

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

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

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

        ui_action(instantiate(install_files));
        copy(script);

	  ui_action(instantiate(install_files));
        copy(res);
	
	  ui_action(instantiate(install_files));
        copy(fdf);




        /*********************************
        Install FORMS  Language Supplement
        **********************************/
        if(child_in_control)
        {
            install_frunw = TRUE;
            install(w32formsl60);
        }
        permit_retry_operations  = FALSE;
        /*******************
         Install dependencies
        ********************/
        EXECUTE_SCRIPT = "INSTALL_DEPENDENCIES";
        execute("%installer_home%%dir_separator%d2kr2ins.usr");
        /******************************************/

        ini_path_list = ini_path_list_d1a;
        ini_var = f_ini_var;
        EXECUTE_SCRIPT = "MODIFY_ENVIRONMENT";
        execute("%installer_home%%dir_separator%d2kr2ins.usr");
        win32_register_key("$ORACLE","",ini_var,'REPLICATE);
        /*****************************************
        Install COMPONENT_PRODUCT -- Applet Viewer
        ******************************************/
        if(install_component)
          install(COMPONENT_PRODUCT);

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

         permit_retry_operations = TRUE;

        /***************************************************************
         Registering map variables except Installer_home and oracle_home
        ****************************************************************/
         win32_register_map_variable("FORMS60");
         win32_register_map_variable("FORMS60_MAPPING");
         win32_register_map_variable("FORMS60_OUTPUT");
         win32_register_map_variable("FORMS60_WALLET");
         win32_register_map_variable("D2KIF60_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(current_product,product_parent(current_product));}  /* reference parent */
        ['UNREGISTERED_PRODUCT: continue();]

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

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

        permit_retry_operations = FALSE;
     if(configureProcesses)
     {
	need_to_start_f_server = TRUE;

      physical_path2_3 = "%oracle_home%\tools\web60";
      physical_path2 = "%oracle_home%\tools\web60\temp";
      virtual_path2 = "/dev60temp";

      make_directory(physical_path2_3);
      make_directory(physical_path2);
      /*if(registered("w32www21")|| member(selected_products,w32www21))
         install_webdb_listner = TRUE;*/
      if(install_webdb_listner)
      {
        cfg_ori_name = "%oracle_home%\listener\cfg\wdbsvr.cfg";
	cfg_file_location = "%oracle_home%\listener\cfg\wdbsvr.ini";
	if(exists(cfg_ori_name))
        {
            move_file(cfg_ori_name,cfg_file_location);
	    modify("%physical_path2%\ =","%virtual_path2%/",cfg_file_location,"DirMaps");

            move_file(cfg_file_location,cfg_ori_name);

	    modify("%physical_path2%\","  %virtual_path2%/",cfg_ori_name," ");
        }
      } 

      path_message2 = nls("path_message2",
"[INFO] Virtual path %virtual_path2% has been created with your WebDb listener, mapping to 
physical path %physical_path2%.
");
      no_webdb_path_message2 = nls("no_webdb_path_message2",
"[ACTION] Please configure the following virtual path with your web listener: %virtual_path2% for 
physical directory %physical_path2%. 
");
      if(install_webdb_listner)
      {
         modify("",path_message2,forms_config_instruction_file);
      }
      else
      {
         modify("",no_webdb_path_message2,forms_config_instruction_file);
      }

      service_startup_message = nls("service_startup_message",
"[INFO] NT service Oracle Forms Server [Forms60Server%oracle_home_group1%] has been created and started for 
the Forms Server.
"); 
      modify("",service_startup_message,forms_config_instruction_file);
     } 

    } /*END if doit*/

        [
            'UNREGISTERED_PRODUCT: continue();
            'CANCEL: signal('FAILURE, instantiate(halt_installation));
        ]


} /*END Frunw60.ins*/
