home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 18 REXX / 18-REXX.zip / MAKEBOOT.ZIP / MAKEBOOT.CMD
OS/2 REXX Batch file  |  1992-05-25  |  11KB  |  319 lines

  1. /*      MAKEBOOT.CMD     version 1.00           Donald L. Meyer */
  2.  
  3. /* This REXX program is designed to create a bootable OS/2 floppy disk */
  4. /* using both the installation disks and, if possible, files from your OS/2      */
  5. /* directory on the installing machine.  (This speeds things up a bit.) */
  6.  
  7. /*   This program accepts up to four parameters, which must be in the */
  8. /* following order:         */
  9. /*      * type of machine for the boot disk     2=PS/2    1=IBM Compat. */
  10. /*      * Drive to install on       (A:, B:, ..)     ***Reqd parameter  */
  11. /*      * Drive to look for OS/2 drivers, etc. besides INSTALLATION disks.*/
  12. /*      * "RECON" tells program to skip main install, and only do optional */
  13. /*              installation of things like HPFS.IFS, SCSI support, etc. */
  14. /*              (One limitation is HPFS.IFS will not fit on 1.2mb
  15. disks)        */
  16.  
  17. /*  Thanks go out to Morton Kaplon  (73457,437 @ Compuserve) for */
  18. /*  doing the legwork determining which files/drivers were/weren't necessary.*/
  19.  
  20. /* Please send any bug reports or suggestions to:         */
  21. /*  internet:   dlmeyer@uiuc.edu         */
  22.  
  23. version=1.00
  24. '@ECHO OFF'
  25. PARSE Arg all_args
  26. /*  Initializations */
  27. i=1
  28. type=''
  29. ReConfig=0
  30.  
  31. /*   Check for special boot disk mode; PS/2 or Non-PS/2  (2,1) */
  32. IF (word(all_args,i)=='1') |  (word(all_args,i)=='2') THEN DO 1
  33.    type=word(all_args,i)
  34.    i = i + 1
  35. END
  36. ELSE NOP
  37.  
  38. /* If not Target drive specified, exit with Syntax description. */
  39. IF word(all_args,i)=='' THEN DO 1
  40.    SAY 'Syntax:   MAKEBOOT {m} d1: {d2:} {RECON}'
  41.    SAY '        [m:  = Machine type: PS/2=2   Non-PS/2=1   *Optional]'
  42.    SAY '        [d1: = floppy drive to make bootdisk in.    *Required]'
  43.    SAY '        [d2: = hard drive with OS/2 installed.  *Optional]'
  44.    SAY '        [RECON = Reconfigure existing boot disk.  *Optional]'
  45.    SAY '                (Optional Parameters are assumed to match '
  46.    SAY '                 current system configuration if not specified.)'
  47.    EXIT
  48. END
  49. ELSE NOP
  50.         /* Load some advanced functions... */
  51. CALL RxFuncAdd 'SysCurPos', 'RexxUtil', 'SysCurPos'
  52. CALL RxFuncAdd 'SysFileTree', 'RexxUtil', 'SysFileTree'
  53. CALL RxFuncAdd 'SysDriveMap', 'RexxUtil', 'SysDriveMap'
  54. CALL RxFuncAdd 'SysDriveInfo', 'RexxUtil', 'SysDriveInfo'
  55. CALL RxFuncAdd 'SysTextScreenRead', 'RexxUtil', 'SysTextScreenRead'
  56.  
  57.         /* Finish setting up operating parameters...  */
  58. instto=word(all_args,i)
  59. i=i+1
  60. instfrom=word(all_args,i)
  61. IF (instfrom=='RECON') | (instfrom=='recon') THEN DO 1
  62.    ReConfig=1
  63.    instfrom=''
  64. END
  65. ELSE IF (word(all_args,i+1)=='RECON') | (word(all_args,i+1)=='recon')
  66. THEN ReConfig=1
  67. IF instfrom=='' THEN DO 1
  68.    DriveMap=SysDriveMap('C:', 'LOCAL')
  69.    DO i=1 to Words(DriveMap)
  70.       k=SysFileTree(Word(DriveMap,i)'\OS2\HELP.CMD', 'file',,)
  71.       IF (file.0==1) THEN instfrom=Word(DriveMap,i)
  72.    END
  73. END
  74. ELSE NOP
  75. IF type=='' THEN DO 1
  76.    type=2               /* Assume PS/2 unless proven incorrect. */
  77.    /*   Check if above assumption correct... */
  78.    i=SysFileTree(instfrom'\OS2\KBD01.SYS', 'file',,)
  79.    IF (file.0==1) THEN type=1
  80.    DROP file
  81. END
  82. ELSE NOP
  83.  
  84.         /* Here we go ..... */
  85. 'CLS'
  86. SAY 'Creating an OS/2 v2.0 Boot Diskette on drive 'instto', from drive 'instfrom'.'
  87. SAY '(v'version')'
  88.  
  89. /* Establish File Lists now that install type has been established.  */
  90. dll_list='ANSICALL BKSCALLS BMSCALLS BVSCALLS BVHINIT DOSCALL1 KBDCALLS MOUCALLS MSG NAMPIPES NLS OS2CHAR QUECALLS SESMGR VIOCALLS'
  91. sys_list='PRINT0'type' KBD0'type' DOS CLOCK0'type' SCREEN0'type
  92. misclist='IBM'type'FLPY.ADD IBMINT13.I13 OS2DASD.DMD INSTALL\SYSLEVEL.OS2 CMD.EXE'
  93. filelist2 = 'HARDERR.EXE SYSINST1.EXE KEYBOARD.DCP COUNTRY.SYS'
  94.  
  95. IF (ReConfig==0) THEN DO 1
  96.   'MD 'instfrom'\OS2\INSTALL\TEMP'
  97.   SAY
  98.   k=0
  99.   DO WHILE k==0
  100.      CALL BEEP 392, 250
  101.      SAY 'Insert OS/2 INSTALLATION DISK in drive 'instto'.'
  102.      'PAUSE'
  103.      SAY
  104.      k=SysFileTree(instto'\SYSINSTX.COM', 'file',,)
  105.      k=file.0
  106.   END
  107.   filelist1 = 'OS2KRNL* OS2LDR SYSINSTX.COM'
  108.  
  109.   k=SysCurPos()
  110.   SAY 'Copying necessary files from drive 'instto' .'
  111.   DO i=1 TO WORDS(filelist1)
  112.      CALL SysCurPos word(k,1), 38+i
  113.      COPY instto'\'WORD( filelist1, i)' 'instfrom'\OS2\INSTALL\TEMP >nul'
  114.      SAY '.'
  115.   END
  116.   'REN 'instfrom'\OS2\INSTALL\TEMP\OS2KRNL* OS2KRNL'
  117.   k=1
  118.   DO WHILE k==1
  119.      SAY
  120.      CALL BEEP 392, 250
  121.      SAY 'Insert OS/2 BOOT DISK [To Be Created] in drive 'instto'.'
  122.      'PAUSE'
  123.      k=SysFileTree(instto'\SYSINSTX.COM', 'file',,)
  124.      k=file.0
  125.   END
  126.   filelist1 = 'OS2\INSTALL\TEMP\OS2KRNL OS2\INSTALL\TEMP\OS2LDR OS2LDR.MSG'
  127.   SAY
  128.   k=SysCurPos()
  129.   SAY 'Installing Files on new BOOT DISKETTE .'
  130.   CALL SysCurPos word(k,1), 39
  131.   instfrom'\OS2\INSTALL\TEMP\SYSINSTX 'instto' >nul'
  132.   SAY '.'
  133.   DO i=1 TO WORDS(filelist1)
  134.      CALL SysCurPos word(k,1), 39+i
  135.      COPY instfrom'\'WORD( filelist1,i)' 'instto'\ >nul'
  136.      SAY '.'
  137.   END
  138.   'ECHO Y | DEL 'instfrom'\OS2\INSTALL\TEMP >nul'
  139.  
  140.   k=SysCurPos()
  141.   SAY 'Installing DLLs .'
  142.   DO i=1 TO WORDS(dll_list)
  143.      COPY instfrom'\OS2\DLL\'WORD(dll_list,i)'.DLL 'instto'\ >nul'
  144.      ERR = SysTextScreenRead(word(k,1)+1,0,7)
  145.      CALL SysCurPos word(k,1)+1, 0
  146.      SAY '                                                      '
  147.         /* If not found, then install is cross-type -- add to files to
  148. get from DISK 1.  */
  149.      IF (ERR=='SYS0002') THEN DO 1
  150.         filelist2=filelist2' 'WORD(dll_list,i)'.DLL'
  151.      END
  152.      CALL SysCurPos word(k,1), 16+i
  153.      SAY .
  154.   END
  155.   k=SysCurPos()
  156.   SAY 'Installing SYSs .'
  157.   DO i=1 TO WORDS(sys_list)
  158.      COPY instfrom'\OS2\'WORD(sys_list,i)'.SYS 'instto'\ >nul'
  159.      ERR = SysTextScreenRead(word(k,1)+1,0,7)
  160.      CALL SysCurPos word(k,1)+1, 0
  161.      SAY '                                                      '
  162.      IF (ERR=='SYS0002') THEN DO 1
  163.         filelist2=filelist2' 'WORD(sys_list,i)'.SYS'
  164.      END
  165.      CALL SysCurPos word(k,1), 16+i
  166.      SAY .
  167.   END
  168.   k=SysCurPos()
  169.   SAY 'Installing misc .'
  170.   DO i=1 TO WORDS(misclist)
  171.      COPY instfrom'\OS2\'WORD( misclist, i)' 'instto'\ >nul'
  172.      ERR = SysTextScreenRead(word(k,1)+1,0,7)
  173.      CALL SysCurPos word(k,1)+1, 0
  174.      SAY '                                                      '
  175.      IF (ERR=='SYS0002') THEN DO 1
  176.         filelist2=filelist2' 'WORD(misclist,i)
  177.      END
  178.      CALL SysCurPos word(k,1), 16+i
  179.      SAY .
  180.   END
  181.  
  182.   DROP dll_list
  183.   DROP sys_list
  184.   DROP misclist
  185.   k=0
  186.   DO WHILE k==0
  187.      SAY
  188.      SAY 'Insert OS/2 DISKETTE 1 in drive 'instto'.'
  189.      CALL BEEP 392, 250
  190.      'PAUSE'
  191.      k=SysFileTree(instto'\FDISK.COM', 'file',,)
  192.      k=file.0
  193.   END
  194.   SAY
  195.   k=SysCurPos()
  196.   SAY 'Copying Files from OS/2 DISKETTE 1.'
  197.   IF (type==1) THEN filelist2=filelist2' IBM'type'S506.ADD'
  198.   DO i=1 TO WORDS(filelist2)
  199.      CALL SysCurPos word(k,1), 34+i
  200.      COPY instto'\'WORD(filelist2,i)' 'instfrom'\OS2\INSTALL\TEMP >nul'
  201.      SAY .
  202.   END
  203.   k=1
  204.   j=0
  205.   DO WHILE (k>0) | (j==0)
  206.      SAY
  207.      SAY 'Re-Insert the new OS/2 BOOT DISK in drive 'instto'.'
  208.      CALL BEEP 392, 250
  209.      'PAUSE'
  210.      j=SysFileTree(instto'\CMD.EXE', 'file',,)  /* Check presence of
  211. files to verify correct disk.  */
  212.      j=file.0
  213.      k=SysFileTree(instto'\*.BIO', 'file',,)
  214.      k=file.0
  215.   END
  216.   SAY
  217.   SAY 'Copying Files to new BOOT DISKETTE .'
  218.   k=SysCurPos()
  219.   DO i=1 TO WORDS(filelist2)
  220.      CALL SysCurPos word(k,1)-1, 35+i
  221.      COPY instfrom'\OS2\INSTALL\TEMP\'WORD(filelist2,i)' 'instto'\ >nul'
  222.      SAY .
  223.   END
  224.   'ECHO Y | DEL 'instfrom'\OS2\INSTALL\TEMP >nul'
  225.   'RD 'instfrom'\OS2\INSTALL\TEMP'
  226.   IF type==2 THEN DO 1  /* Create ABIOS.SYS if a PS/2 boot disk.  */
  227.      abios_file=instto'\ABIOS.SYS'
  228.      CALL lineout abios_file, '', 1
  229.      k=lineout(abios_file)
  230.      DROP abios_file
  231.      SAY 'ABIOS.SYS Created on drive 'instto'.'
  232.      SAY
  233.   END
  234. END
  235. /*   The Optionals Area  */
  236. 'CLS'
  237. SAY
  238. k=SysCurPos()
  239. DriveInfo=SysDriveInfo(instto)
  240. file = SysFileTree(instto'\NPXEMLTR.DLL', 'file',,)
  241. IF (word(DriveInfo,2)<25280) & (file.0==0) THEN DO 1
  242.    SAY ' There isn''t enough space to install coprocessor emulator...'
  243.    SAY
  244. END
  245. ELSE DO 1
  246.    SAY ' Will this disk be used on machines without math coprocessors? [Y/N]'
  247.    i=SysCurPos(word(k,1),72)
  248.    PULL nomath
  249. END
  250. k=SysCurPos()
  251. file = SysFileTree(instto'\OS2SCSI.DMD', 'file',,)
  252. IF (word(DriveInfo,2) < 10462 + ((nomath=='Y')*25280)) & (file.0==0)
  253. THEN DO 1
  254.    SAY ' There isn''t enough space to install the SCSI Driver...'
  255.    SAY
  256. END
  257. ELSE DO 1
  258.    SAY ' Will you need the SCSI Driver installed?  [Y/N]'
  259.    i=SysCurPos(word(k,1),50)
  260.    PULL scsi
  261. END
  262. k=SysCurPos()
  263. file = SysFileTree(instto'\HPFS.IFS', 'file',,)
  264. IF (word(DriveInfo,2)<125466 + ((nomath=='Y') * 25280) + ((scsi=='Y') * 10462)) & (file.0==0) THEN DO 1
  265.    SAY ' There isn''t enough space to install the HPFS File System...'
  266.    SAY
  267. END
  268. ELSE DO 1
  269.    SAY ' Will you need the HPFS File System?  [Y/N]'
  270.    i=SysCurPos(word(k,1),50)
  271.    PULL hpfs
  272. END
  273. SAY
  274. k=SysCurPos()
  275. SAY 'Copying Optional Files.'
  276. CALL SysCurPos word(k,1), 22+(scsi=='Y')
  277. IF (scsi=='Y') THEN COPY instfrom'\OS2\OS2SCSI.DMD 'instto'\ >nul'
  278. SAY '.'
  279. CALL SysCurPos word(k,1), 22+(scsi=='Y')+(hpfs=='Y')
  280. IF (hpfs=='Y') THEN COPY instfrom'\OS2\HPFS.IFS 'instto'\ >nul'
  281. SAY '.'
  282. CALL SysCurPos word(k,1), 22+(scsi=='Y')+(hpfs=='Y')+(nomath=='Y')
  283. IF (nomath=='Y') THEN COPY instfrom'\OS2\DLL\NPXEMLTR.DLL 'instto'\ >nul'
  284. SAY '.'
  285.  
  286. /* Create the Config.Sys dynamically...   */
  287. SAY 'Creating CONFIG.SYS on drive 'instto'...'
  288. config_file=instto'\CONFIG.SYS'
  289. CALL lineout config_file, 'IFS=HPFS.IFS /CACHE:64', 1
  290. CALL lineout config_file, 'BUFFERS=32'
  291. CALL lineout config_file, 'IOPL=YES'
  292. CALL lineout config_file, 'MEMMAN=NOSWAP'
  293. CALL lineout config_file, 'PROTSHELL=SYSINST1.EXE'
  294. CALL lineout config_file, 'SET OS2_SHELL=CMD.EXE'
  295. CALL lineout config_file, 'DISKCACHE=64,LW'
  296. CALL lineout config_file, 'PROTECTONLY=YES'
  297. CALL lineout config_file, 'LIBPATH=.;\;'
  298. CALL lineout config_file, 'PAUSEONERROR=NO'
  299. CALL lineout config_file, 'CODEPAGE=850'
  300. CALL lineout config_file, 'DEVINFO=KBD,US,KEYBOARD.DCP'
  301. CALL lineout config_file, 'REM DEVINFO=SCR,EGA,VTBL850.DCP'
  302. CALL lineout config_file, 'DEVICE=\DOS.SYS'
  303. CALL lineout config_file, 'REM DEVICE=\MOUSE.SYS'
  304. CALL lineout config_file, 'SET PATH=.;\'
  305. CALL lineout config_file, 'SET DPATH=\;'
  306. CALL lineout config_file, 'SET KEYS=ON'
  307. CALL lineout config_file, 'BASEDEV=PRINT0'type'.SYS'
  308. CALL lineout config_file, 'BASEDEV=IBM'type'FLPY.ADD'
  309. IF (type==1) THEN CALL lineout config_file, 'BASEDEV=IBM1S506.ADD'
  310. IF (scsi=='Y') THEN CALL lineout config_file, 'BASEDEV=IBMSCSI.ADD'
  311. CALL lineout config_file, 'BASEDEV=IBMINT13.I13'
  312. CALL lineout config_file, 'BASEDEV=OS2DASD.DMD'
  313. CALL lineout config_file, 'REM DEVICE=\TESTCFG.SYS'
  314. k=lineout(config_file)
  315. DROP config_file
  316. SAY
  317. SAY 'Boot Diskette has been created.'
  318. EXIT
  319.