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

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