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

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