home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 10 Tools / 10-Tools.zip / lansystk.zip / MPTSUTIL / LCU / CASSKEL.CMD < prev    next >
OS/2 REXX Batch file  |  1998-05-08  |  31KB  |  527 lines

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