home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 33 VDrivers / 33-VDrivers.zip / s3_virge.zip / setup.cmd < prev    next >
OS/2 REXX Batch file  |  1998-11-19  |  12KB  |  338 lines

  1. /**/
  2. '@echo off'
  3. call rxfuncadd sysloadfuncs, rexxutil, sysloadfuncs
  4. call sysloadfuncs
  5. /* CID ERROR CODES */
  6. error = 65024
  7. ERR_USAGE       = 5632
  8. ERR_CHIP        = 5636
  9. ERR_OS2VER      = 5636
  10. ERR_UNPACK      = 5636
  11. ERR_COMPAT      = 5636
  12. env = 'OS2ENVIRONMENT'
  13. src = ''
  14. trg = ''
  15. parse upper arg args
  16. cid = parsearg('U')
  17. call getsrc
  18. if args <> '' then signal usage
  19. call gettrg
  20. /* space-seperated S3 chip list -- must match with svgadefs.h */
  21. chips = '801/805 928 911 864 964 868 968 Trio32 Trio64 Trio64V+'
  22. chips = chips 'Aurora64V+ ViRGE ViRGE/vX Trio64UV+ Trio64V+Compatible Trio64V2'
  23. chips = chips 'Yosemite ViRGE/DX-GX ViRGE/GX2 ViRGE+COMPATBLE M3 M5 ViRGE/GX2 Trio3D M5+ ViRGE/GX3'
  24. pipenull = ' 1>nul 2>&1'
  25. w = 70
  26. log = trg'\os2\install\display.log'
  27. x = linein(src||'BUILD.LVL')
  28. rc = lineout( src||'BUILD.LVL' )
  29. rc = lineout(log, copies('=',w))
  30. rc = lineout(log, x)
  31. call SysCls
  32. say ''
  33. say copies('*',w)
  34. say center('S3 ViRGE,ViRGE/VX,ViRGE/DX,ViRGE/GX,ViRGE/GX2',w)
  35. say center('display driver installation',w)
  36. say center('Version 1.03.20',w)
  37. say ''
  38. say center('Please read README.TXT first', w)
  39. say center('before installing this package', w)
  40. say ''
  41. call usage1
  42. say ''
  43. say center('Source Path 'src,w)
  44. say center('Target Drive 'trg '['word(trginfo,4)']',w)
  45. if cid <> '' then do
  46.         say ''
  47.         say 'User Options:'
  48.         call saylog '   Unattended Installation'
  49. end
  50. say copies('*',w)
  51. say ''
  52. u2spec = SysSearchPath('PATH', 'UNPACK2.EXE')
  53. if (u2spec = '') then do
  54.         call lineout log, 'adding unpack2 capability to system'
  55.         'unpack' src'unpack.pk2' trg pipenull
  56. end
  57. call unpack 'prereq.pk2' trg||'\os2\dll\portio.dll'
  58. call unpack 'prereq.pk2' trg||'\os2\install\s3chipid.exe'
  59. ''trg||'\os2\install\s3chipid 2 0'
  60. chipid = rc
  61. rc = SysFileDelete( trg||'\os2\install\s3chipid.exe' )
  62. rc = SysFileDelete( trg||'\os2\dll\portio.dll' )
  63. if chipid = 0 then do
  64.         error = ERR_CHIP
  65.         call saylog 'Error: Unknown (probably non-S3) video hardware'
  66.         signal readme
  67. end
  68. else if chipid < -1 then do
  69.         error = ERR_COMPAT
  70.         call saylog 'Error: BIOS indicates chip is not compatibile'
  71.         signal readme
  72. end
  73. else if chipid <> -1 then do
  74.         chiptext = 'S3 ' || word( chips, chipid )
  75.         tempid = chipid
  76. end
  77. else do
  78.         chiptext = 'IBM Mach 868'
  79.         tempid = 6
  80. end
  81. call saylog 'The target video hardware is ['tempid'] ' || chiptext
  82. say ''
  83. if chipid <> -1 then x = wordpos(chipid, '12 13 18 19 23')
  84. else x = 1
  85. if x=0 then do
  86.         error = ERR_CHIP
  87.         call saylog 'Error: Hardware not supported by this driver package'
  88.         say 'please download a package matching the detected hardware.'
  89.         signal readme
  90. end
  91. os2ver = SysOS2Ver() /* returns 2.30 for Warp */
  92. if (os2ver > 2.4) then do
  93.         call saylog 'Warning: New version of OS/2'
  94.         SAY ''
  95.         SAY 'This S3 display driver package was designed'
  96.         SAY 'for OS/2 Warp version 4.00 and earlier'
  97.         SAY 'There is a possbility these drivers may not'
  98.         SAY 'function with this new version of OS/2'
  99.         SAY 'You may continue with installation or'
  100.         SAY 'quit and download a new, updated version of'
  101.         SAY 'this package.'
  102.         call prompt
  103. end
  104. if (os2ver < 2.10) then do
  105.         error = ERR_OS2VER
  106.         call saylog 'Error: Unsupported older OS/2 version'
  107.         signal readme
  108. end
  109. currentdriver = sysini(, 'PM_DISPLAYDRIVERS', 'CURRENTDRIVER')
  110. If \pos('IBMVGA32',currentdriver) then do
  111.         call saylog 'Warning: Not running IBM VGA at install time'
  112.         say "Your system is not currently running IBM's VGA drivers."
  113.         say 'In order to install any new hi-res display driver package'
  114.         say 'safely, the system should be reset to VGA mode.'
  115.         say 'please refer to your IBM OS/2 Warp documentation or'
  116.         say 'readme.txt on this installation diskette for more'
  117.         say 'information.'
  118.         call prompt
  119. end
  120. if cid = '' then do
  121.         say "Press any key to continue, or 'q' to cancel"
  122.         key = SysGetKey('NOECHO')
  123.         parse upper var key key
  124.         if key = 'Q' then signal readme
  125. end
  126. prefix = 'WIN_RES_S3_'
  127. count  = 20
  128. Do i = 0 to 20
  129.         appkey = prefix||i
  130.         result = sysini(, appkey, 'DELETE:')
  131. End
  132. rc=sysini( , 'PM_DISPLAYDRIVERS', 'RESOURCESIZE', 'DELETE:' )
  133. /*
  134. ** turn off readonly attributes -- fails dspinstl
  135. */
  136. rc = SysFileTree(trg||'\os2\*.*',stem,'S','***+*','***-*')
  137. /* Files required by dspinstl.exe */
  138. say ''
  139. call saylog 'Installing files required by dspinstl.exe...'
  140. call unpack 'prereq.pk2' trg||'\os2\install\dspinstl.exe'
  141. call unpack 'prereq.pk2' trg||'\os2\install\dspinstl.hlp'
  142. call unpack 'prereq.pk2' trg||'\os2\install\dspinstl.ico'
  143. call unpack 'prereq.pk2' trg||'\os2\install\product.exe'
  144. call unpack 'prereq.pk2' trg||'\os2\dll\svga.dll'
  145. call unpack 'prereq.pk2' trg||'\os2\dll\inscfg32.dll'
  146. 'copy ' || src || 'install1.dsp ' || trg || '\' pipenull
  147. 'copy ' || src || 'install2.dsp ' || trg || '\' pipenull
  148. 'copy ' || src || 's3common.dsp ' || trg || '\' pipenull
  149. 'copy ' || src || 's3misc1.dsp  ' || trg || '\' pipenull
  150. mmbase = value('MMBASE',,env)
  151. if mmbase <> '' then do
  152.         if right(mmbase,1) = ';' then mmbase = left(mmbase, length(mmbase)-1)
  153.         if right(mmbase,1) = '\' then mmbase = left(mmbase, length(mmbase)-1)
  154.         if ( os2ver < 2.4 ) & ( os2ver > 2.11 )then do
  155.                 call unpack 'prereq.pk2' mmbase'\dll\dive.dll'
  156.                 call unpack 'prereq.pk2' mmbase'\dll\svsh.dll'
  157.                 call unpack 'prereq.pk2' mmbase'\r565lut8.lut'
  158.                 call unpack 'prereq.pk2' mmbase'\y644lut8.lut'
  159.                 call unpack 'prereq.pk2' mmbase'\yuv_lut8.lut'
  160.         end
  161. end
  162. rc=SysFileDelete( trg || '\os2\install\s3virge.dsc' )
  163. rc=SysFileDelete( trg || '\os2\install\s3triov.dsc' )
  164. rc=SysFileDelete( trg || '\os2\install\triov.dsc' )
  165. rc=SysFileDelete( trg || '\os2\install\triov1.dsc' )
  166. rc=SysFileDelete( trg || '\os2\install\pss3.dsc' )
  167. rc=SysFileDelete( trg || '\os2\install\s3.dsc' )
  168. rc=SysFileDelete( trg || '\os2\install\00s3.dsc' )
  169. rc=SysFileDelete( trg || '\os2\private.dif' )
  170. rc=SysFileDelete( trg || '\os2\video.cfg' )
  171. refreshtable = value('REFRESH_TABLE',,env)
  172. if refreshtable <> '' then rc=SysFileDelete( refreshtable )
  173. call unpack 'prereq.pk2' trg||'\os2\install\VIRGE.dsc'
  174. 'rename ' || trg || '\os2\install\VIRGE.dsc 00S3.DSC'
  175. call unpack 'prereq.pk2' trg||'\os2\svga.exe'
  176. call saylog "Starting OS/2's display install program..."
  177. say ''
  178. /* set up parameters for dspinstl.exe */
  179. call stream log, 'c', 'close'
  180. dspinstl = trg||'\os2\install\dspinstl.exe'
  181. dspsrc = right( src, 1 )
  182. if (dspsrc <> '\') & (dspsrc <> '/') then
  183.         dspsrc = src
  184. else
  185.         dspsrc = left(src, length(src)-1) /* dspinstl: no trailing slash */
  186. dspopt = '/pk:other /sk:none /s:'dspsrc' /t:'trg
  187. if os2ver = 2.11 then do
  188.    dspdsc = '/pd:'src'S3MISC1.DSC'
  189. dcmd = dspinstl dspopt dspdsc cid
  190. rc = lineout(log, dcmd)
  191. ''dcmd
  192. end
  193. dspdsc = '/pd:'src'PVIRGE.DSC'
  194. dcmd = dspinstl dspopt dspdsc cid
  195. rc = lineout(log, dcmd)
  196. /* Dspinstl renames files on replace so delete files first. */
  197. result = sysini(, 'PM_INSTALL', 'WINOS2_LOCATION')
  198. winpath = ''
  199. if (result <> '') & (pos('ERROR',result) = 0) then do
  200.         winpath = space(left(result,length(result)-1),0)
  201.         rc = SysFileTree(winpath||'\*.*',stem,,'***+*','***-*')
  202.         rc = SysFileDelete( winpath || '\os2fs.exe' )
  203. end
  204. rc = SysFileDelete( trg || '\OS2\DDC.CMD' )
  205. ''dcmd
  206. call saylog "...OS/2 display install program has completed."
  207. say ''
  208. if winpath <> '' then do
  209.         setup='EXENAME='||winpath||'\os2fs.exe;NORENAME=YES'
  210.         rc = SysCreateObject("WPProgram", "S3 Windows Font Size", "<WP_CONFIG>",setup,'update')
  211.         If (rc <> 0)
  212.                 Then call lineout log,'Font Size Object Created'
  213.                 Else call lineout log,'Font Size Object Creation Failed in 'winpath' rc='rc
  214. end
  215. setup = 'EXENAME=' || trg || '\OS2\DDC.CMD;'
  216. setup = setup || 'ICONFILE=' || trg || '\OS2\DDC.ICO;'
  217. setup = setup || 'NOAUTOCLOSE=YES;MAXIMIZED=YES;NORENAME=YES'
  218. rc = SysCreateObject("WPProgram", "DDC Display Setup", "<WP_CONFIG>",setup,'update')
  219. If (rc <> 0)
  220.         Then call lineout log, 'DDC setup object created'
  221.         Else call lineout log, 'DDC setup object creation failed rc='rc
  222. setting = 'WIN_BACKGROUND_INIT=1;'
  223. len = length(setting)
  224. x = SysIni(, 'WINOS2', 'PM_GlobalWindows31Settings')
  225. If (left(x, len) <> setting)then do
  226.         x = setting||x
  227.         SysIni(, 'WINOS2', 'PM_GlobalWindows31Settings', x)
  228. end
  229. if ((os2ver = 2.10) | (os2ver = 2.11)) then do
  230.         '' || trg || '\os2\install\vcfginst.exe'
  231.         rc = SysFileDelete( trg || '\os2\install\vcfginst.exe' )
  232. end
  233. '' || trg || '\os2\install\create.exe ' || trg || '\os2\install\syslevel.vid 1030 S310320 562107701 ViRGE,ViRGE/VX,ViRGE/DX,ViRGE/GX,ViRGE/GX2 Video Display Driver'
  234. rc = SysFileDelete( trg || '\os2\install\create.exe' )
  235. dspdsc = '/pd:' || trg || '\os2\install\00S3.DSC'
  236. dspopt = '/pk:other /sk:none /s:'dspsrc' /t:'trg
  237. if cid = '' then
  238.      dcmd = dspinstl dspopt dspdsc
  239. else
  240.      dcmd = dspinstl dspopt dspdsc '/res:640x480x256 /u'
  241. ''dcmd
  242. rc = SysFileDelete( trg || '\install1.dsp' )
  243. rc = SysFileDelete( trg || '\install2.dsp' )
  244. rc = SysFileDelete( trg || '\s3common.dsp' )
  245. rc = SysFileDelete( trg || '\s3misc1.dsp'  )
  246. 'start ' || trg || '\os2\install\product.exe ' || trg cid
  247. signal done
  248. getsrc:
  249. if cid = '' then do
  250.         parse source src
  251.         src = word(src,3)
  252. end
  253. else do
  254.         src = parsearg('S')
  255.         if src = '' then signal usage
  256.         src = right(src,length(src)-3)
  257.         temp = right(src, 1)
  258.         if (temp <> '\') & (temp <> '/') then src=src||'\'
  259. end
  260. src = FileSpec('DRIVE', src) || FileSpec('PATH', src)
  261. return
  262. gettrg:
  263. trg = SysSearchPath('PATH', 'PMSHELL.EXE')
  264. trg = FileSpec('drive',trg)
  265. trginfo = SysDriveInfo(trg)
  266. return
  267. parsearg:
  268. parse upper arg switch
  269. result = ''
  270. x = pos(switch, args)
  271. if x <> 0 then do
  272.         y = pos(' ', args, x)
  273.         if y = 0 then y = length(args)
  274.         result = space(substr(args, x-1, y-x+2),0)
  275.         args = delstr(args, x-1, y-x+2)
  276. end
  277. return result
  278. usage:
  279. call usage1
  280. error = ERR_USAGE
  281. signal readme
  282. saylog:
  283. parse arg msg
  284.         say msg
  285.         rc = lineout(log, msg)
  286. return
  287. prompt:
  288. if cid = '' then do
  289.         say ''
  290.         SAY 'Do you wish to continue installation? (y or n)'
  291.         key = SysGetKey('NOECHO')
  292.         say ''
  293.         parse upper var key key
  294.         if key <> 'Y' then signal readme
  295. end
  296. return
  297. unpack:
  298. parse arg pack file
  299. pack = src||pack
  300. if file = '' then
  301.         'unpack2' pack trg pipenull
  302. else do
  303.         call SysFileTree file,stem,,'***+*','***-*'
  304.         filename = filespec("name", file)
  305.         filedrive = filespec("drive", file)
  306.         filepath = filedrive||filespec("path", file)
  307.         if filepath='' then filepath=trg
  308.         'unpack2 'pack filepath' /n:'filename pipenull
  309. end
  310. if (rc <> 0) then do
  311.         error = err_unpack
  312.         call saylog 'Error: unpacking 'file' from 'pack', rc = 'rc
  313.         signal readme
  314. end
  315. else rc = lineout(log, 'UNPACK:' file 'successful')
  316. return
  317. readme:
  318. say ''
  319. say 'The installation has ended without modification to your'
  320. say 'system.  Please reference README.TXT on the installation'
  321. say 'diskette for more information.'
  322. say ''
  323. rc = lineout( log )
  324. exit error
  325. done:
  326. rc = lineout( log )
  327. if cid = '' then 'exit'
  328. exit error
  329. usage1:
  330. say 'SETUP.CMD: S3 Display Driver Installation'
  331. say ''
  332. say 'Usage: setup {/U /S:SRCPATH}'
  333. say ''
  334. say 'Use the optional /U parameter for unattended (CID) installation'
  335. return
  336.  
  337.  
  338.