home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 10 Tools / 10-Tools.zip / csinst.zip / rstrfnc.cmd < prev    next >
OS/2 REXX Batch file  |  1996-09-12  |  2KB  |  57 lines

  1. /* REXX *********************************************/
  2. /*                                                  */
  3. /* Program name: RSTRFNC                            */
  4. /* Function    : Restore Backup after the failing   */
  5. /*               installation                       */
  6. /*               example for the post-install-      */
  7. /*               failure exit                       */
  8. /*                                                  */
  9. /* Syntax      : Call from the INSTALL.DAT via:     */
  10. /*         START_REXX_IF_FAILURE=RESTOREP dest_path */
  11. /*                                                  */
  12. /* Changes     :                                    */
  13. /*                                                  */
  14. /* Made use of GREED.  21 May 1996 / 21:22:36   JRK */
  15. /****************************************************/
  16. Parse Arg destPath
  17. /*-------------(Write lines into file)--------------*/
  18. filename    = destPath'\install.log'
  19. rc = LineOut( filename, 'Destination Directory:' destPath)
  20.  
  21. /*==============(Exception handling)================*/
  22. Signal On Failure Name CLEARUP
  23. Signal On Halt    Name CLEARUP
  24. Signal On Syntax  Name CLEARUP
  25.  
  26. /*==========(Initialize RexxUtil support)===========*/
  27. If RxFuncQuery('SysLoadFuncs') Then Do
  28.   Call RxFuncAdd 'SysLoadFuncs', 'RexxUtil', 'SysLoadFuncs'
  29.   Call SysLoadFuncs
  30. End /* If RxFuncQuery... */
  31.  
  32. /*--------------(Save directory)---------------*/
  33. directory = destPath||'\SAVEPREV'
  34. /*-----------(Find file/Set attributes)-------------*/
  35. rc = SysFileTree( directory||'\*.fnc', fileList, 'FO' )
  36. Do i = 1 To fileList.0
  37.   name  = FileSpec( "Name", fileList.i )   /* FILENAME.EXT */
  38.   delRC = SysFileDelete( destPath'\'name )
  39.   a = "Delete: " destPath'\'name || ", RC="delRC
  40.   Queue Date( S ) Time() a 
  41.   /*------------------(copy file)-------------------*/
  42.   "unpack" fileList.i destPath||"\"
  43.   /* If rc = 0 Then delRC = SysFileDelete( fileList.i ) */
  44.   a = "unpack" fileList.i destPath||"\" || ", RC="rc
  45.   Queue Date( S ) Time() 'Restore:' a
  46. End /* If ... */
  47.  
  48. /*-------------(Remove directory)--------------*/
  49. /* rc = SysRmDir( directory ) */
  50.  
  51. /*================(End this program)================*/
  52. Return
  53.  
  54. CLEARUP:
  55.   Say 'GREED001E - Break, Failure or Syntax Error'
  56. Return
  57.