home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 3 Comm / 03-Comm.zip / hapb2_d1.zip / SETUP.CMD < prev    next >
OS/2 REXX Batch file  |  1996-07-11  |  3KB  |  130 lines

  1. /* Setup.cmd */
  2.  
  3. /*  $Revision: 1.10 $  */
  4. /*  $Date: 1996/07/02 14:58:52 $ */
  5.  
  6. PARSE ARG arg1
  7.  
  8. /* Load RexxUtil functions if not loaded */
  9. WeLoadedRxFnc=0 
  10. if rxfuncquery('SysLoadFuncs') <> 0 then 
  11.     do
  12.        /* Load RexxUtil functions */
  13.         call RxFuncAdd 'SysLoadFuncs', 'RexxUtil', 'SysLoadFuncs'
  14.         call SysLoadFuncs
  15.         WeLoadedRxFnc=1
  16.     end
  17.  
  18. /* Clear screen */
  19. rv = SysCls()
  20.  
  21. /*Check for setup.cmd */
  22. rc = SysFileTree("setup.cmd", stem, 'O')
  23. IF stem.0 = 0 THEN
  24.     SIGNAL err
  25. say ' '
  26. say ' '
  27. say 'Loading...'
  28. say ' '
  29. say ' '
  30.  
  31. /* How much space is needed */
  32. required = 100000
  33.  
  34. /* Get TMP environment variable */
  35. tempvar = VALUE('TMP',,'OS2ENVIRONMENT')
  36. IF tempvar = ' ' THEN
  37.     DO
  38.         tempvar = SysSearchPath('PATH', os2.ini)
  39.         tempvar = left(tempvar, 3)
  40.         flag = 1
  41.     END
  42.  
  43. /* Get the OS/2 boot drive */
  44. PARSE VALUE tempvar WITH drive':'path
  45. drive = drive || ':'
  46.  
  47. /* Get available drive space */
  48. drivestring = SysDriveInfo(drive)
  49. PARSE VALUE drivestring WITH,
  50.     drive_name,
  51.     drive_free,
  52.     drive_used,
  53.     drive_vol
  54.  
  55. /* Check if enough disk space */
  56. IF drive_free < required THEN
  57.     DO
  58.         say ' '
  59.         say ' '
  60.         say ' '
  61.         say 'ERROR:  Not enough free space for temporary setup files.'
  62.         say ' '
  63.         say 'Setup requires ' || required || ' bytes for temporary setup files'
  64.         say 'and found ' || drive_free || ' bytes available. Please free up some '
  65.         say 'additional disk space on drive ' || drive || ', or point the TMP '
  66.         say 'environment variable in your CONFIG.SYS file to a drive '
  67.         say 'with more space and then reboot.'
  68.         say ' '
  69.         say 'Once the problem has been corrected run SETUP again.'
  70.         SIGNAL Cleanup
  71.     END
  72. ELSE
  73.     DO
  74.         '@echo off'
  75.         Commandline = "setup2.exe"
  76.         IF arg1 = ' ' THEN
  77.             NOP
  78.         ELSE
  79.             Commandline = Commandline 'y' arg1
  80.         Commandline
  81.         szFileSpec = tempvar || '\hasetup.hlp'
  82.  
  83.         /* Wait until hasetup.hlp is deleted by InstallSheild */
  84.         DO Forever
  85.             rc = SysSleep(1)
  86.             rc = SysFileTree(szFileSpec, 'stem')
  87.             if stem.0 = 0 THEN
  88.                 LEAVE
  89.         END
  90.  
  91. Delete:
  92.         rc = SysSleep(10)
  93.         if flag <> 1 THEN 
  94.             DO
  95.                 Commandline = 'del' tempvar || '\~ins0363.~mp'
  96.                 Commandline
  97.                 Commandline = 'del' tempvar || '\~ins0463.~mp'
  98.                 Commandline
  99.                 Commandline = 'del' tempvar || '\setup.dll'
  100.                 Commandline
  101.                 Commandline = 'del' tempvar || '\install.log'
  102.                 Commandline
  103.                 Commandline = 'del' tempvar || '\~ins0163.~mp'
  104.                 Commandline
  105.             END
  106.         rv = SysCls()
  107.         signal cleanup
  108.             
  109.     END
  110.  
  111. Err:
  112.     /* if not in installation directory */
  113.     rc = SysCls()
  114.     say ' '
  115.     say ' '
  116.     say ' '
  117.     say ' '
  118.     SAY 'Please log onto the drive that contains the HyperACCESS for OS/2'
  119.     say 'installation files and type SETUP'
  120.     SAY ' '
  121.     SIGNAL Cleanup
  122.  
  123. Cleanup:
  124.      /* if we loaded the REXX Utility Package drop it */
  125.     if WeLoadedRxFnc = 1 then  
  126.          call SysDropFuncs
  127.  
  128.     EXIT
  129.  
  130.