home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 29 Fixes_o / 29-Fixes_o.zip / su2112.zip / SU2BD30N.CMD < prev    next >
OS/2 REXX Batch file  |  1995-01-16  |  30KB  |  830 lines

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