home *** CD-ROM | disk | FTP | other *** search
/ PC World Komputer 1996 February / PCWK0296.iso / po7_win / rsf70 / rsf70.ins < prev    next >
Text File  |  1994-12-01  |  23KB  |  551 lines

  1. /* Copyright (c) Oracle Corporation 1992.  All Rights Reserved */
  2. /*****************************************************************************
  3.   NAME
  4.     rsf70.ins - V3 installation script for Windows Required
  5.                 Support Files 7.0.
  6.  
  7.   DESCRIPTION
  8.     This script installs Windows Required Suport Files 7.0.
  9.  
  10.   MODIFIED    DD-MMM-YY  Reason
  11.     Colello   20-APR-94  make 3.0.10.1 compliant
  12.     Colello   06-DEC-93  catch errors around v6translate of PATH
  13.     akelley   21-OCT-93  Toolkit, Help, Multimedia removed
  14.     ming      23-SEP-93  DLL version checking added
  15.     akelley   31-AUG-93  NLS added
  16.     akelley   02-AUG-93  set_rdbms error handlers added
  17.     akelley   28-MAY-93  modified to match OS/2 scripts.
  18.     akelley   27-APR-93  OH105 added
  19.     akelley   27-APR-93  MM105 added
  20.     akelley   09-MAR-93  TK20 added
  21.     gcostanz  22-FEB-93  Added instantiation to install messages
  22.     akelley   26-OCT-92  Added RDBMS70.
  23.     handrus   16-SEP-92  Fixed.
  24.     ekabatch  07-MAR-92  Normalized.
  25.     ekabatch  28-JAN-92  Created.
  26. *****************************************************************************/
  27. {
  28.   /**************************************************************************
  29.       Start main logic...
  30.    **************************************************************************/
  31.  
  32.   add_bin_to_path = false;
  33.  
  34.   if (doit)
  35.     {
  36.       ins_ratchet = "7.0.16.4.4F";
  37.  
  38.       execute("%installer_home%\windows.ins");
  39.  
  40.       permit_retry_operations = TRUE;
  41.  
  42.       ui_action(instantiate(installing_scripts));
  43.       copy(deinstl);
  44.  
  45.       ui_action(instantiate(installing_dlls));
  46.       copy(dll);
  47.  
  48.       ui_action(instantiate(installing_executables));
  49.       copy(exe);
  50.  
  51.       ui_action(instantiate(installing_msbs));
  52.       copy(msg,nls_abbreviation);
  53.  
  54.       ui_action(instantiate(installing_sql));
  55.       copy(sql);
  56.  
  57.       /**********************************************************************
  58.          DLL version checking...
  59.       ***********************************************************************/
  60.  
  61.       {
  62.         registration_comment = "";
  63.         old_dlls_txt = ""; /* initialize to "" to indicate not modified yet */
  64.  
  65.         no_version_version = "0.0.0.0.0.0.0";
  66.         reinstall_or_downgrade = (version_status == 'reinstall) ||
  67.                                  (version_status == 'downgrade);
  68.  
  69.         /********************************************************************
  70.            Get the path and try to get rid of white space...
  71.          ********************************************************************/
  72.  
  73.         {
  74.           path = v6_translate("%%PATH%%");
  75.           path = replace(path,"; ",";");
  76.           path = replace(path," ;",";");
  77.           path = replace(path,"%tab_character%;",";");
  78.           path = replace(path,";%tab_character%",";");
  79.         } [ 'OS_ERROR: path = "";
  80.             'UNBOUND_ENVIRONMENT_VARIABLE: path = ""; ]
  81.  
  82.         /********************************************************************
  83.            Separate the path into its components.  Add %boot_drive%:\WINDOWS,
  84.            %boot_drive%:\WINDOWS\SYSTEM, and %oracle_home%\BIN
  85.          ********************************************************************/
  86.  
  87.         old_exploded_path = explode(path,";");
  88.         subtract(old_exploded_path,list(".","..")); /* don't count . and .. */
  89.  
  90.         oracle_home_bin = "%oracle_home%\BIN";
  91.  
  92.         /* Note:  Don't change the order below!!!! */
  93.         exploded_path = list(oracle_home_bin,windows_directory(),
  94.                              windows_system_directory());
  95.         union(exploded_path,old_exploded_path);
  96.  
  97.         /* loop for each member of target_list */
  98.         while (not(empty(target_list)))
  99.           {
  100.             target = first(target_list);
  101.             target_list = rest(target_list);
  102.  
  103.             target_base = first(explode(target,"."));
  104.             bin_dll = "%oracle_home%\BIN\%target%"; /* .DLL (DLL currently in oracle home) */
  105.             new_dll = "%oracle_home%\BIN\%target_base%.NEW"; /*    .NEW (DLL from installation media) */
  106.  
  107.             ui_action(instantiate(searching_path));
  108.  
  109.             /****************************************************************
  110.                Get the version of new_dll...
  111.              ****************************************************************/
  112.  
  113.             if (not((earlier_version(installer_version,"3.0.9.5.0"))))
  114.               {
  115.                 {
  116.                   version_no = windows_file_version(new_dll);
  117.                 } [ 'OS_ERROR: version_no = no_version_version; ]
  118.               }
  119.             else
  120.               version_no = no_version_version;
  121.  
  122.             unsorted_dll_list = list(list(version_no,new_dll));
  123.  
  124.             ui_action(sorting_dlls);
  125.  
  126.             /****************************************************************
  127.                Get the versions of all DLL's...
  128.              ****************************************************************/
  129.  
  130.             dll_path = exploded_path;         /* don't modify exploded_path */
  131.             while (not(empty(dll_path)))
  132.               {
  133.                 path_member = first(dll_path);
  134.                 dll_path = rest(dll_path);
  135.  
  136.                 if (file_name(path_member)==".")
  137.                   continue();
  138.                 full_target = replace("%path_member%\%target%","\\","\");
  139.                 ui_action(instantiate(searching_file));
  140.                 if (exists(full_target))
  141.                   {
  142.                     if (not((earlier_version(installer_version,"3.0.9.5.0"))))
  143.                       {
  144.                         {
  145.                           version_no = windows_file_version(full_target);
  146.                         } [ 'OS_ERROR: version_no = no_version_version; ]
  147.                       }
  148.                     else
  149.                       version_no = no_version_version;
  150.                     unsorted_dll_list = cons(list(version_no,full_target),
  151.                                              unsorted_dll_list);
  152.                   }
  153.               } [ 'INVALID_FILE_NAME,'PERMISSION_DENIED,'OS_ERROR: continue(); ]
  154.  
  155.             /****************************************************************
  156.                Sort list of DLLs by version number.  dll_list will contain
  157.                list of DLL_path with newest version at head of list.
  158.                version_list will be in same order but will give list of form
  159.                "DLL_path DLL_version", with special format for currently
  160.                installed version, and version from installation media.  This
  161.                has to be a STABLE sort!
  162.              ****************************************************************/
  163.  
  164.             bin_str = "";            /* necessary b/c bin_dll may not exist */
  165.  
  166.             dll_list = list();
  167.             version_list = list();
  168.             done = false;
  169.             while (not(done))
  170.               {
  171.  
  172.                 /************************************************************
  173.                    Get the oldest version of the dll...
  174.                  ************************************************************/
  175.  
  176.                 oldest = first(unsorted_dll_list);
  177.                 oldest_version_no = first(oldest);
  178.  
  179.                 tmp_list = rest(unsorted_dll_list);
  180.                 while ((oldest_version_no != no_version_version) &&
  181.                        not(empty(tmp_list)))
  182.                   {
  183.                     current = first(tmp_list);
  184.                     tmp_list = rest(tmp_list);
  185.                     current_version_no = first(current);
  186.                     if (earlier_version(current_version_no,oldest_version_no))
  187.                       {
  188.                         oldest = current;
  189.                         oldest_version_no = current_version_no;
  190.                       }
  191.                   }
  192.  
  193.                 /************************************************************
  194.                    Remove the oldest version from unsorted_dll_list and cons
  195.                    it to dll_list and version_list
  196.                  ************************************************************/
  197.  
  198.                 extract(unsorted_dll_list,oldest);
  199.                 oldest_dll = first(rest(oldest));
  200.                 dll_list = cons(oldest_dll,dll_list);
  201.  
  202.                 /* The spaces in " %no_version_version%" and "
  203.                    %no_version_info%" are important.  Don't change them. */
  204.                 if (oldest_dll == bin_dll)
  205.                   {
  206.                     bin_str = replace(instantiate(bin_format),
  207.                                       " %no_version_version%",
  208.                                       " %no_version_info%");
  209.                     str = bin_str;
  210.                   }
  211.                 else if (oldest_dll==new_dll)
  212.                   {
  213.                     new_str = replace(instantiate(new_format),
  214.                                       " %no_version_version%",
  215.                                       " %no_version_info%");
  216.                     str = new_str;
  217.                   }
  218.                 else
  219.                   str = replace(instantiate(default_format),
  220.                                 " %no_version_version%",
  221.                                 " %no_version_info%");
  222.  
  223.                 if (empty(unsorted_dll_list))
  224.                   {
  225.                     done = TRUE;
  226.                     newest_str = str;
  227.                     newest_dll = oldest_dll;
  228.                     newest_version_no = oldest_version_no;
  229.                   }
  230.  
  231.                 version_list = cons(str,version_list);
  232.               }
  233.  
  234.             /****************************************************************
  235.                Decide which dll to install...
  236.              ****************************************************************/
  237.             {
  238.               preferred = new_dll;              /* assume preferred is .NEW */
  239.  
  240.               if (newest_dll == new_dll)
  241.                 signal('DO_MOVE,"");
  242.  
  243.               if ((newest_dll == bin_dll) &&
  244.                   (first(rest(dll_list)) == new_dll)) /* if .DLL > .NEW >= ... */ {
  245.                     if (reinstall_or_downgrade)
  246.                       signal('DO_MOVE,"");
  247.  
  248.                     if (not(yesno_dialog(instantiate(overwrite_message),
  249.                                          false,overwrite_content,
  250.                                          instantiate(overwrite_help))))
  251.                       preferred = bin_dll;
  252.  
  253.                     signal('DO_MOVE,"");
  254.                   }
  255.               else
  256.                 {
  257.                   if (reinstall_or_downgrade)
  258.                     {
  259.                       preferred = new_dll;
  260.                       preferred_str = new_str;
  261.                       message = prefer_new_message;
  262.                     }
  263.                   else
  264.                     {
  265.                       preferred = newest_dll;
  266.                       preferred_str = newest_str;
  267.                       if (newest_dll==bin_dll)
  268.                         message = prefer_installed_message;
  269.                       else
  270.                         message = prefer_newest_message;
  271.                     }
  272.  
  273.                   mark
  274.                     {
  275.                       if (not(yesno_dialog(instantiate(message),true,
  276.                                            prefer_content,
  277.                                            instantiate(prefer_help))))
  278.                         {
  279.                           mark
  280.                             pick = single_selection_dialog(instantiate(choose_dll_message),
  281.                                                            version_list,
  282.                                                            preferred_str,
  283.                                                            choose_dll_content,
  284.                                                            instantiate(choose_dll_help));
  285.                           if (pick==new_str)
  286.                             preferred = new_dll;
  287.                           else if (pick==bin_str)
  288.                             preferred = bin_dll;
  289.                           else
  290.                             preferred = first(explode(pick));
  291.                         }
  292.                     }
  293.                   signal('DO_MOVE,"");
  294.                 }
  295.             } [ 'DO_MOVE: continue(); ]
  296.  
  297.             /****************************************************************
  298.                Install the preferred version and delete new_dll...
  299.              ****************************************************************/
  300.  
  301.             if (preferred != bin_dll)
  302.               {
  303.                 copy_file(preferred,bin_dll);
  304.               } [ 'PERMISSION_DENIED:
  305.                    {
  306.                      error = permission_denied;
  307.                      information_dialog(instantiate(cannot_copy));
  308.                      signal('CANNOT_COPY,installation_aborted);
  309.                    }
  310.                   'OS_ERROR:
  311.                    {
  312.                      error = os_error;
  313.                      information_dialog(instantiate(cannot_copy));
  314.                      signal('CANNOT_COPY,installation_aborted);
  315.                    }
  316.                   'WRITE_ERROR:
  317.                    {
  318.                      error = write_error;
  319.                      information_dialog(instantiate(cannot_copy));
  320.                      signal('CANNOT_COPY,installation_aborted);
  321.                  }
  322.                ]
  323.             {
  324.               remove_file(new_dll);
  325.             } [ 'PERMISSION_DENIED,'OS_ERROR,'WRITE_ERROR: continue(); ]
  326.  
  327.             /****************************************************************
  328.                Note the version number of the installed version...
  329.              ****************************************************************/
  330.  
  331.             if (not((earlier_version(installer_version,"3.0.9.5.0"))))
  332.               {
  333.                 {
  334.                   final_version_no = windows_file_version(bin_dll);
  335.                   final_version_no = " %final_version_no%";
  336.                 } [ 'OS_ERROR: final_version_no = ""; ]
  337.               }
  338.             else
  339.               final_version_no = "";
  340.  
  341.             if (preferred!=new_dll)
  342.               if (final_version_no=="")
  343.                 registration_comment = "%registration_comment%%target% %no_version_info%; ";
  344.               else
  345.                 registration_comment = "%registration_comment%%target%%final_version_no%; ";
  346.  
  347.             extract(dll_list,bin_dll);
  348.             extract(dll_list,new_dll);
  349.  
  350.             /****************************************************************
  351.                If there are extra dlls in the system, ask to rename them...
  352.              ****************************************************************/
  353.  
  354.             if (not(empty(dll_list)))
  355.               {
  356.                 if (yesno_dialog(instantiate(auto_rename),TRUE,
  357.                                  auto_rename_content,
  358.                                  instantiate(auto_rename_help)))
  359.                   { /* if ok to rename ... */
  360.                     add_bin_to_path = true; /* since we are removing a DLL from their DLL search path, we need to do this! */
  361.                     while (not(empty(dll_list)))
  362.                       {
  363.                         old_dll = first(dll_list);
  364.                         dll_list = rest(dll_list);
  365.                         old_dll_dir = directory_name(old_dll);
  366.                         target_old = replace("%old_dll_dir%\%target_base%.OLD", "\\", "\");
  367.                         move_file(old_dll,target_old); /* rename */
  368.                         if (exists(old_dll))
  369.                           signal('PERMISSION_DENIED,"");
  370.                       } [ 'PERMISSION_DENIED:
  371.                          {
  372.                            error = permission_denied;
  373.                            information_dialog(instantiate(cannot_rename));
  374.                            signal('CANNOT_RENAME,installation_aborted);
  375.                          }
  376.                          'OS_ERROR:
  377.                          {
  378.                            error = os_error;
  379.                            information_dialog(instantiate(cannot_rename));
  380.                            signal('CANNOT_RENAME,installation_aborted);
  381.                          }
  382.                          'WRITE_ERROR:
  383.                          {
  384.                            error = write_error;
  385.                            information_dialog(instantiate(cannot_rename));
  386.                            signal('CANNOT_RENAME,installation_aborted);
  387.                          } ]
  388.                   }
  389.                 else
  390.                   {                  /* if not ok to rename ... */
  391.                     ui_action(instantiate(writing_dlls_txt));
  392.                     if (old_dlls_txt=="")
  393.                       { /* if file not started */
  394.                         old_dlls_txt = "%oracle_home%\rsf_dlls.txt"; /* if not, delete any previous */
  395.                         remove_file(old_dlls_txt); /* versions of this file */
  396.                         modify("",instantiate(head_message),old_dlls_txt);
  397.                       }
  398.                     modify("","",old_dlls_txt);
  399.                     modify("","-------------------------------------------------------------",
  400.                            old_dlls_txt);
  401.                     modify("",instantiate(header_message),old_dlls_txt);
  402.                     modify("","",old_dlls_txt);
  403.  
  404.                     extract(version_list,new_str);     /* don't include these in the list */
  405.                     extract(version_list,bin_str);
  406.  
  407.                     while (not(empty(version_list)))
  408.                       {
  409.                         current = first(version_list);
  410.                         version_list = rest(version_list);
  411.                         modify("",current,old_dlls_txt);
  412.                       }
  413.                     modify("","-------------------------------------------------------------",
  414.                            old_dlls_txt);
  415.                     information_dialog(instantiate(list_written));
  416.                   } [ 'PERMISSION_DENIED,'WRITE_ERROR,'OS_ERROR:
  417.                      /* can't modify old_dlls_txt */
  418.                      information_dialog(instantiate(mod_problem),
  419.                                         mod_content,
  420.                                         instantiate(mod_help));
  421.                     ]
  422.               }
  423.           }
  424.       }
  425.  
  426.       /**********************************************************************
  427.          Continue with the installation.  Modify Config...
  428.        **********************************************************************/
  429.  
  430.       if (set_rdbms70)
  431.         {
  432.            ui_action(instantiate(modifying_config));
  433.            modify("RDBMS70",rdbms70,ora_config,"Oracle");
  434.         }
  435.  
  436.       if (set_pro15)
  437.         {
  438.            ui_action(instantiate(modifying_config));
  439.            modify("PRO15",pro15,ora_config,"Oracle");
  440.         }
  441.  
  442.       if (set_pro14)
  443.         {
  444.            ui_action(instantiate(modifying_config));
  445.            modify("PRO14",pro14,ora_config,"Oracle");
  446.         }
  447.  
  448.       ui_action(instantiate(registering));
  449.       register(current_product,registration_comment);
  450.       if (member(selected_products,current_product))
  451.         reference(current_product);
  452.     }
  453.  
  454.   /**************************************************************************
  455.      Add BIN to path?...
  456.    **************************************************************************/
  457.  
  458.   if (add_bin_to_path)
  459.     {
  460.       {
  461.         environment_path = v6_translate("%%PATH%%");
  462.       } [ 'OS_ERROR: environment_path = "";
  463.          'UNBOUND_ENVIRONMENT_VARIABLE: environment_path = "";
  464.         ]
  465.       if (not(member(explode(environment_path,";"),oracle_home_bin)))
  466.         {
  467.           /******************************************************************
  468.              If oracle_home\bin not in path, create autoexec.new, then ask to
  469.              copy AUTOEXEC.NEW to AUTOEXEC.BAT.  First find DOS boot drive...
  470.            ******************************************************************/
  471.  
  472.           ui_action(identifying_bt_drive);
  473.           boot_drive = dos_boot_drive();
  474.  
  475.           if (earlier_version(dos_version(),"4"))
  476.             {
  477.               mapped_drives = dos_mapped_drives();
  478.               extract(mapped_drives,"A");
  479.               extract(mapped_drives,"B");
  480.               bt_drive = single_selection_dialog(bt_drive_prompt,
  481.                                                  mapped_drives,
  482.                                                  bt_drive_content,
  483.                                                  bt_drive_help);
  484.             }
  485.  
  486.           autoexec_bat = "%boot_drive%:\AUTOEXEC.BAT";
  487.           autoexec_new = "%boot_drive%:\AUTOEXEC.NEW";
  488.           autoexec_old = "%boot_drive%:\AUTOEXEC.OLD";
  489.  
  490.           if (exists(autoexec_bat))
  491.             copy_file(autoexec_bat,autoexec_new);
  492.           else
  493.             create_file(autoexec_new);
  494.  
  495.           {
  496.             path_variable = "SET PATH";
  497.             separator = " = ";
  498.             autoexec_path = translate(path_variable,autoexec_new,separator);
  499.           } [ 'UNBOUND_ENVIRONMENT_VARIABLE:
  500.              {
  501.                path_variable = "PATH";
  502.                {
  503.                  autoexec_path = translate(path_variable,
  504.                                            autoexec_new,separator);
  505.                } [ 'UNBOUND_ENVIRONMENT_VARIABLE:
  506.                   {
  507.                     separator = " ";
  508.                     {
  509.                       autoexec_path = translate(path_variable,autoexec_new,
  510.                                                 separator);
  511.                     } [ 'UNBOUND_ENVIRONMENT_VARIABLE:
  512.                        {
  513.                          autoexec_path = "";
  514.                          continue();
  515.                        } ]
  516.                   } ]
  517.              } ]
  518.  
  519.           if (member(explode(autoexec_path,";"),oracle_home_bin))
  520.             information_dialog(instantiate(pth_problem_prompt),
  521.                                pth_problem_content,
  522.                                instantiate(pth_problem_help));
  523.           else
  524.             {
  525.               autoexec_path = "%oracle_home_bin%;%autoexec_path%";
  526.               autoexec_path = implode(explode(autoexec_path,";"),";");
  527.               autoexec_path = "%autoexec_path%;";
  528.               len = length(autoexec_path);
  529.               if (len > 127)
  530.                 additional_changes_help = grter_path_length;
  531.               else
  532.                 additional_changes_help = "";
  533.  
  534.               modify(path_variable,autoexec_path,autoexec_new,separator);
  535.  
  536.               modify_autoexec = yesno_dialog(instantiate(mod_autoexec_prompt),TRUE,
  537.                                              instantiate(mod_autoexec_content),
  538.                                              instantiate("%mod_autoexec_help% %additional_changes_help%"));
  539.               if (modify_autoexec)
  540.                 {
  541.                   copy_file(autoexec_bat,autoexec_old);
  542.                   move_file(autoexec_new,autoexec_bat);
  543.                   signal('FAILURE,autoexec_was_changed);
  544.                 }
  545.             }
  546.         }
  547.     }
  548.  
  549.   permit_retry_operations = FALSE;
  550. }
  551.