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

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