#
# $Header: ddbo.vrf.pp 1.1 95/02/27 12:14:15 wyim Osd<unix> $ Copyr (c) 1992 Oracle
#

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

/***************************************************************************
NAME
    ddbo.vrf.pp

FUNCTION
    Performs the following for the product Distributed Database Option:
    - Product depenency analysis to determine whether
      to load the product files.
    - Acquires product executables relink options (if applicable).
    - Collect configuration information from the user for the Distributed
	  Database Option.

NOTES
    References and/or modifies the following variables in the product
    name space:

        do_load
                TRUE if product files are to be copied or moved from stage
                home to Oracle home.  FALSE otherwise.
        do_relink
                TRUE if the product executables are to be relinked.
                FALSE otherwise.
        do_db_actions
                TRUE if the product's database objects are to be created
                in the database (For RDBMS, it also means creating
                the database).  FALSE means no database actions.

CREATED
    PKu		07/29/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.vrf.pp 3090000.1 95/09/05 15:17:19 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." );








/* Galina  
	{ 
	  if (exists(User_Dflt_File)) 
	  { 
	    { _tmp_var=translate(dflt_idx, User_Dflt_File, "="); 
	      _dflt_str="%_tmp_var%"; 
	    } 
	    [ 'UNBOUND_ENVIRONMENT_VARIABLE: _dflt_str=list_dflt; ] 
	  } 
	  else 
	    _dflt_str=list_dflt; 
	  if (Default_Install) 
	    output = _dflt_str; 
   else \ 

	    output=MULTIPLE_TEXT_DIALOG(prompt, _dflt_str, content, help); 
   if (exists(User_Dflt_File)) modify(dflt_idx, output, User_Dflt_File, "=");\ 
	  LOG_HDR("MULTIPLE_TEXT") 
	  _prompt=prompt; _answer=output; 
	  first_log=first(_answer); _answer1=rest(_answer); 
	  second_log=first(answer1); _answer=rest(answer1); 
	  third_log=first(answer); answer1=rest(answer); forth_log=first(answer1); 
	  _dummy="       Q> %_prompt%"; modify("", _dummy, Install_Log); 
	  _dummy="       A> %first_log%"; modify("", _dummy, Install_Log); 
	  _dummy="       A> %second_log%"; modify("", _dummy, Install_Log); 
	  _dummy="       A> %third_log%"; modify("", _dummy, Install_Log); 
	  _dummy="       A> %forth_log%"; modify("", _dummy, Install_Log); 
	}
  Galina */















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

    product = ddbo;
    src = "%Stage_Home%/rdbms";

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

FUNCTION
    Contains common initialization code for *.vrf scripts.

NOTES

CREATED
    PKu		07/26/92

