#
# $Header: xa.ins.pp 1.2 95/04/28 16:41:05 jpau Osd<unix> $ Copyr (c) 1992 Oracle
#

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

/***************************************************************************
NAME
    xa.ins.pp

FUNCTION
    Install the product XA.

NOTES

CREATED
    ERuben	10/26/92

MODIFIED 
***************************************************************************/
{mark{
/* Define USE_ULIMIT for ports which have file size restrictions imposed  */
/* by ulimit.  These are usually System V ports. */
/* Define NO_DEVSYS for ports which don't require Software Development System */
/* for installing Oracle */
/* Define OFF_SERVER_ONLY for Office Server only systems. */
/* Define GEN_AS to generate assembly code instead of c code in gen scripts */
/*  The SYSTEM_CHECK macro causes install/system.check, the pre-installation */
/*  configuration test, to be included in INSTALL.DIST.  The intent is that */
/*  this macro will be defined for all platforms (eventually). */
/*  The INCLUDE_CORE macro causes install/CORE.DIST to be included in  */
/*  install/INSTALL.DIST.  CORE.DIST contains a list of files which are  */
/*  required by all products.  They are especially important in the case */
/*  of sites which do not have an RDBMS license but link and use network */
/*  user tools (like SQL*Forms) from a "client" platform.  At some point */
/*  base development will "define" a CORE product and it can replace this */
/*  psydo-product.  */
/*  In 6.0.27.6, USE_BIGORALIB and USE_LIBKNL have been obsoleted.   */
/*  Both libora.a and libknl.a are now used for all ports.  This is  */
/*  done to clean up the suffix makefiles and to separate user and   */
/*  kernel libraries. */
/*  USE_BIGFRMLIB causes the the big forms library libforms.a to be made, */
/*  which is composed of libtm.a, libomm.a and libram.a */
/* Define USE_ROFIX if you want to rofix certain modules for your port.  */
/* Modules to be rofixed are designated in the make suffix files in the  */
/* source directories.  Rofixing (read-only fix) a module means compiling */
/* it in such a way as to move all data in the module from data space into */
/* text space.  Modules to be rofixed should be chosen with care since */
/* rofixing read/write data causes segmentation violations at run time. */
/*  Define LIBMEM if the make command on your port understands library    */
/*  dependency on object files, i.e. the rule: lib.a(obj1.o obj2.o).      */
/*  Define LIBSEP as well if each object file has to be listed separately,*/
/*  i.e. the rule: lib.a(obj1.o) lib.a(obj2.o).  For LIBSEP to be         */
/*  effective, LIBMEM has to be defined first.                            */
/* Define USE_RANLIB if "ranlib" is required after re-archiving the   */
/* library.  This affects the makefiles we ship out to the customers, */
/* not the makefiles in the development system.                       */
/* If you are using GNU make. */
/* Pro*Cobol Macros : Define the appropriate BUILD_* macros for your port. */
/* The code for the macro included below may require some port specific    */
/* modification.                                                           */
/* IDC */
/*
 * $Header: macros.ins.pp 3090000.1 95/09/05 15:17:16 wyim Generic<base> $ Copyr (c) 1992 Oracle
 */


/*
 * $Header: misc.ins.pp 3090000.1 95/09/05 15:17:24 wyim Generic<base> $ Copyr (c) 1992 Oracle
 */








problem_error_info=nls( "problem_error_info","A problem occured trying to process the last error." );
problem_error_info_help=nls( "problem_error_info_help","?html problem_error_info_help" );
problem_error_info_content=nls( "problem_error_info_content","Error Processing Problem" );

problem_dlg_help=nls( "problem_dlg_help","?html problem_dlg_help" );

problem_header_dflt=nls( "problem_header_dflt", "
Platform:	%%operating_system%%
Release:	%%rel_version%%
Product: 	%%pname%%
Version:	%%current_version%%

Area:		(Installation)	

Install information:

	Installer Version:  %%installer_version%%
	Installer Script:   %%_line%% 
	Install Action:     %%Inst_Action%%

	Stage Home	    %%Stage_Home%%
	Oracle_Base	    %%Oracle_Base%%	(%%OFA_Compliant%%)
	Oracle Home	    %%Oracle_Home%%
	Owner		    %%Owner%%
	Log		    %%Install_Log%%

	During installation of the above product the error below is
	encountered:
");




Sys_Macro_Holdfile="%%Oracle_Home%%/orainst/holdfile.log";
Sys_Macro_Help=nls("Sys_Macro_Help", "?html Sys_Macro_Help" );
Sys_Macro_Content=nls( "Sys_Macro_Content", "O/S Error" );
Sys_Macro_Prompt=nls("Sys_Macro_Prompt", "
Error during action '%%_com%%'.

Command:  %%_cmd%%

");
Sys_Macro_Cancel_Prompt=nls("Sys_Macro_Cancel_Prompt", "Installation terminated at user request." );













     
	{ /*_ECHO ( "Entering xa.ins" ) */ 
	  _dummy = "Entering xa.ins" ; 
	  modify ( "" , ">>> %_dummy%" , Install_Log ) ; 
	}

    ran_lib_mesg=nls("ran_lib_mesg", "Initializing XA library with ranlib");
    protect_mesg=nls("protect_mesg", "Changing library protections");
    running_xaview=nls("running_xaview", "Initializing the XA views.");
    svrmgrl = "%Oracle_Home%/bin/svrmgrl";

    /*
     * Install products on which this product depends.
     */
     
	{ /*_INSTALL_PRODUCT ( ocommon ) */ 
	  { 
	    _prod_bound = TRUE ; 
	    _tmp_var = product_interface_label ( ocommon ) ; 
	  } 
	  [ 'UNBOUND_VARIABLE : { _prod_bound = FALSE ; } ] 
	  { 
	    if ( _prod_bound ) 
	      install ( ocommon ) ; 
	  } 
	}
     
	{ /*_INSTALL_PRODUCT ( network ) */ 
	  { 
	    _prod_bound = TRUE ; 
	    _tmp_var = product_interface_label ( network ) ; 
	  } 
	  [ 'UNBOUND_VARIABLE : { _prod_bound = FALSE ; } ] 
	  { 
	    if ( _prod_bound ) 
	      install ( network ) ; 
	  } 
	}
     
	{ /*_INSTALL_PRODUCT ( ddbo ) */ 
	  { 
	    _prod_bound = TRUE ; 
	    _tmp_var = product_interface_label ( ddbo ) ; 
	  } 
	  [ 'UNBOUND_VARIABLE : { _prod_bound = FALSE ; } ] 
	  { 
	    if ( _prod_bound ) 
	      install ( ddbo ) ; 
	  } 
	}
     
	{ /*_INSTALL_PRODUCT ( __dbupload ) */ 
	  { 
	    _prod_bound = TRUE ; 
	    _tmp_var = product_interface_label ( __dbupload ) ; 
	  } 
	  [ 'UNBOUND_VARIABLE : { _prod_bound = FALSE ; } ] 
	  { 
	    if ( _prod_bound ) 
	      install ( __dbupload ) ; 
	  } 
	}

/*
 * $Header: pinit.ins.pp 3090000.1 95/09/05 15:17:25 wyim Generic<base> $ Copyr (c) 1992 Oracle
 */
/***************************************************************************
NAME
    pinit.ins

FUNCTION
    Contains common initialization code for *.ins scripts.

NOTES

CREATED
    PKu		07/26/92

MODIFIED 
***************************************************************************/
   { /* pinit.ins */
/*
 * $Header: macros.ins.pp 3090000.1 95/09/05 15:17:16 wyim Generic<base> $ Copyr (c) 1992 Oracle
 */

    ui_product(product_label);
    ui_action("");

    if (Install_Doc_Only) {
      install_cd_doc=true;
       
	{ /*_INST_CD_DOC*/ 
	   if ( OraDoc ) { 
	     _pname = product_name ( product ) ; 
	     _pversion = product_version ( product ) ; 
	     if ( install_cd_doc ) 
	       _dummy = "%_pname% %_pversion%" ; 
	     else 
	       _dummy = "" ; 
	     modify ( "%_pname%_%_pversion%" , _dummy , CD_Doc_Inst_File , "=" ) ; 
	   } 
	}
	    }
	  } /*end of pinit.ins*/


    /*
     * Loading files....
     */
    if (do_load) {
         
	{ /*_BEGIN_SW_INST*/ 
	  _ploc = product_location ( product ) ; 
	  _pfname = product_file_name ( product ) ; 
	  _pSW = "%Stage_Home%/%_ploc%/%_pfname%.SW" ; 
	  if ( not ( Keep_Stage ) && ( exists ( _pSW ) ) ) remove_file ( _pSW ) ; 
	  _bsi_prdname = "%Oracle_Home%/%_ploc%/partial.prdO" ; 
	  if ( not ( Patch_Install ) ) 
	      if ( exists ( _bsi_prdname ) ) remove_file ( _bsi_prdname ) ; 
	}
        copy(base);

         
	{ /*_TRANSF2 ( Load_Lib , lib , incl ) */ 
	  
	{ /*_ACTION ( instantiate ( Load_Lib ) ) */ 
	  _com = instantiate ( Load_Lib ) ; 
	  ui_action ( "%_com%" ) ; 
	  
	{ /*_LOG_MSG ( "%_com%" ,  Install_Log ) */ 
	  _msg = "%_com%" ; 
	  _logfile = Install_Log ; 
	  if ( _logfile == "" ) 
	  { 
	    modify ( "" , ">>> %_msg%" , Install_Log ) ; 
	    modify ( "" , ">>> %_msg%" , Sql_Log ) ; 
	    modify ( "" , ">>> %_msg%" , Make_Log ) ; 
	    modify ( "" , ">>> %_msg%" , OS_Log ) ; 
	    if ( ORCA_Debug ) 
	      modify ( "" , ">>> %_msg%" , Debug_Log ) ; 
	  } 
	  else if ( _logfile == Install_Log ) 
	    modify ( "" , "     - %_msg%" , Install_Log ) ; 
	  else if ( _logfile == Sql_Log ) 
	    modify ( "" , "     - %_msg%" , Sql_Log ) ; 
	  else if ( _logfile == Make_Log ) 
	    modify ( "" , "     - %_msg%" , Make_Log ) ; 
	  else if ( _logfile == OS_Log ) 
	    modify ( "" , "     - %_msg%" , OS_Log ) ; 
	  else if ( _logfile == Debug_Log ) 
	    if ( ORCA_Debug ) 
	      modify ( "" , "     - %_msg%" , Debub_Log ) ; 
	  else 
	    information_dialog ( "Bad Log file name" ) ; 
	} 
	} 
	  transfer ( lib , Keep_Stage ) ; 
	  transfer ( incl , Keep_Stage ) ; 
	}
         
	{ /*_TRANSF ( Load_Doc , doc ) */ 
	  
	{ /*_ACTION ( instantiate ( Load_Doc ) ) */ 
	  _com = instantiate ( Load_Doc ) ; 
	  ui_action ( "%_com%" ) ; 
	  
	{ /*_LOG_MSG ( "%_com%" ,  Install_Log ) */ 
	  _msg = "%_com%" ; 
	  _logfile = Install_Log ; 
	  if ( _logfile == "" ) 
	  { 
	    modify ( "" , ">>> %_msg%" , Install_Log ) ; 
	    modify ( "" , ">>> %_msg%" , Sql_Log ) ; 
	    modify ( "" , ">>> %_msg%" , Make_Log ) ; 
	    modify ( "" , ">>> %_msg%" , OS_Log ) ; 
	    if ( ORCA_Debug ) 
	      modify ( "" , ">>> %_msg%" , Debug_Log ) ; 
	  } 
	  else if ( _logfile == Install_Log ) 
	    modify ( "" , "     - %_msg%" , Install_Log ) ; 
	  else if ( _logfile == Sql_Log ) 
	    modify ( "" , "     - %_msg%" , Sql_Log ) ; 
	  else if ( _logfile == Make_Log ) 
	    modify ( "" , "     - %_msg%" , Make_Log ) ; 
	  else if ( _logfile == OS_Log ) 
	    modify ( "" , "     - %_msg%" , OS_Log ) ; 
	  else if ( _logfile == Debug_Log ) 
	    if ( ORCA_Debug ) 
	      modify ( "" , "     - %_msg%" , Debub_Log ) ; 
	  else 
	    information_dialog ( "Bad Log file name" ) ; 
	} 
	} 
	  transfer ( doc , Keep_Stage ) ; 
	}
         
	{ /*_TRANSF2 ( Load_Admin , admin , instal ) */ 
	  
	{ /*_ACTION ( instantiate ( Load_Admin ) ) */ 
	  _com = instantiate ( Load_Admin ) ; 
	  ui_action ( "%_com%" ) ; 
	  
	{ /*_LOG_MSG ( "%_com%" ,  Install_Log ) */ 
	  _msg = "%_com%" ; 
	  _logfile = Install_Log ; 
	  if ( _logfile == "" ) 
	  { 
	    modify ( "" , ">>> %_msg%" , Install_Log ) ; 
	    modify ( "" , ">>> %_msg%" , Sql_Log ) ; 
	    modify ( "" , ">>> %_msg%" , Make_Log ) ; 
	    modify ( "" , ">>> %_msg%" , OS_Log ) ; 
	    if ( ORCA_Debug ) 
	      modify ( "" , ">>> %_msg%" , Debug_Log ) ; 
	  } 
	  else if ( _logfile == Install_Log ) 
	    modify ( "" , "     - %_msg%" , Install_Log ) ; 
	  else if ( _logfile == Sql_Log ) 
	    modify ( "" , "     - %_msg%" , Sql_Log ) ; 
	  else if ( _logfile == Make_Log ) 
	    modify ( "" , "     - %_msg%" , Make_Log ) ; 
	  else if ( _logfile == OS_Log ) 
	    modify ( "" , "     - %_msg%" , OS_Log ) ; 
	  else if ( _logfile == Debug_Log ) 
	    if ( ORCA_Debug ) 
	      modify ( "" , "     - %_msg%" , Debub_Log ) ; 
	  else 
	    information_dialog ( "Bad Log file name" ) ; 
	} 
	} 
	  transfer ( admin , Keep_Stage ) ; 
	  transfer ( instal , Keep_Stage ) ; 
	}



        /* Register the product */
         
	{ /*_REG_PROD*/ 
	  
	{ /*_ACTION ( instantiate ( Register_Prompt ) ) */ 
	  _com = instantiate ( Register_Prompt ) ; 
	  ui_action ( "%_com%" ) ; 
	  
	{ /*_LOG_MSG ( "%_com%" ,  Install_Log ) */ 
	  _msg = "%_com%" ; 
	  _logfile = Install_Log ; 
	  if ( _logfile == "" ) 
	  { 
	    modify ( "" , ">>> %_msg%" , Install_Log ) ; 
	    modify ( "" , ">>> %_msg%" , Sql_Log ) ; 
	    modify ( "" , ">>> %_msg%" , Make_Log ) ; 
	    modify ( "" , ">>> %_msg%" , OS_Log ) ; 
	    if ( ORCA_Debug ) 
	      modify ( "" , ">>> %_msg%" , Debug_Log ) ; 
	  } 
	  else if ( _logfile == Install_Log ) 
	    modify ( "" , "     - %_msg%" , Install_Log ) ; 
	  else if ( _logfile == Sql_Log ) 
	    modify ( "" , "     - %_msg%" , Sql_Log ) ; 
	  else if ( _logfile == Make_Log ) 
	    modify ( "" , "     - %_msg%" , Make_Log ) ; 
	  else if ( _logfile == OS_Log ) 
	    modify ( "" , "     - %_msg%" , OS_Log ) ; 
	  else if ( _logfile == Debug_Log ) 
	    if ( ORCA_Debug ) 
	      modify ( "" , "     - %_msg%" , Debub_Log ) ; 
	  else 
	    information_dialog ( "Bad Log file name" ) ; 
	} 
	} 
	  register ( product , File_Loaded_Msg ) ; 
	}
         
	{ /*_REFERENCE_PRODUCT ( ocommon , "ocommon" , product ) */ 
	  { 
	     reference ( ocommon , product ) ; 
	  } 
	  [ 'UNBOUND_VARIABLE : 
	     { 
	       _tmp_registry = registration ( "ocommon" ) ; 
	       reference ( _tmp_registry , product ) ; 
	     } 
	  ] 
	}
         
	{ /*_REFERENCE_PRODUCT ( network , "network" , product ) */ 
	  { 
	     reference ( network , product ) ; 
	  } 
	  [ 'UNBOUND_VARIABLE : 
	     { 
	       _tmp_registry = registration ( "network" ) ; 
	       reference ( _tmp_registry , product ) ; 
	     } 
	  ] 
	}
         
	{ /*_REFERENCE_PRODUCT ( ddbo , "ddbo" , product ) */ 
	  { 
	     reference ( ddbo , product ) ; 
	  } 
	  [ 'UNBOUND_VARIABLE : 
	     { 
	       _tmp_registry = registration ( "ddbo" ) ; 
	       reference ( _tmp_registry , product ) ; 
	     } 
	  ] 
	}
        if (not(internally_called)) 
             
	{ /*_REFERENCE_PRODUCT ( product , product_name ( product ) , product ) */ 
	  { 
	     reference ( product , product ) ; 
	  } 
	  [ 'UNBOUND_VARIABLE : 
	     { 
	       _tmp_registry = registration ( product_name ( product ) ) ; 
	       reference ( _tmp_registry , product ) ; 
	     } 
	  ] 
	}
    }

    if (do_db_actions)
    {
/*
 * $Header: pinitdb.ins 3090000.1 95/09/05 15:17:14 wyim Generic<base> $ Copyr (c) 1992 Oracle
 */
/***************************************************************************
NAME
    pinitdb.ins
FUNCTION
    Contains common initialization code for do_db_actions.
    Installs dbup (Running DB Verification).
NOTES
CREATED
    PKu         07/26/92
MODIFIED 
    ERuben      05/15/93  Add the running of the SQL*Plus script calcfree.sql
                          if this script is being run for development to
                          determine how much space product objects occupy.
                          For_Development is set in unix.zoo.pp as of
                          unix.zoo.pp 3000903.5.
***************************************************************************/
       { /* pinitdb.ins */
	install(dbup);
	if (has_db_objects && (not(empty(DB_Startup_Failed))))
	{
          modify("", instantiate(No_DB_Act_Mesg), Install_Log);
          do_db_actions=false; do_upgrade=false; do_migrate=false;
	}
        else
        {
          if (For_Development && registered("plus"))
          {
            /* 
            ** Determine if we need to run the space calculation script for
            ** development.  Only want to do this if Oracle Development is
            ** doing this and SQL*Plus has already installed.
            */
            product_title = product_name(product);
            plus_exec     = "%Oracle_Home%/bin/sqlplus";
            plus_userpass = "system/%system_pw%";
            plus_script   = "%Oracle_Home%/ocommon/util/calcfree.sql";
            plus_arg      = "'%product_title%'";
            spawn("%plus_exec% %plus_userpass% @%plus_script% %plus_arg%",
                  Install_Log,Install_Log);
          }
        }
        
        ui_product(product_label);
        ui_action(instantiate(Install_Prompt));
       } /* end of pinitdb.ins */
    }

    if (do_db_actions || do_upgrade)
    {
        /*
         * String initialization
         */
     	/* Create database objects for the product. */

        instantiate_file ("%Oracle_Home%/rdbms/install/xa/catxa.orc",
                "%Oracle_Home%/rdbms/admin/catxa.sql");
        catxa_sql="%Oracle_Home%/rdbms/admin/catxa.sql";
        args="<<!
@%catxa_sql%
exit
!";

         
	{ /*_SYS ( "%svrmgrl% %args%" , running_xaview ) */ 
	  _cmd = "%svrmgrl% %args%" ; _exe = "%svrmgrl% %args%" ; _com = running_xaview ; _help = Sys_Macro_Help ; 
	  
	{ /*_LOG_SEL ( _cmd ,  _log_file ) */ 
	    _log_file = OS_Log ; 
	   if ( contains ( _cmd , "bin/sqldba" ) || contains ( _cmd , "bin/sqlplus" ) || contains ( _cmd , "bin/svrmgrl" ) ) 
	      _log_file = Sql_Log ; 
	   if ( contains ( _cmd , "make " ) ) 
	      _log_file = Make_Log ; 
	} 
	  
	  { { /*_SYS_RETRY*/ 
	    _result = "Retry" ; 
	    _log_file = _log_file ; 
	    problem_holdfile = instantiate ( Sys_Macro_Holdfile ) ; 
	    while ( _result == "Retry" ) { 
	      problem_holdfile = instantiate ( Sys_Macro_Holdfile ) ; 
	      modify ( "" , log_divider ( ) , _log_file ) ; 
	      modify ( "" , "Action:  %_com%" , _log_file ) ; 
	      modify ( "" , "Command: (%_cmd%), Out,Err=%_log_file%" , _log_file ) ; 
	      remove_file ( problem_holdfile ) ; 
	      _line = replace ( log_divider ( ) , "-" , "" ) ; 
	      _stat = spawn ( _exe , problem_holdfile , problem_holdfile ) ; 
	      modify ( "" , "Status:  %_stat%" , _log_file ) ; 
	      if ( _stat != 0 ) { 
	      modify ( "" , "(( OIERR-SYS: %_cmd% ))" , _log_file ) ; 
	      } 
	      _s = _stat ; _result = "Ok" ; 
	      while ( ( _s != 0 ) || ( Sys_Option_ProcessDflt && ( _result == "Process" ) ) ) { 
	        _result = full_retry_dialog ( instantiate ( Sys_Macro_Prompt ) , 
	  	      problem_holdfile , true , Sys_Option_Ignore , true , 
	  	      instantiate ( Sys_Macro_Content ) , instantiate ( _help ) ) ; 
	        if ( Sys_Option_ProcessDflt && ( _result == "Process" ) ) 
	          
		  { /*_SYS_PROCESS_ERROR*/ 
		    { problem_header  = instantiate ( Problem_Header_Dflt ) ; 
	  	      problem_text    = instantiate ( Sys_Macro_Prompt ) ; 
	    	      problem_action  = _com ; 
		      execute ( "problem.ins" ) ; 
		    } 
		    [ 'DEFAULT : { information_dialog ( problem_error_info , problem_error_info_content , problem_error_info_help ) ; } ] 
		  } /*End SYS_PROCESS_ERROR*/ 
	        _s = 0 ; 
	      } 
	      
	    { modify ( "" , "{" , _log_file ) ; 
	      create_file ( problem_holdfile ) ; /*To stop sed raising error*/ 
	      _pfx = "OIERR-SYS" ; if ( _result == "Ok" ) _pfx = "Ok" ; 
	      spawn ( instantiate ( "sed -e 's/^/| %%_pfx%%: /' < %%problem_holdfile%% >>%%_log_file%%" ) ) ; 
	      modify ( "" , "}" , _log_file ) ; } 
	    [ 'DEFAULT : { } ]  
	      modify ( "" , instantiate ( "Result:  %%_result%%" ) , _log_file ) ; 
	    } 
	    modify ( "" , log_divider ( ) , _log_file ) ; 
	    Sys_Option_Ignore = true ; 
	    Sys_Option_ProcessDflt = true ; 
	   } 
	   [ 'CANCEL : { modify ( "" , "Result:  Cancel" , _log_file ) ; 
	      		signal ( 'CANCEL , Sys_Macro_Cancel_Prompt ) ; } ] 
	  } /*End _SYS_RETRY*/ 
	} /*End SYS*/
    }


    /* Change back to default directory */
    change_directory(); change_directory(Stage_Home);

     
	{ /*_ECHO ( "Leaving xa.ins" ) */ 
	  _dummy = "Leaving xa.ins" ; 
	  modify ( "" , ">>> %_dummy%" , Install_Log ) ; 
	}
}}
 
