/* Copyright (c) Oracle Corporation 1994.  All Rights Reserved */
/*****************************************************************************
  NAME
 dbtool71.ins - V3 installation script for Database Administration Tools v7.1

  DESCRIPTION
    This script installs Database Administration Tools v7.1

  OWNER
    Amy Winarske

  MODIFIED    DD-MMM-YY  Reason
    awinarsk  06-JAN-95  Moved VS10 vrf code to handle random product install order.
    awinarsk  05-JAN-95  Modified for MSHELP, NetWare connect string.
    awinarsk  04-JAN-95  Added WINDBHLP71 dependency, NLS handling.
    awinarsk  03-JAN-95  Modified to handle workgroup server.
    awinarsk  29-DEC-94  Fixed bug w/modifying vs10.ini
    awinarsk  27-DEC-94  Made more changes to handle bundle_name
    awinarsk  21-DEC-94  Added NLS library files.
    awinarsk  14-DEC-94  Fixed TOOLS_GROUP errata, vs10 modification conditions.
    awinarsk  13-DEC-94  Further changes to accommodate product names.
    awinarsk  08-DEC-94  Added new information for upcoming release.
    akelley   08-NOV-94  Created.
*****************************************************************************/
{
  if (doit)
    {
      /*****************************
        Set the VRF-INS script ratchet
      ******************************/
      ins_ratchet = "7.1.4.1.0";

      execute("%installer_home%\windows.ins");

      permit_retry_operations = TRUE;

      /*******************
	Determine whether or not to create VS10.INI and set up defaults.
	The verification work is done here instead of in the VRF script to 
        allow for the random installation order problem.
      ********************/

      {
       set_vs10 = false;
       vs10 = v7_translate("vs10");

       if (not(exists(vs10))) 
         signal('UNBOUND_ENVIRONMENT_VARIABLE);
      }
      [
       'OS_ERROR,'INVALID_FILE_NAME,'PERMISSION_DENIED,'UNBOUND_ENVIRONMENT_VARIABLE:
       {
         vs10 = "%oracle_home%\vs10";
         set_vs10 = true;
       }
      ]

     {
        set_defaults = FALSE;

	if ((bundle_name == P_O7_E) || (bundle_name == P_O7))
	       {
	        tools_group =  "Personal Oracle7"; /* "Database Administration Tools";*/
	        {
			if (not (exists ("%oracle_home%\vs10\vs10.ini"))) 
                	{
                	  set_defaults=TRUE;
	        	}
		}
		['PERMISSION_DENIED, 'OS_ERROR: set_defaults=TRUE;]
 	       }
        else 
	       {
                tools_group = "Database Administration Tools"; 
                set_defaults = TRUE;
	       }
      }
      ['UNBOUND_ENVIRONMENT_VARIABLE:
             {
              tools_group = "Database Administration Tools";
             }
      ]

   
      /******************
        Install the product
      *******************/

      ui_product(product_label);

      ui_action( instantiate(installing_scripts) );
      copy(deinst);

      ui_action( instantiate(installing_exe) );
      copy(exe);

      ui_action( instantiate(installing_dll) );
      if (distributed_option)   
	copy(dll,"enterp");
      else 
	copy(dll,"pers");  /* The default install is non-distributed/ no snapshot*/

      copy(dll, nls_abbreviation);

      ui_action( instantiate(installing_msg) );
      copy(msg, nls_abbreviation);

      ui_action( instantiate(installing_sql) );
      copy(sqldat);

      /*********************
       Check if system files already exist or if they are old 
       before installing them.
      **********************/

      ui_action( instantiate(installing_sys) );
      system_files = group_files(sys);
      product_directory = implode(list(product_home,
                                       product_location(current_product)),"\");
      pathify(product_directory);

      while (not (empty(system_files)))
      {
         /* Set up the filenames and versions */
         current_destination_file = first(system_files);
         current_source_file = implode(list(product_directory,
                                            file_name(current_destination_file)),
                                       "\");
         pathify(current_source_file);

         source_file_version = windows_file_version(current_source_file);
         {
           if ((not(exists(current_destination_file)))
            || (windows_earlier_version(current_destination_file,
                                        source_file_version)))
             signal('FILE_NOT_FOUND);
	 } ['default: copy_file(current_source_file,current_destination_file); ]

         system_files = rest(system_files);

      }

      ui_action( instantiate(installing_hlp) );
      copy(hlp);

   /*******************
        Modify Configuration files.  Specifically, ORACLE.INI and VS10.INI
      ********************/

      ui_action( instantiate(modifying_config) );

      modify("TOOLS_GROUP", tools_group, ora_config,"Oracle");

      {
       if (set_vs10) 
       { 
        if ((bundle_name == P_O7) || (bundle_name == P_O7_E)) 
        {
	 if ( not((member(selected_products, winrdbms71)) || (registered("winrdbms71"))))
           modify("VS10",vs10,ora_config,"Oracle");
        }
        else 
         modify("VS10",vs10,ora_config,"Oracle");   
       }
      }
      ['PERMISSION_DENIED, 'OS_ERROR: ui_action("Error modifying VS10.INI file");]

      if(set_mshelp)
        modify("MSHELP",mshelp,ora_config,"Oracle");
	
      if (set_defaults)
      {
        if ((bundle_name == W_O7_W_NT) ||
            (bundle_name == E_O7_W_NT))
        {
	  modify("SQLNET DBNAME %host%", "%protocol_string%:%host%:%sid%",ora_config,"Oracle");
        }
	else if ((bundle_name == W_O7_NW)   ||       /* Netware has a special spx connect string */
                 (bundle_name == E_O7_NW) )
	{ if (protocol_type == protocol_type_spx)
	    modify("SQLNET DBNAME %host%", "%protocol_string%:%host%-spx",ora_config,"Oracle");     
          else
	    modify("SQLNET DBNAME %host%", "%protocol_string%:%host%:%sid%",ora_config,"Oracle");     
	}
        modify("HOST",host,"%vs10%\vs10.ini","LOGON"); 
        modify("DEFAULTSRV",defaultsrv,"%vs10%\vs10.ini","CONFIGURATION_DETAILS");
        modify("DEFAULTCONFIG",defaultconfig,"%vs10%\vs10.ini","CONFIGURATION_DETAILS");
        modify("DFT_TBLSPACE",dft_tblspace,"%vs10%\vs10.ini","UMAN");
        modify("TMP_TBLSPACE",tmp_tblspace,"%vs10%\vs10.ini","UMAN");
      }

     permit_retry_operations = FALSE;

      /*******************
        Install Dependencies
      ********************/
      ui_action( instantiate(installing_dependencies) );
      install(winrsf71);
      install(windbhlp71);

      permit_retry_operations = TRUE;

      /*******************
        Register the product
      ********************/
      ui_product( instantiate(product_label) );
      ui_action( instantiate(registering) );

      register(current_product);
      if (member(selected_products,current_product))
        reference(current_product);

      reference(winrsf71,current_product);

    { reference(windbhlp71,current_product);
     } ['default: continue(); ]

      permit_retry_operations = FALSE;
    }
}








