home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 29 Fixes_o / 29-Fixes_o.zip / wr07060a.zip / US7060B2.DSK / LCU / LCU.ZIP / CASSAMP1.CMD < prev    next >
OS/2 REXX Batch file  |  1995-04-05  |  35KB  |  582 lines

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