home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 33 VDrivers / 33-VDrivers.zip / eos21012.zip / SETUP.CMD < prev    next >
OS/2 REXX Batch file  |  1996-08-20  |  10KB  |  310 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 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'
  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',w)
  35. say center('display driver installation',w)
  36. say center('Version 1.00.12',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 '
  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')
  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 > 4.00) 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 3.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. /*
  133. ** turn off readonly attributes -- fails dspinstl
  134. */
  135. rc = SysFileTree(trg||'\os2\*.*',stem,'S','***+*','***-*')
  136. /* Files required by dspinstl.exe */
  137. say ''
  138. call saylog 'Installing files required by dspinstl.exe...'
  139. call unpack 'prereq.pk2' trg||'\os2\install\dspinstl.exe'
  140. call unpack 'prereq.pk2' trg||'\os2\install\dspinstl.hlp'
  141. call unpack 'prereq.pk2' trg||'\os2\install\dspinstl.ico'
  142. call unpack 'prereq.pk2' trg||'\os2\install\product.exe'
  143. call unpack 'prereq.pk2' trg||'\os2\dll\svga.dll'
  144. call unpack 'prereq.pk2' trg||'\os2\dll\inscfg32.dll'
  145. mmbase = value('MMBASE',,env)
  146. if mmbase <> '' then do
  147.     if right(mmbase,1) = ';' then mmbase = left(mmbase, length(mmbase)-1)
  148.     if right(mmbase,1) = '\' then mmbase = left(mmbase, length(mmbase)-1)
  149.     call unpack 'prereq.pk2' mmbase'\dll\dive.dll'
  150.     call unpack 'prereq.pk2' mmbase'\dll\svsh.dll'
  151.     call unpack 'prereq.pk2' mmbase'\r565lut8.lut'
  152.     call unpack 'prereq.pk2' mmbase'\y644lut8.lut'
  153.     call unpack 'prereq.pk2' mmbase'\yuv_lut8.lut'
  154. end
  155. rc=SysFileDelete( trg || '\os2\install\s3virge.dsc' )
  156. rc=SysFileDelete( trg || '\os2\install\s3triov.dsc' )
  157. rc=SysFileDelete( trg || '\os2\install\triov.dsc' )
  158. rc=SysFileDelete( trg || '\os2\install\triov1.dsc' )
  159. rc=SysFileDelete( trg || '\os2\install\pss3.dsc' )
  160. rc=SysFileDelete( trg || '\os2\install\s3.dsc' )
  161. rc=SysFileDelete( trg || '\os2\install\00s3.dsc' )
  162. rc=SysFileDelete( trg || '\os2\private.dif' )
  163. rc=SysFileDelete( trg || '\os2\video.cfg' )
  164. refreshtable = value('REFRESH_TABLE',,env)
  165. if refreshtable <> '' then rc=SysFileDelete( refreshtable )
  166. call unpack 'prereq.pk2' trg||'\os2\install\VIRGE.dsc'
  167. 'rename ' || trg || '\os2\install\VIRGE.dsc 00S3.DSC'
  168. call unpack 'prereq.pk2' trg||'\os2\svga.exe'
  169. call saylog "Starting OS/2's display install program..."
  170. say ''
  171. /* set up parameters for dspinstl.exe */
  172. call stream log, 'c', 'close'
  173. dspinstl = trg||'\os2\install\dspinstl.exe'
  174. dspsrc = right( src, 1 )
  175. if (dspsrc <> '\') & (dspsrc <> '/') then
  176.     dspsrc = src
  177. else
  178.     dspsrc = left(src, length(src)-1) /* dspinstl: no trailing slash */
  179. dspopt = '/pk:other /sk:none /s:'dspsrc' /t:'trg
  180. dspdsc = '/pd:'src'PVIRGE.DSC'
  181. dcmd = dspinstl dspopt dspdsc cid
  182. rc = lineout(log, dcmd)
  183. /* Dspinstl renames files on replace so delete files first. */
  184. result = sysini(, 'PM_INSTALL', 'WINOS2_LOCATION')
  185. if result <> '' then do
  186.     winpath = space(left(result,length(result)-1),0)
  187.     rc = SysFileTree(winpath||'\*.*',stem,,'***+*','***-*')
  188.     rc = SysFileDelete( winpath || '\os2fs.exe' )
  189. end
  190. rc = SysFileDelete( trg || '\OS2\DDC.CMD' )
  191. ''dcmd
  192. call saylog "...OS/2 display install program has completed."
  193. say ''
  194. if winpath <> '' then do
  195.     setup='EXENAME='||winpath||'\os2fs.exe;NORENAME=YES'
  196.     rc = SysCreateObject("WPProgram", "S3 Windows Font Size", "<WP_CONFIG>",setup,'update')
  197.     If (rc <> 0)
  198.         Then call lineout log,'Font Size Object Created'
  199.         Else call lineout log,'Font Size Object Creation Failed in 'winpath' rc='rc
  200. end
  201. setup = 'EXENAME=' || trg || '\OS2\DDC.CMD;'
  202. setup = setup || 'ICONFILE=' || trg || '\OS2\DDC.ICO;'
  203. setup = setup || 'NOAUTOCLOSE=YES;MAXIMIZED=YES;NORENAME=YES'
  204. rc = SysCreateObject("WPProgram", "DDC Display Setup", "<WP_CONFIG>",setup,'update')
  205. If (rc <> 0)
  206.     Then call lineout log, 'DDC setup object created'
  207.     Else call lineout log, 'DDC setup object creation failed rc='rc
  208. setting = 'WIN_BACKGROUND_INIT=1;'
  209. len = length(setting)
  210. x = SysIni(, 'WINOS2', 'PM_GlobalWindows31Settings')
  211. If (left(x, len) <> setting)then do
  212.     x = setting||x
  213.     SysIni(, 'WINOS2', 'PM_GlobalWindows31Settings', x)
  214. end
  215. if ((os2ver = 2.10) | (os2ver = 2.11)) then ''src'vcfginst.exe'
  216. '' || trg || '\os2\install\create.exe ' || trg || '\os2\install\syslevel.vid 1000 S310012 562107701 ViRGE'
  217. rc = SysFileDelete( trg || '\os2\install\create.exe' )
  218. 'start ' || trg || '\os2\install\product.exe ' || trg cid
  219. signal done
  220. getsrc:
  221. if cid = '' then do
  222.     parse source src
  223.     src = word(src,3)
  224. end
  225. else do
  226.     src = parsearg('s')
  227.     if src = '' then signal usage
  228.     src = right(src,length(src)-3)
  229.     temp = right(src, 1)
  230.     if (temp <> '\') & (temp <> '/') then src=src||'\'
  231. end
  232. src = FileSpec('DRIVE', src) || FileSpec('PATH', src)
  233. return
  234. gettrg:
  235. trg = SysSearchPath('PATH', 'PMSHELL.EXE')
  236. trg = FileSpec('drive',trg)
  237. trginfo = SysDriveInfo(trg)
  238. return
  239. parsearg:
  240. parse arg switch
  241. result = ''
  242. x = pos(switch, args)
  243. if x <> 0 then do
  244.     y = pos(' ', args, x)
  245.     if y = 0 then y = length(args)
  246.     result = space(substr(args, x-1, y-x+2),0)
  247.     args = delstr(args, x-1, y-x+2)
  248. end
  249. return result
  250. usage:
  251. call usage1
  252. error = ERR_USAGE
  253. signal readme
  254. saylog:
  255. parse arg msg
  256.     say msg
  257.     rc = lineout(log, msg)
  258. return
  259. prompt:
  260. if cid = '' then do
  261.     say ''
  262.     SAY 'Do you wish to continue installation? (y or n)'
  263.     key = SysGetKey('NOECHO')
  264.     say ''
  265.     parse upper var key key
  266.     if key <> 'Y' then signal readme
  267. end
  268. return
  269. unpack:
  270. parse arg pack file
  271. pack = src||pack
  272. if file = '' then
  273.     'unpack2' pack trg pipenull
  274. else do
  275.     call SysFileTree file,stem,,'***+*','***-*'
  276.     filename = filespec("name", file)
  277.     filedrive = filespec("drive", file)
  278.     filepath = filedrive||filespec("path", file)
  279.     if filepath='' then filepath=trg
  280.     'unpack2 'pack filepath' /n:'filename pipenull
  281. end
  282. if (rc <> 0) then do
  283.     error = err_unpack
  284.     call saylog 'Error: unpacking 'file' from 'pack', rc = 'rc
  285.     signal readme
  286. end
  287. else rc = lineout(log, 'UNPACK:' file 'successful')
  288. return
  289. readme:
  290. say ''
  291. say 'The installation has ended without modification to your'
  292. say 'system.  Please reference README.TXT on the installation'
  293. say 'diskette for more information.'
  294. say ''
  295. rc = lineout( log )
  296. exit error
  297. done:
  298. rc = lineout( log )
  299. if cid = '' then 'exit'
  300. exit error
  301. usage1:
  302. say 'SETUP.CMD: S3 Display Driver Installation'
  303. say ''
  304. say 'Usage: setup {/u /s:srcpath}'
  305. say ''
  306. say 'Use the optional /u parameter for unattended (CID) installation'
  307. return
  308.  
  309.  
  310.