MODIFIED 
***************************************************************************/
   { /* pinit.vrf */
    product_label = product_interface_label(product);
    pname = product_name(product);

    ui_product(product_label);
    ui_action(instantiate(Analyze_Depend_Prompt));

    ui_product(product_label);
    ui_action("");

    has_db_objects=false;
	   } /*end of pinit.vrf*/

    /*
     * Product dependency analysis.  If no dependent, set depend_size 
     * to 0.
     */
    depend_size = 0;
     
	{ /*_VERIFY_PRODUCT ( ocommon , "ocommon" , tmp_size ) */ 
	  { 
	     _prod_bound = TRUE ; 
	     tmp_size = 0 ; 
	     _tmp_var = product_interface_label ( ocommon ) ; 
	  } 
	  [ 
	    'UNBOUND_VARIABLE : 
	     { 
	       _prod_bound = FALSE ; 
	       _pname = "ocommon" ; 
	       if ( not ( Build_Stage_Only ) ) 
	         if ( not ( registered ( _pname ) ) ) 
	           signal ( 'CANCEL , instantiate ( Depend_Not_Installed_Mesg ) ) ; 
	     } 
	  ] 
	  { 
	    if ( _prod_bound ) 
	      tmp_size = verify ( ocommon ) ; 
	  } 
	}
    depend_size=depend_size+tmp_size;

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

FUNCTION
    Common product version analysis, relink and db action determination
    code used in *.vrf scripts.

NOTES
    References the following globol variables:
	Analyze_Version_Prompt
	Do_Upgrade_Prompt, Do_Upgrade_Content, Do_Upgrade_Help
	Inst_Action, Inst_Normal, Inst_Maintain, Inst_Force_Fresh,
		Inst_Force_Upgrade, Inst_Per_Product.

    References the following variables local to the product name space:
        product_label		
        depend_size		

    Sets the following variables local to product name space that control 
    the script execution flow:
        do_load		
        do_upgrade		
        do_relink	
        do_db_actions		

CREATED
    PKu 	07/26/92

MODIFIED 
    JDonham 08/18/94  Bug 199720: If the user selected Inst_DB_Upgrade, don't
                        show the _db_act_list dialog unless the script was
			internally called.

    ERuben  10/05/93  Bug 181945: Set do_load from tape to true if the
                        current version being load does not equal the version
                        in sw_state_file.

***************************************************************************/
   {/* panlys.vrf */

    local_relink_install_failed=list();
    patch_install=false;
    do_dei_patch=false;
    do_load=false;
    do_upgrade=false;
    do_relink=false;
    do_db_actions=false;
    do_prod_admin=false;
    do_migrate=false;

    is_upgrade=false;
    query_db_action=false;

    _db_act_list=DB_Action_Full_List;
    _db_act_help=DB_Action_Full_Help;

    current_version = product_version(product);
    installed_version = "UNKNOWN";

    plocation=product_location(product);
    pfname=product_file_name(product);
    sw_state_file="%Stage_Home%/%plocation%/%pfname%.SW";
    dei_file="%Stage_Home%/%plocation%/%pfname%.dei";
    cmpr_dei_file="%Stage_Home%/%plocation%/%pfname%.dei_";
    map_file="%Stage_Home%/%plocation%/%pfname%.map";
    patch_prd_file="%Stage_Home%/%plocation%/PARTIAL.prd";

    ui_product(product_label);
    ui_action("");

    /*
     * Add product to list for loading from tape or CD into stage.
     *
     * JDONHAM: the '__' hack shouldn't be needed any more, since
     * unix.pvf.pp is now fixed to remove duplicate tape blocks.
     */
    add(Load_Product_List, product);

    /*
     * Do not do any product analysis if this ORAINST session is for
     * building stage or loading doc only.
     */
    if (Build_Stage_Only || Install_Doc_Only)
        return(depend_size);

    /*
    ** Determine if this product is a patch
    ** If this is a patch release, we take different actions
    ** ex. relinking is forced, partial.prdO is NOT deleted, etc.
    */
    if (exists(patch_prd_file))
      Patch_Install=TRUE;


    if ((Inst_Action==Inst_Fresh) || (Inst_Action==Inst_SW) ||
	(Migrate_Action==Migrate_SW_Inst))
    {
	/* This is an installation, reinstallation, or upgrade based on
	   unix.rgs.  Perform product analysis */
        /*
         * check version compatibility.
         */
        ui_action(instantiate(Analyze_Version_Prompt));

        if (not(registered(product_name(product))))
	{
	    /* Fresh install -- load files */
            if (not(Patch_Install))
              do_load = true;
            else
              do_load = yesno_dialog(instantiate(Do_Patch_Prompt),false,
                                     Do_Patch_Content,instantiate(Do_Patch_Help));
		}
        else
        {
            registry = registration(product_name(product));
            installed_version = registry_version(registry);

            if (earlier_version(registry,current_version))
	    {
		/* if do upgrade, load files and set the do_upgrade flag */
                do_load = yesno_dialog(instantiate(Do_Upgrade_Prompt),
                                        Do_Upgrade_Content,
                                        instantiate(Do_Upgrade_Help));
		is_upgrade = do_load;
		    }
            else if (not(internally_called))
	    {
		/* if do reinstall (user explicitly selected the product), 
		   load files */
                do_load =  yesno_dialog(instantiate(Reinstall_Prompt), false);
		    }
	    else
	      ui_action(instantiate(Already_Installed_Msg));
	        }

        /*
        ** This basically checks to see if the product is already load during
        ** a Fresh Install.  Product might be already loaded because of a
        ** partial install which was aborted due to failure.  If the product
        ** is already loaded from tape, we give the option of skipping it.
        ** NOTE: this should be enhanced to take care of build_stage_only,
        **       possibly in a different 'if' block to avoid problems regarding
        **       removing do_load from the following 'if' block
        */
	if (Tape_Load && do_load)
        {
	    if (not(exists(sw_state_file)))
	        do_load_from_tape=true;
	    else
	    {
	        /* Software appears to be already loaded and untouched in
	           stage home.  Ask the user if reload into stage home */
	        {
		        version_in_stage=translate("VERSION", sw_state_file, "=");

		        if (version_in_stage == current_version)
                {
		            do_load_from_tape=yesno_dialog(
				        instantiate(Load_from_Tape_Prompt), false,
				        Load_from_Tape_Content,
				        instantiate(Load_from_Tape_Help));
	                } else
                {
                    /*
                     * Bug 181945:
                     * If we've reached here then sw_state_file existed, but
                     * the version number is not equal to the current version.
                     * This situation would indicate that we are using the 
                     * same stage home as the last version, without having
                     * removed the last version.  This would happen if we
                     * installed the last version with Keep_Stage equal to 
                     * true, or if this particular product was never installed
                     * from the previous release.
                     */
                    do_load_from_tape = true;
	                } /*if (version_in_stage == current_version)*/
		        }
		        [   'UNBOUND_ENVIRONMENT_VARIABLE: { do_load_from_tape=true; }]
		    }

        if (not(do_load_from_tape)) extract(Load_Product_List, product);
		}

        /*
        ** LATER:
        ** We should add some code here to terminate the install if we are
        ** installing from temporary/permanent staging area and the SW state
        ** file is not present.  We'd have to 'if' out floppy and CDROM
        ** permanent staging areas.  This also creates a problem for testing
        ** since a permanent staging area is harder to simulate with a
        ** SHIPHOME.
        */

        if (not(do_load))
        {
          if (member(Load_Product_List, product))
            extract(Load_Product_List, product);
	        }
        else
        {
          /*
          ** Create DB objects if doing complete fresh install; do
          ** product admin if loading files
          */
          do_prod_admin = true;
          do_relink = Relink_All;

          if (Inst_Action==Inst_Fresh)
          {
            if (not(empty(DB_Startup_Failed)))
            {
              modify("", "  (%product_label%): S/W install only (DB action deactivated due to DB creation/startup failure.", Install_Log);
	            }
            else
            {
              do_db_actions=true; do_upgrade=is_upgrade;
	            }
	          }

          /*
          ** If this is a patch install, force relinking on.
          ** If do_relink is not already TRUE at this point, inform
          ** the user we are forcing it to be TRUE.
          */
          if (Patch_Install && not(do_relink))
          {
            do_relink=TRUE;
            information_dialog(instantiate(patch_relink_prompt),
                               patch_relink_content,patch_relink_help);
	          }
	        }
	    } 
    else if (Inst_Action==Inst_DB_New)
    {
      if (not(internally_called))
      {
        /*
        ** The user selected this product to have its DB objects created.
        */
        do_db_actions=true; 
	      }
      else
      {
        /*
        ** The product the user selected relies on this product being
        ** installed.
        */
        query_db_action=true;
	      }
	    }
    else if (Inst_Action==Inst_DB_Upgrade)
    {
      /*
       * Bug 199720:
       *
       * The user has already chosen Inst_DB_Upgrade, so we should only pop
       * up the _db_act_list dialog if the script was internally called for
       * this product (i.e. the product the user selected relies on this
       * product).
       *
       */

      if (not(internally_called))
	{

	  /*
	   *  _db_act_list=DB_Action_Short_List;
	   *  _db_act_help=DB_Action_Short_Help;
	   *
	   *  Don't need to set these since we won't be putting up the dialog
	   */

	  do_db_actions=true; do_upgrade=true;
		}
      else
	{
	  query_db_action=true;
	        }

	    }
    else if (Inst_Action==Inst_Deinstall)
    {
	signal('CANCEL, instantiate(Deinst_Wrong_Win_Msg));
	    }
    else if (Inst_Action==Inst_V6_To_V7)
    {
        if ((Migrate_Action==Migrate_Util_Inst) ||
	    (Migrate_Action==Migrate_Util_Run) )
	{
	    signal('CANCEL, instantiate(Migrate_Only_Prompt));
		}
        if (Migrate_Action==Migrate_DB)
        {
	    query_db_action=true;
	    if (not(internally_called))
	    {
    	        _db_act_list=DB_Action_Short_List;
    	        _db_act_help=DB_Action_Short_Help;
		    }
	        }
	    }
    else if (Inst_Action==Inst_Deinstall_Patch)
    {
      /*
      ** This session is specifically for deinstalling
      ** a patch.
      **
      ** 1) Make sure the product is installed.
      ** 2) Double check to make sure current version is OLDER
      **    than installed version.
      ** 3) Set do_dei_patch to true since we want to revert
      **    to the old files.
      ** 4) Set do_relink to true since we want to relink
      **    right after we deinstall.
      */
      if (not(registered(product_name(product))))
      {
        information_dialog(instantiate(Not_Installed_Err));
        return(depend_size);
	      }

      registry = registration(product_name(product));
      installed_version = registry_version(registry);

      if (later_version(registry,current_version))
      {
        do_dei_patch=TRUE;
        do_relink=TRUE;
	      }
      else
      {
        do_dei_patch=yesno_dialog(instantiate(Do_Dei_Patch_Prompt),false,
                                  Do_Dei_Patch_Content,
                                  instantiate(Do_Dei_Patch_Help));
        if (do_dei_patch)
          do_relink=TRUE;
	      }
	    }
    else if (Inst_Action==Inst_Maint)
    {
        /*
         * If this ORAINST session is for creating DB, relink executables,
	 * and/or product administration, then does the following:
	 *
	 * - if user selected "product admin", then do it only if the script
	 *   is not internally called.
	 * - if user selected "product relink", then do it only if the script
	 *   is not internally called.
	 * - if user selected "DB objects create/upgrade", then prompt the user
	 *   whether he wants to create/upgrade/do nothing.
         */
        /*
        ** We don't want to produce the warning error for dbup or __dbupload
        */
        product_title=product_name(product);
        if ((not(registered(product_title))) && 
            (product_title != "dbup") &&
            (product_title != "__dbupload"))
	{
          information_dialog(instantiate(Not_Installed_Err));
          return(depend_size);
		}

	/* take actions only if externally invoked */
	if (not(internally_called)) 
	{
	    if (member(Maint_Action, Maint_Prod_Admin))
	        do_prod_admin=true;

	    if (member(Maint_Action, Maint_Relink))
	        do_relink=true;

	    if (member(Maint_Action, Maint_DB_Obj))
	    {
	        query_db_action=true;
	        _db_act_list=DB_Action_Short_List;
	        _db_act_help=DB_Action_Short_Help;
		    }
		}
	    }
    else
	signal('failure, instantiate("Unexpected Inst_Action value: %Inst_Action%"));

    if (has_db_objects && query_db_action)
    {
        db_action=single_selection_dialog(instantiate(DB_Action_Prompt),
			_db_act_list, DB_Action_Content, _db_act_help);
        if (db_action==DB_Action_Create)
        {
	    do_db_actions=true; do_upgrade=false;
	        }
        else if (db_action==DB_Action_Upgrade)
        {
	    do_db_actions=true; do_upgrade=true;
	        }
        else if (db_action==DB_Action_No) 
        { 
	    do_db_actions=false; do_upgrade=false;
		} 
        else 
	    signal('failure, instantiate("Unexpected db_action value: %db_action%"));
	    }

    if ((Migrate_Action==Migrate_DB) && do_upgrade) do_migrate=true;

    modify("", "  (%product_label%):", Install_Log);
    modify("", "    do_load=%do_load%; do_relink=%do_relink%; do_db_actions=%do_db_actions%; do_upgrade=%do_upgrade%", Install_Log);
    modify("", "    do_migrate=%do_migrate%; do_prod_admin=%do_prod_admin%; has_db_objects=%has_db_objects%; is_upgrade=%is_upgrade%", Install_Log);
    modify("", "    OraDoc=%OraDoc%; Do_Install_Cd_Doc=%Do_Install_CD_Doc%", Install_Log);
	   }/*end of panlys.vrf*/


    /*
     * If applicable, product-specific link options should be
     * gathered here.
     */
    if (do_relink)
    {
/*
 * $Header: pinitlk.vrf 3090000.1 95/09/05 15:17:16 wyim Generic<base> $ Copyr (c) 1992 Oracle
 */
/***************************************************************************
NAME
    pinitlk.vrf
FUNCTION
    Collect link options.
NOTES
    References the following global variables:
	Collect_Link_Opts
CREATED
    PKu		07/26/92
MODIFIED 
***************************************************************************/
       { /* pinitlk.vrf */
        ui_action(instantiate(Collect_Link_Opts));
       } /* end of pinitlk.vrf */
    	/* dialogs to obtain link options info */
    }

    /*
	 * Add RDBMS_DDB_OPT to the RDBMS_Opts_List so that the RDBMS
	 * verify script will ask for the dba group.  Only do this if
	 * do_load is set, otherwise the rdbms.vrf script will ask
	 * for the dba group and rdbms.ins.pp will show the pa_inst_list 
	 * as undefined.
	 */
	if (do_load)
	{
		add(RDBMS_Opts_List, "RDBMS_DDB_OPT");
	}

    /*
     * Return total size of the product (and its dependents).
     */
     
	{ /*_TOTAL_SZ ( sum ( lib , base , instal ) , depend_size , total_size ) */ 
	  if ( do_load ) 
	    total_size = ( sum ( lib , base , instal ) ) + ( depend_size ) ; 
	  else 
	    total_size = ( depend_size ) ; 
	}

     
	{ /*_ECHO ( "Leaving ddbo.vrf" ) */ 
	  _dummy = "Leaving ddbo.vrf" ; 
	  modify ( "" , ">>> %_dummy%" , Install_Log ) ; 
	}
    return(total_size);
}}
 
