home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 11 Util / 11-Util.zip / makdskv4.zip / MAKDSKV4.CMD next >
OS/2 REXX Batch file  |  1996-10-18  |  16KB  |  436 lines

  1. /* This is a Rexx Procedure */
  2. /* MAKDSKV4 v1.00a           */
  3. /* MAKEDSKV4.CMD is a REXX implementation of MAKESR.CMD modified to use     */
  4. /* the 4 disk utility set produced by the OS2_V4 "CreateBootDisk" utility   */
  5. /* in place of the 3 disk set that was used by OS2_V3 (Warp). It also       */
  6. /* incorporates the keyboard country code used in REXXKBD.CMD rather than   */
  7. /* calling it externally.                                                   */
  8. /*                                                                          */
  9. /* I make absolutely no claims or warranties regarding the suitability,     */
  10. /* safety, or reliability of this procedure when used on your particular    */
  11. /* set-up and I have had no access to test it on any system other than my   */
  12. /* own.                                                                     */
  13. /*                                                                          */    
  14. /* At a minimum, backup a test volume and restore it using your recovery    */
  15. /* disks BEFORE  you rely on them to recover any valuable data.             */
  16. /*                                                                          */
  17. /* The only rights I wish to claim with regard to this software is that     */
  18. /* if you modify it in any way, please remove my name from it before any    */
  19. /* distribution of such a revised version.                                  */
  20. /*                                                                          */
  21. /* John Getsoian (71005.3316@compuserve.com)                                */
  22.  
  23.  
  24. call RxFuncAdd 'SysLoadFuncs','RexxUtil','SysLoadFuncs'
  25. call SysLoadFuncs
  26.  
  27. /*get arguments */ 
  28.  
  29. PARSE UPPER ARG source target opparm
  30. echo off
  31.  
  32. /* Check Stuff */
  33.  
  34. /* Is this a merlin system? */
  35.  
  36. opver=SysOS2Ver()
  37. IF opver < 2.40 THEN SIGNAL nov4
  38.  
  39. /* verify a proper target diskette drive */
  40.  
  41. IF (target <> "A:" & target <> "B:") THEN SIGNAL notarget 
  42.  
  43. /* verify source drive */
  44. dummy=Stream(source||'\os2\format.com','c','query exists')
  45. IF dummy="" THEN SIGNAL nosource
  46.  
  47. /* verify the call originates in Dualstor directory */
  48.  
  49. dummy=Stream('sr.exe','c','query exists')
  50. IF dummy="" THEN SIGNAL invalidlocal
  51.  
  52. /* begin nuts and bolts - first make disks unless user supplies (skip) */
  53.  
  54. cls 
  55. say "┌─────────────────────────────────────────────────┐"
  56. say "│ MAKDSKV4.CMD - Create DualstorV3 Disaster       │"
  57. say "│ Recovery Disks for OS2_V4                       │"
  58. say "│                                                 │"
  59. say "│ To create your disaster recovery set            │"
  60. say "│ you will need:                                  │"
  61. say "│   -Your OS2_V4 CD loaded into your CD-ROM drive │"
  62. say "│   -4 1.4 MB floppy disks                        │"
  63. say "│                                                 │"
  64. say "│ or                                              │"
  65. say "│   you can use the 'skip' parameter if you       │"
  66. say "│   have already made a V4 utility disk set       │"
  67. say "│   you wish to use                               │"
  68. say "│                                                 │"
  69. say "│ System files will installed from drive "source"       │"
  70. say "│ Target drive is floppy disk "target"                  │"
  71. say "│                                                 │"
  72. say "└─────────────────────────────────────────────────┘"
  73. say "Press CTRL-C to QUIT"
  74. say "         or"
  75. PAUSE
  76.  
  77. /* Check for SKIP parm  */
  78.  
  79. IF opparm <>"SKIP" THEN bootdisk
  80.  
  81. /* get rid of existing config.sys and snooper list */
  82.  
  83. loopit:  
  84. say "."
  85. say " ┌────────────────────────────────────────────────┐"
  86. say " │Insert the 2nd of the four disks in drive "target"    │"
  87. say " └────────────────────────────────────────────────┘"
  88. say " Press CTRL-C to QUIT"
  89. say "          or"
  90. PAUSE
  91.  
  92. /*Is this the right disk? */
  93. info=SysDriveInfo(target)
  94. PARSE UPPER VAR info nul1 nul2 drivesize diskname
  95.  
  96. IF (drivesize > 2400000 | drivesize < 1000000) then SIGNAL not14flop
  97.  
  98. IF diskname = "DISK 1" then call ahead1
  99.     else
  100.         say "."
  101.         say "Wrong disk inserted!"
  102.         call loopit 
  103. ahead1:
  104.  
  105. say " ┌────────────────────────────────────────────────┐"
  106. say " │Deleting files from Disk #2                     │"
  107. say " └────────────────────────────────────────────────┘"
  108.  
  109. targstring=target||'\*.flt 1>nul 2>nul'
  110. del targstring
  111.  
  112. /* more files could be deleted  here but why bother, plenty of room */
  113.  
  114. /* make sure target files are accessible */
  115. targstring=target||'\config.sys -r 1>nul'
  116. attrib targstring
  117. targstring=target||'\snoop.lst -r 1>nul'
  118. attrib targstring
  119.  
  120. /* Build new config.sys */
  121. targfile=target||'\config.sys 1>nul 2>nul'
  122. del targfile
  123.  
  124. say "."
  125. say " ┌────────────────────────────────────────────────┐"
  126. say " │Creating CONFIG.SYS on Disk #2                  │"
  127. say " └────────────────────────────────────────────────┘"
  128. say "."
  129.  
  130. /* get country information (incorporate REXXKBD.CMD from Dualstor OEM)  */
  131.  
  132. say "."
  133. say " ┌──────────────────────────────────────────────────┐"
  134. say " │Recovering country information from source volume │"
  135. say " └──────────────────────────────────────────────────┘"
  136. say "."
  137. infile=source||'\config.sys'
  138. do while lines(infile) > 0
  139.     dataline=linein(infile)
  140.     dataline_pos_lower=pos('devinfo=kbd,',dataline)
  141.     dataline_pos_upper=pos('DEVINFO=KBD,',dataline)
  142.     if dataline_pos_lower \= dataline_pos_upper
  143.     then do
  144.        comma2=lastpos(',',dataline)            /*pos of 2nd comma*/
  145.        comma2=comma2-1
  146.        keyparm=substr(dataline,1,comma2)
  147.        keyparm=keyparm||",keyboard.dcp"
  148.      end
  149. end
  150.  
  151. /* check for HPFS */
  152. say "."
  153. say " ┌─────────────────────────────────────────────────────┐"
  154. say " │ Checking for HPFS                                   │"
  155. say " └─────────────────────────────────────────────────────┘"
  156. say "."
  157.  
  158. targfile=target||'\config.sys'
  159. targstring=source||'\os2\hpfs.ifs'
  160. hpfsflag=Stream(targstring,'c','query exists')
  161. IF hpfsflag <> "" THEN rc=LINEOUT(targfile,'ifs=hpfs.ifs /c:256')
  162.  
  163. rc=rc+LINEOUT(targfile,'buffers=64')
  164. rc=rc+LINEOUT(targfile,'iopl=yes')
  165. rc=rc+LINEOUT(targfile,'memman=noswap')
  166. rc=rc+LINEOUT(targfile,'protshell=a:\cmd.exe /k startup.cmd')
  167. rc=rc+LINEOUT(targfile,'set os2_shell=a:\cmd.exe')
  168. rc=rc+LINEOUT(targfile,'diskcache=256,LW')
  169. rc=rc+LINEOUT(targfile,'protectonly=yes')
  170. rc=rc+LINEOUT(targfile,'libpath=.;\;\os2\dll;')
  171. rc=rc+LINEOUT(targfile,'pauseonerror=no')
  172. rc=rc+LINEOUT(targfile,'codepage=850')
  173. rc=rc+LINEOUT(targfile,keyparm)
  174. rc=rc+LINEOUT(targfile,'devinfo=scr,ega,vtbl850.dcp')
  175. rc=rc+LINEOUT(targfile,'set path=\;\os2;\os2\system;\os2\install;')
  176. rc=rc+LINEOUT(targfile,'set dpath=\;\os2;\os2\system;\os2\install;')
  177. rc=rc+LINEOUT(targfile,'set keys=on')
  178. rc=rc+LINEOUT(targfile,'set saveconnect=1')
  179. rc=rc+LINEOUT(targfile,'basedev=ibmkbd.sys')
  180. rc=rc+LINEOUT(targfile,'basedev=ibm1flpy.add')
  181. rc=rc+LINEOUT(targfile,'basedev=ibm1s506.add')
  182. rc=rc+LINEOUT(targfile,'basedev=ibm2flpy.add')
  183. rc=rc+LINEOUT(targfile,'basedev=ibm2adsk.add')
  184. rc=rc+LINEOUT(targfile,'basedev=ibm2scsi.add')
  185. rc=rc+LINEOUT(targfile,'basedev=ibmint13.i13')
  186. rc=rc+LINEOUT(targfile,'basedev=os2dasd.dmd')
  187. rc=rc+LINEOUT(targfile,'basedev=aha152x.add')
  188. rc=rc+LINEOUT(targfile,'basedev=aha154x.add')
  189. rc=rc+LINEOUT(targfile,'basedev=aha164x.add')
  190. rc=rc+LINEOUT(targfile,'basedev=aha174x.add')
  191. rc=rc+LINEOUT(targfile,'basedev=aic7770.add')
  192. rc=rc+LINEOUT(targfile,'basedev=aic7870.add')
  193. rc=rc+LINEOUT(targfile,'basedev=btscsi.add')
  194. rc=rc+LINEOUT(targfile,'basedev=fd16-700.add')
  195. rc=rc+LINEOUT(targfile,'basedev=fd8xx.add')
  196. rc=rc+LINEOUT(targfile,'basedev=fd7000ex.add')
  197. rc=rc+LINEOUT(targfile,'basedev=dpt20xx.add')
  198. rc=rc+LINEOUT(targfile,'basedev=dac960.add')
  199. rc=rc+LINEOUT(targfile,'basedev=flashpt.add')
  200. rc=rc+LINEOUT(targfile,'basedev=ipsraid.add')
  201. rc=rc+LINEOUT(targfile,'basedev=ql10os2.add')
  202. rc=rc+LINEOUT(targfile,'basedev=ql40os2.add')
  203. rc=rc+LINEOUT(targfile,'basedev=ql510.add')
  204. rc=rc+LINEOUT(targfile,'device=\dos.sys')
  205. rc=rc+LINEOUT(targfile,'device=\mouse.sys')
  206. rc=rc+LINEOUT(targfile,'device=ip22drv.sys')
  207.  
  208. targstring=target||'ibm2m57.add'
  209. dummy=Stream(targstring,'c','query exists')
  210. IF dummy <> "" THEN rc=rc+LINEOUT(targfile,'basedev=ibm2m57.add')
  211. rc=rc+LINEOUT(targfile,'device=\testcfg.sys')
  212. rc=rc+LINEOUT(targfile)
  213. IF rc > 0 then SIGNAL writefail
  214.  
  215.  
  216. say "."
  217. say " ┌────────────────────────────────────────────────────┐"
  218. say " │ New config.sys successfully created!               │"
  219. say " └────────────────────────────────────────────────────┘"
  220. say "."
  221.  
  222. /* create an abreviated snoop list */
  223. targfile=target||'\snoop.lst 1>nul 2>nul'
  224. del targfile
  225. targfile=target||'\snoop.lst'
  226.  
  227. rc=LINEOUT(targfile,'resrv.snp')
  228. rc=rc+LINEOUT(targfile,'netdet1.snp')
  229. rc=rc+LINEOUT(targfile,'ibmkbd.snp')
  230. rc=rc+LINEOUT(targfile,'ibm1flpy.snp')
  231. rc=rc+LINEOUT(targfile,'ibm1s506.snp')
  232. rc=rc+LINEOUT(targfile,'aha6360.snp')
  233. rc=rc+LINEOUT(targfile,'aha154x.snp')
  234. rc=rc+LINEOUT(targfile,'aha174x.snp')
  235. rc=rc+LINEOUT(targfile,'aic7870.snp')
  236. rc=rc+LINEOUT(targfile,'ql10os2.snp')
  237. rc=rc+LINEOUT(targfile,'ql40os2.snp')
  238. rc=rc+LINEOUT(targfile,'ql510.snp')
  239. rc=rc+LINEOUT(targfile,'ipsraid.snp')
  240. rc=rc+LINEOUT(targfile,'btscsi.snp')
  241. rc=rc+LINEOUT(targfile,'fd16-700.snp')
  242. rc=rc+LINEOUT(targfile,'fd8xx.snp')
  243. rc=rc+LINEOUT(targfile,'fd7000ex.snp')
  244. rc=rc+LINEOUT(targfile,'dpt20xx.snp')
  245. rc=rc+LINEOUT(targfile,'flashpt.snp')
  246. rc=rc+LINEOUT(targfile,'dac960.snp')
  247. rc=rc+LINEOUT(targfile,'pcmcia.snp')
  248. rc=rc+LINEOUT(targfile,'ir.snp')
  249. rc=rc+LINEOUT(targfile,'netdet2.snp')
  250. rc=rc+LINEOUT(targfile,'pcibus.snp')
  251. rc=rc+LINEOUT(targfile,'mouse.snp')
  252. rc=rc+LINEOUT(targfile)
  253. IF rc > 0 then SIGNAL writefail
  254.  
  255. loopit2:
  256. say "."
  257. say " ┌────────────────────────────────────────────────┐"
  258. say " │Insert the 3nd of the four disks in drive "target"    │"
  259. say " └────────────────────────────────────────────────┘"
  260. say " Press CTRL-C to QUIT"
  261. say "          or"
  262. PAUSE
  263.  
  264. /*Is this the right disk? */
  265. info=SysDriveInfo(target)
  266. PARSE UPPER VAR info nul1 nul2 nul3 diskname
  267. IF diskname = "DISK 2" then call ahead2
  268.     else
  269.         say "."
  270.         say "Wrong disk inserted!"
  271.         call loopit2 
  272. ahead2:
  273.  
  274. say "."
  275. say " ┌────────────────────────────────────────────────┐"
  276. say " │Deleting files from Disk #3                     │"
  277. say " └────────────────────────────────────────────────┘"
  278. say "."
  279.  
  280. targstring=target||'\fdisk.com 1>nul 2>nul' ; del targstring
  281. targstring=target||'\npxemltr.dll 1>nul 2>nul' ; del targstring
  282. targstring=target||'\os2cdrom.dmd 1>nul 2>nul' ; del targstring
  283. targstring=target||'\cdinst.exe 1>nul 2>nul' ; del targstring
  284. targstring=target||'\sysinst1.exe 1>nul 2>nul' ; del targstring
  285. targstring=target||'\sysinst2.exe 1>nul 2>nul' ; del targstring
  286. targstring=target||'\marketng.msg 1>nul 2>nul' ; del targstring
  287. targstring=target||'\del.lst 1>nul 2>nul' ; del targstring
  288. targstring=target||'\cdfs.ifs 1>nul 2>nul' ; del targstring
  289. targstring=target||'\startup.cmd 1>nul 2>nul' ; del targstring
  290. targstring=target||'\message.txt 1>nul 2>nul' ; del targstring
  291.  
  292. say "."
  293. say " ┌────────────────────────────────────────────────┐"
  294. say " │Copying files to Disk #3                        │"
  295. say " └────────────────────────────────────────────────┘"
  296. say "."
  297.  
  298. targstring='ip22drv.sys '||target||'\ >nul' ; copy targstring
  299. targstring='ip2xdmn.exe '||target||'\ >nul' ; copy targstring
  300. targstring='ipcrgui.dll '||target||'\ >nul' ; copy targstring
  301. targstring='ipbb.dll '||target||'\ >nul' ; copy targstring
  302. targstring='ipbp.dll '||target||'\ >nul' ; copy targstring
  303. targstring='ipmb.dll '||target||'\ >nul' ; copy targstring
  304. targstring='ipnwutil.dll '||target||'\ >nul' ; copy targstring
  305. targstring='ipqual.dll '||target||'\ >nul' ; copy targstring
  306. targstring='iprst.dll '||target||'\ >nul' ; copy targstring
  307. targstring='ipucgen.dll '||target||'\ >nul' ; copy targstring
  308. targstring='sr.exe '||target||'\ >nul' ; copy targstring
  309.  
  310.  
  311. If hpfsflag <> ""
  312.     then do
  313.         targstring=source||'\os2\dll\uhpfs.dll '||target||'\ >nul' ; copy targstring
  314.         targstring=source||'\os2\hpfs.ifs '||target||'\ >null >nul' ; copy targstring
  315.     end
  316.  
  317.  
  318. say "."
  319. say " ┌────────────────────────────────────────────────┐"
  320. say " │Creating STARTUP.CMD                            │"
  321. say " └────────────────────────────────────────────────┘"
  322. say "."
  323.   
  324. targfile=target||'\startup.cmd'
  325.  
  326. rc=LINEOUT(targfile,'cls') 
  327. rc=rc+LINEOUT(targfile,'@echo off')
  328. rc=rc+LINEOUT(targfile,'type message.txt')
  329. rc=rc+LINEOUT(targfile,'detach ip2xdmn.exe')
  330. rc=rc+LINEOUT(targfile)
  331. IF rc > 0  then SIGNAL writefail
  332.  
  333. say "."
  334. say " ┌────────────────────────────────────────────────┐"
  335. say " │Creating Message.txt                            │"
  336. say " └────────────────────────────────────────────────┘"
  337. say "."
  338.  
  339.  
  340. targfile=target||'\message.txt'
  341. rc=LINEOUT(targfile,'.')
  342. rc=rc+LINEOUT(targfile,' ┌───────────────────────────────────────────────────────────────┐')
  343. rc=rc+LINEOUT(targfile,' │                                                               │')
  344. rc=rc+LINEOUT(targfile,' │Run SR.EXE from this disk to recover Dualstor tape volumes     │')
  345. rc=rc+LINEOUT(targfile,' │Use SR /ds for filename scroll during recovery                 │')
  346. rc=rc+LINEOUT(targfile,' │                                                               │')
  347. rc=rc+LINEOUT(targfile,' │Disk 4 contains disk utilities (FDISK, FORMAT, CHKDSK)         │')
  348. rc=rc+LINEOUT(targfile,' │plus some room for a few of your own                           │')
  349. rc=rc+LINEOUT(targfile,' │                                                               │')
  350. rc=rc+LINEOUT(targfile,' └───────────────────────────────────────────────────────────────┘')
  351. rc=rc+LINEOUT(targfile,'.')
  352. rc=rc+LINEOUT(targfile)
  353. if rc >0 then SIGNAL writefail
  354.  
  355. loopit3:
  356. say "."
  357. say " ┌────────────────────────────────────────────────┐"
  358. say " │Insert the last of the four disks in drive "target"   │"
  359. say " └────────────────────────────────────────────────┘"
  360. say " Press CTRL-C to QUIT"
  361. say "          or"
  362. PAUSE
  363.  
  364. /*Is this the right disk? */
  365. info=SysDriveInfo(target)
  366. PARSE UPPER VAR info nul1 nul2 nul3 diskname
  367. IF diskname = "DISK 3" then call ahead3
  368.     else
  369.         say "."
  370.         say "Wrong disk inserted!"
  371.         call loopit3 
  372. ahead3:
  373.  
  374. /* not sure why this needs to be added back, its not on the original util set   */
  375. /* but the CLI wont work from disk 4 without it                                 */
  376.  
  377. targstring=source||'\os2\dll\kbdcalls.dll '||target||'\ >nul' ; copy targstring
  378.  
  379. say "."
  380. say " ┌────────────────────────────────────────────────┐"
  381. say " │ DONE!                                          │"
  382. say " └────────────────────────────────────────────────┘"
  383. say "."
  384.  
  385. exit
  386.  
  387.  
  388. /* error traps  */
  389.  
  390. nosource:
  391. say "."
  392. say "Invalid system drive. Your OS2 system drive must be specified."
  393. say "."
  394. call parmerr
  395.  
  396. notarget:
  397. say "."
  398. say target "Invalid target drive specification"
  399. say "."
  400. call parmerr
  401.        
  402. parmerr:
  403. say "."
  404. say "Usage: MAKDSKV4 [OS2 System Drive:] [Target Floppy Drive:] [skip] "
  405. say ""
  406. say " -use skip to use an existing set of OS_2V4 utility disks"
  407. say "."
  408. exit
  409.  
  410. invalidlocal:
  411. say "."
  412. say "This script must be run from your Dualstor directory. Change your"
  413. say "working directory to the Dualstor directory and run MAKDSKV4 again."
  414. say "."
  415. exit
  416.  
  417. nov4:
  418. say "."
  419. say "  This script is for OS2_V4 systems only, "
  420. say "  for OS_2V3 (Warp) use MAKESR.CMD"
  421. say "."
  422. exit
  423.  
  424. writefail:
  425. say "."
  426. say "There was a problem creating the "||targfile||" file on the target diskette "
  427. say "."
  428. exit
  429.  
  430. not14flop:
  431. say "."
  432. say "Sorry, this script is for 1.4 meg floppies disks only."
  433. say "."
  434. exit
  435.  
  436.