home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 33 VDrivers / 33-VDrivers.zip / s3trio64.zip / setup.cmd < prev    next >
OS/2 REXX Batch file  |  1996-03-16  |  7KB  |  266 lines

  1. /*
  2. ** S3 Video Device Driver Setup
  3. **
  4. ** Bernie Thompson Jan 5, 1996
  5. ** (c) 1996 S3, Inc.
  6. */
  7.  
  8. '@echo off'
  9. call rxfuncadd sysloadfuncs, rexxutil, sysloadfuncs
  10. call sysloadfuncs
  11.  
  12. /* ERROR CODES */
  13. error = -512
  14. ERR_USAGE    = 1
  15. ERR_CHIP     = 2
  16. ERR_OS2VER   = 3
  17. ERR_UNPACK   = 4
  18.  
  19. parse arg src trg cid
  20.  
  21. call getsrc
  22. call gettrg
  23.  
  24. /* space-seperated S3 chip list -- must match with svgadefs.h */
  25. chips = '801/805 928 911 864 964 868 968 Trio32 Trio64 Trio64V+'
  26. chips = chips 'Aurora64V ViRGE ViRGE/vX Trio64UV+ Trio64V+Compatible'
  27.  
  28. log = trg'\os2\install\s3setup.log'
  29. x = linein(src||'BUILD.LVL')
  30. rc = lineout(log, copies('=',60))
  31. rc = lineout(log, x)
  32.  
  33. w = 60
  34. call SysCls
  35. say ''
  36. say copies('*',w)
  37. say center('S3 Trio64/64V+ display driver installation',w)
  38. say center('Version 2.81.05',w)
  39. say ''
  40. say center('Please read README.TXT first', w)
  41. say center('before installing this package', w)
  42. say ''
  43. say center('Source Path 'src,w)
  44. say center('Target Drive 'trg '['word(trginfo,4)']',w)
  45. say copies('*',w)
  46. say ''
  47.  
  48. copy src||'portio.dll' trg||'\os2\dll 1>nul 2>&1'
  49.  
  50. ''src||'chipid'
  51. chipid = rc
  52. if chipid = 0 then do
  53.    error = ERR_CHIP
  54.    call saylog 'Error: Unknown (probably non-S3) video hardware'
  55.    signal readme
  56. end
  57.  
  58. call saylog 'The target video hardware is ['chipid'] S3 'word(chips,chipid)
  59. say ''
  60.  
  61. x = wordpos(chipid, '8 9 10 11 14 15')
  62. if x = 0 then do
  63.    error = ERR_CHIP
  64.    call saylog 'Error: Hardware not supported by this driver package'
  65.    say 'please download a package matching the detected hardware'
  66.    signal readme
  67. end
  68.  
  69. os2ver = SysOS2Ver() /* returns 2.30 for Warp */
  70.  
  71. proglist = ''
  72.  
  73. if (os2ver > 2.30) then do
  74.    call saylog 'Warning: New version of OS/2'
  75.    SAY ''
  76.    SAY 'This s3 display driver package was designed'
  77.    SAY 'for OS/2 Warp version 3.00 and earlier'
  78.    SAY 'There is a possbility these drivers may not'
  79.    SAY 'function with this new version of OS/2'
  80.    SAY 'You may continue with installation or'
  81.    SAY 'quit and download a new, updated version of'
  82.    SAY 'this package'
  83.    call prompt
  84. end
  85.  
  86. if (os2ver < 2.10) then do
  87.    error = ERR_OS2VER
  88.    call saylog 'Error: Unsupported older OS/2 version'
  89.    signal readme
  90. end
  91.  
  92. currentdriver = sysini(, 'PM_DISPLAYDRIVERS', 'CURRENTDRIVER')
  93. If \pos('IBMVGA32',currentdriver) then do
  94.    call saylog 'Warning: Not running IBM VGA at install time'
  95.    say "Your system is not currently running IBM's VGA drivers."
  96.    say 'In order to install any new hi-res display driver package'
  97.    say 'safely, the system should be reset to VGA mode.'
  98.    say 'please refer to your IBM OS/2 Warp documentation or'
  99.    say 'readme.txt on this installation diskette for more'
  100.    say 'information.'
  101.    call prompt
  102. end
  103.  
  104. prefix = 'WIN_RES_S3_'
  105. count  = 20
  106.  
  107. Do i = 0 to 20
  108.    appkey = prefix||i
  109.    result = sysini(, appkey, 'DELETE:')
  110. End
  111.  
  112. /*
  113. ** We are turning the read-only attributes off in our target
  114. ** directories because dspinstl will silently fail to copy
  115. ** over read-only files. This has generated bug reports
  116. ** repeatedly in the past.
  117. */
  118. rc = SysFileTree(trg||'\os2\*.*',stem,'S','***+*','***-*')
  119.  
  120. /*
  121. ** These two files are private to videocfg.dll and family.
  122. ** They are not valid with a new configuration, and should be deleted
  123. */
  124. rc = SysFileDelete(trg||'\os2\private.dif')
  125. if rc=0 then call lineout log, 'private.dif deleted'
  126. rc = SysFileDelete(trg||'\os2\video.cfg')
  127. if rc=0 then call lineout log, 'video.cfg deleted'
  128.  
  129. fspec = SysSearchPath('PATH', 'UNPACK2.EXE')
  130. if fspec = '' then do
  131.    call lineout log, 'adding unpack2 capability to system'
  132.    'copy 'src'unpack.exe 'trg'\os2 1> nul 2>&1'
  133.    'copy 'src'unpack2.exe 'trg'\os2 1> nul 2>&1'
  134. end
  135.  
  136. file = src||'dspinstl.ex_'
  137. call unpack
  138.  
  139. file = src||'inscfg32.dl_'
  140. call unpack
  141.  
  142. if cid <> '' then cid = '/u'
  143.  
  144. say "Starting OS/2's display install program..."
  145. say ''
  146.  
  147. dspinstl = trg||'\os2\install\dspinstl.exe'
  148. dspsrc = right( src, 1 )
  149. if dspsrc <> '\' & dspsrc <> '/' then
  150. do
  151.    dspsrc = src
  152. end
  153. else do
  154.    dspsrc = left(src, length(src)-1) /* dspinstl: no trailing slash */
  155. end
  156. dspopt = '/pk:other /sk:none /s:'dspsrc' /t:'trg'\ /pd:'src'prereqs.dsc'
  157. dsplog = '/l:'trg'\os2\install\display.log'
  158. dcmd = dspinstl dspopt dsplog cid
  159. rc = lineout(log, dcmd)
  160. ''dcmd
  161.  
  162. result = sysini(, 'PM_INSTALL', 'WINOS2_LOCATION')
  163. if result <> '' then do
  164.    winpath = space(left(result,length(result)-1),0)
  165.  
  166.    rc = SysFileTree(winpath||'\*.*',stem,,'***+*','***-*')
  167.  
  168.    setup='EXENAME='||winpath||'\os2fs.exe;OBJECTID=<S3_FONTSIZE>'
  169.  
  170.    rc = SysDestroyObject('<S3_FONTSIZE>')
  171.    rc = SysCreateObject("WPProgram", "S3 Windows Font Size", "<WP_CONFIG>",setup)
  172.    If rc
  173.       Then call lineout log,'Font Size Object Created'
  174.       Else call lineout log,'Font Size Object Creation Failed in 'winpath' rc='rc
  175. end
  176.  
  177. setup ='EXENAME=\OS2\DDC.CMD;OBJECTID=<S3_DDC>;ICONFILE=\OS2\DDC.ICO;'
  178. setup = setup||'NOAUTOCLOSE=YES;MAXIMIZED=YES'
  179.  
  180. rc = SysDestroyObject('<S3_DDC>')
  181. rc = SysCreateObject("WPProgram", "DDC Display Setup", "<WP_CONFIG>",setup)
  182. If rc
  183.   Then call lineout log, 'DDC setup object created'
  184.   Else call lineout log, 'DDC setup object creation failed rc='
  185.  
  186. setting = 'WIN_BACKGROUND_INIT=1;'
  187. len = length(setting)
  188. x = SysIni(, 'WINOS2', 'PM_GlobalWindows31Settings')
  189. If (left(x, len) <> setting)then
  190. do
  191.    x = setting||x
  192.    SysIni(, 'WINOS2', 'PM_GlobalWindows31Settings', x)
  193. end
  194.  
  195. if ((os2ver = 2.10) | (os2ver = 2.11)) then ''src'vcfginst.exe'
  196.  
  197. 'start 'src'product.exe 'src trg cid
  198. signal done
  199.  
  200. getsrc:
  201. rc = stream(src||'BUILD.LVL', 'c', 'query exists')
  202. if (rc = '') | (src = '') then do
  203.    parse source src
  204.    src = word(src,3)
  205.    src = FileSpec('DRIVE', src) || FileSpec('PATH', src)
  206. end
  207. return
  208.  
  209. gettrg:
  210. rc = stream(trg||'\OS2\PMSHELL.EXE', 'c', 'query exists')
  211. if (rc = '') | (trg = '') then do
  212.    trg = SysSearchPath('PATH', 'PMSHELL.EXE')
  213.    trg = FileSpec('drive',trg)
  214. end
  215. trginfo = SysDriveInfo(trg)
  216. return
  217.  
  218. usage:
  219. say 'SETUP.CMD: S3 Display Driver Installation'
  220. say ''
  221. say 'Usage: setup [SOURCE_PATH:] [BOOTDRIVE:] {/u}'
  222. say ''
  223. say 'Use the optional /u parameter for CID installs'
  224. signal readme
  225.  
  226. saylog:
  227. parse arg msg
  228.    say msg
  229.    rc = lineout(log, msg)
  230. return
  231.  
  232. prompt:
  233. if cid = '' then
  234. do
  235.    say ''
  236.    SAY 'Do you wish to continue installation? (y or n)'
  237.    key = SysGetKey('NOECHO')
  238.    say ''
  239.    parse upper var key key
  240.    if key <> 'Y' then signal readme
  241. end
  242. return
  243.  
  244. unpack:
  245. 'unpack 'file trg' >> nul'
  246. if rc then do
  247.    error = err_unpack
  248.    call saylog 'Error: unpacking 'file', rc = 'rc
  249.    signal readme
  250. end
  251. return
  252.  
  253. readme:
  254. say ''
  255. say 'The installation has ended without any modifications to your'
  256. say 'system.  Please reference README.TXT on the installation'
  257. say 'diskette for more information.'
  258. say ''
  259. exit error
  260.  
  261. done:
  262. if cid = '' then 'exit'
  263. exit error
  264.  
  265.  
  266.