home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 33 VDrivers / 33-VDrivers.zip / mx_10311.exe / setup.cmd < prev    next >
OS/2 REXX Batch file  |  1997-12-04  |  12KB  |  344 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. ERR_OUTOFRC     = 5636
  13. env = 'OS2ENVIRONMENT'
  14. src = ''
  15. trg = ''
  16. parse upper arg args
  17. cid = parsearg('U')
  18. call getsrc
  19. if args <> '' then signal usage
  20. call gettrg
  21. /* space-seperated S3 chip list -- must match with svgadefs.h */
  22. chips = '801/805 928 911 864 964 868 968 Trio32 Trio64 Trio64V+'
  23. chips = chips 'Aurora64V+ ViRGE ViRGE/vX Trio64UV+ Trio64V+Compatible Trio64V2'
  24. chips = chips 'Yosemite ViRGE/DX-GX ViRGE/GX2 ViRGE+COMPATBLE M3 M5 ViRGE/GX2 Trio3D'
  25. pipenull = ' 1>nul 2>&1'
  26. w = 70
  27. log = trg'\os2\install\display.log'
  28. x = linein(src||'BUILD.LVL')
  29. rc = lineout( src||'BUILD.LVL' )
  30. rc = lineout(log, copies('=',w))
  31. rc = lineout(log, x)
  32. call SysCls
  33. say ''
  34. say copies('*',w)
  35. say center('S3 ViRGE,ViRGE/VX,ViRGE/DX,ViRGE/GX,ViRGE/GX2,ViRGE/MX',w)
  36. say center('display driver installation',w)
  37. say center('Version 1.03.11',w)
  38. say ''
  39. say center('Please read README.TXT first', w)
  40. say center('before installing this package', w)
  41. say ''
  42. call usage1
  43. say ''
  44. say center('Source Path 'src,w)
  45. say center('Target Drive 'trg '['word(trginfo,4)']',w)
  46. if cid <> '' then do
  47.         say ''
  48.         say 'User Options:'
  49.         call saylog '   Unattended Installation'
  50. end
  51. say copies('*',w)
  52. say ''
  53. u2spec = SysSearchPath('PATH', 'UNPACK2.EXE')
  54. if (u2spec = '') then do
  55.         call lineout log, 'adding unpack2 capability to system'
  56.         'unpack' src'unpack.pk2' trg pipenull
  57. end
  58. call unpack 'prereq.pk2' trg||'\os2\dll\portio.dll'
  59. call unpack 'prereq.pk2' trg||'\os2\install\s3chipid.exe'
  60. ''trg||'\os2\install\s3chipid 2 0'
  61. chipid = rc
  62. rc = SysFileDelete( trg||'\os2\install\s3chipid.exe' )
  63. rc = SysFileDelete( trg||'\os2\dll\portio.dll' )
  64. if chipid = 0 then do
  65.         error = ERR_CHIP
  66.         call saylog 'Error: Unknown (probably non-S3) video hardware'
  67.         signal readme
  68. end
  69. else if chipid < -1 then do
  70.         error = ERR_COMPAT
  71.         call saylog 'Error: BIOS indicates chip is not compatibile'
  72.         signal readme
  73. end
  74. else if chipid = 32767 then do
  75.         error = ERR_OUTOFRC
  76.         call saylog 'Error: OS/2 can not alloc enough resource for PM display driver'
  77.         signal readme
  78. end
  79. else if chipid <> -1 then do
  80.         chiptext = 'S3 ' || word( chips, chipid )
  81.         tempid = chipid
  82. end
  83. else do
  84.         chiptext = 'IBM Mach 868'
  85.         tempid = 6
  86. end
  87. call saylog 'The target video hardware is ['tempid'] ' || chiptext
  88. say ''
  89. if chipid <> -1 then x = wordpos(chipid, '12 13 18 19 22 23')
  90. else x = 1
  91. if x=0 then do
  92.         error = ERR_CHIP
  93.         call saylog 'Error: Hardware not supported by this driver package'
  94.         say 'please download a package matching the detected hardware.'
  95.         signal readme
  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. 'copy ' || src || 'VIRGE.DSC ' || trg || '\os2\install\VIRGE.dsc' pipenull
  180. 'rename ' || trg || '\os2\install\VIRGE.dsc 00S3.DSC'
  181. call unpack 'prereq.pk2' trg||'\os2\svga.exe'
  182. call saylog "Starting OS/2's display install program..."
  183. say ''
  184. /* set up parameters for dspinstl.exe */
  185. call stream log, 'c', 'close'
  186. dspinstl = trg||'\os2\install\dspinstl.exe'
  187. dspsrc = right( src, 1 )
  188. if (dspsrc <> '\') & (dspsrc <> '/') then
  189.         dspsrc = src
  190. else
  191.         dspsrc = left(src, length(src)-1) /* dspinstl: no trailing slash */
  192. dspopt = '/pk:other /sk:none /s:'dspsrc' /t:'trg
  193. if os2ver = 2.11 then do
  194.    dspdsc = '/pd:'src'S3MISC1.DSC'
  195. dcmd = dspinstl dspopt dspdsc cid
  196. rc = lineout(log, dcmd)
  197. ''dcmd
  198. end
  199. dspdsc = '/pd:'src'PVIRGE.DSC'
  200. dcmd = dspinstl dspopt dspdsc cid
  201. rc = lineout(log, dcmd)
  202. /* Dspinstl renames files on replace so delete files first. */
  203. result = sysini(, 'PM_INSTALL', 'WINOS2_LOCATION')
  204. winpath = ''
  205. if (result <> '') & (pos('ERROR',result) = 0) then do
  206.         winpath = space(left(result,length(result)-1),0)
  207.         rc = SysFileTree(winpath||'\*.*',stem,,'***+*','***-*')
  208.         rc = SysFileDelete( winpath || '\os2fs.exe' )
  209. end
  210. rc = SysFileDelete( trg || '\OS2\DDC.CMD' )
  211. ''dcmd
  212. call saylog "...OS/2 display install program has completed."
  213. say ''
  214. if winpath <> '' then do
  215.         setup='EXENAME='||winpath||'\os2fs.exe;NORENAME=YES'
  216.         rc = SysCreateObject("WPProgram", "S3 Windows Font Size", "<WP_CONFIG>",setup,'update')
  217.         If (rc <> 0)
  218.                 Then call lineout log,'Font Size Object Created'
  219.                 Else call lineout log,'Font Size Object Creation Failed in 'winpath' rc='rc
  220. end
  221. setup = 'EXENAME=' || trg || '\OS2\DDC.CMD;'
  222. setup = setup || 'ICONFILE=' || trg || '\OS2\DDC.ICO;'
  223. setup = setup || 'NOAUTOCLOSE=YES;MAXIMIZED=YES;NORENAME=YES'
  224. rc = SysCreateObject("WPProgram", "DDC Display Setup", "<WP_CONFIG>",setup,'update')
  225. If (rc <> 0)
  226.         Then call lineout log, 'DDC setup object created'
  227.         Else call lineout log, 'DDC setup object creation failed rc='rc
  228. setting = 'WIN_BACKGROUND_INIT=1;'
  229. len = length(setting)
  230. x = SysIni(, 'WINOS2', 'PM_GlobalWindows31Settings')
  231. If (left(x, len) <> setting)then do
  232.         x = setting||x
  233.         SysIni(, 'WINOS2', 'PM_GlobalWindows31Settings', x)
  234. end
  235. if ((os2ver = 2.10) | (os2ver = 2.11)) then do
  236.         '' || trg || '\os2\install\vcfginst.exe'
  237.         rc = SysFileDelete( trg || '\os2\install\vcfginst.exe' )
  238. end
  239. '' || trg || '\os2\install\create.exe ' || trg || '\os2\install\syslevel.vid 1030 S310311 562107701 ViRGE,ViRGE/VX,ViRGE/DX,ViRGE/GX,ViRGE/GX2'
  240. rc = SysFileDelete( trg || '\os2\install\create.exe' )
  241. dspdsc = '/pd:' || trg || '\os2\install\00S3.DSC'
  242. dspopt = '/pk:other /sk:none /s:'dspsrc' /t:'trg
  243. if cid = '' then
  244.      dcmd = dspinstl dspopt dspdsc
  245. else
  246.      dcmd = dspinstl dspopt dspdsc '/res:640x480x256 /u'
  247. ''dcmd
  248. rc = SysFileDelete( trg || '\install1.dsp' )
  249. rc = SysFileDelete( trg || '\install2.dsp' )
  250. rc = SysFileDelete( trg || '\s3common.dsp' )
  251. rc = SysFileDelete( trg || '\s3misc1.dsp'  )
  252. 'start ' || trg || '\os2\install\product.exe ' || trg cid
  253. signal done
  254. getsrc:
  255. if cid = '' then do
  256.         parse source src
  257.         src = word(src,3)
  258. end
  259. else do
  260.         src = parsearg('S')
  261.         if src = '' then signal usage
  262.         src = right(src,length(src)-3)
  263.         temp = right(src, 1)
  264.         if (temp <> '\') & (temp <> '/') then src=src||'\'
  265. end
  266. src = FileSpec('DRIVE', src) || FileSpec('PATH', src)
  267. return
  268. gettrg:
  269. trg = SysSearchPath('PATH', 'PMSHELL.EXE')
  270. trg = FileSpec('drive',trg)
  271. trginfo = SysDriveInfo(trg)
  272. return
  273. parsearg:
  274. parse upper arg switch
  275. result = ''
  276. x = pos(switch, args)
  277. if x <> 0 then do
  278.         y = pos(' ', args, x)
  279.         if y = 0 then y = length(args)
  280.         result = space(substr(args, x-1, y-x+2),0)
  281.         args = delstr(args, x-1, y-x+2)
  282. end
  283. return result
  284. usage:
  285. call usage1
  286. error = ERR_USAGE
  287. signal readme
  288. saylog:
  289. parse arg msg
  290.         say msg
  291.         rc = lineout(log, msg)
  292. return
  293. prompt:
  294. if cid = '' then do
  295.         say ''
  296.         SAY 'Do you wish to continue installation? (y or n)'
  297.         key = SysGetKey('NOECHO')
  298.         say ''
  299.         parse upper var key key
  300.         if key <> 'Y' then signal readme
  301. end
  302. return
  303. unpack:
  304. parse arg pack file
  305. pack = src||pack
  306. if file = '' then
  307.         'unpack2' pack trg pipenull
  308. else do
  309.         call SysFileTree file,stem,,'***+*','***-*'
  310.         filename = filespec("name", file)
  311.         filedrive = filespec("drive", file)
  312.         filepath = filedrive||filespec("path", file)
  313.         if filepath='' then filepath=trg
  314.         'unpack2 'pack filepath' /n:'filename pipenull
  315. end
  316. if (rc <> 0) then do
  317.         error = err_unpack
  318.         call saylog 'Error: unpacking 'file' from 'pack', rc = 'rc
  319.         signal readme
  320. end
  321. else rc = lineout(log, 'UNPACK:' file 'successful')
  322. return
  323. readme:
  324. say ''
  325. say 'The installation has ended without modification to your'
  326. say 'system.  Please reference README.TXT on the installation'
  327. say 'diskette for more information.'
  328. say ''
  329. rc = lineout( log )
  330. exit error
  331. done:
  332. rc = lineout( log )
  333. if cid = '' then 'exit'
  334. exit error
  335. usage1:
  336. say 'SETUP.CMD: S3 Display Driver Installation'
  337. say ''
  338. say 'Usage: setup {/U /S:SRCPATH}'
  339. say ''
  340. say 'Use the optional /U parameter for unattended (CID) installation'
  341. return
  342.  
  343.  
  344.