home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 18 REXX / 18-REXX.zip / bootd2.zip / BOOTD211.CMD < prev    next >
OS/2 REXX Batch file  |  1994-03-21  |  24KB  |  640 lines

  1. /* BOOTD211.CMD for OS/2 2.11 by James K. Beard CIS 71675,566        */
  2. /* Two-disk OS/2 2.11 boot; packs 1.2 MB in A:, 1.1 MB in B:
  3.    Supported on floppy are CHKDSK, FORMAT, FDISK, BACKUP, RESTORE
  4.    Sufficient room remains on B: (if 1.44 MB) for HPFS, your SCSI
  5.    drivers, the IBM Tiny Editor, etc.  Use the procedure in Appendix C
  6.    of the OS/2 manual to backup and restore the worplace shell, or use
  7.    the shareware WPSBACKUP.
  8.  
  9.    Origially inspired by MAKEBOOT.CMD version 1.00 by Donald L. Meyer,
  10.    internet:   dlmeyer@uiuc.edu
  11.  
  12. NOTE:  Version 1.00 was BOOTDISK.CMD; BOOTD210 replaced it.
  13.  
  14.      This program accepts one parameter:
  15.      "RECONFIGURE" tells program to skip main install, and only do optional
  16.        installation of things like SCSI support, etc.
  17.     Credit due to Morton Kaplon  (73457,437 @ Compuserve) for
  18.     doing the legwork determining which files/drivers were/weren't
  19.     necessary for Donald L. Meyer's 2.0 version, and David Moskowitz's
  20.     article in "OS/2 2.1 Unleashed" (Sams, 1993) pp 57-59. */
  21.  
  22. '@ECHO OFF' /* Don't echo system commands to screen */
  23.  
  24. version=1.10 /*  For 2.11, fixes line wrap problems, avoids loading DOS FORMAT.COM  */
  25.  
  26. /*  Initializations */
  27.  
  28. CALL RxFuncAdd 'SysLoadFuncs', 'RexxUtil', 'SysLoadFuncs' /* Install the RexxUtil functions */
  29. CALL SysLoadFuncs /*  Get them all; call SysDropFuncs on EXIT  */
  30.  
  31. CALL SysCls  /* Clear screen; "dots" won't work if screen scrolls */
  32.  
  33. IF (\(SysOS2Ver()='2.11')) THEN DO /* Verify OS/2 2.11 */
  34.    SAY 'Installed OS/2 version is 'SysOS2Ver()
  35.    SAY 'BOOTDISK/CMD 'version' is tested only for OS/2 2.11'
  36.    SAY 'Continue?'
  37.    IF y_or_n()='N' THEN DO
  38.       CALL SysDropFuncs
  39.       exit
  40.       END  /* DO */
  41.    END /* DO */
  42.  
  43. /* Parse arguments */
  44. /* Copy command line argument string to "all_args" & convert to upper case */
  45. PARSE UPPER ARG all_args
  46. CALL parse_all_args(all_args)
  47.  
  48. CALL find_os2 /* Find OS/2 (define "instfrom," usually 'C:' */
  49.  
  50. SAY 'BOOT211.CMD 'version' for OS/2 2.11'
  51. SAY 'Utility to create two OS/2 2.11 Boot Diskettes for drives A: and B:'
  52.  
  53. /* Echo usage instructions to screen */
  54. SAY 'Syntax:   BOOTD211 [RECONFIGURE]'
  55. SAY '        Optional parameter RECONFIGURE => Reconfigure existing boot disk.'
  56.  
  57. CALL find_config /* Determine type: ISA - EISA, or MCA - PS/2; HPFS;CD_ROM=Y or N */
  58.  
  59. /* Begin creating the two boot disks */
  60. /* Files from Disk 1, copied to A:\*.* */
  61. Disk1_to_temp = 'SYSINSTX.COM' /* Disk 1 to temp. dir*/
  62. boot_files='OS2KRNL' 'OS2LDR' 'OS2LDR.MSG' /* Root. dir to A: */
  63. Disk2_to_A='KEYBOARD.DCP' /* Smaller KEYBOARD.DCP than on HD */
  64. /* IF (type='1') THEN Disk2_to_A=Disk2_to_A' IBM1S506.ADD' */
  65.  
  66. IF (ReConfig='N') THEN DO /* No "RECONFIG" command line option */
  67.   temp_dir=instfrom'\OS2\INSTALL\BOOTDISK'
  68.   CALL SysFileTree temp_dir'\SYSINSTX.COM', 'file', 'FO'
  69. /*****************************************************************/
  70. /*** Copy necessary files from Service Pack DISK 0 and DISK 1 ****/
  71.    if file.0='0' THEN DO /* If SYSINSTX.COM isn't on C:, use Service Pack disks*/
  72.       CALL SysFileTree temp_dir, 'file', 'DO'  /* If not alread there ... */
  73.       if file.0=0 THEN CALL SysMkDir temp_dir /* Create scratch subdirectory */
  74.  
  75. /* Copy files from Service Pack Disk 1 into temporary subdirectory */
  76.       CALL copy_from_a temp_dir 'SP_DISK_1' 'SYSINSTX.COM' Disk1_to_temp
  77.  
  78. /* Copy specific files from Disk 2 into temporary subdirectory */
  79.       CALL copy_from_a temp_dir 'SP_DISK_2' 'KEYBOARD.DCP' Disk2_to_A
  80.       CALL evict_disk /* Make sure OS/2 2.11 Service Pack disks are out of A: */
  81.    END /* DO */
  82. /*****************************************************************/
  83. /******************* Create the boot disks ***********************/
  84.    CALL saywrap('Do you want to format the floppy disks before copying files?')
  85.    IF y_or_n()='Y' THEN
  86.       CALL format_a_b
  87.    ELSE
  88.       CALL label_a_b
  89.  
  90. /* Install boot track, kernal, loader */
  91.    CALL saywrap('Installing boot track ...')
  92.    temp_dir'\SYSINSTX A: >NUL' /* Boot track */
  93.  
  94.    CALL root_to_A boot_files /* Copy boot files to A: */
  95.  
  96.    source=temp_dir
  97.    extension='' /* Null strings disrupt argument transfer--use globals */
  98.    CALL copy_to_boot 'A:' Disk2_to_A ; /* Copy boot files to A: */
  99.  
  100. /* Copy the DLL's to B:\DLL */
  101.  
  102. /* Begin by making the directory B:\DLL */
  103.    CALL SysFileTree 'B:\DLL', 'file', 'DO' /* If not alread there ... */
  104.    IF file.0=0 THEN CALL SysMkDir 'B:\DLL' /* Create B:\DLL */
  105.  
  106.    dll_list='ANSICALL BKSCALLS BMSCALLS BVHINIT BVSCALLS DOSCALL1 KBDCALLS MOUCALLS MSG NAMPIPES NLS OS2CHAR QUECALLS SESMGR VIOCALLS'
  107.    IF hpfs='Y' THEN dll_list=dll_list UHPFS
  108.    IF cd_rom='Y' then dll_list=dll_list UCDFS
  109.  
  110.  
  111.    source=instfrom'\OS2\DLL'
  112.    extension='.DLL'
  113.    CALL copy_to_boot 'B:\DLL' dll_list
  114.  
  115.    CALL getconfig /* Get the *.ADD and *.IFS files from user's C:\CONFIG.SYS */
  116. /* Output of "getconfig" is lists A_nfiles B_nfiles, stem variable C_files */
  117.  
  118. /* Copy SP installation disk files from temporary directory to A: */
  119.    source=temp_dir
  120.    extension=''
  121.    CALL copy_to_boot 'A:' Disk2_to_A
  122.  
  123. /* Set up file lists for A: and B: */
  124.    A_list='IBM'type'FLPY.ADD IBM1S506.ADD OS2DASD.DMD CLOCK0'type'.SYS COUNTRY.SYS IBMINT13.I13 KBD0'type'.SYS PRINT0'type'.SYS SCREEN0'type'.SYS'
  125.    B_list='OSO001H.MSG OSO001.MSG'
  126.    AB_list='CMD.EXE CHKDSK.COM FDISK.COM FORMAT.COM BACKUP.EXE RESTORE.EXE'
  127.    size_A=WORD(SysDriveInfo('A:'),3) /* Drive A: a 1.44 MB? */
  128.    if size_A>1400000 then DO
  129.       A_list=A_list AB_list /* Concatenate the file lists */
  130.       big_drive='A'
  131.       END /* DO */
  132.    else DO
  133.       B_list=B_list AB_list /* The B: drive better be 1.44MB if A: isn't */
  134.       big_drive='B'
  135.    END /* DO */
  136.  
  137. /* Copy files from "instfrom" drive to A: */
  138.    IF cd_rom='Y' THEN A_list=A_list OS2CDROM.DMD /* Add Microsoft CD-ROM extensions */
  139.    A_list=A_list A_nfiles /* Concatenate the lists */
  140.  
  141.    source='' /* Source is various subdirectories in \OS2 */
  142.    extension='' /* Extensions are supplied in file list */
  143.    CALL copy_to_boot 'A:' A_list
  144.  
  145. /* Copy files from "instfrom" drive to B: */
  146.    B_list=B_list B_nfiles
  147.  
  148.    CALL copy_to_boot 'B:' B_list /* "source" and "extension" are null strings */
  149.  
  150. /**********************/
  151.    CALL saywrap('Do you want to LEAVE the temporary directory 'temp_dir' for future')
  152.    CALL saywrap('runs of BOOTDISK/CMD without the OS/2 2.11 Service Pack diskettes?')
  153.    IF y_or_n()='N' THEN DO
  154.       SAY 'Delete the temporary directory 'temp_dir
  155.       SAY 'Are you sure?'
  156.       IF y_or_n()='N' THEN LEAVE
  157. /* Erase the temporary files and remove the temporary directory */
  158.       'ECHO Y | DEL 'temp_dir' >NUL' /* Delete files; echo "Y" to prompt */
  159.       CALL SysRmDir temp_dir /* Delete the subdirectory */
  160.    END
  161. /**********************/
  162.  
  163.    IF type='2' THEN DO  /* Create ABIOS.SYS if a PS/2 boot disk.  */
  164.       abios_file='A:\ABIOS.SYS'
  165.       CALL lineout abios_file, '', 1
  166.       k=lineout(abios_file)
  167.       DROP abios_file
  168.       CALL saywrap('ABIOS.SYS Created on drive A:.')
  169.    END
  170. END
  171.  
  172. /*   The Optionals Area  */
  173. /* CALL SysCls */
  174.  
  175. /* Get drive space */
  176. DriveInfo=SysDriveInfo('A:') /* Give space on A:, too */
  177. disk_space_A=WORD(DriveInfo,2)
  178. DriveInfo=SysDriveInfo('B:')
  179. disk_space_B=WORD(DriveInfo,2)
  180.  
  181. /* Get co-processor emulator size */
  182. CALL SysFileTree instfrom'\OS2\DLL\NPXEMLTR.DLL', 'file_c', 'F'
  183. math_size=WORD(file_c.1,3)
  184.  
  185. /* Get SCSI driver data */
  186. CALL SysFileTree instfrom'OS2SCSI.DMD', 'file_s', 'FS'
  187. scsi_size=WORD(file_s.1,3)
  188. scsi_filespec=WORD(file_s.1,5)
  189.  
  190. /* Check for Tiny Editor */
  191. CALL saywrap('Looking for Tiny Editor IBM freeware ...')
  192. DriveMap=SysDriveMap('C:', 'LOCAL') /* Find all attached hard drives */
  193.  
  194. DO i=1 to WORDS(DriveMap) /* Loop over the number of drives */
  195.   ed_from=WORD(DriveMap,i)
  196.   CALL SysFileTree ed_from'\THELP.HLP', 'file_e', 'FS' /* Locate TinyEd */
  197.   IF (file_e.0>0) THEN LEAVE /* Define "instfrom" */
  198.   END
  199. IF file_e.0>0 THEN DO
  200.   editor='Y'
  201.   t_hlpsize=WORD(file_e.1,3) /* HELP file size */
  202.   t_hlpspec=WORD(file_e.1,5) /* HELP file pathname */
  203.   sp=LASTPOS('\',t_hlpspec) /* Find pathname for T2.EXE */
  204.   t_exespec=SUBSTR(t_hlpspec,1,sp)'T2.EXE'
  205.   CALL SysFileTree t_exespec, 'file_e', 'F' /* Find executable */
  206.   t_exesize=WORD(file_e.1,3) /* T2.EXE file size */
  207.   t_size=t_hlpsize+t_exesize
  208.   END
  209. ELSE
  210.   editor='N'
  211.  
  212. /* Start interactive configuration process */
  213. CALL saywrap('Drive A: space is             'disk_space_A' bytes.')
  214. CALL saywrap('SCSI driver size is           'scsi_size' bytes.')
  215. CALL saywrap('Drive B: space is             'disk_space_B' bytes.')
  216. CALL saywrap('Co-processor emulator size is 'math_size' bytes.')
  217. IF editor='Y' THEN
  218.   CALL saywrap('Editor size is                't_size' bytes.')
  219.  
  220. IF (disk_space_B<math_size) & (file_c.0=1) THEN DO
  221.   CALL saywrap(' There isn''t enough space to install coprocessor emulator.')
  222.   ismath='N'
  223. END
  224. ELSE DO
  225.   CALL saywrap('Will this disk be used on machines without math coprocessors?')
  226.   ismath=y_or_n()
  227.   END
  228.  
  229. IF ismath='Y' THEN DO /* Install emulator; keep track of disk space */
  230.   'COPY 'instfrom'\OS2\DLL\NPXEMLTR.DLL B:\DLL\*.* /B /V >NUL'
  231.   DriveInfo=SysDriveInfo('B:')
  232.   disk_space_B=WORD(DriveInfo,2)
  233.   CALL saywrap('Remaining disk space on B: is 'disk_space_B' bytes.')
  234.   END
  235.  
  236. IF (disk_space_A < scsi_size) & (file_s.0='0') THEN DO
  237.   CALL saywrap('There isn''t enough space to install the SCSI Driver...')
  238.   scsi='N'
  239.   END
  240. ELSE DO
  241.   CALL saywrap('Will you need the SCSI Driver installed?')
  242.   scsi=y_or_n()
  243.   END
  244.  
  245. IF scsi='Y' THEN DO /* Add on SCSI driver size */
  246.   'COPY 'instfrom'\OS2\OS2SCSI.DMD A:\*.* /B /V >NUL' /* Copy the SCSI driver */
  247.   DriveInfo=SysDriveInfo('A:')
  248.   disk_space_A=WORD(DriveInfo,2)
  249.   CALL saywrap('Remaining disk space on A: is 'disk_space_A' bytes.')
  250.   END
  251.  
  252. IF big_drive='A' THEN
  253.    space_ed=disk_space_A
  254. else
  255.    space_ed=disk_space_B
  256.  
  257. IF editor='Y' THEN DO
  258.   IF (space_ed < t_size) THEN DO
  259.     CALL saywrap('There isn''t enough space to install the Tiny Editor.')
  260.     edits='N'
  261.     END
  262.   ELSE DO
  263.     CALL saywrap('Will you need the Tiny Editor installed?')
  264.     edits=y_or_n()
  265.     END
  266.   END
  267. ELSE
  268.   edits='N'
  269.  
  270. IF edits='Y' THEN DO
  271.   'COPY 't_exespec big_drive':\edit.exe /B /V >NUL' /* Rename it EDIT.EXE */
  272.   'COPY 't_hlpspec big_drive':\*.* /B /V >NUL'
  273.   END
  274.  
  275. CALL create_config_sys big_drive hpfs type scsi cd_rom /* Create A:\CONFIG.SYS dynamically */
  276.  
  277. CALL saywrap('Boot Diskettes have been created.')
  278.  
  279. DriveInfo=SysDriveInfo('A:') /* Give space on A:, too */
  280. disk_space_A=WORD(DriveInfo,2)
  281. CALL saywrap('Remaining disk space on A: is 'disk_space_A' bytes.')
  282.  
  283. DriveInfo=SysDriveInfo('B:') /* Give remaining space on B: */
  284. disk_space_B=WORD(DriveInfo,2)
  285. CALL saywrap('Remaining disk space on B: is 'disk_space_B' bytes.')
  286.  
  287. The_End:
  288. CALL SysDropFuncs
  289. EXIT
  290. /************************************************************/
  291. /************* Utility functions and procedures *************/
  292. /************************************************************/
  293. parse_all_args: PROCEDURE EXPOSE ReConfig; ARG arg_string
  294.  
  295. IF (WORD(arg_string,1)='RECONFIGURE') THEN
  296.   ReConfig='Y'
  297. ELSE
  298.   ReConfig='N'
  299.  
  300. RETURN
  301. /************************************************************/
  302. find_os2: PROCEDURE EXPOSE instfrom /*Find the drive where OS/2 is installed */
  303. DriveMap=SysDriveMap('C:', 'LOCAL') /* Find all attached hard drives */
  304. DO i=1 TO WORDS(DriveMap) /* Loop over the number of drives */
  305.   CALL SysFileTree WORD(DriveMap,i)'\OS2\HELP.CMD', 'file' /*Locate OS/2 */
  306.   IF (file.0='1') THEN instfrom=WORD(DriveMap,i) /* Define "instfrom" */
  307.   END
  308. RETURN
  309. /************************************************************/
  310. find_config: PROCEDURE EXPOSE instfrom type hpfs cd_rom /* Determine configuration */
  311. call SysFileTree instfrom'\OS2\KBD01.SYS', 'file', 'FO' /* Check: [E]ISA or MCA? */
  312. IF (file.0='1') THEN
  313.   type=1 /* ISA or EISA */
  314. ELSE
  315.   type=2 /* MCA or PS/2 */
  316.  
  317. call SysFileTree instfrom'\OS2\HPFS.IFS', 'file', 'FO' /* Check: HPFS? */
  318. IF file.0=1 THEN
  319.   hpfs='Y'
  320. ELSE
  321.   hpfs='N'
  322.  
  323. call SysFileTree instfrom'\OS2\CDFS.IFS', 'file', 'FO' /* Check:  CD-ROM? */
  324. IF file.0>0 then
  325.    cd_rom='Y'
  326. ELSE
  327.    cd_rom='N'
  328.  
  329. /* SAY 'Type' type', HPFS =' hpfs', CD_ROM =' cd_rom */
  330. RETURN
  331. /************************************************************/
  332. copy_from_a: PROCEDURE; ARG temp_dir id filename file_list /* Copy files from A: */
  333. /* temp_dir  Temporary directory to which files are copied */
  334. /* id         Disk ID; 'SP_DISK_1' or 'SP_DISK_2' */
  335. /* filename   File on OS/2 disk whose existence identifies it */
  336. /* file_list  List of files to copy */
  337. CALL get_inst_disk id filename /* Get the OS/2 2.11 disk */
  338. CALL get_files_a temp_dir id file_list /* Copy the files to the temp subdir */
  339. RETURN
  340. /************************************************************/
  341. get_inst_disk: PROCEDURE; ARG id filename /* Get OS/2 disk in A: */
  342. /* id         Disk ID; 'SP_DISK_1' or 'SP_DISK_2' */
  343. /* filename   File on OS/2 disk whose existence identifies it */
  344. k=0
  345. DO WHILE k=0
  346.   CALL BEEP 392, 250 /* Beep 392 Hz for 250 milliseconds */
  347.   if(id='SP_DISK_1') THEN
  348.     SAY 'Insert OS/2 2.1 Service Pack Disk 1 in drive A:.'
  349.   ELSE
  350.     SAY 'Insert OS/2 2.1 Service Pack Disk 2 in drive A:.'
  351.   'PAUSE'
  352.   CALL SysFileTree 'A:\'filename, 'file', 'FO' /* Check for filename */
  353.   k=file.0 /* Try again until filename is found */
  354.   END
  355. RETURN
  356. /************************************************************/
  357. get_files_a: PROCEDURE; ARG temp_dir id file_list
  358. /* Copy files from OS/2 disk in A: */
  359. /* temp_dir  Temporary directory to which files are copied */
  360. /* id         Disk ID; 'SP_DISK_1' or 'SP_DISK_2' */
  361. /* file_list  List of files to copy */
  362. CALL SysFileTree temp_dir, 'file', 'DO' /* Make sure directory exists */
  363. IF file.0=0 THEN DO
  364.    SAY 'Error in "get_files," directory 'temp_dir' does not exist.'
  365.    CALL SysDropFuncs
  366.    EXIT
  367.    END /* DO */
  368. k=SysCurPos() /* Find row of cursor on screen */
  369. k=WORD(k,1)
  370. IF id='SP_DISK_1' THEN
  371.   message='Copying files from OS/2 2.1 Service Pack Disk 1'
  372. ELSE
  373.   message='Copying files from OS/2 2.1 Service Pack Disk 2'
  374. SAY message
  375. dot_pos=LENGTH(message)
  376. n=WORDS(file_list)
  377. DO i=1 TO n /* Loop over file names in "file_list" */
  378.   'COPY A:\'WORD( file_list, i) temp_dir' /B /V >NUL'
  379.   CALL SysCurPos k, dot_pos+i /* Echo a dot for each file */
  380.   SAY '.'
  381. END
  382. RETURN
  383. /************************************************************/
  384. evict_disk: PROCEDURE
  385. /* Evicts OS/2 2.11 Service Pack disk from A: before writing to A: */
  386. /* filename  File name that identifies an Service Pack disk */
  387. k=1
  388. DO FOREVER /* Get the OS/2 2.11 Service Pack disks out of A: */
  389.    sdi=SysDriveInfo('A:')
  390.    IF sdi='' THEN LEAVE /* Disk not ready */
  391.    IF \(WORD(sdi,4)='SP') THEN LEAVE /* OS/2 SP disk label is "SP DISK <n>' */
  392.    CALL BEEP 392, 250
  393.    SAY 'Please remove OS/2 2.1 Service Pack Disk from Drive A:,'
  394.    SAY 'Then insert OS/2 2.11 BOOT DISKS [To Be Created] in drives A: and B:.'
  395.    'PAUSE'
  396.    END /* DO */
  397. RETURN
  398. /************************************************************/
  399. format_a_b: PROCEDURE /* Format A: and B: */
  400.  
  401. SAY 'FORMATting the boot disks ...'
  402.  
  403. tempfile=SysTempFileName('TEMP????') /* Write response file for FORMAT */
  404. CALL LINEOUT tempfile, '', 1 /* Open the file, write blank line */
  405. CALL LINEOUT tempfile, 'N'
  406. CALL LINEOUT tempfile /* Close the file */
  407.  
  408. 'FORMAT A: /V:OS21_BOOT_A <'tempfile' >NUL' /* Format and label the disks */
  409. 'FORMAT B: /V:OS21_BOOT_B <'tempfile' >NUL'
  410.  
  411. CALL SysFileDelete tempfile
  412.  
  413. RETURN
  414. /************************************************************/
  415. label_a_b: PROCEDURE /* Label A: and B: */
  416. /* Begin by cleaning off A:\ and B:\ */
  417.  
  418. tempfile=SysTempFileName('TEMP????') /* Write response file for DEL */
  419. CALL LINEOUT tempfile, '', 1 /* Open the file, write blank line */
  420. CALL LINEOUT tempfile, 'Y'
  421. CALL LINEOUT tempfile /* Close the file */
  422.  
  423. CALL SysFileTree 'A:\*.', 'file', FO
  424. IF file.0>0 THEN DO
  425.    'ATTRIB -h -s -r A:\*' /* Remove pesky hidden, system, read-only attributes */
  426.    'DEL A:\*. > NUL <' tempfile /* Delete kernel and loader files */
  427.    END /* DO */
  428.  
  429. CALL SysFileTree 'A:\*.MSG', 'file', FO
  430. IF file.0>0 THEN
  431.    'DEL A:\*.MSG > NUL <' tempfile /* Delete OS2LDR.MSG */
  432.  
  433. CALL SysFileTree 'A:\CONFIG.SYS', 'file', FO
  434. IF file.0>0 THEN
  435.    'DEL A:\CONFIG.SYS > NUL <' tempfile /* Delete CONFIG.SYS */
  436.  
  437. CALL SysFileTree 'B:\*.EXE', 'file', FO
  438. IF file.0>0 THEN
  439.    'DEL B:\*.EXE'
  440.  
  441. CALL SysFileTree 'B:\*.COM', 'file', FO
  442. IF file.0>0 THEN
  443.    'DEL B:\*.COM'
  444.  
  445. CALL SysFileTree 'B:\*.IFS', 'file', FO
  446. IF file.0>0 THEN
  447.    'DEL B:\*.IFS'
  448.  
  449. CALL SysFileDelete tempfile
  450. 'LABEL A:OS210BOOT_A'
  451. 'LABEL B:OS210BOOT_B'
  452. RETURN
  453. /************************************************************/
  454. root_to_a: PROCEDURE EXPOSE instfrom temp_dir; ARG file_list
  455. /* Copies HSR files on C:\ to A:\, removes HSR attributes
  456. NOTE:  EAs are stripped from files before copying to A: */
  457. /* file_list  List of files to copy */
  458. /****Argument passed as variable****/
  459. /* instfrom   Hard drive where OS/2 2.11 is installed */
  460.  
  461. k=SysCurPos() /* Move the cursor to column dot_pos */
  462. k=WORD(k,1)
  463. IF k>21 THEN k=0 /* End-around, don't scroll */
  464.  
  465. message='Installing Boot Files on new BOOT DISKETTE A'
  466. dot_pos=LENGTH(message)
  467. CALL saywrap(message)
  468. n=WORDS(file_list)
  469. DO i=1 TO n
  470.    CALL SysCurPos k+1, 0 /* Echo file names to screen */
  471.    SAY '                                                     ' /* Erase line */
  472.    CALL SysCurPos k+1, 0 /* Echo file names to screen */
  473.    file_name=WORD(file_list,i)
  474.    CALL saywrap(file_name)
  475.  
  476.    'XCOPY 'instfrom'\'file_name 'A:\  /V /H /T >NUL' /* System files to A: */
  477.    'ATTRIB -h -s -r A:\*' /* Remove attributes */
  478.    CALL SysCurPos k, dot_pos+i /* Echo dots */
  479.    SAY '.'
  480.    END
  481. CALL SysCurPos k+1, 0 /* Clear last file name */
  482. SAY COPIES(' ',53)
  483. CALL SysCurPos k+1, 0 /* Leave cursor on beginning of blank line */
  484. DROP file_list /* Retrieve memory used by file_list */
  485. RETURN
  486. /************************************************************/
  487. copy_to_boot: PROCEDURE EXPOSE source extension instfrom; ARG ab file_list
  488. /* ab         Destination drive, 'A:' or 'B:' */
  489. /* file_list  List of files to copy */
  490. /****Arguments passed as variables to allow null strings****/
  491. /* source     Source path, or blank string '' */
  492. /* extension  Extension, such as '.DLL' to be applied to all file names */
  493. /* instfrom   Hard drive where OS/2 2.11 is installed */
  494.  
  495. k=SysCurPos() /* Move the cursor to column dot_pos */
  496. k=WORD(k,1)
  497. IF k>21 THEN k=0 /* End-around, don't scroll */
  498.  
  499. message='Installing Files on new BOOT DISKETTE 'ab
  500. dot_pos=LENGTH(message)
  501. CALL saywrap(message)
  502. n=WORDS(file_list)
  503. DO i=1 TO n
  504.    CALL SysCurPos k+1, 0 /* Echo file names to screen */
  505.    SAY COPIES(' ',53) /* Erase line */
  506.    CALL SysCurPos k+1, 0 /* Echo file names to screen */
  507.    file_name=WORD(file_list,i)extension
  508.    CALL saywrap(file_name)
  509.  
  510.    CALL get_filespec(file_name)
  511.  
  512.    'COPY 'filespec ab'\*.* /B /V >NUL' /* System files to ab: */
  513.    CALL SysCurPos k, dot_pos+i /* Echo dots */
  514.    SAY '.'
  515.    END
  516. CALL SysCurPos k+1, 0 /* Clear last file name */
  517. SAY COPIES(' ',53)
  518. CALL SysCurPos k+1, 0 /* Leave cursor on beginning of blank line */
  519. DROP file_list /* Retrieve memory used by file_list */
  520. RETURN
  521. /************************************************************/
  522. get_filespec:  PROCEDURE EXPOSE instfrom source filespec; ARG filename
  523. IF source='' THEN DO
  524.    rc=SysFileTree(instfrom'\OS2\'filename,'file','FSO')
  525.    IF (rc>0 | file.0=0) THEN DO
  526.       SAY 'File 'filename' not found in' instfrom'\OS2'
  527.       CALL SysDropFuncs
  528.       EXIT
  529.       END /* IF */
  530.    filespec=file.1
  531.    END /* DO */
  532. ELSE
  533.    filespec=source'\'filename
  534. RETURN
  535. /************************************************************/
  536. getconfig: PROCEDURE EXPOSE A_nfiles B_nfiles C_files.;
  537. /* Get the *.ADD and *.IFS files from user's C:\CONFIG.SYS */
  538. 'TYPE C:\CONFIG.SYS | RXQUEUE' /* Put CONFIG.SYS in current queue */
  539. C_files.0=0 /* Initialize stem variable */
  540. A_nfiles=''
  541. B_nfiles=''
  542. do ii=1 to Queued() /* Process the lines */
  543.    Parse Pull OneLine
  544.    call parseit(OneLine)
  545.    IF \(Drive='') THEN DO
  546.       i=C_files.0+1 /* Increment the count */
  547.       C_files.i=NewLine  /* Save a line for CONFIG.SYS */
  548.       C_files.0=i /* Save the count in stem variable */
  549.  
  550.       IF Drive='A' THEN /* New file, line for CONFIG.SYS */
  551.          A_nfiles=A_nfiles FileName /* Add the file name to the list */
  552.       else
  553.          B_nfiles=B_nfiles FileName
  554.    END /* DO */
  555. end /* do */
  556. RETURN
  557. /************************************************************/
  558. parseit: PROCEDURE EXPOSE NewLine FileName Drive; ARG aline
  559. /* Parse lines from C:\CONFIG.SYS, make new boot disk CONFIG.SYS line,
  560. return file name and drive to which file is to be copied */
  561. loc_line=STRIP(aline) /* Remove leading and trailing blanks */
  562. select
  563.    when ABBREV(loc_line,'BASEDEV=') then DO /* BASEDEV drivers on A: */
  564.    PARSE VALUE SUBSTR(loc_line,9) WITH loc_file options /* <filespec> <options> */
  565.    FileName=FILESPEC('Name',loc_file) /* File name from command */
  566.    NewLine='BASEDEV='FileName options /* reformatted line */
  567.    Drive=A
  568.    END /* DO */
  569.  
  570.    when ABBREV(loc_line,'IFS=') then DO /* IFS drivers on B: */
  571.    PARSE VALUE SUBSTR(loc_line,5) WITH loc_file options
  572.    FileName=FILESPEC('Name',loc_file)
  573.    NewLine='IFS=B:\'FileName options
  574.    Drive=B
  575.    END /* DO */
  576.  
  577. otherwise DO /* All other lines */
  578.    NewLine=''
  579.    FileName=''
  580.    Drive=''
  581.    END /* DO */
  582. end  /* select */
  583.  
  584. RETURN
  585. /************************************************************/
  586. saywrap: PROCEDURE; PARSE ARG msg /* Erase line, then write to screen */
  587. k=WORD(SysCurPos(), 1) /* Find line number */
  588. IF k>21 THEN DO
  589.   k=0 /* End-around, don't scroll */
  590.   CALL SysCurPos 0, 0
  591.   END
  592. CALL SysCurPos k,0 /* Reposition cursor */
  593. DO 3
  594.   SAY COPIES(' ', 75) /* Erase lines */
  595.   END
  596. CALL SysCurPos k, 0 /* Back up and write on blank line */
  597. SAY msg
  598. RETURN
  599. /************************************************************/
  600. y_or_n: PROCEDURE /* Get 'Y' or 'N' from console */
  601. /* Syntax:  response=y_or_n()  */
  602. resp='X'
  603. DO UNTIL (resp='Y' | resp='N')
  604.   CALL saywrap('Y or N?')
  605.   PULL resp
  606.   resp=WORD(resp,1) /* Eliminate leading & trailing blanks, etc. */
  607.   END
  608. RETURN resp
  609. /************************************************************/
  610. create_config_sys: PROCEDURE EXPOSE C_files.; ARG big_drive hpfs type scsi cd_rom
  611. /* Create the CONFIG.SYS dynamically...   */
  612. CALL saywrap('Creating CONFIG.SYS on drive A: ...')
  613. config_file='A:\CONFIG.SYS'
  614. CALL lineout config_file, 'PROTSHELL='big_drive':\CMD.EXE' /* Opens the file */
  615. CALL lineout config_file, 'SET OS2_SHELL='big_drive':\CMD.EXE'
  616. CALL lineout config_file, 'SET RUNWORKPLACE='big_drive':\CMD.EXE'
  617. CALL lineout config_file, 'SET COMSPEC='big_drive':\CMD.EXE'
  618. CALL lineout config_file, 'LIBPATH=.;\;B:\DLL;'
  619. CALL lineout config_file, 'SET PATH=A:\;B:\;B:\DLL;C:\OS2'
  620. CALL lineout config_file, 'SET DPATH=A:\;B:\;B:\DLL'
  621. CALL lineout config_file, 'SET PROMPT=$I[$P]'
  622. CALL lineout config_file, 'BUFFERS=32'
  623. CALL lineout config_file, 'IOPL=YES'
  624. CALL lineout config_file, 'DISKCACHE=64,LW'
  625. CALL lineout config_file, 'MEMMAN=NOSWAP'
  626. CALL lineout config_file, 'PROTECTONLY=YES'
  627. CALL lineout config_file, 'PAUSEONERROR=YES'
  628. CALL lineout config_file, 'CODEPAGE=437,850'
  629. CALL lineout config_file, 'DEVINFO=KBD,US,KEYBOARD.DCP'
  630. CALL lineout config_file, 'SET KEYS=ON'
  631. IF cd_rom='Y' THEN
  632.    CALL lineout config_file, 'DEVICE=OS2CDROM.DMD /Q' /* The one & only DEVICE driver */
  633. CALL lineout config_file, 'rem DEVICE=\TESTCFG.SYS' /*Add if you need it; I don't */
  634. do i=1 to C_files.0 /* Add the BASEDEV drivers & IFSs from C:\CONFIG.SYS, but loaded from A: */
  635.    CALL lineout config_file, C_files.i
  636. end /* do */
  637. CALL lineout config_file  /* Close the file */
  638. RETURN
  639. /************************************************************/
  640.