home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 29 Fixes_o / 29-Fixes_o.zip / su2112.zip / su2bd20n.cmd < prev    next >
OS/2 REXX Batch file  |  1994-03-28  |  30KB  |  828 lines

  1. /**************************************************************************************************/
  2. /* IBM Save Utility/2                                                                             */
  3. /**************************************************************************************************/
  4. /* SU2BD20N.CMD                                                                                   */
  5. /* OS/2 2.0 with NETBIOS Boot diskette builder                                                    */
  6. /**************************************************************************************************/
  7. /*                                                                                                */
  8. /*  (c) Copyright IBM Corp. 1993  All rights reserved.                                            */
  9. /*  U.S. Government Users Restricted Rights - Use, duplication or disclosure restricted           */
  10. /*  by GSA ADP Schedule Contract with IBM Corp.                                                   */
  11. /*                                                                                                */
  12. /**************************************************************************************************/
  13.  
  14. call init;
  15. parse source . . pgmsourcepath;
  16. SourcePath = left(PgmSourcePath,lastpos('\',PgmSourcePath))
  17.  
  18. su2_drive = value('SAVEU2',,'OS2ENVIRONMENT');
  19.  
  20. starting_location = directory(su2_drive'\SAVEU2');
  21. if directory() <> su2_drive'\SAVEU2' then
  22.    call error 1 0 xx                                      /* Ensure we are in the right place    */
  23.  
  24. if stream('SU2CUS.CMD','C','QUERY EXIST') <> 0 then
  25.    esym'CALL SU2CUS.CMD'
  26. else
  27.    call error 11 0 xx
  28.  
  29. librarian = value('LIBRARIAN',,'OS2ENVIRONMENT');
  30. transport = value('TRANSPORT',,'OS2ENVIRONMENT');
  31.  
  32. say bold||yellow                                           /* In case MKDIR returns error         */
  33. esym'MKDIR WORK'
  34. say '';
  35. rc = directory(su2_drive'\SAVEU2\WORK') /*  Change to the Work subdirectory    */
  36.  
  37. Call ArrayLoading
  38.  
  39. say 'Getting files from Librarian' librarian;
  40. '..\'transport 'GETFILE SU2UTIL.EXE from' Librarian '/VIEW PROCS /P 10 /PD 120 /V1'
  41. if rc <> 0 then
  42.    call error 12 rc 'SU2UTIL.EXE'
  43.  
  44. '..\'transport 'GETFILE SETENV.EXE from' Librarian '/VIEW PROCS /P 10 /PD 120 /V1'
  45. if rc <> 0 then
  46.    call error 12 rc 'SETENV.EXE'
  47.  
  48. /**************************************************************************************************/
  49. /* Find the Boot Drive to find the LIBPATH to find the DLLs                                       */
  50. /**************************************************************************************************/
  51.  
  52. esym'SU2UTIL BOOTDRIVE | RXQUEUE'
  53. do queued();
  54.    pull BootDrive
  55. end;
  56.  
  57. do while lines(bootdrive'\CONFIG.SYS') & keyword <> 'LIBPATH'
  58.    parse value linein(bootdrive'\CONFIG.SYS') with keyword '=' dllpath
  59. end;
  60. rc = stream(bootdrive'\CONFIG.SYS','C','CLOSE')
  61.  
  62. if keyword <> 'LIBPATH' then
  63.    call error 8 0 bootdrive'\CONFIG.SYS'
  64.  
  65. i=1;
  66. do until dllpath = ''                 /*  load the dll path array           */
  67.    parse var dllpath entry ';' dllpath
  68.    dll.i = entry
  69.    i = i+1;
  70. end;
  71. dll.0 = i-1;
  72.  
  73. SourceFile  = Search_Path('LANTRAN.LOG')
  74. if SourceFile = ''  then
  75.    call error 10 0 xx                  /*  did we find  the \IBMCOM\ */
  76. ibmcom_path = left(SourceFile,length(SourceFile) - 12)
  77.  
  78. workarea  = su2_drive'\SAVEU2\WORK\'
  79.  
  80. /**************************************************************************************************/
  81. /* Build Diskette Zero                                                                            */
  82. /**************************************************************************************************/
  83.  
  84. Call Heading
  85. do forever;
  86.    say bold||Green'Put a copy of the OS/2 2.0 installation diskette into drive A and press Enter.';
  87.    say '';
  88.    say bold||yellow'WARNING:'
  89.    say 'This Diskette will be modified and no longer usable for its original purpose.'resetcolors
  90.    pull reply;
  91.  
  92.    if stream('A:\SYSINSTX.COM','C','QUERY EXIST') = '' then
  93.       say bold||red'The diskette in drive A is not the correct diskette.'
  94.    else
  95.       leave;
  96. end;
  97.  
  98. Call Heading
  99. call SysCurState 'OFF';
  100. if stream('A:\BUNDLE','C','QUERY EXIST') \= '' then
  101.    esym'ERASE A:\BUNDLE'
  102.  
  103. say bold||cyan'Copying from the Running System to Diskette #0'bold||white;
  104.  
  105. esym'COPY ..\'transport'.EXE A:\' rdir;
  106.  
  107. do i = 1 to active_d0.0
  108.   say left(left('█', i, '█'), active_d0.0, '▒') curup;
  109.   sourcefile = Search_Path(active_d0.i);
  110.   if sourcefile = '' then
  111.      call error 3 0 active_d0.i
  112.   else
  113.      do
  114.         esym'COPY' sourcefile 'A:\' rdir;
  115.         if rc <> 0 then
  116.            call error 4 rc active_d0.i
  117.      end;
  118. end;
  119. say clearline||resetcolors;
  120. call SysCurState 'ON';
  121.  
  122. /**************************************************************************************************/
  123. /* Build diskette One                                                                             */
  124. /**************************************************************************************************/
  125.  
  126. Call Heading
  127. do forever;
  128.    say bold||Green'Put a copy of OS/2 2.0 diskette #1 into drive A and press Enter'
  129.    say '';
  130.    say bold||yellow'WARNING:'
  131.    say 'This Diskette will be modified and no longer usable for its original purpose.'resetcolors
  132.    pull reply;
  133.  
  134.    if stream('A:\CMD.EXE','C','QUERY EXIST') = '' then
  135.       say bold||red'The diskette in drive A is not the correct diskette.'
  136.    else
  137.       leave;
  138. end;
  139.  
  140. call SysCurState 'OFF';
  141. Call Heading
  142. say bold||cyan'Copying from the OS2 installation Diskette #1 to' workarea||bold||white;
  143. do i = 1 to disk_one.0
  144.   say left(left('█', i, '█'), disk_one.0, '▒') curup;
  145.   esym'COPY A:\'disk_one.i workarea rdir;
  146.   if rc <> 0 then
  147.      call error 2 rc disk_one.i
  148. end;
  149. say clearline||resetcolors;
  150.  
  151. /**************************************************************************************************/
  152. /* Erase the diskette                                                                             */
  153. /**************************************************************************************************/
  154.  
  155. say bold||cyan'Preparing the diskette';
  156. esym||sourcepath'SU2DU ERASE A:' rdir;
  157.  
  158. say bold||cyan'Copying files from' workarea 'to Diskette #1'bold||white;
  159. esym'COPY SETENV.EXE A:\' rdir;
  160.  
  161. do i = 1 to disk_one.0
  162.    say left(left('█', i, '█'), disk_one.0, '▒') curup;
  163.    esym'COPY' workarea||disk_one.i  'A:\' rdir;
  164.    if rc <> 0 then
  165.       call error 2 rc disk_one.i
  166. end;
  167. say clearline||resetcolors
  168.  
  169. say bold||cyan'Copying selected files from the installed system to Diskette #1'bold||white;
  170. do i = 1 to active_d1.0
  171.    say left(left('█', i, '█'), active_d1.0, '▒') curup;
  172.    sourcefile = Search_Path(active_d1.i);
  173.    if sourcefile = '' then
  174.       call error 3 0 active_d1.i
  175.    else
  176.       do
  177.         esym'COPY' sourcefile 'A:\' rdir;
  178.         if rc <> 0 then
  179.            call error 4 rc active_d1.i
  180.       end;
  181. end;
  182. say clearline||resetcolors;
  183.  
  184. say bold||cyan'Copying selected LAN Transport files to Diskette #1'bold||white;
  185. do i = 1 to ibmcom_d1.0
  186.    say left(left('█', i, '█'), ibmcom_d1.0, '▒') curup;
  187.    sourcefile = Search_Path(ibmcom_d1.i);
  188.    if sourcefile = '' then
  189.       call error 3 0 ibmcom_d1.i
  190.    else
  191.       do
  192.          esym'COPY' sourcefile 'A:\' rdir;
  193.          if rc <> 0 then
  194.             call error 4 rc active_d1.i
  195.       end;
  196. end;
  197. say clearline||resetcolors;
  198.  
  199. /**************************************************************************************************/
  200. /* Build the CONFIG.SYS file on Diskette One                                                      */
  201. /**************************************************************************************************/
  202.  
  203. say bold||cyan'Building CONFIG.SYS on diskette #1'
  204. do i = 1 to config_sys.0
  205.    rc = lineout('A:\CONFIG.SYS', config_sys.i)
  206.    if rc <> 0 then
  207.       call error 5 rc 'A:\CONFIG.SYS'
  208. end;
  209. rc = stream('A:\CONFIG.SYS','C','CLOSE')
  210.  
  211. /**************************************************************************************************/
  212. /* Build the STARTUP.CMD file on Diskette One                                                     */
  213. /**************************************************************************************************/
  214.  
  215. say bold||cyan'Building STARTUP.CMD on diskette #1'
  216. do i = 1 to startup_cmd.0
  217.    rc = lineout('A:\STARTUP.CMD', startup_cmd.i)
  218.    if rc <> 0 then
  219.       call error 5 rc 'A:\STARTUP.CMD'
  220. end;
  221. rc = stream('A:\STARTUP.CMD','C','CLOSE')
  222.  
  223. /**************************************************************************************************/
  224. /* Build the SU2GO.CMD file on diskette One                                                       */
  225. /**************************************************************************************************/
  226.  
  227. say bold||cyan'Building SU2GO.CMD on diskette #1'
  228. do i = 1 to su2go_cmd.0
  229.    rc = lineout('A:\SU2GO.CMD', su2go_cmd.i)
  230.    if rc <> 0 then
  231.       call error 5 rc 'A:\SU2GO.CMD'
  232. end;
  233. rc = stream('A:\SU2GO.CMD','C','CLOSE')
  234.  
  235. /**************************************************************************************************/
  236. /* Build the PROTOCOL.INI file on diskette One                                                    */
  237. /**************************************************************************************************/
  238.  
  239. say bold||cyan'Building PROTOCOL.INI on diskette #1'
  240. do i = 1 to protocol_ini.0
  241.    rc = lineout('A:\PROTOCOL.INI', protocol_ini.i)
  242.    if rc <> 0 then
  243.       call error 5 rc 'A:\PROTOCOL.INI'
  244. end;
  245. rc = stream('A:\PROTOCOL.INI','C','CLOSE')
  246.  
  247. /**************************************************************************************************/
  248. /* Clean up and exit                                                                              */
  249. /**************************************************************************************************/
  250.  
  251. call SysCurState 'ON';
  252. rc = directory(su2_drive'\SAVEU2')
  253. esym||sourcePath'SU2DU ERASE' su2_drive'\SAVEU2\WORK' rdir;
  254. esym'RMDIR' su2_drive'\SAVEU2\WORK' rdir;
  255. rc = directory(starting_location);
  256.  
  257. exit 0;
  258.  
  259. /**************************************************************************************************/
  260. /* Search the PATH or LIBPATH for a filespec and return the full path                             */
  261. /**************************************************************************************************/
  262. Search_Path: Procedure  Expose dll.
  263. arg filespec
  264.  
  265. parse var filespec name '.' Ext
  266. if Ext = 'DLL' then
  267.    do i = 1 to dll.0
  268.       if (stream(dll.i'\'filespec,c,'QUERY EXISTS')) <> '' then
  269.          return dll.i'\'filespec;
  270.    end;
  271. else
  272.    do
  273.       remaining_path = value('PATH',,'OS2ENVIRONMENT')
  274.       work = 1
  275.       do until work = ""
  276.          parse var remaining_path work ';' remaining_path
  277.          if (stream(work'\'filespec,c,'QUERY EXISTS'))   <> '' then
  278.             return work'\'filespec;
  279.       end;
  280.  
  281.       remaining_path = value('DPATH',,'OS2ENVIRONMENT')
  282.       work = 1
  283.       do until work = ""
  284.          parse var remaining_path work ';' remaining_path
  285.          if (stream(work'\'filespec,c,'QUERY EXISTS'))   <> '' then
  286.             return work'\'filespec;
  287.       end;
  288.    end;
  289.  
  290. return '';
  291.  
  292. /**************************************************************************************************/
  293. /* Clear the screen and put up headings                                                           */
  294. /**************************************************************************************************/
  295. Heading:
  296.  
  297. say resetcolors||clearscreen||bold||cyan||on_blue||clearline;
  298. say center('SaveUtility/2 OS/2 2.0 Boot Diskette Builder',80) || curup;
  299. say clearline||resetcolors;
  300. say '';
  301.  
  302. return;
  303.  
  304. /**************************************************************************************************/
  305. /* Initialize                                                                                     */
  306. /**************************************************************************************************/
  307. init:
  308.  
  309. EscB = '1B'x||'['  ; CurSave   =EscB||'s'  ; CurRest     =EscB||'u'
  310. black  =EscB||'30m'; on_black  =EscB||'40m'; resetcolors =EscB||'0m'; tab8  ='09'x
  311. red    =EscB||'31m'; on_red    =EscB||'41m'; bold        =EscB||'1m'; curup =EscB||'1A';
  312. green  =EscB||'32m'; on_green  =EscB||'42m'; underscore  =EscB||'4m'; curdn =EscB||'1B';
  313. yellow =EscB||'33m'; on_yellow =EscB||'43m'; blink       =EscB||'5m'; curfwd=EscB||'1C';
  314. blue   =EscB||'34m'; on_blue   =EscB||'44m'; reversevideo=EscB||'7m'; curbwd=EscB||'1D';
  315. magenta=EscB||'35m'; on_magenta=EscB||'45m'; invisible   =EscB||'8m'; curpos=EscB||'24;80H';
  316. cyan   =EscB||'36m'; on_cyan   =EscB||'46m'; clearscreen =EscB||'2J'; co80  =EscB||'=3h';
  317. white  =EscB||'37m'; on_white  =EscB||'47m'; clearline   =EscB||'K';  co40  =EscB||'=1h';
  318. esym   = '@'; rdir = '1>NUL 2>NUL';
  319.  
  320. call Heading
  321.  
  322. say 'This function builds a pair of diskettes which can be used to perform';
  323. say 'a full system restore of an OS/2 2.0 system using SaveUtility/2.'
  324. say '';
  325. say 'You must supply copies of the OS/2 2.0 Installation diskette and Diskette #1.';
  326. say 'You will be prompted when to insert these diskettes, which will then be';
  327. say 'modified for use with the SaveUtility/2 full system restore.'
  328.  
  329. return 0;
  330.  
  331. /*COPYALL*/
  332. ArrayLoading:
  333. call loadarray disk_one  /* Required List of files we need from OS/2 disk #1 to SU/2 disk 1 */
  334. /* 000000.BIO   */
  335. /* ABIOS.SYS    */
  336. /* ANSICALL.DLL */
  337. /* BKSCALLS.DLL */
  338. /* BMSCALLS.DLL */
  339. /* BVHINIT.DLL  */
  340. /* BVSCALLS.DLL */
  341. /* CLOCK01.SYS  */
  342. /* CLOCK02.SYS  */
  343. /* CMD.EXE      */
  344. /* COUNTRY.SYS  */
  345. /* DISK.NUM     */
  346. /* DOSCALL1.DLL */
  347. /* F80000.BIO   */
  348. /* F80100.BIO   */
  349. /* F80200.BIO   */
  350. /* F80402.BIO   */
  351. /* F80403.BIO   */
  352. /* F80404.BIO   */
  353. /* F80600.BIO   */
  354. /* F80700.BIO   */
  355. /* F80701.BIO   */
  356. /* F80702.BIO   */
  357. /* F80703.BIO   */
  358. /* F80704.BIO   */
  359. /* F80902.BIO   */
  360. /* F80903.BIO   */
  361. /* F80904.BIO   */
  362. /* F80A00.BIO   */
  363. /* F80A01.BIO   */
  364. /* F80A02.BIO   */
  365. /* F80C00.BIO   */
  366. /* F80D00.BIO   */
  367. /* F80D01.BIO   */
  368. /* F81000.BIO   */
  369. /* F81B00.BIO   */
  370. /* F88000.BIO   */
  371. /* FC0400.BIO   */
  372. /* FC0403.BIO   */
  373. /* FC0500.BIO   */
  374. /* HARDERR.EXE  */
  375. /* HPFS.IFS     */
  376. /* IBM1FLPY.ADD */
  377. /* IBM1S506.ADD */
  378. /* IBM2ADSK.ADD */
  379. /* IBM2FLPY.ADD */
  380. /* IBM2SCSI.ADD */
  381. /* IBMINT13.I13 */
  382. /* KBD01.SYS    */
  383. /* KBD02.SYS    */
  384. /* KBDCALLS.DLL */
  385. /* KEYBOARD.DCP */
  386. /* MOUCALLS.DLL */
  387. /* MSG.DLL      */
  388. /* NAMPIPES.DLL */
  389. /* NLS.DLL      */
  390. /* NPXEMLTR.DLL */
  391. /* OS2CHAR.DLL  */
  392. /* OS2DASD.DMD  */
  393. /* OS2SCSI.DMD  */
  394. /* PRINT01.SYS  */
  395. /* QUECALLS.DLL */
  396. /* SCREEN01.SYS */
  397. /* SCREEN02.SYS */
  398. /* SESMGR.DLL   */
  399. /* SIPANEL1.DLL */
  400. /* SYSLEVEL.OS2 */
  401. /* VIOCALLS.DLL */
  402. /* VTBL850.DCP  */
  403. /* W020100.BIO  */
  404. /* W020101.BIO  */
  405. /* W050000.BIO  */
  406. /* W050100.BIO  */
  407. /* W050101.BIO  */
  408. /* W060100.BIO  */
  409. /* W0F0000.BIO  */
  410. /* END-OF-LIST     */
  411.  
  412. /* FDISK.COM  */
  413.  
  414. Call loadarray active_d0       /*  things we need from the running system for disk #0 */
  415. /* ACSNETB.DLL  */
  416. /* CHKDSK.COM   */
  417. /* FORMAT.COM   */
  418. /* UHPFS.DLL    */
  419. /* END-OF-LIST  */
  420.  
  421. say 'Loading NETBIOS/Lan Adapter and Protocol Support configuration.'curup;
  422.  
  423. Call loadarray active_d1    /* things we need from the running system for disk #1 */
  424. /* ACSLAN.DLL   */
  425. /* LANMSGDD.OS2 */
  426. /* LANMSGDL.DLL */
  427. /* LANMSGEX.EXE */
  428. /* LT0.MSG      */
  429. /* LT2.MSG      */
  430. /* OSO001.MSG   */
  431. /* PRO.MSG      */
  432. /* PROTMAN.OS2  */
  433. /* VDISK.SYS    */
  434. /* END-OF-LIST  */
  435.  
  436.  
  437. Call loadarray ibmcom_d1    /*  things from the IBMCOM Subdirectory for Disk #1  */
  438. /* \MACS\IBMNET.OS2       */
  439. /* \MACS\IBMNETA.OS2      */
  440. /* \MACS\IBMTOK.OS2       */
  441. /* \PROTOCOL\LANDD.OS2    */
  442. /* \PROTOCOL\LANDLL.EXE   */
  443. /* \PROTOCOL\LANDLLDD.OS2 */
  444. /* \PROTOCOL\LANPDD.OS2   */
  445. /* \PROTOCOL\NETBEUI.OS2  */
  446. /* \PROTOCOL\NETBIND.EXE  */
  447. /* \PROTOCOL\NETBIOS.OS2  */
  448. /* END-OF-LIST            */
  449.  
  450.  
  451. Call loadarray protocol_ini
  452. /* [PROT_MAN]                   */
  453. /*                              */
  454. /*    DriverName = PROTMAN$     */
  455. /*                              */
  456. /* [IBMLXCFG]                   */
  457. /*                              */
  458. /*    IBMTOK_nif = IBMTOK.nif   */
  459. /*    NETBEUI_nif = NETBEUI.nif */
  460. /*                              */
  461. /* [NETBEUI_nif]                */
  462. /*                              */
  463. /*    DriverName = netbeui$     */
  464. /*    Bindings = IBMTOK_nif     */
  465. /*    ETHERAND_TYPE = "I"       */
  466. /*    USEADDRREV = "YES"        */
  467. /*    SESSIONS = 40             */
  468. /*    NCBS = 95                 */
  469. /*    NAMES = 21                */
  470. /*    SELECTORS = 5             */
  471. /*    USEMAXDATAGRAM = "NO"     */
  472. /*    ADAPTRATE = 1000          */
  473. /*    WINDOWERRORS = 0          */
  474. /*    TI = 30000                */
  475. /*    T1 = 500                  */
  476. /*    T2 = 200                  */
  477. /*    MAXIN = 1                 */
  478. /*    MAXOUT = 1                */
  479. /*    NETBIOSTIMEOUT = 500      */
  480. /*    NETBIOSRETRIES = 8        */
  481. /*    NAMECACHE = 16            */
  482. /*    PIGGYBACKACKS = 1         */
  483. /*    DATAGRAMPACKETS = 2       */
  484. /*    PACKETS = 350             */
  485. /*    PIPELINE = 5              */
  486. /*    MAXTRANSMITS = 6          */
  487. /*    MINTRANSMITS = 2          */
  488. /*    DLCRETRIES = 5            */
  489. /*                              */
  490. /* [IBMTOK_nif]                 */
  491. /*                              */
  492. /*    DriverName = IBMTOK$      */
  493. /*    PRIMARY                   */
  494. /*    MAXTRANSMITS = 12         */
  495. /*    RECVBUFS = 2              */
  496. /*    RECVBUFSIZE = 256         */
  497. /*    XMITBUFS = 1              */
  498. /* END-OF-LIST                  */
  499.  
  500. Call loadarray config_sys
  501. /* BUFFERS=32 */
  502. /* IOPL=YES */
  503. /* MEMMAN=NOSWAP */
  504. /* PROTSHELL=A:\CMD.EXE /K A:\STARTUP.CMD */
  505. /* PROTECTONLY=YES */
  506. /* LIBPATH=.;A:\;C:\;D:\;E:\;F:\;G:\;H:\;I:\;J:\;K:\;L:\;M:\;N:\;O:\;P:\;Q:\;R:\;S:\;T:\;U:\;V:\;W:\;X:\;Y:\;Z:\; */
  507. /* SET PATH=A:\;\; */
  508. /* SET DPATH=A:\;\; */
  509. /* IFS=HPFS.IFS /C:64 /AUTOCHECK:C */
  510. /* PAUSEONERROR=NO */
  511. /* CODEPAGE=850 */
  512. /* DEVINFO=KBD,US,KEYBOARD.DCP */
  513. /* DEVINFO=SCR,EGA,VTBL850.DCP */
  514. /* SET KEYS=ON */
  515. /* DEVICE=A:\LANPDD.OS2 */
  516. /* DEVICE=A:\LANMSGDD.OS2 /I:A:\ */
  517. /* DEVICE=A:\PROTMAN.OS2 /I:A:\ */
  518. /* DEVICE=A:\VDISK.SYS 640,256,32 */
  519. /* RUN=A:\NETBIND.EXE */
  520. /* RUN=A:\LANMSGEX.EXE */
  521. /* DEVICE=A:\NETBEUI.OS2 */
  522. /* DEVICE=A:\IBMTOK.OS2 */
  523. /* DEVICE=A:\NETBIOS.OS2 */
  524. /* BASEDEV=PRINT01.SYS */
  525. /* BASEDEV=IBM1FLPY.ADD */
  526. /* RUN=A:\LANDLL.EXE */
  527. /* BASEDEV=IBM1S506.ADD */
  528. /* BASEDEV=IBM2FLPY.ADD */
  529. /* BASEDEV=IBM2ADSK.ADD */
  530. /* BASEDEV=IBM2SCSI.ADD */
  531. /* BASEDEV=IBMINT13.I13 */
  532. /* BASEDEV=OS2DASD.DMD */
  533. /* SET TRANSPORT= */
  534. /* SET LIBRARIAN= */
  535. /* SET SU2_DROPACLS=1 */
  536. /* END-OF-LIST */
  537.  
  538. do i = 1 to config_sys.0;                                  /* Insert transport * librarian names  */
  539.    if config_sys.i = 'SET TRANSPORT=' then
  540.          config_sys.i = 'SET TRANSPORT='transport;
  541.    if config_sys.i = 'SET LIBRARIAN=' then
  542.          config_sys.i = 'SET LIBRARIAN='librarian;
  543. end;
  544.  
  545. Call loadarray startup_cmd
  546. /* @IF %ECHO%. == . SET ECHO=OFF */
  547. /* @ECHO %ECHO% */
  548. /* Rem */
  549. /* Rem STARTUP.CMD for SaveUtility/2 OS/2 2.0 System Restore */
  550. /* Rem */
  551. /* */
  552. /* cls */
  553. /* ECHO                  SaveUtility/2 OS/2 2.0 System Restore */
  554. /* ECHO. */
  555. /* @ECHO  Locating VDISK */
  556. /* for %%D in (C: D: E: F: G: H: I: J: K: L: M: N: O: P: Q: R: S: T: U: V: W: X: Y: Z:) DO VOL %%D 1>nul 2>NUL && set VD=%%D */
  557. /* ECHO   VDISK in use is %VD% */
  558. /* */
  559. /* Set RTN=P1& SET FILE=CMD.EXE& GOTO COPYIT */
  560. /* :P1 */
  561. /* Set COMSPEC=%VD%\CMD.EXE */
  562. /* */
  563. /* Set RTN=P2& SET FILE=SU2GO.CMD& GOTO COPYIT */
  564. /* :P2 */
  565. /* Set RTN=P3& SET FILE=OSO001.MSG& GOTO COPYIT */
  566. /* :P3 */
  567. /* Set RTN=P4& SET FILE=SETENV.EXE& GOTO COPYIT */
  568. /* :P4 */
  569. /* */
  570. /* GOTO EXIT */
  571. /* */
  572. /* :Copyit */
  573. /* ECHO  Copying  %FILE% to %VD% */
  574. /* Copy A:\%FILE% %VD%\ */
  575. /* if ERRORLEVEL 1 GOTO ERR01 */
  576. /* IF NOT EXIST %VD%\%FILE% GOTO ERR01 */
  577. /* GOTO %RTN% */
  578. /* */
  579. /* :ERR01 */
  580. /* ECHO Error RA01  Failed to copy %FILE% to %VD%, cause unknown. */
  581. /* GOTO EGRESS */
  582. /* */
  583. /* :EXIT */
  584. /* %VD% */
  585. /* SU2GO.CMD */
  586. /* */
  587. /* :EGRESS */
  588. /* END-OF-LIST */
  589.  
  590. Call loadarray su2go_cmd
  591. /* @IF %ECHO%. == . SET ECHO=OFF */
  592. /* @ECHO %ECHO% */
  593. /* */
  594. /* IF %1. == RCMD. GOTO COMMAND */
  595. /* IF %1. == RESTART. GOTO Restart */
  596. /* IF %1. == restart. GOTO Restart */
  597. /* IF %1. == Restart. GOTO Restart */
  598. /* */
  599. /* :RETRY */
  600. /* ECHO  Reinsert diskette #0 */
  601. /* PAUSE && ECHO  */
  602. /* IF EXIST A:\%TRANSPORT%.EXE GOTO SECOND */
  603. /* */
  604. /* ECHO  The diskette you inserted is not correct */
  605. /* GOTO RETRY */
  606. /* :SECOND */
  607. /* */
  608. /* ECHO AAA */
  609. /* IF NOT %WKSNAME%. == . GOTO GOTNAME */
  610. /* ECHO Type the Subscriber name of this workstation and press Enter. */
  611. /* SETENV.EXE %VD%\REPLY.CMD WKSNAME Edit0 */
  612. /* CALL %VD%\REPLY.CMD */
  613. /* :GOTNAME */
  614. /* */
  615. /* Set PATH=%VD%;%PATH% */
  616. /* Set DPATH=%VD%;%DPATH% */
  617. /* ECHO Getting selected files from Librarian %LIBRARIAN% */
  618. /* %TRANSPORT% GETFILE FDISK.COM FROM %LIBRARIAN% /VIEW OS2 /ALIAS %VD%\FDISK.COM /V1 /pd 120 */
  619. /* IF NOT EXIST %VD%\FDISK.COM SET FILE=FDISK.COM& GOTO ERR04 */
  620. /* */
  621. /* :RESTART */
  622. /* */
  623. /* CLS */
  624. /* ECHO                  SaveUtility/2 OS/2 2.0 System Restore */
  625. /* ECHO. */
  626. /* ECHO. */
  627. /* ECHO Restore process options are as follows: */
  628. /* ECHO. */
  629. /* ECHO    1.  Partition the fixed disk                        (FDISK command) */
  630. /* ECHO    2.  Format a logical drive                          (FORMAT command) */
  631. /* ECHO    3.  Make a logical drive bootable                   (SYSINSTX command) */
  632. /* ECHO    4.  Receive files from SaveUtility/2 */
  633. /* ECHO    5.  Request a SaveUtility/2 full system restore, */
  634. /* ECHO        then Receive files from SaveUtility/2 */
  635. /* ECHO. */
  636. /* ECHO    9.  Exit to command prompt */
  637. /* ECHO. */
  638. /* ECHO Type one of the above options and press Enter. */
  639. /* :AskAgain */
  640. /* IF NOT EXIST %VD%\SETENV.EXE SET FILE=SETENV.EXE& GOTO ERR04 */
  641. /* SETENV.EXE %VD%\Reply.cmd option Edit0 */
  642. /* call %VD%\Reply.cmd */
  643. /* */
  644. /* if %OPTION%. == 1. GOTO FDISK */
  645. /* if %OPTION%. == 2. GOTO Format */
  646. /* if %OPTION%. == 3. GOTO MAKBOOT */
  647. /* if %OPTION%. == 4. GOTO Receive */
  648. /* if %OPTION%. == 5. GOTO FSRReq */
  649. /* if %OPTION%. == 9. GOTO Quit */
  650. /* */
  651. /* ECHO You selected an invalid option (%OPTION%). */
  652. /* GOTO AskAgain */
  653. /* */
  654. /* :FDISK */
  655. /* FDISK */
  656. /* ECHO If changes to the hard drives have been made, a reboot is required at */
  657. /* ECHO this time. otherwise press Enter to return. */
  658. /* @pause */
  659. /* GOTO Restart */
  660. /* */
  661. /* :Quit */
  662. /* ECHO To resume, type SU2GO RESTART and press Enter. */
  663. /* GOTO EGRESS */
  664. /* */
  665. /* :Format */
  666. /* CLS */
  667. /* ECHO                  SaveUtility/2 OS/2 2.0 System Restore */
  668. /* ECHO. */
  669. /* ECHO Type the drive letter and press Enter. */
  670. /* SETENV.EXE %VD%\Reply.cmd Drive Edit0 */
  671. /* CALL %VD%\REPLY.CMD */
  672. /* ECHO Specify the format, FAT or HPFS and press Enter. */
  673. /* SETENV.EXE %VD%\REPLY.CMD FILETYPE EDIT0 */
  674. /* CALL %VD%\REPLY.CMD */
  675. /* VOL %Drive%: */
  676. /* ECHO Formatting drive %Drive%: with a file system of %FileType% */
  677. /* ECHO ON */
  678. /* FORMAT %Drive%: /FS:%FileType% */
  679. /* @PAUSE */
  680. /* @ECHO %ECHO% */
  681. /* GOTO Restart */
  682. /* */
  683. /* :MAKBOOT */
  684. /* ECHO Type the drive letter and press Enter. */
  685. /* SETENV.EXE %VD%\Reply.cmd Drive Edit0 */
  686. /* CALL %VD%\REPLY.CMD */
  687. /* SYSINSTX %Drive%: */
  688. /* IF ERRORLEVEL 1 GOTO ERR02 */
  689. /* GOTO Restart */
  690. /* */
  691. /* :FSRREQ */
  692. /* CLS */
  693. /* ECHO                  SaveUtility/2 OS/2 2.0 System Restore */
  694. /* ECHO. */
  695. /* ECHO Sending a request for a Full System Restore to Librarian %LIBRARIAN% */
  696. /* %TRANSPORT% SENDCMD ""SU2SREST.CMD %WKSNAME%"" TO %LIBRARIAN% /VIEW SYSREST /V1 /pd 120 */
  697. /* :RECEIVE */
  698. /* ECHO. */
  699. /* ECHO This workstation will be identified as %WKSNAME% */
  700. /* ECHO. */
  701. /* ECHO The Restorer will send your files in due course.... */
  702. /* C: */ 
  703. /* CHDIR \ */ 
  704. /* %TRANSPORT% RECEIVE CURRENTDIR /CONT /RECOVER /V1 */
  705. /* IF ERRORLEVEL 2 GOTO ERR06 */
  706. /* %VD% */
  707. /* IF NOT EXIST C:\GETMODE.CMD GOTO ERR06 */
  708. /* CALL C:\GETMODE.CMD */
  709. /* ERASE C:\GETMODE.CMD */
  710. /* SET SU2_POLLDUR=360 */
  711. /* SET SU2_POLL=20 */
  712. /* SET SU2_SD=1 */
  713. /* SET SU2_RECOVER=1 */
  714. /* SET SU2_VIEW=UNRESTRICTED */
  715. /* FOR %%F IN (C:\TOBEREST.*) DO %TRANSPORT% GETLIST %%F FROM %FROMREST% %GETMODE% /V1 /PD 480 */
  716. /* IF ERRORLEVEL 1 GOTO ERR08 */
  717. /* FOR %%F IN (C:\TOBEREST.*) DO ERASE %%F */
  718. /* %TRANSPORT% GETFILE %WKSNAME%.OS2 FROM %LIBRARIAN% /VIEW PROFILES /ALIAS %VD%\FSRCUS.CMD /V1 /pd 120 */
  719. /* IF NOT EXIST %VD%FSRCUS.CMD GOTO ERR05 */
  720. /* IF EXIST %VD%FSRCUS.CMD CALL %VD%FSRCUS.CMD */
  721. /* IF NOT EXIST %SUBDRV%\SAVEU2\SU2CRITF.PRO GOTO ERR07 */
  722. /* IF EXIST %SUBDRV%\SAVEU2\SU2CRITF.PRO COPY %SUBDRV%\SAVEU2\SU2CRITF.PRO %SUBDRV%\SAVEU2\SU2CRITF.RST */
  723. /* %SUBDRV%\SAVEU2\SU2CRITF.EXE RESTORE %SUBDRV%\SAVEU2 */
  724. /* if %OPTION%. == 4. GOTO RESTART */
  725. /* ECHO  */
  726. /* ECHO                           OS/2 2.0 System Restore Completed */
  727. /* ECHO  */
  728. /* ECHO  */
  729. /* ECHO Remove the diskette from drive A: and press Ctrl-Alt-Del. */
  730. /* GOTO EGRESS */
  731. /* :COPYIT */
  732. /* ECHO  Copying  %FILE% to %VD% */
  733. /* Copy A:\%FILE% %VD%\ */
  734. /* if ERRORLEVEL 1 GOTO ERR04 */
  735. /* IF NOT EXIST %VD%\%FILE% GOTO ERR04 */
  736. /* GOTO %RTN% */
  737. /* :HEADING */
  738. /* CLS */
  739. /* ECHO                  SaveUtility/2 OS/2 2.0 System Restore */
  740. /* GOTO %RTN% */
  741. /* :ERR02 */
  742. /* ECHO Error RA02  SYSINSTX failed with a non-zero return code. */
  743. /* ECHO B  The hard disk may need re-formatting. */
  744. /* GOTO EGRESS */
  745. /* :ERR04 */
  746. /* ECHO Error RA04  Failed to copy %FILE% to %VD%, cause unknown. */
  747. /* GOTO EGRESS */
  748. /* :ERR05 */
  749. /* ECHO Error RA05  Failed to find %VD%FSRCUS.CMD. */
  750. /* GOTO EGRESS */
  751. /* :ERR06 */
  752. /* ECHO Error RA06  Failure during LAN Transport Setup. */
  753. /* GOTO EGRESS */
  754. /* :ERR07 */
  755. /* ECHO Error RA07  Failed to find %SUBDRV%\SAVEU2\SU2CRITF.PRO. */
  756. /* GOTO EGRESS */
  757. /* :ERR08 */
  758. /* ECHO Error RA08  Failed to get list from %LIBRARIAN% */
  759. /* GOTO EGRESS */
  760. /* :COMMAND */
  761. /* @ECHO ON */
  762. /* if %2. == FDISKQ. GOTO FDiskQ */
  763. /* %2 %3 %4 %5 %6 %7 %8 %9 */
  764. /* GOTO EGRESS */
  765. /* */
  766. /* :FDiskQ */
  767. /* FDISK /QUERY */
  768. /* */
  769. /* :EGRESS */
  770. /* %TRANSPORT% GOODBYE %LIBRARIAN% /V0 */
  771. /* END-OF-LIST */
  772.  
  773. return
  774.  
  775. /**************************************************************************************************/
  776. /* Load an array from the appropriate comments in this source code                                */
  777. /**************************************************************************************************/
  778. loadarray:
  779. arg ArrayName
  780.  
  781. say cyan'Resolving' ArrayName 'information.'||curup;
  782. i = 1;
  783. GoodData = '';                                             /* ensure no carry-over from last list */
  784.  
  785. do while GoodData <> 'END-OF-LIST';
  786.    parse value sourceline(sigl + i ) with '/*' GoodData '*/'
  787.    GoodData = strip(GoodData);
  788.    expression = Arrayname'.'i' = "'GoodData'"'
  789.    interpret expression
  790.    i = i + 1;
  791. end;
  792. i = i-2;
  793. expression = Arrayname'.0 = 'i;
  794. interpret expression;
  795. say clearline||curup;
  796.  
  797. return 0;
  798.  
  799. /**************************************************************************************************/
  800. /* Handle Errors                                                                                  */
  801. /**************************************************************************************************/
  802. error:
  803. arg err rc dater pause                                    /*  ie  call error 3 rc hello           */
  804.  
  805. say '';
  806. say bold||red||'Error'||err;
  807. select
  808.    when err =  1 then say 'Unable to Locate the \SAVEU2 subdirectory'
  809.    when err =  2 then say 'Copy failed for 'yellow||dater||red||' with a rc of 'yellow||rc||red'.'
  810.    when err =  3 then say 'Unable to locate required file 'yellow||dater||red||'.'
  811.    when err =  4 then say 'Copy failed for 'yellow||dater||red||', return code was' yellow||rc||red'.'
  812.    when err =  5 then say 'Write failed for 'yellow||dater||red||', return code was' yellow||rc||red'.'
  813.    when err =  6 then say 'Building the diskette in drive A: failed.'
  814.    when err =  7 then say 'Invocation of 'yellow||dater||red||' failed with rc of 'yellow||rc||red'.'
  815.    when err =  8 then say 'The LIBPATH statment could not be found in 'yellow||dater||red||'.'
  816.    when err =  9 then say 'Unable to copy 'yellow||dater||red||' to the A: drive.'
  817.    when err = 10 then say 'The \IBMCOM subdirectory could not be found.'
  818.    when err = 11 then say 'Unable to locate SU2CUS.CMD in the \SAVEU2 subdirectory.'
  819.    when err = 12 then say 'Failure during transport with a rc of 'yellow||rc||red', active file is 'yellow||dater||red||'.'
  820.    otherwise say 'Error code '||yellow||err||red||'is undefined.'
  821. end;
  822.  
  823. say resetcolors||bold||green;
  824. esym'PAUSE';
  825. say resetcolors;
  826.  
  827. exit 8;
  828.