home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 33 VDrivers / 33-VDrivers.zip / s3savage.zip / setup.cmd < prev    next >
OS/2 REXX Batch file  |  1999-07-30  |  12KB  |  353 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+ Savage_family'
  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 Savage',w)
  35. say center('display driver installation',w)
  36. say center('Version 6.10.10',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, '26')
  84. else x = 1
  85. Select
  86. When x=0 then do
  87.         error = ERR_CHIP
  88.         call saylog 'Error: Hardware not supported by this driver package'
  89.         say 'please download a package matching the detected hardware.'
  90.         signal readme
  91. end
  92. When x<0 then
  93.         flat=1
  94. Otherwise
  95.         flat=0
  96. end
  97. os2ver = SysOS2Ver() /* returns 2.30 for Warp */
  98. if (os2ver > 2.4) then do
  99.         call saylog 'Warning: New version of OS/2'
  100.         SAY ''
  101.         SAY 'This S3 display driver package was designed'
  102.         SAY 'for OS/2 Warp version 4.00 and earlier'
  103.         SAY 'There is a possbility these drivers may not'
  104.         SAY 'function with this new version of OS/2'
  105.         SAY 'You may continue with installation or'
  106.         SAY 'quit and download a new, updated version of'
  107.         SAY 'this package.'
  108.         call prompt
  109. end
  110. if (os2ver < 2.10) then do
  111.         error = ERR_OS2VER
  112.         call saylog 'Error: Unsupported older OS/2 version'
  113.         signal readme
  114. end
  115. currentdriver = sysini(, 'PM_DISPLAYDRIVERS', 'CURRENTDRIVER')
  116. If \pos('IBMVGA32',currentdriver) then do
  117.         call saylog 'Warning: Not running IBM VGA at install time'
  118.         say "Your system is not currently running IBM's VGA drivers."
  119.         say 'In order to install any new hi-res display driver package'
  120.         say 'safely, the system should be reset to VGA mode.'
  121.         say 'please refer to your IBM OS/2 Warp documentation or'
  122.         say 'readme.txt on this installation diskette for more'
  123.         say 'information.'
  124.         call prompt
  125. end
  126. if cid = '' then do
  127.         say "Press any key to continue, or 'q' to cancel"
  128.         key = SysGetKey('NOECHO')
  129.         parse upper var key key
  130.         if key = 'Q' then signal readme
  131. end
  132. prefix = 'WIN_RES_S3_'
  133. count  = 20
  134. Do i = 0 to 20
  135.         appkey = prefix||i
  136.         result = sysini(, appkey, 'DELETE:')
  137. End
  138. rc=sysini( , 'PM_DISPLAYDRIVERS', 'RESOURCESIZE', 'DELETE:' )
  139. /*
  140. ** turn off readonly attributes -- fails dspinstl
  141. */
  142. rc = SysFileTree(trg||'\os2\*.*',stem,'S','***+*','***-*')
  143. /* Files required by dspinstl.exe */
  144. say ''
  145. call saylog 'Installing files required by dspinstl.exe...'
  146. call unpack 'prereq.pk2' trg||'\os2\install\dspinstl.exe'
  147. call unpack 'prereq.pk2' trg||'\os2\install\dspinstl.hlp'
  148. call unpack 'prereq.pk2' trg||'\os2\install\dspinstl.ico'
  149. call unpack 'prereq.pk2' trg||'\os2\install\product.exe'
  150. call unpack 'prereq.pk2' trg||'\os2\dll\svga.dll'
  151. call unpack 'prereq.pk2' trg||'\os2\dll\inscfg32.dll'
  152. 'copy ' || src || 'install1.dsp ' || trg || '\' pipenull
  153. 'copy ' || src || 'install2.dsp ' || trg || '\' pipenull
  154. 'copy ' || src || 's3common.dsp ' || trg || '\' pipenull
  155. 'copy ' || src || 's3misc1.dsp  ' || trg || '\' pipenull
  156. mmbase = value('MMBASE',,env)
  157. if mmbase <> '' then do
  158.         if right(mmbase,1) = ';' then mmbase = left(mmbase, length(mmbase)-1)
  159.         if right(mmbase,1) = '\' then mmbase = left(mmbase, length(mmbase)-1)
  160.         if ( os2ver < 2.4 ) & ( os2ver > 2.11 )then do
  161.                 call unpack 'prereq.pk2' mmbase'\dll\dive.dll'
  162.                 call unpack 'prereq.pk2' mmbase'\dll\svsh.dll'
  163.                 call unpack 'prereq.pk2' mmbase'\r565lut8.lut'
  164.                 call unpack 'prereq.pk2' mmbase'\y644lut8.lut'
  165.                 call unpack 'prereq.pk2' mmbase'\yuv_lut8.lut'
  166.         end
  167. end
  168. rc=SysFileDelete( trg || '\os2\install\s3virge.dsc' )
  169. rc=SysFileDelete( trg || '\os2\install\s3triov.dsc' )
  170. rc=SysFileDelete( trg || '\os2\install\triov.dsc' )
  171. rc=SysFileDelete( trg || '\os2\install\triov1.dsc' )
  172. rc=SysFileDelete( trg || '\os2\install\pss3.dsc' )
  173. rc=SysFileDelete( trg || '\os2\install\s3.dsc' )
  174. rc=SysFileDelete( trg || '\os2\install\00s3.dsc' )
  175. rc=SysFileDelete( trg || '\os2\private.dif' )
  176. rc=SysFileDelete( trg || '\os2\video.cfg' )
  177. refreshtable = value('REFRESH_TABLE',,env)
  178. if refreshtable <> '' then rc=SysFileDelete( refreshtable )
  179. if flat = 0 then do
  180.         call unpack 'prereq.pk2' trg||'\os2\install\GX3.dsc'
  181.         'rename ' || trg || '\os2\install\GX3.dsc 00S3.DSC'
  182. end
  183. else do
  184.         call unpack 'prereq.pk2' trg||'\os2\install\.dsc'
  185.         'rename ' || trg || '\os2\install\.dsc 00S3.DSC'
  186. end
  187. call unpack 'prereq.pk2' trg||'\os2\svga.exe'
  188. call saylog "Starting OS/2's display install program..."
  189. say ''
  190. /* set up parameters for dspinstl.exe */
  191. call stream log, 'c', 'close'
  192. dspinstl = trg||'\os2\install\dspinstl.exe'
  193. dspsrc = right( src, 1 )
  194. if (dspsrc <> '\') & (dspsrc <> '/') then
  195.         dspsrc = src
  196. else
  197.         dspsrc = left(src, length(src)-1) /* dspinstl: no trailing slash */
  198. dspopt = '/pk:other /sk:none /s:'dspsrc' /t:'trg
  199. if os2ver = 2.11 then do
  200.    dspdsc = '/pd:'src'S3MISC1.DSC'
  201. dcmd = dspinstl dspopt dspdsc cid
  202. rc = lineout(log, dcmd)
  203. ''dcmd
  204. end
  205. if flat = 0 then
  206.         dspdsc = '/pd:'src'PGX3.DSC'
  207. else
  208.         dspdsc = '/pd:'src'P.DSC'
  209. dcmd = dspinstl dspopt dspdsc cid
  210. rc = lineout(log, dcmd)
  211. /* Dspinstl renames files on replace so delete files first. */
  212. result = sysini(, 'PM_INSTALL', 'WINOS2_LOCATION')
  213. winpath = ''
  214. if (result <> '') & (pos('ERROR',result) = 0) then do
  215.         winpath = space(left(result,length(result)-1),0)
  216.         rc = SysFileTree(winpath||'\*.*',stem,,'***+*','***-*')
  217.         rc = SysFileDelete( winpath || '\os2fs.exe' )
  218. end
  219. rc = SysFileDelete( trg || '\OS2\DDC.CMD' )
  220. ''dcmd
  221. call saylog "...OS/2 display install program has completed."
  222. say ''
  223. if winpath <> '' then do
  224.         setup='EXENAME='||winpath||'\os2fs.exe;NORENAME=YES'
  225.         rc = SysCreateObject("WPProgram", "S3 Windows Font Size", "<WP_CONFIG>",setup,'update')
  226.         If (rc <> 0)
  227.                 Then call lineout log,'Font Size Object Created'
  228.                 Else call lineout log,'Font Size Object Creation Failed in 'winpath' rc='rc
  229. end
  230. setup = 'EXENAME=' || trg || '\OS2\DDC.CMD;'
  231. setup = setup || 'ICONFILE=' || trg || '\OS2\DDC.ICO;'
  232. setup = setup || 'NOAUTOCLOSE=YES;MAXIMIZED=YES;NORENAME=YES'
  233. rc = SysCreateObject("WPProgram", "DDC Display Setup", "<WP_CONFIG>",setup,'update')
  234. If (rc <> 0)
  235.         Then call lineout log, 'DDC setup object created'
  236.         Else call lineout log, 'DDC setup object creation failed rc='rc
  237. setting = 'WIN_BACKGROUND_INIT=1;'
  238. len = length(setting)
  239. x = SysIni(, 'WINOS2', 'PM_GlobalWindows31Settings')
  240. If (left(x, len) <> setting)then do
  241.         x = setting||x
  242.         SysIni(, 'WINOS2', 'PM_GlobalWindows31Settings', x)
  243. end
  244. if ((os2ver = 2.10) | (os2ver = 2.11)) then do
  245.         '' || trg || '\os2\install\vcfginst.exe'
  246.         rc = SysFileDelete( trg || '\os2\install\vcfginst.exe' )
  247. end
  248. '' || trg || '\os2\install\create.exe ' || trg || '\os2\install\syslevel.vid 6100 S361010 562107701 Savage Video Display Driver'
  249. rc = SysFileDelete( trg || '\os2\install\create.exe' )
  250. dspdsc = '/pd:' || trg || '\os2\install\00S3.DSC'
  251. dspopt = '/pk:other /sk:none /s:'dspsrc' /t:'trg
  252. if cid = '' then
  253.      dcmd = dspinstl dspopt dspdsc
  254. else
  255.      dcmd = dspinstl dspopt dspdsc '/res:640x480x256 /u'
  256. ''dcmd
  257. rc = SysFileDelete( trg || '\install1.dsp' )
  258. rc = SysFileDelete( trg || '\install2.dsp' )
  259. rc = SysFileDelete( trg || '\s3common.dsp' )
  260. rc = SysFileDelete( trg || '\s3misc1.dsp'  )
  261. 'start ' || trg || '\os2\install\product.exe ' || trg cid
  262. signal done
  263. getsrc:
  264. if cid = '' then do
  265.         parse source src
  266.         src = word(src,3)
  267. end
  268. else do
  269.         src = parsearg('S')
  270.         if src = '' then signal usage
  271.         src = right(src,length(src)-3)
  272.         temp = right(src, 1)
  273.         if (temp <> '\') & (temp <> '/') then src=src||'\'
  274. end
  275. src = FileSpec('DRIVE', src) || FileSpec('PATH', src)
  276. return
  277. gettrg:
  278. trg = SysSearchPath('PATH', 'PMSHELL.EXE')
  279. trg = FileSpec('drive',trg)
  280. trginfo = SysDriveInfo(trg)
  281. return
  282. parsearg:
  283. parse upper arg switch
  284. result = ''
  285. x = pos(switch, args)
  286. if x <> 0 then do
  287.         y = pos(' ', args, x)
  288.         if y = 0 then y = length(args)
  289.         result = space(substr(args, x-1, y-x+2),0)
  290.         args = delstr(args, x-1, y-x+2)
  291. end
  292. return result
  293. usage:
  294. call usage1
  295. error = ERR_USAGE
  296. signal readme
  297. saylog:
  298. parse arg msg
  299.         say msg
  300.         rc = lineout(log, msg)
  301. return
  302. prompt:
  303. if cid = '' then do
  304.         say ''
  305.         SAY 'Do you wish to continue installation? (y or n)'
  306.         key = SysGetKey('NOECHO')
  307.         say ''
  308.         parse upper var key key
  309.         if key <> 'Y' then signal readme
  310. end
  311. return
  312. unpack:
  313. parse arg pack file
  314. pack = src||pack
  315. if file = '' then
  316.         'unpack2' pack trg pipenull
  317. else do
  318.         call SysFileTree file,stem,,'***+*','***-*'
  319.         filename = filespec("name", file)
  320.         filedrive = filespec("drive", file)
  321.         filepath = filedrive||filespec("path", file)
  322.         if filepath='' then filepath=trg
  323.         'unpack2 'pack filepath' /n:'filename pipenull
  324. end
  325. if (rc <> 0) then do
  326.         error = err_unpack
  327.         call saylog 'Error: unpacking 'file' from 'pack', rc = 'rc
  328.         signal readme
  329. end
  330. else rc = lineout(log, 'UNPACK:' file 'successful')
  331. return
  332. readme:
  333. say ''
  334. say 'The installation has ended without modification to your'
  335. say 'system.  Please reference README.TXT on the installation'
  336. say 'diskette for more information.'
  337. say ''
  338. rc = lineout( log )
  339. exit error
  340. done:
  341. rc = lineout( log )
  342. if cid = '' then 'exit'
  343. exit error
  344. usage1:
  345. say 'SETUP.CMD: S3 Display Driver Installation'
  346. say ''
  347. say 'Usage: setup {/U /S:SRCPATH}'
  348. say ''
  349. say 'Use the optional /U parameter for unattended (CID) installation'
  350. return
  351.  
  352.  
  353.