home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 33 VDrivers / 33-VDrivers.zip / eng30301.zip / DISK1.ZIP / SETUP.CMD < prev    next >
OS/2 REXX Batch file  |  1996-12-04  |  12KB  |  342 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+COMPATBLE'
  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 Vision864/964/868/968/Trio32/64/64V+/64V2',w)
  35. say center('display driver installation',w)
  36. say center('Version 3.03.01',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, '4 5 6 7 8 9 10 15 16')
  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<3 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. mmbase = value('MMBASE',,env)
  156. if mmbase <> '' then do
  157.         if right(mmbase,1) = ';' then mmbase = left(mmbase, length(mmbase)-1)
  158.         if right(mmbase,1) = '\' then mmbase = left(mmbase, length(mmbase)-1)
  159.         if ( os2ver < 2.4 ) & ( os2ver > 2.11 )then do
  160.                 call unpack 'prereq.pk2' mmbase'\dll\dive.dll'
  161.                 call unpack 'prereq.pk2' mmbase'\dll\svsh.dll'
  162.                 call unpack 'prereq.pk2' mmbase'\r565lut8.lut'
  163.                 call unpack 'prereq.pk2' mmbase'\y644lut8.lut'
  164.                 call unpack 'prereq.pk2' mmbase'\yuv_lut8.lut'
  165.         end
  166. end
  167. rc=SysFileDelete( trg || '\os2\install\s3virge.dsc' )
  168. rc=SysFileDelete( trg || '\os2\install\s3triov.dsc' )
  169. rc=SysFileDelete( trg || '\os2\install\triov.dsc' )
  170. rc=SysFileDelete( trg || '\os2\install\triov1.dsc' )
  171. rc=SysFileDelete( trg || '\os2\install\pss3.dsc' )
  172. rc=SysFileDelete( trg || '\os2\install\s3.dsc' )
  173. rc=SysFileDelete( trg || '\os2\install\00s3.dsc' )
  174. rc=SysFileDelete( trg || '\os2\private.dif' )
  175. rc=SysFileDelete( trg || '\os2\video.cfg' )
  176. refreshtable = value('REFRESH_TABLE',,env)
  177. if refreshtable <> '' then rc=SysFileDelete( refreshtable )
  178. if flat = 0 then do
  179.         call unpack 'prereq.pk2' trg||'\os2\install\TRIOV2.dsc'
  180.         'rename ' || trg || '\os2\install\TRIOV2.dsc 00S3.DSC'
  181. end
  182. else do
  183.         call unpack 'prereq.pk2' trg||'\os2\install\LINX64.dsc'
  184.         'rename ' || trg || '\os2\install\LINX64.dsc 00S3.DSC'
  185. end
  186. call unpack 'prereq.pk2' trg||'\os2\svga.exe'
  187. call saylog "Starting OS/2's display install program..."
  188. say ''
  189. /* set up parameters for dspinstl.exe */
  190. call stream log, 'c', 'close'
  191. dspinstl = trg||'\os2\install\dspinstl.exe'
  192. dspsrc = right( src, 1 )
  193. if (dspsrc <> '\') & (dspsrc <> '/') then
  194.         dspsrc = src
  195. else
  196.         dspsrc = left(src, length(src)-1) /* dspinstl: no trailing slash */
  197. dspopt = '/pk:other /sk:none /s:'dspsrc' /t:'trg
  198. if flat = 0 then
  199.         dspdsc = '/pd:'src'PTRIOV2.DSC'
  200. else
  201.         dspdsc = '/pd:'src'PLINX64.DSC'
  202. dcmd = dspinstl dspopt dspdsc cid
  203. rc = lineout(log, dcmd)
  204. /* Dspinstl renames files on replace so delete files first. */
  205. result = sysini(, 'PM_INSTALL', 'WINOS2_LOCATION')
  206. winpath = ''
  207. if (result <> '') & (pos('ERROR',result) = 0) then do
  208.         winpath = space(left(result,length(result)-1),0)
  209.         rc = SysFileTree(winpath||'\*.*',stem,,'***+*','***-*')
  210.         rc = SysFileDelete( winpath || '\os2fs.exe' )
  211. end
  212. rc = SysFileDelete( trg || '\OS2\DDC.CMD' )
  213. ''dcmd
  214. call saylog "...OS/2 display install program has completed."
  215. say ''
  216. if winpath <> '' then do
  217.         setup='EXENAME='||winpath||'\os2fs.exe;NORENAME=YES'
  218.         rc = SysCreateObject("WPProgram", "S3 Windows Font Size", "<WP_CONFIG>",setup,'update')
  219.         If (rc <> 0)
  220.                 Then call lineout log,'Font Size Object Created'
  221.                 Else call lineout log,'Font Size Object Creation Failed in 'winpath' rc='rc
  222. end
  223. setup = 'EXENAME=' || trg || '\OS2\DDC.CMD;'
  224. setup = setup || 'ICONFILE=' || trg || '\OS2\DDC.ICO;'
  225. setup = setup || 'NOAUTOCLOSE=YES;MAXIMIZED=YES;NORENAME=YES'
  226. rc = SysCreateObject("WPProgram", "DDC Display Setup", "<WP_CONFIG>",setup,'update')
  227. If (rc <> 0)
  228.         Then call lineout log, 'DDC setup object created'
  229.         Else call lineout log, 'DDC setup object creation failed rc='rc
  230. setting = 'WIN_BACKGROUND_INIT=1;'
  231. len = length(setting)
  232. x = SysIni(, 'WINOS2', 'PM_GlobalWindows31Settings')
  233. If (left(x, len) <> setting)then do
  234.         x = setting||x
  235.         SysIni(, 'WINOS2', 'PM_GlobalWindows31Settings', x)
  236. end
  237. if ((os2ver = 2.10) | (os2ver = 2.11)) then do
  238.         '' || trg || '\os2\install\vcfginst.exe'
  239.         rc = SysFileDelete( trg || '\os2\install\vcfginst.exe' )
  240. end
  241. '' || trg || '\os2\install\create.exe ' || trg || '\os2\install\syslevel.vid 3030 S330301 562107701 Vision864/964/868/968/Trio32/64/64V+/64V2'
  242. rc = SysFileDelete( trg || '\os2\install\create.exe' )
  243. dspdsc = '/pd:' || trg || '\os2\install\00S3.DSC'
  244. dspopt = '/pk:other /sk:none /s:'trg' /t:'trg
  245. dcmd = dspinstl dspopt dspdsc '/u'
  246. ''dcmd
  247. rc = SysFileDelete( trg || '\install1.dsp' )
  248. rc = SysFileDelete( trg || '\install2.dsp' )
  249. rc = SysFileDelete( trg || '\s3common.dsp' )
  250. 'start ' || trg || '\os2\install\product.exe ' || trg cid
  251. signal done
  252. getsrc:
  253. if cid = '' then do
  254.         parse source src
  255.         src = word(src,3)
  256. end
  257. else do
  258.         src = parsearg('S')
  259.         if src = '' then signal usage
  260.         src = right(src,length(src)-3)
  261.         temp = right(src, 1)
  262.         if (temp <> '\') & (temp <> '/') then src=src||'\'
  263. end
  264. src = FileSpec('DRIVE', src) || FileSpec('PATH', src)
  265. return
  266. gettrg:
  267. trg = SysSearchPath('PATH', 'PMSHELL.EXE')
  268. trg = FileSpec('drive',trg)
  269. trginfo = SysDriveInfo(trg)
  270. return
  271. parsearg:
  272. parse upper arg switch
  273. result = ''
  274. x = pos(switch, args)
  275. if x <> 0 then do
  276.         y = pos(' ', args, x)
  277.         if y = 0 then y = length(args)
  278.         result = space(substr(args, x-1, y-x+2),0)
  279.         args = delstr(args, x-1, y-x+2)
  280. end
  281. return result
  282. usage:
  283. call usage1
  284. error = ERR_USAGE
  285. signal readme
  286. saylog:
  287. parse arg msg
  288.         say msg
  289.         rc = lineout(log, msg)
  290. return
  291. prompt:
  292. if cid = '' then do
  293.         say ''
  294.         SAY 'Do you wish to continue installation? (y or n)'
  295.         key = SysGetKey('NOECHO')
  296.         say ''
  297.         parse upper var key key
  298.         if key <> 'Y' then signal readme
  299. end
  300. return
  301. unpack:
  302. parse arg pack file
  303. pack = src||pack
  304. if file = '' then
  305.         'unpack2' pack trg pipenull
  306. else do
  307.         call SysFileTree file,stem,,'***+*','***-*'
  308.         filename = filespec("name", file)
  309.         filedrive = filespec("drive", file)
  310.         filepath = filedrive||filespec("path", file)
  311.         if filepath='' then filepath=trg
  312.         'unpack2 'pack filepath' /n:'filename pipenull
  313. end
  314. if (rc <> 0) then do
  315.         error = err_unpack
  316.         call saylog 'Error: unpacking 'file' from 'pack', rc = 'rc
  317.         signal readme
  318. end
  319. else rc = lineout(log, 'UNPACK:' file 'successful')
  320. return
  321. readme:
  322. say ''
  323. say 'The installation has ended without modification to your'
  324. say 'system.  Please reference README.TXT on the installation'
  325. say 'diskette for more information.'
  326. say ''
  327. rc = lineout( log )
  328. exit error
  329. done:
  330. rc = lineout( log )
  331. if cid = '' then 'exit'
  332. exit error
  333. usage1:
  334. say 'SETUP.CMD: S3 Display Driver Installation'
  335. say ''
  336. say 'Usage: setup {/U /S:SRCPATH}'
  337. say ''
  338. say 'Use the optional /U parameter for unattended (CID) installation'
  339. return
  340.  
  341.  
  342.