/* Copyright (c) Oracle Corporation 1995. All Rights Reserved */ /******************************************************************************* NAME toolsvrf.usr - External script for Tools Products' Verifications scripts DESCRIPTION This external script is a Library of Routines (like Functions/Procedures). Each Routine is a block of code that is being used by more than one Installer script. Each routine is uniquely identified by a global variable that needs to be set by the product script calling this script, and a roman numeral (for ease of locating the desired Routine). Following is a list of all the routines in this Library: I. CREATE_LABEL Create a label with the product name, version II. VERIFY_COMPONENTS Verify all the components of the PARENT III. VERIFY_PARENT Check if Parent needs to be installed IV. VERIFY_SIBLINGS Determine sibling products to be co-installed V. CHECK_COMPONENT_PRODUCT Check if COMPONENT_PRODUCT needs to be installed VI. VERIFY_ENVIRONMENT_VARIABLES Setup environment variables foR VARIABLES VII. CHECK_REQUIRED_PRODUCT Check if REQUIRED_PRODUCT needs to be installed VIII.DETERMINE_PRODUCT_LOCATION Determine installation path of the product(s) IX. VERIFY_DEPENDENCIES Check if dependencies in dep_prod_list need to be installed X. SUM_DEPENDENCIES calls verify for dependencies in dep_prod_list OWNER Rajesh Bansal MODIFIED MM/DD/YY REASON arajagop 05/09/96 Made it OIS referenced file rbansal 09/28/95 Modified MODIFY_ORACLE_INI routine for change in section heading from the previous release rbansal 04/18/95 ORACLE.INI variables for product DEMOS ********************************************************************************/ { /******************************************************************** I. Create a label with the product name, version *********************************************************************/ if (OIS_EXECUTE_SCRIPT == "CREATE_LABEL") { if((not(doit)) && (member(selected_products, current_product))) ui_action(instantiate(halt_installation)); current_version = product_version(current_product); version_list = explode(current_version,"."); { msb_version_list= list(first(version_list), first(rest(version_list))); } ['EMPTY_LIST: { msb_version_list = list(current_version,".0"); continue(); } ] display_version = implode(msb_version_list,"."); return(0); } /********************************************************************/ /******************************************************************** II. Verify all the components of the PARENT *********************************************************************/ if (OIS_EXECUTE_SCRIPT == "VERIFY_COMPONENTS") { /* explicitly called; verify all components */ size_files = 0; size_verified_child = 0; child_products = all_child_products(current_product); child_products_to_install = list(); while(not(empty(child_products))) { next_child = first(child_products); if(not(member(products_for_installation, next_child))) { size_verified_child = verify(next_child); if(size_verified_child != 0) { size_files = size_files + size_verified_child; add(child_products_to_install, next_child); } } child_products = rest(child_products); } return(size_files); } /********************************************************************/ /******************************************************************** III. Check to see if parent needs to be installed *********************************************************************/ if (OIS_EXECUTE_SCRIPT == "VERIFY_PARENT") { /* verify parent */ /*************** Check for Parent ****************/ install_parent = TRUE; /* always install parent version matching with the component product version */ if(registered(product_name(product_parent(current_product)))) { parent_registry = registration(product_name(product_parent(current_product))); parent_version = product_version(product_parent(current_product)); if(same_version(parent_registry, parent_version)) install_parent = FALSE; /* parent is up-to-date; don't install */ } return(install_parent); } /********************************************************************/ /******************************************************************** IV. Determine sibling products to be co-installed *********************************************************************/ if (OIS_EXECUTE_SCRIPT == "VERIFY_SIBLINGS") { /* verify sibling products to be co-installed */ total_sum = 0; /******************************************** Determine sibling products to be co-installed *********************************************/ sibling_products = all_child_products(product_parent(current_product)); extract(sibling_products, current_product); /* ALWAYS verify all siblings before parent */ while(not(empty(sibling_products))) { if(member(selected_products, first(sibling_products))) total_sum = total_sum + verify(first(sibling_products)); sibling_products = rest(sibling_products); } return(total_sum); } /********************************************************************/ /******************************************************************** V. Check if COMPONENT_PRODUCT needs to be installed *********************************************************************/ if (OIS_EXECUTE_SCRIPT == "CHECK_COMPONENT_PRODUCT") { /* check if COMPONENT_PRODUCT needs to be installed */ /************************** Check for COMPONENT_PRODUCT ***************************/ install_component = TRUE; /* always install COMPONENT_PRODUCT version matching with the product in control */ if(registered(product_name(COMPONENT_PRODUCT))) { component_registry = registration(product_name(COMPONENT_PRODUCT)); component_version = product_version(COMPONENT_PRODUCT); if(same_version(component_registry, component_version)) install_component = FALSE; /* COMPONENT_PRODUCT is up-to-date; don't install */ } return(install_component); } /********************************************************************/ /****************************** 10/10/95 *********************************************** VI. VERIFY_ENVIRONMENT_VARIABLES Following variables need to be set by the product scripts: file (type STRING) Name of the file in which the modifiction is to be made varlist (type List) List of Path variables in File. For example, FORMS45_PATH for FORMS DEMOS. vallist (type LIST) List of all the paths required. For example, %FORMS45%\PLSQLLIB for FORMS DEMOS group (type STRING) Section Heading in File. For example, "CDE" implode_explode_delimiter (type STRING) Delimiter for implode/explode functions (set to ";" in USER.AVF). If any other value, needs to be set, for example, "," for REGISTERED_LIBRARIES variable in ORACLE.INI old_section_heading OPTIONAL (type STRING) if the section heading needs to be different than the previous release, set this variable to the section heading of the previous release 1) Add ini_var variable in File if it's not there already, 2) Modify File if ini_var is under [CDE] to move it to appropriate section 3) Modify File if ini_var is under old_section_heading to move it to appropriate section 4) Modify ini_var variable in File if it's already there, and doesn't have any/all of paths in ini_path_list ****************************************************************************************/ if (OIS_EXECUTE_SCRIPT == "VERIFY_ENVIRONMENT_VARIABLES") { temp_varlist = varlist; temp_vallist = vallist; /* contains default values for all the variables in varlist */ temp_app_list = append_list; temp_appd_list = append_delimiter_list; /* Vallist returns the list of true and false "To be modified" for the variable that need to be modified and "value in target system", otherwise. */ vallist = list(); while(not(empty(temp_varlist))) { /* take the next vaiable from the varlist */ implode_explode_delimiter = ";"; ini_var = first(temp_varlist); temp_varlist = rest(temp_varlist); ini_path_var = first(temp_vallist); temp_vallist = rest(temp_vallist); paths_in_ini_var = list(); modify_ini_var = FALSE; /* if the appened flag is false then we need to put the value */ append_flag = first(temp_app_list); temp_app_list = rest(temp_app_list); implode_explode_delimeter = first(temp_appd_list); if (implode_explode_delimeter == "") implode_explode_delimeter = ";"; /* ; is default */ temp_appd_list = rest(temp_appd_list); if (append_flag == "false") { add(vallist,ini_path_var); /* write the variable to temp_file */ } else { ini_path_list = explode(ini_path_var, implode_explode_delimiter); { if (script_os != "os2") { ini_path_var = translate(ini_var, ora_config, "CDE"); /* ORACLE.INI contains ini_var under [CDE] ?? */ paths_in_ini_var = explode(ini_path_var, implode_explode_delimiter); modify(ini_path_var, "", ora_config, "CDE"); /* modify ORACLE.INI to remove the variable from [CDE] */ } else { signal('UNBOUND_ENVIRONMENT_VARIABLE); } } [ /* ORACLE.INI doesn't have ini_var under [CDE], check it under appropriate section, e.g., [FORMS45] for Forms Demos */ 'OS_ERROR,'INVALID_FILE_NAME,'FILE_NOT_FOUND, 'PERMISSION_DENIED,'UNBOUND_ENVIRONMENT_VARIABLE: { ini_path_var = translate(ini_var, file, group); /* File contains ini_var ?? */ paths_in_ini_var = explode(ini_path_var, implode_explode_delimiter); } [ /* file doesn't have ini_var, so add it to file*/ 'OS_ERROR,'INVALID_FILE_NAME,'FILE_NOT_FOUND, 'READ_ERROR, 'PERMISSION_DENIED,'UNBOUND_ENVIRONMENT_VARIABLE: { if(OLD_SECTION_HEADING_EXISTS) { ini_path_var = translate(ini_var, file, old_section_heading); /* file contains ini_var under old_section_heading ?? */ paths_in_ini_var = explode(ini_path_var, implode_explode_delimiter); modify(ini_var, "", file, old_section_heading); /* remove variable from old_section_heading */ } else signal('UNBOUND_ENVIRONMENT_VARIABLE); } [ /* file doesn't have ini_var, add it to file */ 'OS_ERROR,'INVALID_FILE_NAME,'FILE_NOT_FOUND, 'PERMISSION_DENIED,'UNBOUND_ENVIRONMENT_VARIABLE: { continue(); } ] ] ] while(not(empty(ini_path_list))) { ini_path_to_add = first(ini_path_list); if(not(member(paths_in_ini_var, ini_path_to_add))) { modify_ini_var = TRUE; add(paths_in_ini_var, ini_path_to_add); /* ini_var does not have the required path, add it to ini_var */ } ini_path_list = rest(ini_path_list); } if(modify_ini_var) { ini_path_var = implode(paths_in_ini_var, implode_explode_delimiter); add(vallist,ini_path_var); /* write the variable to temp_file */ } else add(vallist,"NOMODIFY"); } /* if append_flag */ } return(0); } /************************** End - 10/10/95 *********************************************/ /******************************************************************** VII. Check if REQUIRED_PRODUCT needs to be installed *********************************************************************/ if (OIS_EXECUTE_SCRIPT == "CHECK_REQUIRED_PRODUCT") { /* check if REQUIRED_PRODUCT needs to be installed */ /************************* Check for REQUIRED_PRODUCT **************************/ install_required_product = TRUE; /* REQUIRED_PRODUCT is out-of-date or not installed; install */ if(registered(product_name(REQUIRED_PRODUCT))) { required_product_registry = registration(product_name(REQUIRED_PRODUCT)); required_product_version = product_version(REQUIRED_PRODUCT); if(not(earlier_version(required_product_registry, required_product_version))) install_required_product = FALSE; /* REQUIRED_PRODUCT is up-to-date or would be downgraded; don't install */ } return(install_required_product); } /********************************************************************/ /*********************************05/17/95******************************** VIII. Determine installation path of the product(s) **************************************************************************/ if (OIS_EXECUTE_SCRIPT == "DETERMINE_PRODUCT_LOCATION") { modify_oracle_ini = TRUE; home_variable = ""; prompt_path = TRUE; { /* search for product's home in ORACLE.INI */ if (script_os == "os2") home_variable = translate(install_variable, ora_config); else home_variable = translate(install_variable, ora_config, section_heading); modify_oracle_ini = FALSE; prompt_path = FALSE; } [ 'FILE_NOT_FOUND, 'INVALID_FILE_NAME, 'UNBOUND_ENVIRONMENT_VARIABLE: /* product's home not found under section_heading in ORACLE.INI, try under [CDE] */ { if (script_os != "os2") { {home_variable = translate(install_variable, ora_config, "CDE");} [ 'FILE_NOT_FOUND, 'INVALID_FILE_NAME, 'UNBOUND_ENVIRONMENT_VARIABLE: /* problem with the product's home; prompt */ continue(); ] } /* end of os2 */ } ] if(prompt_path) { home_variable = default_home; /* if (quick_install) prompt_path = FALSE;*/ makedir_default_dir = default_home; if(CALLED_BY_DBTABLES) makedir_select_dir_prompt = instantiate(prompt_sql_home); /* NLS string for installation location */ else makedir_select_dir_prompt = instantiate(install_product); /* NLS string for installation location */ makedir_root_allowed = TRUE; /* allow installation to root level */ /*************************************** Make sure CDE1 and CDE2 products are not installed at the same location ****************************************/ valid_path = FALSE; while(not(valid_path)) { if (prompt_path) home_variable = execute("%installer_home%\makedir.vrf"); /* prompt for location */ if(CDE1_PRODUCT_EXISTS) /* check for CDE1 and CDE2 location conflict only if the product was released with CDE1 */ { {cde1_loc = translate(cde1_variable, ora_config, "CDE");} ['INVALID_FILE_NAME, 'UNBOUND_ENVIRONMENT_VARIABLE: valid_path = TRUE;] /* oracle.ini or variable doesn't exist */ if(not(valid_path)) { if(cde1_loc==home_variable) { makedir_select_dir_prompt = install_loc_conflict; /* NLS string for installation location conflict between cde1 and cde2 */ prompt_path = TRUE; } else valid_path = TRUE; } } else valid_path = TRUE; } /****************************************/ } return(home_variable); } /*************************************************************************/ /******************************************************************** IX. Check if dependencies in dep_prod_list The variables dep_prod_list and dep_instal_cond must be set before calling this script. *****************************************************************************/ if (OIS_EXECUTE_SCRIPT == "VERIFY_DEPENDENCIES") { temp_dep_prod = dep_prod_list; temp_instal_cond = list(); while(not(empty(temp_dep_prod))) { { t_prod = first(temp_dep_prod); } ['EMPTY_LIST:break();] { temp_cond = first(dep_instal_cond); } ['EMPTY_LIST:break();] dep_cond = "install"; if (temp_cond != "always") { if (member(selected_products,current_product) && (not(member(selected_products, t_prod)))) { t_prod_name = product_name(t_prod); if (registered(t_prod_name)) { if (temp_cond != "never") { registry = registration(t_prod_name); current_version = product_version(t_prod); installed_version = registry_version(registry); temp_list = explode(temp_cond,",",false); opted_cond_mark = first(temp_list); temp_list = rest(temp_list); opted_version = first(temp_list); if ((opted_cond_mark == ">") || (opted_cond_mark == ">=")) { if (not(earlier_version(registry,opted_version))) dep_cond = "No"; } else { if (not(later_version(registry,opted_version))) dep_cond = "No"; } } else dep_cond = "No"; } } ['UNREGISTERED_PRODUCT: continue();] } { temp_dep_prod = rest(temp_dep_prod); } ['EMPTY_LIST:continue();] { dep_instal_cond = rest(dep_instal_cond); } ['EMPTY_LIST:continue();] add(temp_instal_cond,dep_cond); } dep_instal_cond = temp_instal_cond; return (1); } /*************************************************************************/ /************************************************************************* X. SUM_DEPENDENCIES calls verify for dependencies in dep_prod_list The variables dep_prd_list and dep_instal_cond must be set before calling this script. OWNER Athmarman MODIFIED DD-MMM-YY Reason arajagop 10-Oct-95 Created. *****************************************************************************/ if (OIS_EXECUTE_SCRIPT == "SUM_DEPENDENCIES") { sum1 = 0; temp_prod_list = dep_prod_list; temp_cond_list = dep_instal_cond; while(not(empty(temp_prod_list))) { {dep_prod = first(temp_prod_list);} ['EMPTY_LIST:break();] {dep_cond = first(temp_cond_list);} ['EMPTY_LIST:break();] if (dep_cond == "install") { sum1 = sum1 + verify(dep_prod); } {temp_prod_list = rest(temp_prod_list);} ['EMPTY_LIST:continue();] {temp_cond_list = rest(temp_cond_list);} ['EMPTY_LIST:continue();] } return (sum1); } /*****************************************************************************/ }