/* Copyright (c) Oracle Corporation 1995. All Rights Reserved */ /******************************************************************************* NAME toolsdei.usr - External script for Tools Products' Deinstallation 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. SET_DEINSTALL_VARIABLES. II. CREATE_LABEL Create a label with the product name, version (used by all dei scripts) III. GET_DEINSTALLATION_PATH Set up deinstallation path (used by all dei scripts - unless path is preset) IV. DEINSTALL_PARENT Deinstall parent if no other child product exists (used by all child scripts) V. UNREFERENCE_DEINSTALL_CHILD_PRODUCTS Unreference and remove all child products if parent product was selected. VI. DEINSTALL_COMPONENTS Same as "Unreference_Deinstall_Child_Products" but also removes all cross-referencing between components & parent. (used by parent scripts) VII. UNREFERENCE_DEPENDENCIES Unreference product dependencies. (generally only used by parent scripts) OWNER Rajesh Bansal MODIFIED MM/DD/YY REASON aharriso 01/02/96 Added FILE_NOT_FOUND handler for TRANSLATE in win32 scripts. aharriso 08/29/95 Added Unreference_dependencies and deinstall_components. rbansal 08/07/95 Created ********************************************************************************/ { /**************************************************************** I. SET_DEINSTALL_VARIABLES Set the directory separator according to the current operating system. Specific to R2.0 *****************************************************************/ if (EXECUTE_SCRIPT == "SET_DEINSTALL_VARIABLES") { RSF_PRODUCT_STRING = "w32rsf73"; PLUS_PRODUCT_STRING = "w32plus33"; dir_separator = "\"; /********************************************** Set variables for program groups for .MAP files ***********************************************/ D2K20_COMPONENTS = "Developer 2000 R2.1 Comps"; D2K20_ADMINISTRATION = "Developer 2000 R2.1 Admin"; D2K20_DEMOS = "Developer 2000 R2.1 Demos"; D2K20_DOCS = "Developer 2000 R2.1 Doc"; D2K20_GROUP = "Developer 2000 R2.1"; D2K20_DRIVERS = "Developer 2000 R2.1 Direct Drivers"; OPEN2K20_DOCS = "Open 2000 R2.1 Documentation"; /**********************************************/ /********************************** Bind variables for Installation ***********************************/ TOOLS_HOME = "%ORACLE_HOME%%dir_separator%TOOLS"; DOC20 = "%TOOLS_HOME%%dir_separator%DOC20"; /**********************************/ /************************ Setup the nls() stuff for deinstall scripts *************************/ deinstall_unregister = nls("deinstall_unregister","Unregistering %%registry_label%%..."); unreference_dependencies= nls("unreference_dependencies","Unreferencing %%registry_label%% Dependencies..."); deinstall_dll = nls("deinstall_dll","Removing %%registry_label%% Dynamic Link Libraries..."); deinstall_which = nls("deinstall_which","Remove which %%registry_label%%?"); deinstall_location = nls("deinstall_location", "%%registry_label%% is not found in this directory. Do you wish to attempt to deinstall at this location anyway?"); deinstall_exe = nls("deinstall_exe", "Removing %%registry_label%% Executables..."); deinstall_components = nls("deinstall_components", "Deinstalling %%registry_label%% Components..."); deinstall_files = nls("deinstall_files","Removing %%registry_label%% files..."); modify_variables = nls("modify_variables", "Modifying %%registry_label%% Environment Variables..."); } /*END SET_DEINSTALL_VARIABLES*/ /********************************************************************/ /******************************************************************** II. Create a label with the product name, version *********************************************************************/ if (EXECUTE_SCRIPT == "CREATE_LABEL") { installed_version = registry_version(current_registry); version_list = explode(installed_version,"."); msb_version_list = list(first(version_list), first(rest(version_list))); display_version = implode(msb_version_list,"."); display_registry_label = "%registry_label% %display_version%"; ui_product(instantiate(display_registry_label)); return(0); } /********************************************************************/ /******************************************************************** III. Set up deinstallation path *********************************************************************/ if (EXECUTE_SCRIPT == "GET_DEINSTALLATION_PATH") { home_variable = ""; /* bind product_home variable */ prompt_flag = FALSE; { home_variable = translate(deinstall_variable, ora_config, section_heading); /* Get path from variable in oracle.ini. */ full_path = "%home_variable%"; if(not(exists(full_path))) /* Make sure this is the product's location */ prompt_flag = TRUE; } [ 'UNBOUND_ENVIRONMENT_VARIABLE,'INVALID_FILE_NAME, 'FILE_NOT_FOUND: { prompt_flag = TRUE; } ] if(prompt_flag) { mark { home_variable = choose_directory_dialog(instantiate(deinstall_which),oracle_home); if(not(exists(instantiate("%home_variable%")))) /* Make sure this is the product's location */ { mark /* Allow user to backup to previous MARK level to select appropriate product location */ { deinstall_here = yesno_dialog(instantiate(deinstall_location), FALSE); if(not(deinstall_here)) signal('FAILURE, "Halted deinstallation process."); } } } } return(home_variable); } /********************************************************************/ /******************************************************************** IV. Deinstall parent if no other child product exists *********************************************************************/ if (EXECUTE_SCRIPT == "DEINSTALL_PARENT") { if(member(registration("selected_registries"), current_registry)) { remove_parent = TRUE; child_products = all_child_registrations(PARENT_PRODUCT); extract(child_products, current_registry); while(not(empty(child_products))) { if(registered(registry_name(first(child_products)))) { remove_parent = FALSE; break(); } child_products = rest(child_products); } if(remove_parent) { dependent = registration(PARENT_REGISTRY_NAME); /*********************************************** if PARENT needs to be deinstalled, make sure all references to PARENT are unreferenced before attempting to deinstall the PARENT ************************************************/ reference_list = registry_references(dependent); while(not(empty(reference_list))) { if(registered(registry_name(first(reference_list)))) unreference(dependent, registration(registry_name(first(reference_list)))); reference_list = rest(reference_list); } /***********************************************/ unreference(dependent); deinstall(dependent); } } ['UNREGISTERED_PRODUCT: continue();] return(0); } /**********************************************************************************/ /********************************************************************************** V. UNREFERENCE_DEINSTALL_CHILD_PRODUCTS Unreference and remove all child products if parent product was selected. **********************************************************************************/ if (EXECUTE_SCRIPT == "UNREFERENCE_DEINSTALL_CHILD_PRODUCTS") { if(member(registration("selected_registries"), current_registry)) /* remove all child products if parent product was selected */ { ui_product(instantiate(display_registry_label)); ui_action(instantiate(deinstall_components)); child_products = all_child_registrations(current_registry); /***************************** Deinstall the child product(s) ******************************/ while(not(empty(child_products))) { if(registered(registry_name(first(child_products)))) { dependent = registration(registry_name(first(child_products))); unreference(dependent); /* unset the child's self-reference */ deinstall(dependent); } child_products = rest(child_products); } } return(0); } /***********************************************************************************/ /************************************************************************************************************************* VI . DEINSTALL_COMPONENTS Similar to "UNREFERENCE_DEINSTALL_CHILD_PRODUCTS" but eliminates cross-referencing between components & parent. ************************************************************************************************************************/ if (EXECUTE_SCRIPT == "DEINSTALL_COMPONENTS") { if(member(registration("selected_registries"), current_registry)) /* remove all child products if parent product was selected */ { ui_product(instantiate(display_registry_label)); ui_action(instantiate(deinstall_components)); child_products = all_child_registrations(current_registry); /*************************************************** Make sure the cross-referencing between different component products/parent is eliminated, before continuing with the deinstallation of child products ****************************************************/ reference_products = child_products; while(not(empty(reference_products))) { if(registered(registry_name(first(reference_products)))) { dependent = registration(registry_name(first(reference_products))); reference_list = registry_references(dependent); while(not(empty(reference_list))) { if(registered(registry_name(first(reference_list)))) unreference(dependent, registration(registry_name(first(reference_list)))); reference_list = rest(reference_list); } } reference_products = rest(reference_products); } /***************************************************/ /******************************************* Deinstall the component (child) product(s) ********************************************/ while(not(empty(child_products))) { if(registered(registry_name(first(child_products)))) { dependent = registration(registry_name(first(child_products))); unreference(dependent); /* unset the child's self-reference */ deinstall(dependent); } child_products = rest(child_products); } /*******************************************/ } /**********************************************************/ return(0); } /***********************************************************************************/ /*********************************************************************************** VII. UNREFERENCE_DEPENDENCIES Unreference and deinstall product dependencies. ***********************************************************************************/ if (EXECUTE_SCRIPT == "UNREFERENCE_DEPENDENCIES") { ui_product(instantiate(display_registry_label)); ui_action(instantiate(unreference_dependencies)); while(not(empty(dependency_list))) { next_dependency = first(dependency_list); if(registered(next_dependency)) { dependent = registration(next_dependency); unreference(dependent, current_registry); unreference(dependent); deinstall(dependent); } dependency_list = rest(dependency_list); } } /***********************************************************************************/ }