home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 10 Tools / 10-Tools.zip / netdorup.zip / ip20073.zip / NDCSD1.DSK / unc.dsk / CFSYSL.CMD next >
OS/2 REXX Batch file  |  1994-02-10  |  5KB  |  144 lines

  1. /***************************************************************************
  2.  * Fix for NetDoor clients                                                 *
  3.  ***************************************************************************
  4.  * Copyright (c) IBM Corporation, 1994.  Permission granted to distribute, *
  5.  * modify, or copy this program, but not to resell.                        *
  6.  ***************************************************************************
  7.  * Return Codes:                                                           *
  8.  * ─────────────                                                           *
  9.  *  100: Could not load RXUTILS.DLL.                                       *
  10.  *  101: Could not load COUENV.DLL.                                        *
  11.  *  102: Could not load COUCOPY.DLL.                                       *
  12.  *                                                                         *
  13.  *  2xx: Error xx from RxCouAssociateAppFile for SYSLEVEL.COU.             *
  14.  *  3xx: Error xx from RxCouInfo.                                          *
  15.  *  4xx: Error xx from RxCouAssociateAppFile for MAINT.HLP                 *
  16.  ***************************************************************************/
  17. parse arg Opts
  18. signal on syntax
  19. signal on novalue
  20. call on halt
  21. '@ECHO OFF'
  22. TrVal = value('CORETRACE',,'OS2ENVIRONMENT')
  23. if TrVal = '' then TrVal = 'N'
  24. trace value TrVal
  25.  
  26. if 'REGFUNC'('RXUTILS') <> 0
  27.   then exit 100
  28.  
  29. if wordpos('DEBUG', translate(Opts)) <> 0
  30.   then do
  31.     call setlocal
  32.     BDr = RxBootDrive()
  33.     OutFile = BDr'\MAINTFIX.LOG'
  34.     say '╔═════════════════════════════════════════════════════════════════════════════╗'
  35.     say '║                          Running Fix in DEBUG mode.                         ║'
  36.     say '║                            The Log File Name is:                            ║'
  37.     say '║'center(OutFile, 77)'║'
  38.     say '╚═════════════════════════════════════════════════════════════════════════════╝'
  39.     call rxPause
  40.     call value 'CORETRACE','I','OS2ENVIRONMENT'
  41.     parse source . . Me
  42.     interpret "'CALL" Me "2>"OutFile"'"
  43.     call endlocal
  44.     exit rc
  45.   end
  46.  
  47. if 'REGFUNC'('COUENV') <> 0
  48.   then exit 101
  49. if 'REGFUNC'('COUCOPY') <> 0
  50.   then exit 102
  51.  
  52. /*****************************************************************************
  53.  * Fix code begins here                                                      *
  54.  *****************************************************************************/
  55.  
  56. /* 1. Register SYSLEVEL.COU file with COUCOPY. */
  57.  
  58. RemoteFile = '[remote]\SYSLEVEL.COU'  /* Location of file on image */
  59. LocalFile  = '[system]\SYSLEVEL.COU'  /* Location of file locally */
  60.  
  61. /* Remove installation supplied dummy association (which was pointing
  62.    to the wrong place anyways). */
  63. call rxCouRemoveAppFile 'COU', '[local]\SYSLEVEL.COU'
  64.  
  65. /* Set new, correct association for file, and ensure that it keeps the
  66.    read-only bit off on each update.  Required, since the ServicePack
  67.    tool insists that syslevel files be R/O, and NetDoor 1.0 installation
  68.    doesn't expect that. */
  69. Res = rxCouAssociateAppFile('COU', RemoteFile, LocalFIle, 'AUTOUPDATE', '-R')
  70. if abbrev(Res, 'ERROR:')
  71.   then do
  72.     parse var Res ':' Res
  73.     exit 200 + Res
  74.   end
  75.  
  76. /* 2. Set up correct association for MAINT.HLP file. */
  77.  
  78. /* Identify the name of the remote directory. */
  79. if rxCouInfo('VER') = 1
  80.   then HelpDir = 'HELP'
  81.   else HelpDir = 'BOOK'
  82.  
  83. /* Check whether the COUENV we are using supports HELP. */
  84. Res = rxCouInfo('GET', 'HELP')
  85. if Res = 'ERROR:6'   /* unknown key */
  86.   then LocalHelp = '[local]\HELP'
  87.   else if abbrev(Res, 'ERROR:')
  88.     then do
  89.       parse var Res ':' Res
  90.       exit 300 + Res
  91.     end
  92.     else LocalHelp = '[help]'
  93.  
  94. /* Set up the association */
  95. Res = rxCouAssociateAppFile('MAINT', '[remote]\'HelpDir'\MAINT.HLP',,
  96.     LocalHelp'\MAINT.HLP', 'AUTOUPDATE')
  97. if abbrev(Res, 'ERROR:')
  98.   then do
  99.     parse var Res ':' Res
  100.     exit 400 + Res
  101.   end
  102.  
  103. exit 0
  104. /***********************************************************************
  105.  *                             ERROR TRAPS                             *
  106.  ***********************************************************************/
  107. BugInit:
  108. signal off error; signal off failure; signal off halt
  109. signal off novalue; signal off notready; signal off syntax
  110. parse upper source . . Me
  111. if symbol('TITLE') = 'LIT'
  112.   then Title = 'Catalog Failure'
  113. Me = Me':'||'0A'x
  114. if symbol('GLOBALS') = 'LIT'
  115.   then do
  116.     Globals = 'TrVal'
  117.     TrVal = 'O'
  118.   end
  119. return
  120.  
  121. Halt:
  122. Where = SigL
  123. call BugInit
  124. say 'Execution halted by user in line' Where
  125. XXC = 204
  126. signal DebugExit
  127.  
  128. Syntax:
  129. Where = SigL
  130. call BugInit
  131. say Me||'Syntax error' rc '('errortext(rc)') in line' Where'.'
  132. XXC = 203
  133. signal DebugExit
  134.  
  135. Novalue:
  136. Where = SigL
  137. call BugInit
  138. say 'NOVALUE error ('condition('D')') in line' Where'.'
  139. XXC = 203
  140. signal DebugExit
  141.  
  142. DebugExit:
  143. exit XXC
  144.