home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 10 Tools / 10-Tools.zip / netdor4.zip / SETUP / CONFIG.CMD next >
OS/2 REXX Batch file  |  1996-04-04  |  39KB  |  1,123 lines

  1. /* 2>nul
  2. @echo. & echo Procedures Language 2/REXX is not installed. & echo Use Selective Install to install REXX, then try again. & goto :end 2>nul
  3. */
  4. /****************************************************************************
  5.  *                            COU Configuration                             *
  6.  ****************************************************************************
  7.  *                    Licensed Materials-Property of IBM                    *
  8.  *               5604-472 (c) Copyright IBM Corporation, 1993               *
  9.  *                           All rights reserved.                           *
  10.  *                 US Government Users Restricted Rights -                  *
  11.  *                Use, duplication or disclosure restricted                 *
  12.  *               by GSA ADP Schedule Contract with IBM Corp.                *
  13.  ****************************************************************************
  14.  * Parameters:                                                              *
  15.  *   /R:response file name (fully qualified)                                *
  16.  *   /S:source directory (assumed to exist)                                 *
  17.  *   /L1:log file name (fully qualified)                                    *
  18.  ****************************************************************************
  19.  * Internal Revision A.1 - 20 Apr 93                                        *
  20.  * Revision 1.0 - 1 May 93                                                  *
  21.  ****************************************************************************/
  22. trace 'O'
  23. TrVal = value('COUTRACE','','OS2ENVIRONMENT')
  24. if TrVal = ''
  25.   then TrVal = 'O'
  26. trace value TrVal
  27. '@ECHO OFF'
  28. signal on syntax
  29. signal on novalue
  30. signal on halt
  31. parse upper arg Args
  32. Ctl.!DispEnv = 0
  33. Ctl.!DispRsp = 0
  34. Ctl.!Verbose = 'OFF'
  35. Ctl.!Jump = ''
  36.  
  37. /*****************************************************************************
  38.  *                                   MAIN                                    *
  39.  *****************************************************************************/
  40. Globals = 'Env Ctl. File. TrVal XCmd.'
  41. XCmd.0 = 0
  42. XC = Initialize()
  43. if XC = 0
  44.   then do
  45.     XC = Configure()
  46.     if XC = 0
  47.       then do
  48.         call LabelDrives
  49.         XC = 'FE00'
  50.       end
  51.   end
  52. call Xit XC
  53. exit XC
  54.  
  55. Xit: procedure expose (Globals)
  56. parse arg XC
  57. if XC = 0
  58.   then XC = '0000'
  59. signal off novalue
  60. /**** PTR 10027 start ****/
  61. if symbol('Ctl.!AppName') = 'VAR' & value('CTL.!RXUTILS') = 1
  62.   then call rxOs2Ini 'USER', Ctl.!AppName, 'RC', XC||d2c(0)
  63. /**** PTR 10027 end ****/
  64. signal on syntax name Cont1
  65. call rxDropFuncs
  66. Cont1:
  67. call rxfuncdrop 'RXCOUENV'
  68. signal off syntax
  69. signal off novalue
  70. do J = 1 to XCmd.0
  71.   XCmd.J
  72. end
  73. exit XC
  74.  
  75. /*****************************************************************************
  76.  * INITIALIZE                                                                *
  77.  *****************************************************************************/
  78. Initialize: procedure expose (Globals) Args
  79. trace value TrVal
  80. say 'Initializing...'
  81. call setlocal
  82. parse source . . File.!Me
  83. File.!MyPath = left(File.!Me, lastpos('\', File.!Me))
  84. /* e.g., "A:\SETUP\" or "Z:\COUINST\SETUP\" */
  85. File.!RootPath = left(File.!MyPath, lastpos('\', left(File.!MyPath,,
  86.     length(File.!MyPath)-1)))
  87. /* e.g., "A:\" or "Z:\COUINST\" */
  88.  
  89. Ctl.!Args = Args  /* Save args */
  90. Args  = translate(Args, ':', '=')
  91. parse var Args '/R:' RspFile . '/' 1 '/S:' SrcDir . '/' 1 '/L1:' File.!Log .,
  92.     '/' 1 '/ITL:' Ctl.!ItlList . '/'
  93.  
  94. parse upper value value('PATH',,'OS2ENVIRONMENT') with ':\OS2;' -1 Ctl.!BDr +2
  95. if File.!Log = ''
  96.   then File.!Log = Ctl.!BDr'\OS2\INSTALL\NETDOOR.LOG'
  97. call lineout File.!Log, 'Args:' Ctl.!Args
  98. call stream File.!Log, 'C', 'CLOSE'
  99. if SrcDir <> ''
  100.   then do
  101.     File.!RootPath = strip(SrcDir, 'T', '\')'\'
  102.     File.!MyPath = File.!RootPath'SETUP\'
  103.   end
  104. if length(File.!RootPath) > 3
  105.   then File.!SourceDir = strip(File.!RootPath, 'T', '\')
  106.   else File.!SourceDir = File.!RootPath
  107. Ctl.!Test = (wordpos('/TEST', Args) > 0)
  108. /**** PTR 10034 start ****/
  109. Ctl.!NoInt = (wordpos('/NOINT', Args) > 0) | Ctl.!Test |,
  110.     (value('CAS_STATE',,'OS2ENVIRONMENT') <> '')
  111. /**** PTR 10034 end ****/
  112. if Ctl.!Test
  113.   then 'PKUNZIP2 -o' File.!RootPath'SETUP\INSTDLL.ZIP' Ctl.!BDr'\OS2\DLL >>',
  114.       File.!Log '2>&1'
  115.  
  116. Ctl.!AppName = 'CREQINST'
  117. RspFile = strip(RspFile)
  118.  
  119. RxUtils = Ctl.!BDr'\OS2\DLL\RXUTILS.DLL'
  120. 'COPY' File.!RootPath'DATA\DLL\RXUTILS.DLL' RxUtils '> NUL 2>&1'
  121. CouEnv = Ctl.!BDr'\OS2\DLL\COUENV.DLL'
  122. 'COPY' File.!RootPath'DATA\DLL\COUENV.DLL' CouEnv '> NUL 2>&1'
  123. call LoadExtFuncs
  124.  
  125. call rxOs2Ini 'USER', Ctl.!AppName, 'REXXERROR', '$RXDEL'
  126. /**** PTR 10027 start ****/
  127. call rxOs2Ini 'USER', Ctl.!AppName, 'RC', '1604'||d2c(0)
  128. /**** PTR 10027 end ****/
  129. call rxOs2Ini 'USER', Ctl.!Appname, 'Install XCode', 997
  130.  
  131. Ctl.!LanInst = (word(rxDriveInfo(left(File.!MyPath, 2),,
  132.     'FSINFO', 'NOFORMAT'), 5) = 'LAN')
  133. /**** PTR 70 start ****/
  134. Ver = rxCouInfo('VER')
  135. if verify(Ver, '10') > 0
  136.   then call Error 'Error "'Ver'" from COUENV.', '0816', 403
  137. if Ver
  138.   then do
  139.     Ctl.!InstClass = 'PRODUCT'
  140.     Ctl.!IniApp = 'COU'
  141.   end
  142.   else do
  143.     Ctl.!InstClass = 'IUO'
  144.     Ctl.!IniApp = 'CORE'
  145.   end
  146. call rxOs2Ini 'USER', Ctl.!IniApp, 'IniFile', '$RXDEL'
  147. /**** PTR 70 end ****/
  148.  
  149. /**** PTR 235 moved ****/
  150. EtcDir = value('ETC',,'OS2ENVIRONMENT')
  151. if EtcDir = ''
  152.   then EtcDir = 'C:\ETC'
  153. if rxDirExist(EtcDir)
  154.   then Ctl.!Etc = strip(EtcDir, 'T', '\')'\'
  155.   else Ctl.!Etc = ''
  156. /**** PTR 235 end ****/
  157.  
  158. Ctl.!Prefix = 'COU'
  159. Ctl.!BDr = rxBootDrive()
  160. /**** PTR 235 moved following lines ****/
  161. call value 'PATH', File.!RootPath'TOOLS;'value('PATH',,'OS2ENVIRONMENT'),,
  162.     'OS2ENVIRONMENT'
  163. call value 'DPATH', File.!RootPath'TOOLS;'value('DPATH',,'OS2ENVIRONMENT'),,
  164.     'OS2ENVIRONMENT'
  165. /**** PTR 235 end *****/
  166. XC = ReadRspFile(RspFile)
  167. if XC > 0
  168.   then return XC
  169.  
  170. File.!SysLvl = File.!RootPath'DISK_1\SYSLEVEL.'Ctl.!Prefix
  171. if rxFileExist(File.!SysLvl)
  172.   then Ctl.!VerNum = rxSysLevel(File.!SysLvl, 'VER')
  173.   else Ctl.!VerNum = '?'
  174.  
  175. call BuildDriveMaps
  176. call GetIniInfo
  177. call GetOthDomains
  178. if Ctl.INSTTYPE = 'SERVER'
  179.   then call FindMaster
  180.   else Ctl.!MasterFile = ''
  181. return 0
  182.  
  183. /****************************************************************************
  184.  * LOADEXTFUNCS                                                             *
  185.  * Load External Functions                                                  *
  186.  ****************************************************************************/
  187. LoadExtFuncs: procedure expose (Globals)
  188. trace value TrVal
  189. call rxfuncadd 'RXLOADFUNCS', 'RXUTILS', 'RXLOADFUNCS'
  190. signal on syntax name LoadRxUtils2
  191. Ver = rxLoadFuncs('QUIET')
  192. signal on syntax name syntax
  193. Ctl.!RxUtils = 1
  194.  
  195. if rxOs2Ver() >= 2.0
  196.   then do
  197.     if \rxfuncquery('SYSDROPFUNCS')
  198.       then do
  199.         signal on syntax name LoadRexxUtil
  200.         call SysDropFuncs
  201.       end
  202.     call LoadRexxUtil
  203.   end
  204.  
  205. call rxfuncadd 'RXCOUINFO', 'COUENV', 'RXCOUINFO'
  206. signal on syntax name NoCouEnv
  207. call rxCouInfo 'VER'
  208. signal on syntax name syntax
  209.  
  210. call rxfuncadd 'RXCOUCOPY', 'COUCOPY', 'RXCOUCOPY'
  211. call rxfuncadd 'RXCOUASSOCIATEAPPFILE', 'COUCOPY', 'RXCOUASSOCIATEAPPFILE'
  212.  
  213. return 0
  214.  
  215. LoadRxUtils2:
  216. signal on syntax name syntax
  217. call Error 'RXUTILS.DLL could not be initialized.', '0800', 100
  218.  
  219. LoadRexxUtil:
  220. if rxOs2Ver() = 2.0
  221.   then 'PKUNZIP2 -o' File.!RootPath'DISK_1\CLIENT.ZIP' Ctl.!BDr'\OS2\DLL',
  222.         'REXXUTIL.DLL >>' File.!Log '2>&1'
  223. signal on syntax name syntax
  224. call rxfuncadd 'SYSLOADFUNCS', 'REXXUTIL', 'SYSLOADFUNCS'
  225. call sysLoadFuncs
  226. return 0
  227.  
  228. NoCouEnv:
  229. signal on syntax name syntax
  230. call Error 'COUENV.DLL could not be initialized.', '0800', 101
  231.  
  232. /*****************************************************************************
  233.  * READRSPFILE                                                               *
  234.  *****************************************************************************/
  235. ReadRspFile: procedure expose (Globals)
  236. trace value TrVal
  237. parse arg RspFile ., Recurse
  238. Recurse = (Recurse <> '')
  239. if RspFile = ''
  240.   then call Error 'Incorrect invocation.  (CONFIG should only be invoked',
  241.       'from INSTALL.EXE.)', '1600', 501
  242. /*** PTR 10091 start ***/
  243. if stream(RspFile, 'C', 'QUERY EXISTS') = ''
  244.   then do
  245.     Temp = rxSearchPath('DPATH', RspFile)
  246.     if Temp = ''
  247.       then call Error 'The file' RspFile 'does not exist.', '0800', 102
  248.       else RspFile = Temp
  249.   end
  250. /*** PTR 10091 end ***/
  251. Size = stream(RspFile, 'C', 'QUERY SIZE')
  252. Data = charin(RspFile, 1, Size)
  253. call stream RspFile, 'C', 'CLOSE'
  254. if \Recurse
  255.   then do
  256.     do queued(); pull .; end     /**** PTR 235 added ****/
  257.     Found. = 0
  258.     Ctl.!LogDoms = ''
  259.     Ctl.!NfsSrv = ''
  260.     /* Assume no CMPVM */
  261.     call value Ctl.!Prefix'.CPMVM', 'N', 'OS2ENVIRONMENT'
  262.     MaxDom = 4
  263.     LogDomFound = 0
  264.     NfsSrvFound = 0
  265. /**** PTR 235 start ****/
  266.     NumHosts = 0
  267.     OldGlobals = Globals
  268.     Globals = Globals 'OldGlobals Found. MaxDom LogDomFound NfsSrvFound',
  269.         'NumHosts'
  270.   end
  271.  
  272. Data = Data'0D0A'x
  273. do while Data <> ''
  274.   parse var Data Line '0D0A'x Data
  275.   if Line = '' | abbrev(Line, '*') | pos('1A'x, Line) > 0
  276.     then iterate
  277.   parse var Line Key . '=' KVal
  278.   Key = translate(Key)
  279.   KVal = strip(KVal)
  280.   call lineout File.!Log, Key'='KVal
  281.   if Key = 'INCLUDE'
  282.     then do
  283.       Orig = KVal
  284.       File = stream(KVal, 'C', 'QUERY EXISTS')
  285.       if File = ''
  286.         then KVal = rxSearchPath('DPATH', KVal)
  287.         else KVal = File
  288.       if KVal <> ''
  289.         then call ReadRspFile KVal, 'RECURSE'
  290.         else call Error 'Warning: INCLUDE file "'Orig'" does not exist.'
  291.       iterate
  292.     end
  293.  
  294.   parse var Key Type '.' Key
  295.   if Type <> 'I'
  296.     then iterate
  297.   Found.Key = 1
  298.   select
  299.     when abbrev(Key, 'LOGDOMAIN') then do
  300.       Ctl.!LogDoms = Ctl.!LogDoms KVal '|'
  301.       LogDomFound = LogDomFound + 1
  302.     end
  303.     when abbrev(Key, 'NFSSRV') then do
  304.       Ctl.!NfsSrv = Ctl.!NfsSrv KVal '|'
  305.       NfsSrvFound = NfsSrvFound + 1
  306.     end
  307.     when Key = 'CDR' then do
  308.       Key = 'REMOTE'
  309.       if length(KVal) = 2
  310.         then KVal = KVal'\'
  311.         else if length(KVal) > 3
  312.           then KVal = strip(KVal, 'T', '\')
  313.       if right(KVal, 1) <> '\'
  314.         then RemPath = KVal'\'
  315.         else RemPath = KVal
  316.       call value Ctl.!Prefix'.REMOTEPATH', RemPath, 'OS2ENVIRONMENT'
  317.     end
  318.     when Key = 'UDR' then do
  319.       Key = 'LOCAL'
  320.       if length(KVal) = 2
  321.         then KVal = KVal'\'
  322.         else if length(KVal) > 3
  323.           then KVal = strip(KVal, 'T', '\')
  324.       if right(KVal, 1) <> '\'
  325.         then LocPath = KVal'\'
  326.         else LocPath = KVal
  327.       call value Ctl.!Prefix'.LOCALPATH', LocPath, 'OS2ENVIRONMENT'
  328.     end
  329.     when Key = 'HOSTSYS'
  330.       then KVal = translate(KVal, ',', ' ')
  331.     when Key = 'HOSTADDS' then do
  332.       do NumHosts = NumHosts + 1 while KVal <> ''
  333.         parse var KVal HName ',' HAddr KVal
  334.         queue 'CMD' HAddr HName '# Added by NetDoor installation'
  335.       end
  336.       NumHosts = NumHosts - 1
  337.       iterate
  338.     end
  339.     otherwise nop
  340.   end /* select */
  341. /**** PTR 235 end ****/
  342.   Ctl.Key = KVal
  343.   call value Ctl.!Prefix'.'Key, KVal, 'OS2ENVIRONMENT'
  344.   if Ctl.!DispRsp
  345.     then call Error Ctl.!Prefix'.'Key':' KVal
  346. end /* do */
  347. call stream File.!Log, 'C', 'CLOSE'
  348.  
  349. if \Recurse
  350.   then do
  351. /*** PTR 104 start ***/
  352.     if symbol('Ctl.IMAGEDRIVE') = 'LIT'
  353.       then do
  354.         Ctl.IMAGEDRIVE = 'NONE'
  355.         call value Ctl.!Prefix'.IMAGEDRIVE', 'NONE', 'OS2ENVIRONMENT'
  356.       end
  357.     if symbol('Ctl.DATADRIVE') = 'LIT'
  358.       then do
  359.         Ctl.DATADRIVE = 'NONE'
  360.         call value Ctl.!Prefix'.DATADRIVE', 'NONE', 'OS2ENVIRONMENT'
  361.       end
  362. /*** PTR 104 end ***/
  363.     call CheckRspFile
  364.     if Ctl.INSTTYPE = 'SERVER'
  365.       then do
  366.         Ctl.STARTUP = 'CMD'
  367.         call value Ctl.!Prefix'.STARTUP', 'CMD', 'OS2ENVIRONMENT'
  368.       end
  369.     do I = LogDomFound + 1 to MaxDom
  370.       Ctl.!LogDoms = Ctl.!LogDoms '|'
  371.     end I
  372.     Ctl.!LogDoms = strip(strip(Ctl.!LogDoms), 'T', '|')
  373.     call value Ctl.!Prefix'.LOGDOMS', Ctl.!LogDoms, 'OS2ENVIRONMENT'
  374.     do I = NfsSrvFound + 1 to MaxDom
  375.       Ctl.!NfsSrv = Ctl.!NfsSrv '|'
  376.     end I
  377.     Ctl.!NfsSrv = strip(strip(Ctl.!NfsSrv), 'T', '|')
  378.     call value Ctl.!Prefix'.NFSSRV', Ctl.!NfsSrv, 'OS2ENVIRONMENT'
  379.  
  380. /**** PTR 235 start ****/
  381.     if NumHosts > 0
  382.       then do
  383.         if Ctl.!Etc = ''
  384.           then call Error 'Required TCP/IP ETC directory not found.',,
  385.               '1604', 205
  386.         Hosts = Ctl.!Etc'HOSTS'
  387.         call Error 'Modifying' Hosts'...'
  388.         push 'EVAL SetCurL("BOTTOM")'
  389.         push 'RF' Hosts
  390.         push 'MSGMODE OFF,' File.!Log
  391.         queue 'WF J:\, N='Ctl.!Prefix
  392.         queue 'WF' Ctl.!BDr'\OS2\INSTALL, N='Ctl.!Prefix
  393.         XC = 'IMPIT'('/R:QUEUE COUINST 0')
  394.         if XC <> 0
  395.           then call Error 'Error' XC 'modifying' Hosts, '1604', 201
  396.       end
  397. /**** PTR 235 end ****/
  398.     Globals = OldGlobals
  399.   end
  400. return 0
  401.  
  402. CheckRspFile: procedure expose (Globals)
  403. /* Basic client */
  404. call CheckRspFile2 'INSTTYPE ACCMETH UDR CDR STARTUP'
  405. /* Conditional client */
  406. select
  407.   when Ctl.ACCMETH = 'NETBIOS'
  408.     then call CheckRspFile2 'LOGDOMAIN1'
  409.   when Ctl.ACCMETH = 'NFS'
  410.     then call CheckRspFile2 'NFSSRV1'
  411. /**** PTR 233 start ****/
  412.   otherwise do
  413.     call Error 'Unexpected access method "' Ctl.ACCMETH '".',,
  414.         '0816', 404
  415.   end
  416. /**** PTR 233 end ****/
  417. end
  418. /* Server */
  419. if Ctl.INSTTYPE = 'SERVER'
  420.   then do
  421.     call CheckRspFile2 'SRVPROTOCOL IMAGEDRIVE DATADRIVE MASTER'
  422.     if wordpos('NETBIOS', Ctl.SRVPROTOCOL) > 0
  423.       then do
  424.         call CheckRspFile2 'SRVTYPE'
  425.         if Ctl.IMAGEDRIVE <> 'NONE'
  426.           then call CheckRspFile2 'ALIAS'
  427.       end
  428.     if Ctl.IMAGEDRIVE = 'NONE' & Ctl.DATADRIVE = 'NONE'
  429.       then call Error 'Server role is not defined.', '1604', 202
  430.   end
  431. return 0
  432.  
  433. CheckRspFile2: procedure expose (Globals)
  434. parse upper arg Reqd
  435. do I = 1 to words(Reqd)
  436.   parse var Reqd RKey Reqd
  437.   if \Found.RKey
  438.     then call Error 'Response file is incomplete:' RKey, '1604', 200
  439. end
  440. return 0
  441.  
  442. /*****************************************************************************
  443.  * BUILDDRIVEMAPS                                                            *
  444.  *****************************************************************************/
  445. BuildDriveMaps: procedure expose (Globals)
  446. Ctl.!Map = space(translate(rxDriveMap('C:', 'LOCAL'), '', ':'))
  447. parse value '' with Ctl.!Unformat Ctl.!CDMap Ctl.!FatMap Ctl.!HpfsMap Ctl.!VDisks
  448. do I = words(Ctl.!Map) to 1 by -1
  449.   Dr = subword(Ctl.!Map, I, 1)
  450.   parse upper value rxDriveInfo(Dr, 'FSINFO') with Info
  451.   if Info = 'TYPE=' then Info = ''   /* RXUTILS 1.71 bug */
  452.   if Info = ''
  453.     then Ctl.!Unformat = Dr Ctl.!Unformat
  454.     else do
  455.       parse upper var Info 'LABEL=' Label . 'FREE=' Free . 'TYPE=' Type .
  456.       select
  457.         when wordpos(Label, 'OS2VDISK VFDISK') > 0
  458.           then Ctl.!VDisks = Dr||Ctl.!VDisks
  459.         when Type = 'CDFS'
  460.           then Ctl.!CDMap = Dr||Ctl.!CDMap
  461.         when Type = 'HPFS'
  462.           then Ctl.!HpfsMap = Dr||Ctl.!HpfsMap
  463.         when Type = 'FAT'
  464.           then Ctl.!FatMap = Dr||Ctl.!FatMap
  465.         otherwise
  466.           nop
  467.       end
  468.     end
  469. end
  470.  
  471. do queued(); pull .; end
  472. if IniGet('USER', Ctl.!AppName, 'LSCSD') < 8000 then
  473.    'CACHE386 /STATS 2>&1 | RXQUEUE'
  474. Ctl.!Hpfs386 = 1
  475. do queued()
  476.   pull Error ':' Line
  477.   if length(Error) = 7
  478.     then if abbrev(Error, 'CAC') | abbrev(Error, 'SYS')
  479.       then Ctl.!Hpfs386 = 0
  480. end
  481. return 0
  482.  
  483. /*****************************************************************************
  484.  * GETINIINFO                                                                *
  485.  *****************************************************************************/
  486. GetIniInfo: procedure expose (Globals)
  487. trace value TrVal
  488. call SetInfo 'OS2', IniGet('USER', Ctl.!AppName, 'OS2CSD')
  489. call SetInfo 'LR', IniGet('USER', Ctl.!AppName, 'LRCSD')
  490. call SetInfo 'LS', IniGet('USER', Ctl.!AppName, 'LSCSD')
  491. call SetInfo 'CM', IniGet('USER', Ctl.!AppName, 'CMCSD')
  492. call SetInfo 'CM2', IniGet('USER', Ctl.!AppName, 'CM2CSD')
  493. call SetInfo 'LAP', IniGet('USER', Ctl.!AppName, 'LAPSCSD')
  494. call SetInfo 'TCP', IniGet('USER', Ctl.!AppName, 'TCPCSD')
  495. return 0
  496.  
  497. IniGet: procedure expose (Globals)
  498. trace value TrVal
  499. parse arg File, App, Key
  500. Res = rxOs2Ini(File, App, Key)
  501. if wordpos(Res, '$RXERROR $INIERROR $INI_ERROR') >0 | abbrev(Res, 'ERROR:')
  502.   then Res = ''
  503. return Res
  504.  
  505. SetInfo: procedure expose (Globals)
  506. trace value TrVal
  507. parse arg Comp, Dr Csd Ver Name
  508. Ctl.Comp = Dr Csd Ver Name
  509. if Dr <> ''
  510.   then do
  511.     EVar = Ctl.!Prefix'.'Comp
  512.     call value EVar'DRIVE', Dr, 'OS2ENVIRONMENT'
  513.     call value EVar'CSD', substr(Csd, 4), 'OS2ENVIRONMENT'
  514.     call value EVar'VER', Ver, 'OS2ENVIRONMENT'
  515.     call value EVar'NAME', Name, 'OS2ENVIRONMENT'
  516.   end
  517. return 0
  518.  
  519. /*****************************************************************************
  520.  * GETOTHDOMAINS                                                             *
  521.  *****************************************************************************/
  522. GetOthDomains: procedure expose (Globals)
  523. trace value TrVal
  524. Ctl.!IniOthDom = ''
  525. if Ctl.AccMeth = 'NETBIOS'
  526.   then do
  527.     parse var Ctl.LR Dr Csd .
  528.     call rxGrep 'OTHDOMAINS', Dr'\IBMLAN\IBMLAN.INI', 'HITS'
  529.     do J = 1 to Hits.0 while Ctl.!IniOthDom = ''
  530.       if \abbrev(Hits.J, ';')
  531.         then parse var Hits.J '=' Ctl.!IniOthDom
  532.     end
  533.     Ctl.!IniOthDom = translate(strip(Ctl.!IniOthDom), ' ', ',')
  534.     PriDomain = IniGet('USER', Ctl.!AppName, 'LRDOMAIN')
  535.     Temp = translate(Ctl.!LogDoms, ' ', '|')
  536.     do while words(Ctl.!IniOthDom) < 4 & Temp <> ''
  537.       parse var Temp Dom Temp
  538.       if wordpos(Dom, PriDomain Ctl.!IniOthDom) = 0
  539.         then Ctl.!IniOthDom = strip(Ctl.!IniOthDom Dom)
  540.     end
  541.     if word(Ctl.LR, 2) >= 6000
  542.       then Ctl.!IniOthDom = translate(Ctl.!IniOthDom, ',', ' ')
  543.   end
  544. return 0
  545.  
  546. /*****************************************************************************
  547.  * FINDMASTER                                                                *
  548.  *****************************************************************************/
  549. FindMaster: procedure expose (Globals)
  550. trace value TrVal
  551. say 'Querying master server.'
  552. say 'Please be patient.  This can take a while...'
  553. File = 'SERVERS.COR'
  554. ImageDir = 'COUIMAGE'
  555.  
  556. Netbios = wordpos('NETBIOS', Ctl.SRVPROTOCOL) > 0
  557. Nfs = wordpos('NFS', Ctl.SRVPROTOCOL) > 0
  558. parse value '?' with 1 NName 1 NDom 1 TName
  559. if Netbios
  560.   then do
  561.     parse value rxUserInfo() with . NName NDom
  562.   end
  563. if Nfs
  564.   then do
  565. /**** PTR 139 start ****/
  566. /*    PreQ = queued()*/
  567. /*    'HOSTNAME 2>NUL | RXQUEUE /LIFO'*/
  568. /*    if queued() > PreQ*/
  569. /*      then pull TName '.'*/
  570. /**** PTR 139 end ****/
  571.       TName = value('HOSTNAME','','OS2ENVIRONMENT')
  572.   end
  573.  
  574. /**** PTR 10052 start ****/
  575. Mstr = ''
  576. /**** PTR 10052 end ****/
  577. if Ctl.MASTER <> '<HERE>'
  578.   then do
  579.     Ctl.MASTER = strip(Ctl.MASTER, 'L', '\')
  580.     DataRes = rxCouInfo('GET', 'DATARES')
  581.     select
  582.       when Ctl.ACCMETH = 'NETBIOS'
  583.         then Mstr = FindMaster.Netbios(Ctl.MASTER, DataRes, File)
  584.       when Ctl.ACCMETH = 'NFS'
  585.         then Mstr = FindMaster.Nfs(Ctl.MASTER, DataRes, File)
  586.       otherwise Mstr = ''
  587.     end
  588.     if Mstr = ''
  589.       then call Error 'Could not link to master server' Ctl.MASTER'.',,
  590.           '0812', 300
  591.     Ctl.!MasterFile = strip(Mstr, 'T', '\')'\'File
  592.     call CheckData Ctl.!MasterFile, NName, TName
  593.   end
  594.   else do
  595.     Ctl.!MasterFile = Ctl.!BDr'\OS2\INSTALL\'File
  596.     Temp.0 = 0
  597. /**** PTR 10018 start ****/
  598.     if NFS
  599.       then TDName = '_'TName
  600. /**** PTR 10018 end ****/
  601.     if Netbios & Nfs & NName = TName
  602.       then do
  603. /**** PTR 10018 start ****/
  604.         call GenDomainEntry NDom, 1, 0, NName
  605. /**** PTR 10036 start ****/
  606.         call GenDomainEntry TDName, 0, 1, TName, TName
  607. /**** PTR 10036 end ****/
  608. /**** PTR 10018 end ****/
  609.         call GenServerEntry NName, 1, 1, Ctl.ALIAS, Ctl.IMAGEDRIVE'\'||,
  610.             ImageDir
  611.       end
  612.       else do
  613. /**** PTR 10010 start ****/
  614.         if Netbios
  615.           then do
  616.             call GenDomainEntry NDom, 1, 0, NName
  617.             call GenServerEntry NName, 1, 0, Ctl.ALIAS
  618.           end
  619.         if Nfs
  620.           then do
  621. /**** PTR 10018 start ****/
  622. /**** PTR 10036 start ****/
  623.             call GenDomainEntry TDName, 0, 1, TName, TName
  624. /**** PTR 10036 end ****/
  625. /**** PTR 10018 end ****/
  626.             call GenServerEntry TName, 0, 1, , Ctl.IMAGEDRIVE'\'ImageDir
  627.           end
  628.       end
  629. /**** PTR 10010 end ****/
  630.  
  631.     call rxStemInsert 'TEMP.', Temp.0+1, ':nick.!CONTROL'
  632.     call rxStemInsert 'TEMP.', Temp.0+1, ':savepw.YES'
  633.     call rxWrite Ctl.!MasterFile, 'TEMP.'
  634.     call rxStemInsert 'TEMP.', 1, center(' Master SERVERS.COR ', 30, '-')
  635.     call rxWrite File.!Log, 'TEMP.', Temp.0, 1, 'A'
  636.     call rxStemInsert 'TEMP.', Temp.0+1, copies('-', 30)
  637.   end
  638. return 0
  639.  
  640. CheckData: procedure expose (Globals)
  641. parse arg NameFile, NEntry, TEntry
  642. if Resolve('NAMEFIND') = ''
  643.   then call Error 'NAMEFIND not found.', '1604', 204
  644. Sep = '1A'x
  645. if NEntry <> '' & NEntry <> '?'
  646.   then do
  647.     Data = translate('NAMEFIND'(NameFile ':NICK' NEntry))
  648.     if Data = 'ERROR:3'
  649.       then call Error 'Entry for' NEntry 'not found in' NameFile'.',,
  650.           '0816', 400
  651.     if abbrev(Data, 'ERROR:')
  652.       then call Error 'Error' Data 'searching for' NEntry 'in' NameFile'.',,
  653.           '0816', 402
  654. /*** PTR 104 start ***/
  655.     if Ctl.IMAGEDRIVE <> 'NONE'
  656. /*** PTR 104 end ***/
  657.       then do
  658.         parse var Data ':ID.' Image (Sep)
  659.         if Image = ''
  660.           then call Error NEntry 'in' NameFile 'missing ID tag.',,
  661.               '0816', 401
  662.       end
  663.   end
  664. if TEntry <> '' & TEntry <> '?'
  665.   then do
  666.     Data = translate('NAMEFIND'(NameFile ':NICK' TEntry))
  667.     if Data = 'ERROR:3'
  668.       then call Error 'Entry for' TEntry 'not found in' NameFile'.',,
  669.           '0816', 400
  670.     if abbrev(Data, 'ERROR:')
  671.       then call Error 'Error' Data 'searching for' TEntry 'in' NameFile'.',,
  672.           '0816', 402
  673. /*** PTR 104 start ***/
  674.     if Ctl.IMAGEDRIVE <> 'NONE'
  675. /*** PTR 104 end ***/
  676.       then do
  677.         parse var Data ':NFS.' Image (Sep)
  678.         if Image = ''
  679.           then call Error TEntry 'in' NameFile 'missing NFS tag.',,
  680.               '0816', 401
  681.       end
  682. /*** PTR 149 start ***/
  683.   end
  684. /*** PTR 149 end ***/
  685. return 0
  686.  
  687. GenDomainEntry: procedure expose (Globals) Temp.
  688. parse arg DomName, NetBios, Nfs, DomSrvName, TName
  689. call rxStemInsert 'TEMP.', Temp.0+1, ':nick.'DomName
  690. call rxStemInsert 'TEMP.', Temp.0+1, ':type.DOMAIN'
  691. /**** PTR 10036 start ****/
  692. call rxStemInsert 'TEMP.', Temp.0+1, ':dserver.'DomSrvName
  693. /**** PTR 10036 end ****/
  694. if Netbios
  695.   then call rxStemInsert 'TEMP.', Temp.0+1, ':servers.'DomSrvName
  696. if Nfs
  697.   then call rxStemInsert 'TEMP.', Temp.0+1, ':nservers.'TName
  698. call rxStemInsert 'TEMP.', Temp.0+1, ''
  699. return 0
  700.  
  701. GenServerEntry: procedure expose (Globals) Temp.
  702. parse arg SrvName, NetBios, Nfs, Alias, Mount
  703. call rxStemInsert 'TEMP.', Temp.0+1, ':nick.'SrvName
  704. call rxStemInsert 'TEMP.', Temp.0+1, ':type.SERVER'
  705. if NetBios
  706.   then call rxStemInsert 'TEMP.', Temp.0+1, ':id.'Alias
  707. if Nfs
  708.   then call rxStemInsert 'TEMP.', Temp.0+1, ':nfs.'Mount
  709. /* call rxStemInsert 'TEMP.', Temp.0+1, ':primary.1' */
  710. call rxStemInsert 'TEMP.', Temp.0+1, ''
  711. return 0
  712.  
  713. /***** NETBIOS ***************************************************************/
  714. FindMaster.Netbios: procedure expose (Globals)
  715. trace value TrVal
  716. parse arg Master, DataRes, OFile
  717. MasterUNC = '\\'Master'\'DataRes
  718. File = MasterUNC'\'OFile
  719. if \rxFileExist(File)
  720.   then call Error 'Could not read from master server' MasterUNC'.',,
  721.       '0812', 301
  722.  
  723. /*** PTR 10120 start ***/
  724. Id = 'NAMEFIND'(File ':NICK' Master ':ID')
  725. if Id <> '' & \abbrev(Id, 'ERROR:')
  726.   then do
  727.     parse var Id '.' Id '1A'x
  728.     UNC2 = '\\'Master'\'Id'\LOCAL\COMPLEX'
  729.     File2 = UNC2'\'OFile
  730.     if rxFileExist(File2)
  731.       then MasterUNC = UNC2
  732.   end
  733. /*** PTR 10120 end ***/
  734. return MasterUNC
  735.  
  736. /***** NFS *******************************************************************/
  737. /* d:\corestuf         everyone */
  738. FindMaster.Nfs: procedure expose (Globals)
  739. trace value TrVal
  740. parse arg Master, DataRes, OFile
  741.  
  742. if Resolve('SHOWEXP') = '' | Resolve('RPCINFO') = '' | Resolve('MOUNT') = ''
  743.   then call Error 'Could not read from master server' Master'.',,
  744.       '1604', 203
  745. if \RpcInfo(Master, 'NFS')
  746.   then call Error 'Could not read from master server' Master'.',,
  747.     '0812', 303   /* NFSD not running */
  748.  
  749. PreQ = queued()
  750. 'CALL SHOWEXP' Master '2>&1 | RXQUEUE'
  751. Found = 0
  752. Exports = ''
  753. do while queued() > PreQ & \Found
  754.   parse pull MtPoint
  755.   if MtPoint = '' then iterate
  756.   if words(MtPoint) = 1 & queued() > PreQ
  757.     then parse pull Who
  758.     else parse var MtPoint MtPoint Who
  759.   if translate(Who) <> 'EVERYONE'
  760.     then iterate
  761.   Test = translate(translate(MtPoint, ' ', '\/'))
  762.   if wordpos(DataRes, Test) > 0
  763.     then Found = 1
  764. end
  765. do while queued() > PreQ; pull .; end
  766.  
  767. if \Found
  768.   then call Error 'Could not read from master server' Master '('DataRes').',,
  769.     '0812', 302
  770.  
  771. parse value rxDriveMap('C', 'FREE') with Dr Dr2 .
  772. if Dr = ''
  773.   then call Error 'No free drive to mount master server.', '0812', 304
  774. 'CALL MOUNT -u-2 -g-2' Dr Master':'MtPoint '>NUL'
  775. call rxStemInsert 'XCMD.', XCmd.0+1, 'CALL UMOUNT' Dr '>CON 2>&1'
  776. File = Dr'\'OFile
  777. if \rxFileExist(File)
  778.   then call Error File 'not found on master server' Master '.', '0812', 305
  779.  
  780. /*** PTR 10120 start ***/
  781. Id = 'NAMEFIND'(File ':NICK' Master ':NFS')
  782. if Id <> '' & \abbrev(Id, 'ERROR:') & Dr2 <> ''
  783.   then do
  784.     parse var Id '.' Id '1A'x
  785.     'CALL MOUNT -u-2 -g-2' Dr2 Master':'Id '>NUL'
  786.     call rxStemInsert 'XCMD.', XCmd.0+1, 'CALL UMOUNT' Dr2 '>CON 2>&1'
  787.     Path2 = Dr2'\LOCAL\COMPLEX'
  788.     File2 = Path2'\'OFile
  789.     if rxFileExist(File2)
  790.       then Dr = Path2
  791.   end
  792. /*** PTR 10120 end ***/
  793. return Dr
  794.  
  795. RpcInfo: procedure expose (Globals)
  796. parse upper arg Host, Service
  797. Running = 0
  798. if Ping(Host)
  799.   then do
  800.     PreQ = queued()
  801.     'CALL RPCINFO -P' Host '2>NUL | RXQUEUE /LIFO'
  802.     if Service = 'NFS'
  803.       then Service = '2049'
  804.     /**
  805.      ** 100003    2   udp   2049can't open file E:\ETC\rpc
  806.      ** 100003    2   udp   2049  nfs
  807.      **/
  808.     do while queued() > PreQ & \Running
  809.       pull Prog Vers Proto Port "CAN'T OPEN FILE"
  810.       if wordpos(Service, Port) > 0
  811.         then Running = 1
  812.     end
  813.     do while queued() > PreQ; pull .; end
  814.   end
  815. return Running
  816.  
  817. Ping: procedure expose (Globals)
  818. parse arg Host
  819. PreQ = queued()
  820. XC = 0
  821. 'CALL PING' Host '1 1 | RXQUEUE /LIFO'
  822. do while queued() > PreQ
  823.   pull Line
  824.   if wordpos('0% PACKET LOSS', Line) > 0
  825.     then XC = 1
  826. end
  827. return XC
  828.  
  829. /*****************************************************************************
  830.  * RESOLVE                                                                   *
  831.  *****************************************************************************/
  832. Resolve: procedure expose (Globals)
  833. parse arg Cmd
  834. Exts = 'COM EXE CMD'
  835. do I = 1 to words(Exts) until Res <> ''
  836.   Res = rxSearchPath('PATH', Cmd'.'word(Exts, I))
  837. end
  838. return Res
  839.  
  840. /*****************************************************************************
  841.  * CONFIGURE                                                                 *
  842.  *****************************************************************************/
  843. Configure: procedure expose (Globals)
  844. trace value TrVal
  845. say 'Loading configuration program...'
  846.  
  847. if value(Ctl.!Prefix'.VERBOSE',,'OS2ENVIRONMENT') = ''
  848.   then call value Ctl.!Prefix'.VERBOSE', Ctl.!Verbose, 'OS2ENVIRONMENT'
  849. if Ctl.!Jump <> ''
  850.   then call value Ctl.!Prefix'.JUMP', Ctl.!Jump, 'OS2ENVIRONMENT'
  851. call value 'TESTMODE', Ctl.!Test, 'OS2ENVIRONMENT'
  852. call value Ctl.!Prefix'.LOG', File.!Log, 'OS2ENVIRONMENT'
  853. call value Ctl.!Prefix'.VERNUM', Ctl.!VerNum, 'OS2ENVIRONMENT'
  854. call value Ctl.!Prefix'.FATMAP', Ctl.!FatMap, 'OS2ENVIRONMENT'
  855. call value Ctl.!Prefix'.HPFSMAP', Ctl.!HpfsMap, 'OS2ENVIRONMENT'
  856. call value Ctl.!Prefix'.HPFS386', Ctl.!Hpfs386, 'OS2ENVIRONMENT'
  857. call value Ctl.!Prefix'.SOURCEDR', left(File.!RootPath, 2), 'OS2ENVIRONMENT'
  858. call value Ctl.!Prefix'.ROOTPATH', File.!RootPath, 'OS2ENVIRONMENT'
  859. call value Ctl.!Prefix'.INIOTHDOMAINS', Ctl.!IniOthDom, 'OS2ENVIRONMENT'
  860. call value Ctl.!Prefix'.INSTCLASS', Ctl.!InstClass, 'OS2ENVIRONMENT'
  861. call value Ctl.!Prefix'.DATARES', rxCouInfo('GET', 'DATARES'),,
  862.     'OS2ENVIRONMENT'
  863. call value Ctl.!Prefix'.LANINST', Ctl.!LanInst, 'OS2ENVIRONMENT'
  864. call value Ctl.!Prefix'.MASTERFILE', Ctl.!MasterFile, 'OS2ENVIRONMENT'
  865. /**** PTR 10034 start ****/
  866. call value Ctl.!Prefix'.NOINT', Ctl.!NoInt, 'OS2ENVIRONMENT'
  867. /**** PTR 10034 end ****/
  868.  
  869. /**** PTR 235 start ****/
  870. if Ctl.!Etc <> ''
  871.   then call value Ctl.!Prefix'.EXPORTS', Ctl.!Etc'EXPORTS', 'OS2ENVIRONMENT'
  872.   else if value(Ctl.!Prefix'.PROTOCOL.NFS',,'OS2ENVIRONMENT') = 'YES'
  873.     then call Error 'Required TCP/IP ETC directory not found.', '1604', 205
  874. /**** PTR 235 end ****/
  875.  
  876. call value Ctl.!Prefix'.MACHNAME', IniGet('USER', Ctl.!AppName,,
  877.     'LRCOMPUTERNAME'), 'OS2ENVIRONMENT'
  878. /**** PTR 10218 start ****/
  879. /*PreQ = queued()*/
  880. /*'@HOSTNAME 2>NUL | RXQUEUE /FIFO'*/
  881. /*if queued() > PreQ*/
  882. /*  then do*/
  883. /*    pull IPName '.'*/
  884. /*    call value Ctl.!Prefix'.IPNAME', IPName, 'OS2ENVIRONMENT'*/
  885. /*  end*/
  886. /**** PTR 10218 end ****/
  887. IPName = value('HOSTNAME','','OS2ENVIRONMENT')
  888. call value Ctl.!Prefix'.IPNAME', IPName, 'OS2ENVIRONMENT'
  889.  
  890. if symbol('Ctl.SRVPROTOCOL') = 'VAR'
  891.   then do I = 1 to words(Ctl.SRVPROTOCOL)
  892.     call value Ctl.!Prefix'.PROTOCOL.'word(Ctl.SRVPROTOCOL, I), 'YES',,
  893.         'OS2ENVIRONMENT'
  894.   end I
  895. DDCmd = 'SET DELDIR='
  896. do I = 1 to words(Ctl.!Map)
  897.   Dr = word(Ctl.!Map, I)
  898.   if pos(Dr, Ctl.!VDisks) = 0 & pos(Dr, Ctl.!CDMap) = 0
  899.     then DDCmd = DDCmd||Dr':\DELETE,512;'
  900. end I
  901. call value Ctl.!Prefix'.DELDIRCMD', DDCmd, 'OS2ENVIRONMENT'
  902.  
  903. /* log our environment */
  904. call lineout File.!Log, '------ Install Env Vars ------'
  905. do queued(); pull .; end
  906. 'SET 2>&1 | RXQUEUE'
  907. do queued()
  908.   parse pull Line
  909.   if abbrev(Line, Ctl.!Prefix'.')
  910.     then if Ctl.!DispEnv
  911.       then call Error Line
  912.       else call lineout File.!Log, Line
  913. end
  914. call lineout File.!Log, copies('-', 30)
  915. call stream File.!Log, 'C', 'CLOSE'
  916.  
  917. RetC = 'IMPIT'('/R:'File.!MyPath'CONFIG.ITL')
  918. if RetC <> 0
  919.   then call Error 'Error' RetC 'from configuration.', '1604', 201
  920. call value Ctl.!Prefix'.JUMP', '', 'OS2ENVIRONMENT'
  921. do while Ctl.!ItlList <> ''
  922.   parse var Ctl.!ItlList Itl ',' Ctl.!ItlList
  923.   if Itl <> ''
  924.     then RetC = 'IMPIT'('/R:'File.!MyPath||Itl)
  925. end
  926.  
  927. /* Delete fix information from ini */
  928. IniFile = rxCouInfo('GET', 'INIFILE')
  929. if rxOs2Ini(IniFile, 'COREFIX', '$RXALL', 'KEYS.') = ''
  930.   then do I = 1 to Keys.0
  931.     if \abbrev(Keys.I, '@')
  932.       then call rxOs2Ini IniFile, 'COREFIX', Keys.I, '$RXDEL'
  933.   end
  934.  
  935. /* Build installation data file */
  936. InstData = strip(rxCouInfo('GET', 'LOCAL'), 'T', '\')'\INSTDATA.'Ctl.!Prefix
  937. call rxTree InstData, 'TEMP.', 'F',, '-----'
  938. if Temp.0 > 0
  939.   then call rxDelete InstData
  940. call lineout InstData, rxBootDrive() rxOs2Ver()
  941. call stream InstData, 'C', 'CLOSE'
  942. call rxTree InstData, 'TEMP.', 'F',, '**+++'
  943.  
  944. /* Delete our null info from OS2.INI */
  945. if rxOs2Ini('USER', 'CREQINST', '$RXALL', 'KEYS.') = ''
  946.   then do I = 1 to Keys.0
  947.     if length(rxOs2Ini('USER', 'CREQINST', Keys.I)) = 0
  948.       then call rxOs2Ini 'USER', 'CREQINST', Keys.I, '$RXDEL'
  949.   end
  950.  
  951. if rxOs2Ver() < 2.0
  952.   then call MigrateGroup
  953. return 0
  954.  
  955. /*****************************************************************************
  956.  * MIGRATEGROUP                                                              *
  957.  *****************************************************************************/
  958. MigrateGroup: procedure expose (Globals)
  959. trace value TrVal
  960. New = 'NetDoor'
  961. call MigrateGroup2 'CORE'
  962. call MigrateGroup2 'Core'
  963. return 0
  964.  
  965. MigrateGroup2: procedure expose (Globals) New
  966. trace value TrVal
  967. parse arg Old
  968. rc = rxQueryGroup('USER', Old, 'PGMS.')
  969. if rc = 0 then do
  970.   do I = 1 to Pgms.0
  971.     rc = rxQueryProgram('USER', Old, Pgms.I, 'DATA.')
  972.     if rc = 0
  973.       then do
  974.         call rxAddProgram 'USER', New, 'DATA.'
  975.         call rxDeleteProgram 'USER', Old, Pgms.I
  976.       end
  977.   end
  978.   call rxDeleteGroup 'USER', Old
  979. end
  980. return 0
  981.  
  982. /*****************************************************************************
  983.  * LABELDRIVES                                                               *
  984.  *****************************************************************************/
  985. LabelDrives: procedure expose (Globals)
  986. return 0
  987. call LabelDrives2 Ctl.!FatMap
  988. call LabelDrives2 Ctl.!HpfsMap
  989. return 0
  990.  
  991. LabelDrives2: procedure expose (Globals)
  992. parse arg DrList
  993. do while DrList <> ''
  994.   parse var DrList Dr +1 DrList
  995.   parse upper value rxDriveInfo(Dr) with 'LABEL=' Label 'FREE='
  996.   if Label = ''
  997.     /* NB This should be machname_drive, but it has to work in all cases */
  998.     then '@ECHO DRIVE_'Dr '| LABEL' Dr': > NUL 2>&1'
  999. end
  1000. return 0
  1001.  
  1002. /*****************************************************************************
  1003.  * ERROR                                                                     *
  1004.  *****************************************************************************/
  1005. Error: procedure expose (Globals)
  1006. parse arg EMsg, CIDcode, XCode
  1007. say EMsg
  1008. LogExists = 0
  1009. if symbol('FILE.!LOG') = 'VAR'
  1010.   then if File.!Log <> ''
  1011.     then LogExists = 1
  1012.  
  1013. if LogExists
  1014.   then call lineout File.!Log, EMsg
  1015. if CIDcode <> '' & LogExists
  1016.     then call lineout File.!Log, 'CID code:' CIDcode',  Extended error',
  1017.         'code:' XCode
  1018. if LogExists
  1019.   then call stream File.!Log, 'C', 'CLOSE'
  1020. if CIDcode <> ''
  1021.   then do
  1022.     if symbol('CTL.!APPNAME') = 'VAR' & value('CTL.!RXUTILS') = 1
  1023.       then call rxOs2Ini 'USER', Ctl.!Appname, 'Install XCode', XCode
  1024.     call Xit CIDCode
  1025.   end
  1026. return 0
  1027.  
  1028. /*****************************************************************************
  1029.  *                       DEBUGGING and ERROR RECOVERY                        *
  1030.  *****************************************************************************/
  1031. DebugInit:
  1032. if wordpos('/DEBUG', Args) > 0
  1033.   then do
  1034.     Parms.!Debug = 1
  1035.     Parms.!Wait = 1
  1036.     parse var Args ArgA '/DEBUG' DArg '/' ArgB
  1037.     Args = strip(ArgA '/'ArgB, 'T', '/')
  1038.     call Report '9999W', 'Debug mode activated.'
  1039.     call SetMsgClass 'X', 'X'
  1040.   end
  1041.   else do
  1042.     Parms.!Debug = 0
  1043.     call SetMsgClass 'I', 'X'
  1044.   end
  1045. return 0
  1046.  
  1047. BugInit:
  1048. if symbol('GLOBALS') = 'LIT'
  1049.   then do
  1050.     Globals = 'TrVal'
  1051.     TrVal = 'O'
  1052.   end
  1053. parse upper source . . Me   /* See if we're running from the macrospace */
  1054. say
  1055. call Error 'Error from' Me':'
  1056. MS = pos('\', Me) = 0       /* since we can't use sourceline if we are */
  1057. return MS
  1058.  
  1059. Syntax:
  1060. signal off error; signal off failure; signal off halt
  1061. signal off novalue; signal off notready; signal off syntax
  1062. Where = sigl
  1063. MacroSp = BugInit()
  1064. Msg = 'Syntax error' rc '('errortext(rc)') raised in line' Where'.'
  1065. signal DebugExit
  1066.  
  1067. Novalue:
  1068. signal off error; signal off failure; signal off halt
  1069. signal off novalue; signal off notready; signal off syntax
  1070. Where = sigl
  1071. MacroSp = BugInit()
  1072. Msg = 'Novalue error ('condition('D')') raised in line' Where'.'
  1073. signal DebugExit
  1074.  
  1075. DebugExit:
  1076. signal off syntax
  1077. if Parms.!Wait = 1
  1078.   then if translate(linein('STDIN:')) = '/D'
  1079.     then do
  1080.       say 'Trace mode started.  TRACE O to exit.'
  1081.       say
  1082.       trace ?i
  1083.       nop
  1084.     end
  1085. call Error Msg, '1604', 999
  1086.  
  1087. Halt:
  1088. call Error 'Execution halted by user request.'
  1089. call Xit 0
  1090.  
  1091. /*****************************************************************************
  1092.  * Required and optional response file tags.                                 *
  1093.  *****************************************************************************
  1094.  * I.INSTTYPE = CLIENT | SERVER (cs)                                         *
  1095.  * I.ACCMETH = NETBIOS | NFS (cs)                                            *
  1096.  * I.UDR = C:\CORE (cs)                                                      *
  1097.  * I.CDR = W: (cs)                                                           *
  1098.  * I.STARTUP = FOLDER | CMD (cs)                                             *
  1099.  * I.LOGDOMAIN1 = server (cs (accmeth=NETBIOS))                              *
  1100.  * I.LOGDOMAIN2 = server (cs (accmeth=NETBIOS), opt)                         *
  1101.  * I.LOGDOMAIN3 = server (cs (accmeth=NETBIOS), opt)                         *
  1102.  * I.LOGDOMAIN4 = server (cs (accmeth=NETBIOS), opt)                         *
  1103.  * I.NFSSRV1 = server (cs (accmeth=NFS))                                     *
  1104.  * I.NFSSRV2 = server (cs (accmeth=NFS), opt)                                *
  1105.  * I.NFSSRV3 = server (cs (accmeth=NFS), opt)                                *
  1106.  * I.NFSSRV4 = server (cs (accmeth=NFS), opt)                                *
  1107.  * I.CMPVM = Y | N (cs, iuo, opt)                                            *
  1108.  * I.HOSTSYS = vm,vm,vm,vm (cs, iou, only if CMPVM=Y)                        *
  1109.  * I.CMPVMGATE = gate (cs, iuo, only if CMPVM=Y)                             *
  1110.  * I.SITE = id (cs, iuo, opt)                                                *
  1111.  * I.HOSTID = vmid (cs, iuo)                                                 *
  1112.  * I.HOSTNODE = vmnode (cs, iuo)                                             *
  1113.  * I.NAME = Name A. Name (cs, iuo)                                           *
  1114.  * I.SRVPROTOCOL = NETBIOS | NFS (or both) (s)                               *
  1115.  * I.SRVTYPE = DOMAIN | SERVER (s (srvprotocol=NETBIOS))                     *
  1116.  * I.BKDC = Y (s (srvtype=DOMAIN), opt)                                      *
  1117.  * I.IMAGEDRIVE = C: | NONE (s)                                              *
  1118.  * I.ALIAS = CORE1 (s, only if IMAGEDRIVE specified)                         *
  1119.  * I.DATADRIVE = C: | NONE (s)                                               *
  1120.  * I.MASTER = <HERE> | server (s)                                            *
  1121.  * I.HOSTADDS = ipname,ipaddr [...] (cs (accmeth=NFS), opt)                  *
  1122.  *****************************************************************************/
  1123.