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 / CASSAMP2.CMD < prev    next >
OS/2 REXX Batch file  |  1995-04-05  |  37KB  |  604 lines

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