home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 30 fixes_v / 30-fixes_v.zip / r212sp.zip / FIXSNL.CMD < prev    next >
OS/2 REXX Batch file  |  1995-03-06  |  5KB  |  202 lines

  1. /* FIXSNL - Fix SNA-Link  */
  2. /* Part of the RemoteControl/2 1.2.02 CSD */
  3. /* Copyright 1995 -  Compuware Corporation */
  4.  
  5. /* Required files: SNLFIX.ZIP */
  6.  
  7.    /* Save the calling environment */
  8.    nRC = setlocal()
  9.  
  10.    call RxFuncAdd 'SysLoadFuncs', 'RexxUtil', 'SysLoadFuncs'
  11.    call SysLoadFuncs
  12.  
  13.     call SysCls
  14.     say''
  15.     say 'RemoteControl/2 FIX SNA-Link program.'
  16.     say ''
  17.     say 'This installation requires that all RemoteControl/2 components be shutdown.'
  18.     say 'However, this fix can still be applied if CSINIT has been executed.'
  19.     say ''
  20.     say 'Press <enter> to continue or "Q" to Quit...'
  21.     say ''
  22.     pull rsp
  23.     If rsp = 'Q' Then call fReturnOS2 '1'
  24.  
  25.     call fInitialize
  26.  
  27.    call fGetInstallationDir
  28.  
  29.    call fCheckSNALink
  30.  
  31.    say ' '
  32.    If SNALinkFound = 'Y' Then Do
  33.                                         say 'SNA-Link found on this directory.  Replacing (8) files...'
  34.                                         say ''    
  35.        '@PKUNZIP2 -o ' szSourceDriveDir || '\SNLFIX.ZIP' szTargetDriveDir 
  36.   End
  37.   Else Do
  38.                                         say 'SNA-Link not found on this directory.'
  39.     say 'Press <enter> to exit.'
  40.     pull .
  41.     call fReturnOS2 '1'
  42.   End
  43.   say ' '
  44.  
  45.    if rc = 0 then do
  46.        say 'The fix has been applied successfully.'
  47.        say 'You may begin using RemoteControl/2 immediately.'
  48.    end
  49.    else do
  50.         say 'Error copying files.'
  51.         say ''
  52.         say 'Please make sure that the following RemoteControl/2 components are not running:'
  53.         say ''
  54.         say 'Administrator, Remote Services, Local Directory Services,' 
  55.         say 'Master Directory Services, and SNA-Link'
  56.         say ''
  57.        end
  58.  
  59.    call fReturnOS2 '0'
  60.  
  61. EXIT
  62.  
  63. /* --------------------------------------------- */
  64. /*                Setup Variable                 */
  65. /* ----------------------------------------------*/
  66.  
  67. fInitialize:
  68.  
  69.    SNALinkFound = 'N'
  70.        
  71.    NO            = 0
  72.    YES           = 1
  73.  
  74.    szSourceDrive    = ' '
  75.    szSourceDir      = ' '
  76.    szSourceDriveDir = ' '
  77.  
  78.    szTargetDrive    = 'C:'
  79.    szTargetDir      = '\REMCON2'
  80.    szTargetDriveDir = 'C:\REMCON2'
  81.  
  82.    szAnswer      = ''
  83.    szTemp1       = ''
  84.    szLocalDrives = ''
  85.    szWorkDrives  = ''
  86.  
  87.    nRC             = 0
  88.    nReturnCode     = 0
  89.    nStrLength      = 0
  90.    nRow            = 0
  91.    nCol            = 0
  92.  
  93.          /* No source drive and dir was passed as a parameter */
  94.          /* get the base drive from which install was started */
  95.          call fGetStartDrive
  96.          szSourceDrive = RESULT
  97.  
  98.          /* get the base directory from which install was started */
  99.          call fGetStartDir
  100.          szSourceDir = RESULT
  101.          if szSourceDir = '\'
  102.             then szSourceDir = ''
  103.          szSourceDriveDir = szSourceDrive || szSourceDir
  104.  
  105.    return
  106.  
  107. /*  Ask for a directory to install the software in                     */
  108. /*---------------------------------------------------------------------*/
  109.  
  110. fGetInstallationDir:
  111.  
  112.    szTargetDriveDir = ''
  113.  
  114.    do while length(szTargetDriveDir) = 0
  115.  
  116.       call SysCls
  117.      
  118.       say ''
  119.       say 'Enter the drive and directory in which RemoteControl/2 has been installed'
  120.       say 'or press <enter> for the default:  C:\REMCON2'
  121.       say''
  122.                 
  123.       pull szAnswer
  124.  
  125.       if szAnswer = '' then
  126.          szAnswer = 'C:\REMCON2'
  127.  
  128.       if substr(szAnswer, 2, 1) = ':' then do
  129.  
  130.          szTargetDrive = substr(szAnswer, 1, 1) || ':'
  131.          nStrLength = length(szAnswer)
  132.          szTargetDir = substr(szAnswer, 3)
  133.          szTargetDriveDir = szTargetDrive || szTargetDir
  134.  
  135.          call SysFileTree szTargetDriveDir||'\CWNETB2.DLL', szFiles,'F'
  136.          if szFiles.0 = 0 then do
  137.             say ''
  138.             say 'RemoteControl/2 files not found in 'szTargetDriveDir
  139.             say ''
  140.             say 'Press <enter> to Retry or "Q" to Quit...' 
  141.             say ''
  142.             pull szAnswer2
  143.            If szAnswer2 = 'Q' Then 
  144.              call fReturnOS2 '1'
  145.            Else 
  146.              call fGetInstallationDir
  147.         end /* if szFiles.0=0 */
  148.  
  149.        
  150.       end /* if */
  151.  
  152.    end /* do */
  153.  
  154.    return
  155.  
  156.  
  157.  
  158. /*---------------------------------------------------------------------*/
  159. /*  Determine whether SNA-Link is installed              */
  160. /*---------------------------------------------------------------------*/
  161.  
  162. fCheckSNALink:
  163.  
  164.    call SysFileTree szTargetDriveDir||'\SNALINK.EXE', szFiles,'SFO'
  165.    if szFiles.0 = 1 then 
  166.         SNALinkFound = 'Y'
  167.     return
  168.  
  169. /*------------------------------------------------------------------------*/
  170.  
  171. fGetStartDrive:
  172. Procedure
  173.  
  174.    parse source IsCmd IsOS2 MyCmdLine
  175.    MyDrive = substr(MyCmdLine, 1, 2)
  176.    return MyDrive
  177.  
  178. /*------------------------------------------------------------------------*/
  179. /*  Return the starting drive subdirectory. IE A:\MYLIB\STARTIT\SETUP.CMD */
  180. /*  will result in a RETURN of \MYLIB\STARTIT                             */
  181. /*------------------------------------------------------------------------*/
  182.  
  183. fGetStartDir:
  184. Procedure
  185.  
  186.    parse source IsCmd IsOS2 MyCmdLine
  187.    szWork = filespec('PATH', MyCmdLine)
  188.    szStrLength = length(szWork)
  189.    if szStrLength < 2
  190.       then return '\'
  191.       else return substr(szWork, 1, szStrLength - 1)
  192.  
  193.  
  194. /* Exit REXX program */
  195. fReturnOS2:
  196. Procedure
  197. Arg nReturnCode
  198.  
  199.    nRC = endlocal()
  200.    EXIT nReturnCode
  201.  
  202.