home *** CD-ROM | disk | FTP | other *** search
/ Monster Media 1993 #2 / Image.iso / os2 / pcswocid.zip / PCSWOLCU.CMD < prev    next >
OS/2 REXX Batch file  |  1993-01-28  |  35KB  |  566 lines

  1. /* REXX command file CASSKEL */
  2.  
  3. /*---------------------------------------------------*/
  4. /*         DO NOT MODIFY THE NEXT EIGHT LINES        */
  5. /*---------------------------------------------------*/
  6.  
  7. parse ARG client logfile additional
  8.  
  9. QUEUE_REBOOT = 0
  10. CALL_AGAIN = 0
  11.  
  12. Call AddDLLFunctions
  13.  
  14. x.0.instprog = ''
  15. x.0.rspdir   = ''
  16. x.0.statevar = 'CAS_STATE'
  17. x.0.default  = ''
  18.  
  19.  
  20. /*---------------------------------------------------*/
  21. /*             MODIFICATIONS START HERE              */
  22. /*---------------------------------------------------*/
  23.  
  24.  
  25. /*****************************************************/
  26. /*                 SRVATTCH SECTION                  */
  27. /*****************************************************/
  28.  
  29. /* 'SRVATTCH z: \\SERVER1\ALIAS' */                             /* Additional SRVATTCHs can be placed here*/
  30.  
  31. /* 'SRVATTCH y: SERVER2'         */                             /* They can be placed before specific     */
  32.                                                                 /* RunInstall statements too if you only  */
  33.                                                                 /* want to attach to a special server     */
  34.                                                                 /* right before a specific install.       */
  35.  
  36. /*****************************************************/
  37. /*                 VARIABLES SECTION                 */
  38. /*****************************************************/
  39.  
  40. /*---------------------------------------------------*/
  41. /*         DO NOT REMOVE THE NEXT FOUR LINES         */
  42. /*              (They may be modified)               */
  43. /*---------------------------------------------------*/
  44.  
  45. bootdrive='c:'                                                  /* Boot Drive                             */
  46. configsys = bootdrive || '\CONFIG.SYS'                          /* Fully qualified path to CONFIG.SYS     */
  47. exepath = 'X:\EXE'                                              /* Path to executable directory on server */
  48. dllpath = 'X:\DLL;X:\IMG\LCU;'                                  /* Paths to the DLL directories on server */
  49.  
  50.  
  51. /*---------------------------------------------------*/
  52. /* The next four lines are included to make it       */
  53. /* easier to change the version of OS/2 2.0 that is  */
  54. /* to be installed.                                  */
  55. /*                                                   */
  56. /* These variables are referenced in the product     */
  57. /* data sections for SEINST and SEMAINT.             */
  58. /*---------------------------------------------------*/
  59.  
  60. os2dir  = 'OS2V20'                                              /* Name of OS/2 2.0 directories         */
  61. os2img  = 'X:\IMG\' || os2dir                                   /* - product image directory            */
  62. os2rsp  = 'X:\RSP\' || os2dir                                   /* - response file directory            */
  63. os2log  = 'Y:\' || os2dir                                       /* - log file directory                 */
  64.  
  65.  
  66. /*****************************************************/
  67. /*               PRODUCT DATA SECTION                */
  68. /*****************************************************/
  69.  
  70. x.seinst = 1                                                    /* structure index                      */
  71. x.1.name='OS/2 2.0'                                             /* product name                         */
  72. x.1.statevar = 'CAS_' || x.1.name                               /* state variable name                  */
  73. x.1.instprog = exepath || '\seinst                     ',       /* fully qualified install program name */
  74.                ' /b:' || bootdrive || '                ',       /* - bootdrive                          */
  75.                ' /s:' || os2img '                      ',       /* - source directory                   */
  76.                ' /t:A:\                                ',       /* - service directory                  */
  77.                '/l1:' || os2log || '\' || client || '.log ',    /* - log file                           */
  78.                ' /r:'                                           /* - response file flag (auto selection)*/
  79. x.1.rspdir   = os2rsp                                           /* response file directory              */
  80. x.1.default  = 'default.rsp'                                    /* default response file name           */
  81.  
  82. x.semaint = 2                                                   /* structure index                      */
  83. x.2.name='OS/2 2.0 Maintenance'                                 /* product name                         */
  84. x.2.statevar = 'CAS_' || x.2.name                               /* state variable name                  */
  85. x.2.instprog = exepath || '\semaint                    ',       /* fully qualified install program name */
  86.                 ' /s:' || os2img || '                  ',       /* - source directory                   */
  87.                 ' /t:c:\service                        ',       /* - target directory                   */
  88.                 ' /b:' || bootdrive || '               ',       /* - target boot drive (not necessarily current) */
  89.                 '/l1:' || os2log || '\' || client || '.log'     /* - log file                           */
  90. x.2.rspdir   = ''                                               /* no auto selection                    */
  91. x.2.default  = ''
  92.  
  93. x.laps_prep = 3                                                 /* structure index                      */
  94. x.3.name='LAPS Maintnenace'                                     /* product name                         */
  95. x.3.statevar = 'CAS_' || x.3.name                               /* state variable name                  */
  96. x.3.instprog = 'x:\img\laps\laps                      ',        /* fully qualified install program name */
  97.                 ' /e:prep                             ',        /* - prep installation                  */
  98.                 ' /s:x:\img\laps                      ',        /* - source directory                   */
  99.                 ' /t:c:\service                       ',        /* - target directory                   */
  100.                 '/tu:' || bootdrive || '              ',        /* - location of config.sys             */
  101.                 '/l1:x:\log\laps\' || client || '.log ',        /* - log file                           */
  102.                 ' /r:x:\rsp\laps\lapsrsp.rsp'                   /* - response file                      */
  103. x.3.rspdir   = ''                                               /* no auto selection                    */
  104. x.3.default  = ''
  105.  
  106. x.laps = 4                                                      /* structure index                      */
  107. x.4.name='LAPS'                                                 /* product name                         */
  108. x.4.statevar = 'CAS_' || x.4.name                               /* state variable name                  */
  109. x.4.instprog = 'x:\img\laps\laps                     ',         /* fully qualified install program name */
  110.                ' /e:maint                            ',         /* - maintenance installation           */
  111.                ' /s:x:\img\laps                      ',         /* - source directory                   */
  112.                ' /t:' || bootdrive || '\             ',         /* - target directory                   */
  113.                '/l1:y:\laps\' || client || '.log ',             /* - log file                           */
  114.                ' /r:'                                           /* - response file flag (auto selection)*/
  115. x.4.rspdir   = 'x:\rsp\laps'                                    /* response file directory              */
  116. x.4.default  = 'lapsrsp.rsp'                                    /* default response file name           */
  117.  
  118. x.esainst = 5                                                   /* structure index                      */
  119. x.5.name='Extd/2'                                               /* product name                         */
  120. x.5.statevar = 'CAS_' || x.5.name                               /* state variable name                  */
  121. x.5.instprog = 'x:\img\es10\esainst                 ',          /* fully qualified install program name */
  122.                ' /s:x:\img\es10                     ',          /* - source directory                   */
  123.                ' /z                                 ',          /* - diagnostic flag (optional)         */
  124.                '/l1:x:\log\es10\' || client || '.l1 ',          /* - error + history log file           */
  125.                '/l2:x:\log\es10\' || client || '.l2 ',          /* - error log file                     */
  126.                '/l5:x:\log\es10\' || client || '.l5 ',          /* - history log file                   */
  127.                '/l4:x:\log\es10\' || client || '.l4 ',          /* - diagnostic log file                */
  128.                ' /r:'                                           /* - response file flag (auto selection)*/
  129. x.5.rspdir   = 'x:\rsp\es10'                                    /* response file directory              */
  130. x.5.default  = 'default.rsp'                                    /* default response file name           */
  131.  
  132. x.laninstr = 6                                                  /* structure index                      */
  133. x.6.name='LAN Services 3.0'                                     /* product name                         */
  134. x.6.statevar = 'CAS_' || x.6.name                               /* state variable name                  */
  135. x.6.instprog = 'x:\img\ls30\laninstr                ',          /* fully qualified install program name */
  136.                ' /req                               ',          /* - install a requester                */
  137.                '/l1:x:\log\ls30\' || client || '.L1 ',          /* - error log file                     */
  138.                '/l2:x:\log\ls30\' || client || '.L2 ',          /* - history log file                   */
  139.                ' /g:x:\rsp\ls30\general             ',          /* - include file directory             */
  140.                ' /r:'                                           /* - response file flag (auto selection)*/
  141. x.6.rspdir   = 'x:\rsp\ls30'                                    /* response file directory              */
  142. x.6.default  = 'req.rsp'                                        /* default response file name           */
  143.  
  144. /* The THINSRV product data is supplied here for a refrence,   */
  145. /* It is not set up to be installed with a RunInstall statement*/
  146. /* below.  If you wish to install it, just add a               */
  147. /* RunInstall(x.thinsrv) statement within the install section  */
  148. /* below.  This is used to install subordinate code servers    */
  149. /* from master code servers.                                   */
  150.  
  151. x.thinsrv = 7                                                   /* structure index                      */
  152. x.7.name='SRVIFS Server'                                        /* product name                         */
  153. x.7.statevar = 'CAS_' || x.7.name                               /* state variable name                  */
  154. x.7.instprog = 'x:\img\srvifs\thinsrv                  ',       /* fully qualified install program name */
  155.                ' /s:x:\img\srvifs                      ',       /* - source directory                   */
  156.                ' /t:' || bootdrive || '\srvifs         ',       /* - target directory                   */
  157.                '/tu:' || bootdrive || '\               ',       /* - config.sys location                */
  158.                '/l1:x:\log\srvifs\' || client || '.log ',       /* - log file                           */
  159.                ' /u:x:\rsp\srvifs\server.lst           ',       /* - authlist                           */
  160.                ' /r:x:\rsp\srvifs\server.ini'                   /* - ini file                           */
  161. x.7.rspdir   = ''                                               /* no auto selection                    */
  162. x.7.default  = ''
  163.  
  164. x.thinifs = 8                                                   /* structure index                      */
  165. x.8.name='SRVIFS Requester'                                     /* product name                         */
  166. x.8.statevar = ''                                               /* state variable name                  */
  167. x.8.instprog = 'x:\img\srvifs\thinifs                   ',      /* fully qualified install program name */
  168.                '  /s:x:\img\srvifs                      ',      /* - source directory                   */
  169.                '  /t:' || bootdrive || '\srvifsrq       ',      /* - target directory                   */
  170.                ' /tu:' || bootdrive || '\               ',      /* - config.sys location                */
  171.                ' /l1:y:\srvifs\' || client || '.log ',          /* - log file                           */
  172.                '/req:' || client || '                   ',      /* - requester name                     */
  173.                '/srv:\\CIDSRV\IMAGES                            ',      /* - server name                        */
  174.                '  /d:x'                                         /* - remote drive identifier            */
  175. x.8.rspdir   = ''                                               /* no auto selection                    */
  176. x.8.default  = ''
  177.  
  178.  
  179. x.thinifs2 = 12                                                 /* structure index                      */
  180. x.12.name='SRVIFS Requester'                                    /* product name                         */
  181. x.12.statevar = ''                                              /* state variable name                  */
  182. x.12.instprog = 'x:\img\srvifs\thinifs                  ',      /* fully qualified install program name */
  183.                '  /s:x:\img\srvifs                      ',      /* - source directory                   */
  184.                '  /t:' || bootdrive || '\srvifsrq       ',      /* - target directory                   */
  185.                ' /tu:' || bootdrive || '\               ',      /* - config.sys location                */
  186.                ' /l1:y:\srvifs\' || client || '.log ',          /* - log file                           */
  187.                '/req:' || client || '                   ',      /* - requester name                     */
  188.                '/srv:\\CIDSRV\LOGS                       ',     /* - server name                        */
  189.                '  /d:Y'                                         /* - remote drive identifier            */
  190. x.12.rspdir   = ''                                              /* no auto selection                    */
  191. x.12.default  = ''
  192.  
  193.  
  194. x.ifsdel = 9                                                    /* structure index                      */
  195. x.9.name='SRVIFS Delete'                                        /* product name                         */
  196. x.9.statevar = ''                                               /* state variable name                  */
  197. x.9.instprog = 'x:\img\srvifs\ifsdel             ',             /* fully qualified install program name */
  198.                ' /t:' || bootdrive || '\srvifsrq ',             /* - target directory                   */
  199.                '/tu:' || bootdrive                              /* - config.sys location                */
  200. x.9.rspdir   = ''                                               /* no auto selection                    */
  201. x.9.default  = ''
  202.  
  203. x.casinstl = 10                                                 /* structure index                               */
  204. x.10.name='LAN CID Utility'                                     /* product name                                  */
  205. x.10.statevar = ''                                              /* state variable name                           */
  206. x.10.instprog = 'x:\img\lcu\casinstl                 ',         /* fully qualified install program name          */
  207.                '/cmd:x:\client                       ',         /* - location of .cmd files (passed to casagent) */
  208.                ' /tu:' || bootdrive || '             ',         /* - config.sys location (boot drive)            */
  209.                ' /pl:' || dllpath || '               ',         /* - string to add to libpath                    */
  210.                ' /pa:x:\img\lcu                      ',         /* - workstation's path to LCU code on server    */
  211.                ' /l1:y:\lcu\' || client || '.log ',             /* - CASINSTL log file                           */
  212.                ' /l2:y:\lcu\SRVIFS_REQ.log'                     /* - CASAGENT log file                           */
  213. x.10.rspdir   = ''                                              /* no auto selection                             */
  214. x.10.default  = ''
  215.  
  216. x.casdelet = 11                                                /* structure index                      */
  217. x.11.name='LAN CID Utility Delete'                             /* product name                         */
  218. x.11.statevar = ''                                             /* state variable name                  */
  219. x.11.instprog = 'x:\img\lcu\casdelet   ',                      /* fully qualified install program name */
  220.                 '/pl:' || dllpath || ' ',                      /* - string to delete from libpath      */
  221.                 '/tu:' || bootdrive                            /* - config.sys location (boot drive)   */
  222. x.11.rspdir   = ''                                             /* no auto selection                    */
  223. x.11.default  = ''
  224.  
  225. x.pcswocid = 12                                                  /* structure index                      */
  226. x.12.name='pcswinv3'                                             /* product name                         */
  227. x.12.statevar = 'CAS_' || x.12.name                              /* state variable name                  */
  228. x.12.instprog = 'x:\img\pcswinv3\pcswocid',                      /* fully qualified install program name */
  229.                 '/s:x:\img\pcswinv3',                            /* - source directory                   */
  230.                 '/t:c:\pcswinv3',                                /* - target directory                   */
  231.                 '/l1:y:\pcswinv3\' || client || '.hst',          /* - history log file                   */
  232.                 '/l2:y:\pcswinv3\' || client || '.err',          /* - error log file                     */
  233.                 '/g:x:\rsp\pcswinv3',                            /* - general response file *.WS path    */
  234.                 '/r:'                                            /* - response file flag (auto selection)*/
  235. x.12.rspdir   = 'x:\rsp\pcswinv3'                                /* response file directory              */
  236. x.12.default  = 'pcswocid.rsp'                                   /* default response file name           */
  237.  
  238.  
  239. /*---------------------------------------------------*/
  240. /*         NUMBER OF PROGRAMS SET UP IN THE          */
  241. /*               PRODUCT DATA SECTION                */
  242. /*---------------------------------------------------*/
  243.  
  244. NUM_INSTALL_PROGS = 12
  245.  
  246.  
  247. /*---------------------------------------------------*/
  248. /*       DO NOT MODIFY OR REMOVE THE NEXT LINE       */
  249. /*---------------------------------------------------*/
  250.  
  251. OVERALL_STATE = GetEnvironmentVars()
  252.  
  253.  
  254. /*****************************************************/
  255. /*                  INSTALL SECTION                  */
  256. /*****************************************************/
  257.  
  258. Do Forever
  259.   Select
  260.     when OVERALL_STATE = 0 then do
  261.       if RunInstall(x.thinifs)  == BAD_RC then exit             /* Install SRVIFS requester     */
  262.       if RunInstall(x.thinifs2) == BAD_RC then exit             /* Install SRVIFS requester     */
  263.       if RunInstall(x.casinstl) == BAD_RC then exit             /* Install LCU                  */
  264.       Call CheckBoot                                            /* Reboot if it was requested   */
  265.     end
  266.     when OVERALL_STATE = 1 then do
  267.       if RunInstall(x.pcswocid) == BAD_RC then exit
  268.       if RunInstall(x.ifsdel)   == BAD_RC then exit             /* Delete SRVIFS requester      */
  269.       if RunInstall(x.casdelet) == BAD_RC then exit             /* Delete LCU                   */
  270.       Call Reboot                                               /* Reboot                       */
  271.     end
  272.     otherwise
  273.        NOP
  274.    end
  275. end
  276. exit
  277.  
  278.  
  279. /*************************************************************/
  280. /*         DO NOT MODIFY ANY CODE BELOW THIS LINE !!!        */
  281. /*************************************************************/
  282.  
  283. RunInstall: procedure expose x. queue_reboot call_again configsys logfile client OVERALL_STATE
  284.   parse arg index, new_state, other
  285.   install = SetEnvironmentVar(x.index.statevar)
  286.   if install == YES then do
  287.     rc2 = LogMessage(72, x.index.name, '', logfile)             /* log an install starting msg  */
  288.     install_prog = 'CMD /C ' || strip(x.index.instprog)         /* build the command string     */
  289.  
  290.                                                 /* If automatic responst file selection was     */
  291.                                                 /* indicated, then get the response file name   */
  292.                                                 /* and append it to the command string.         */
  293.     if x.index.default <> '' then do
  294.       response_file = DetermineResponseFile(x.index.rspdir, client,
  295.                                             , x.index.default, x.index.name,
  296.                                             , logfile)
  297.       if response_file == '' then exit
  298.       install_prog = install_prog || response_file
  299.     end
  300.  
  301.     install_prog                                                /* Execute the install program  */
  302.  
  303.     state = value(x.index.statevar,,'OS2ENVIRONMENT')           /* Get the current install state*/
  304.                                                                 /* for this install program from*/
  305.                                                                 /* the environment.             */
  306.  
  307.                                                 /* Check the return code and set the global     */
  308.                                                 /* variables accordingly.                       */
  309.  
  310.     parse value ProcessReturnCode(rc, state, QUEUE_REBOOT, CALL_AGAIN, logfile),
  311.            with rc ',' state ',' QUEUE_REBOOT ',' CALL_AGAIN
  312.  
  313.     rc2 = value(x.index.statevar, state, 'OS2ENVIRONMENT')      /* Set the new install state for*/
  314.                                                                 /* this install program.        */
  315.  
  316.                                                 /* Put the install state into the CONFIG.SYS,   */
  317.                                                 /* if this action was unsuccessful, then exit.  */
  318.  
  319.     if PutStateVar(x.index.statevar, state, configsys, logfile) <> 0 then exit
  320.  
  321.     if rc == GOOD_RC then do
  322.       if pos('\SEMAINT', translate(install_prog)) <> 0 then     /* If the install program was   */
  323.         Call PreserveStartupCmd(install_prog)                   /* SEMAINT, then make sure      */
  324.                                                                 /* STARTUP.CMD won't be copied  */
  325.                                                                 /* over when SEINST runs.       */
  326.  
  327.       rc2 = LogMessage(70, x.index.name, '', logfile)           /* log an install successful msg*/
  328.       return GOOD_RC                                            /* return a good return code    */
  329.     end
  330.  
  331.     else do
  332.       rc2 = LogMessage(71, x.index.name, '', logfile)           /* log an install failed msg    */
  333.       if (new_state <> '') then                                 /* If a new state was requested,*/
  334.                                                                 /* then set OVERALL_STATE to the*/
  335.         rc2 = SetState(new_state, 'RunInstall', 2)              /* new state.                   */
  336.  
  337.       return BAD_RC                                             /* return a bad return code     */
  338.     end
  339.   end
  340.   return GOOD_RC
  341.  
  342.  
  343. /*************************************************************/
  344. PreserveStartupCmd: procedure
  345.  
  346.   parse upper arg string, other
  347.  
  348.   if pos('/T:', string) <> 0 then                               /* Determine if there is a      */
  349.     findvalue = '/T:'                                           /* target parameter.  If there  */
  350.   else                                                          /* is none, return.             */
  351.     if pos('-T:',string) <> 0 then
  352.       findvalue = '-T:'
  353.     else
  354.       return 0
  355.  
  356.   remain = substr(string, pos(findvalue, string) + 3)           /* Get the value of the target  */
  357.                                                                 /* parameter.                   */
  358.   blank = pos(' ', remain)
  359.  
  360.   if (blank <> 0) then
  361.     param = substr(remain, 1, blank-1)
  362.   else
  363.     param = remain
  364.                                                 /* Erase startup.lcu in the target directory,  */
  365.                                                 /* then rename startup.s13 to startup.lcu      */
  366.  
  367.   'if exist ' param || '\startup.lcu erase  ' param || '\startup.lcu'
  368.   'if exist ' param || '\startup.s13 rename ' param || '\startup.s13 *.lcu'
  369.  
  370.   return 0
  371.  
  372. /*************************************************************/
  373. GetEnvironmentVars: procedure expose X. NUM_INSTALL_PROGS
  374.  
  375.  
  376.   OVERALL_STATE = value(x.0.statevar,,'OS2ENVIRONMENT')         /* Get the overall install state */
  377.                                                                 /* from the environment.         */
  378.  
  379.   if OVERALL_STATE == '' then do                                /* If the overall install state  */
  380.     OVERALL_STATE = 0                                           /* has not been set yet, reset   */
  381.     do I=0 to NUM_INSTALL_PROGS by 1                            /* all the state vars to 0.      */
  382.       if x.I.statevar <> '' then
  383.         rc = value(x.I.statevar,'0','OS2ENVIRONMENT')
  384.     end
  385.   end
  386.  
  387.   return OVERALL_STATE
  388.  
  389.  
  390. /*************************************************************/
  391. SetEnvironmentVar: procedure
  392.   parse arg env_string, other
  393.   if env_string == '' then do                                   /* If the install program has   */
  394.                                                                 /* no state variable, then ...  */
  395.  
  396.     rc = value('REMOTE_INSTALL_STATE','0','OS2ENVIRONMENT')     /* Set the REMOTE_INSTALL_STATE */
  397.                                                                 /* to 0 so that the program     */
  398.                                                                 /* being run can know that is   */
  399.                                                                 /* being run in an unattended   */
  400.                                                                 /* environment.                 */
  401.  
  402.     return YES                                                  /* return install=yes           */
  403.  
  404.   end
  405.  
  406.   state = value(env_string,,'OS2ENVIRONMENT')                   /* Otherwise, get the value of  */
  407.                                                                 /* the state variable from the  */
  408.                                                                 /* environment.                 */
  409.  
  410.   if state <> '' then do                                        /* If the state variable exists */
  411.  
  412.     rc = value('REMOTE_INSTALL_STATE',state,'OS2ENVIRONMENT')   /* Set the REMOTE_INSTALL_STATE */
  413.                                                                 /* environment variable to the  */
  414.                                                                 /* value of the state variable. */
  415.  
  416.     return YES                                                  /* return install=yes           */
  417.   end
  418.   else                                                          /* Otherwise,                   */
  419.     return NO                                                   /* return install=no            */
  420.  
  421.  
  422. /*************************************************************/
  423. BootDriveIsDiskette:
  424.  
  425.   if IsBootDriveRemovable() == 1 then do                        /* If the drive booted from is  */
  426.                                                                 /* a diskette drive, then set   */
  427.     rc2 = SetState(OVERALL_STATE+1)                             /* the OVERALL_STATE to the     */
  428.                                                                 /* requested value.             */
  429.     return 'YES'
  430.  
  431.   end
  432.  
  433.   else                                                          /* else the machine was booted  */
  434.                                                                 /* from the hardfile.           */
  435.     return 'NO'
  436.  
  437. /*************************************************************/
  438. BootDriveIsFixedDisk:
  439.  
  440.   if IsBootDriveRemovable() == 0 then do                        /* If the drive booted from is  */
  441.                                                                 /* a fixed disk, then set       */
  442.     rc2 = SetState(OVERALL_STATE+1)                             /* the OVERALL_STATE to the     */
  443.                                                                 /* requested value.             */
  444.     return 'YES'
  445.  
  446.   end
  447.  
  448.   else                                                          /* else the machine was booted  */
  449.                                                                 /* from a diskette.             */
  450.     return 'NO'
  451.  
  452. /*************************************************************/
  453. SetState:
  454.   parse arg new_state, proc_name, param_num, other
  455.  
  456.     if datatype(new_state, number) <> 1 then do                 /* If the new state requested is*/
  457.                                                                 /* not numeric, then log an     */
  458.       if proc_name <> '' then                                   /* error.                       */
  459.         LogMessage(63, proc_name, param_num, logfile)
  460.       else
  461.         LogMessage(63, 'SetState', 1, logfile)
  462.  
  463.       exit
  464.     end
  465.  
  466.     OVERALL_STATE = new_state                                   /* Set the OVERALL_STATE to the */
  467.                                                                 /* new state requested.         */
  468.  
  469.     rc = value(x.0.statevar, new_state, 'OS2ENVIRONMENT')       /* Save the OVERALL_STATE in the*/
  470.                                                                 /* environment.                 */
  471.     return 'NO_ERROR'
  472.  
  473.  
  474. /*************************************************************/
  475. SaveStates:
  476.  
  477.   do I=0 to NUM_INSTALL_PROGS by 1            /* Put the install states into the CONFIG.SYS,  */
  478.     if x.I.statevar <> '' then                /* if this action was unsuccessful, then exit.  */
  479.  
  480.       if PutStateVar(x.I.statevar, value(x.I.statevar,,'OS2ENVIRONMENT'),
  481.                      , configsys, logfile) <> 0 then exit
  482.   end
  483.  
  484.   return
  485.  
  486. /*************************************************************/
  487. RebootAndGotoState:
  488.   parse arg new_state, other
  489.  
  490.   rc2 = SetState(new_state, 'RebootAndGotoState', 1)           /* Set the state to go to in    */
  491.                                                                /* OVERALL_STATE.               */
  492.  
  493.   Call SaveStates                                              /* Save the environment vars    */
  494.  
  495.   Call Reboot                                                  /* Reboot the machine           */
  496.  
  497.   return
  498.  
  499.  
  500. /*************************************************************/
  501. CheckBoot:
  502.   if QUEUE_REBOOT <> 0 then do                                  /* If a reboot has been queued  */
  503.                                                                 /* by an install program ...    */
  504.  
  505.     if CALL_AGAIN == 0 then                                     /* If no install programs want  */
  506.                                                                 /* to be recalled ...           */
  507.  
  508.       rc = SetState(OVERALL_STATE+1)                            /* Increment the overall state  */
  509.                                                                 /* variable.                    */
  510.  
  511.     Call SaveStates                                             /* Save the environment vars    */
  512.  
  513.     Call Reboot                                                 /* Reboot the machine           */
  514.  
  515.   end
  516.  
  517.   else                                                          /* Otherwise, increment the     */
  518.     rc = SetState(OVERALL_STATE+1)                              /* state variable and go on.    */
  519.  
  520.   return
  521.  
  522.  
  523. /*************************************************************/
  524. Reboot:
  525.   bootdrive
  526.  
  527.   rc = value('OS2_SHELL', bootdrive || '\OS2\CMD.EXE', 'OS2ENVIRONMENT')
  528.   rc = value('COMSPEC',   bootdrive || '\OS2\CMD.EXE', 'OS2ENVIRONMENT')
  529.  
  530.   'cls'
  531.   rc = AskRemoveDiskIfFloppy()
  532.  
  533.   pathlen = length(exepath)                                     /* Get length of exepath        */
  534.   posslash = lastpos("\",strip(exepath))                        /* Determine the last occurcnce */
  535.                                                                 /*   of '\' in exepath          */
  536.  
  537.   if posslash = pathlen then                                    /* If '\' is the last character */
  538.  
  539.     cmdline = exepath || 'SETBOOT /IBD:' || bootdrive           /* Then append 'SETBOOT'        */
  540.  
  541.   else
  542.  
  543.     cmdline = exepath || '\SETBOOT /IBD:' || bootdrive          /* Else append '\SETBOOT'       */
  544.  
  545.   LogMessage(74, '', '', logfile)                               /* Log a message indicating     */
  546.                                                                 /* reboot.                      */
  547.   cmdline
  548.  
  549.   LogMessage(73, 'SETBOOT', '', logfile)                        /* If the code gets to here, the*/
  550.                                                                 /* reboot failed.  Log a message*/
  551.   exit                                                          /* and exit.                    */
  552.  
  553.   return
  554.  
  555.  
  556. /*************************************************************/
  557. AddDLLFunctions:
  558.   Call RxFuncAdd 'ProcessReturnCode',     'CASAGENT', 'PROCESSRETURNCODE'
  559.   Call RxFuncAdd 'DetermineResponseFile', 'CASAGENT', 'DETERMINERESPONSEFILE'
  560.   Call RxFuncAdd 'PutStateVar',           'CASAGENT', 'PUTSTATEVAR'
  561.   Call RxFuncAdd 'LogMessage',            'CASAGENT', 'GETANDLOGMESSAGE'
  562.   Call RxFuncAdd 'AskRemoveDiskIfFloppy', 'CASAGENT', 'ASKREMOVEDISKIFFLOPPY'
  563.   Call RxFuncAdd 'IsBootDriveRemovable',  'CASAGENT', 'ISBOOTDRIVEREMOVABLE'
  564.  
  565.   return
  566.