home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 5 Edit / 05-Edit.zip / greed223.zip / SAVEPRE.CMD < prev    next >
OS/2 REXX Batch file  |  1997-11-06  |  3KB  |  71 lines

  1. /* REXX *********************************************/
  2. /*                                                  */
  3. /* Program name: SAVEPRE                            */
  4. /* Function    : Save current installation - an     */
  5. /*               example for the pre-install exit   */
  6. /*                                                  */
  7. /* Syntax      : Call from the INSTALL.DAT via:     */
  8. /*    START_REXX_BY_START_INSTALL=SAVEPRE dest_path */
  9. /*                                                  */
  10. /* Changes     :                                    */
  11. /*                                                  */
  12. /* Made use of GREED.  21 May 1996 / 19:50:29   JRK */
  13. /****************************************************/
  14. Parse Arg destPath
  15. /*-------------(Write lines into file)--------------*/
  16. filename    = destPath'\install.log'
  17. rc = LineOut( filename, 'Destination Directory:' destPath)
  18.  
  19. /*==============(Exception handling)================*/
  20. Signal On Failure Name CLEARUP
  21. Signal On Halt    Name CLEARUP
  22. Signal On Syntax  Name CLEARUP
  23.  
  24. Call On NOTREADY
  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. "ATTRIB -r -h -s *.*>>NUL"
  33. /* delRC = SysFileDelete( destPath'\greed.ini' ) */
  34. /*--------------(Save directory)---------------*/
  35. directory = destPath||'\DfltFNCs'
  36. rc = SysMkDir( directory )
  37. /*--------------(Make directory)---------------*/
  38. directory = destPath||'\SAVEPREV'
  39. rc = LineOut( filename, 'Save Directory:' directory )
  40. rc = SysMkDir( directory )
  41. if rc = 0 | rc = 5 then do
  42.   ret = LineOut( filename, 'Make Save Directory RC='rc )
  43.   rc = LineOut( filename, "Save" destPath||"\*.*" directory"\" )
  44.   rc = SysFileTree( destPath||"\*.*", fileList, 'FO', '**---' )
  45.   /*-------------(Delete an application)--------------*/
  46.   /* appl    = 'RACF Callable Services' */       /* Application name */
  47.   /* result = SysIni( destPath||"\TSOISPF.FNC", appl, 'DELETE:' ) */ 
  48.   /* appl    = 'User' */                         /* Application name */
  49.   /* result = SysIni( destPath||"\TSOISPF.FNC", appl, 'DELETE:' ) */
  50.   Do i = 1 To fileList.0
  51.     name  = FileSpec( "Name", fileList.i )  /* FILENAME.EXT */
  52.     If Translate(name) \= 'INSTALL.LOG' Then Do
  53.       delFile = directory'\'name
  54.       rc = SysDestroyObject( delFile )
  55.       rc = SysCopyObject( fileList.i, directory )
  56.     End
  57.   End
  58.   rc = LineOut( filename, 'Save Previous Installation RC='rc )
  59. End
  60. Else ret = LineOut( filename, 'Make Save Directory RC='rc )
  61. /*----------(Set command for file system)-----------*/
  62. status = Stream( filename, 'C', 'Close' )
  63.  
  64. /*================(End this program)================*/
  65. Exit
  66.  
  67. CLEARUP:
  68. NOTREADY:
  69.   rc = LineOut( filename, 'Signal on error in the SavePrev exit' )
  70. Exit
  71.