home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 5 Edit / 05-Edit.zip / greed223.zip / RSTRFNC.CMD < prev    next >
OS/2 REXX Batch file  |  1998-02-23  |  7KB  |  194 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 Source envir callType procName
  17. Parse Arg destPath
  18. /*-------------(Write lines into file)--------------*/
  19. filename = destPath'\install.log'
  20. rc = LineOut( filename, 'Destination Directory:' destPath)
  21.  
  22. /*==============(Exception handling)================*/
  23. Signal On Failure Name CLEARUP
  24. Signal On Halt    Name CLEARUP
  25. Signal On Syntax  Name CLEARUP
  26.  
  27. /*==========(Initialize RexxUtil support)===========*/
  28. If RxFuncQuery('SysLoadFuncs') Then Do
  29.   Call RxFuncAdd 'SysLoadFuncs', 'RexxUtil', 'SysLoadFuncs'
  30.   Call SysLoadFuncs
  31. End /* If RxFuncQuery... */
  32.  
  33. Queue Queue Date( S ) Time() 'Start'  procName
  34. Call SaveFNCFiles destPath
  35. Call DfltFNCFiles destPath
  36. Call SetGrayBColor destPath
  37. Call DelGreedXInfo
  38. Call DelIniAppl 'Sizes and Positions'
  39. Call DelIniKey 'GreedSaveOptions'
  40. Call DelIniKey 'GreedXOptions', 'GreedX'
  41. Queue procName 'completed'
  42.  
  43. /*================( complete )================*/
  44. Return
  45.  
  46. CLEARUP:
  47. Return
  48.  
  49. /*==============( P R O C E D U R E S )==============*/
  50.  
  51.  
  52. /*=============( Save current FNC File )=============*/
  53. SaveFNCFiles: Procedure
  54. procName = 'SaveFNCFiles'
  55. Arg destPath
  56.  
  57. Queue Queue Date( S ) Time() 'Start'  procName
  58. /*--------------(Save directory)---------------*/
  59. directory = destPath||'\SAVEPREV'
  60. /*-----------(Find file/Set attributes)-------------*/
  61. rc = SysFileTree( directory||'\*.FNC', fileList, 'FO' )
  62. Do i = 1 To fileList.0
  63.   name  = FileSpec( "Name", fileList.i )   /* FILENAME.EXT */
  64.   delRC = SysFileDelete( destPath'\'name )
  65.   a = "Delete: " destPath'\'name || ", RC="delRC
  66.   Queue Date( S ) Time() a 
  67.   /*------------------(copy file)-------------------*/
  68.   "unpack" fileList.i destPath||"\ >>NUL"
  69.   /* If rc = 0 Then delRC = SysFileDelete( fileList.i ) */
  70.   a = "unpack" fileList.i destPath||"\" || ", RC="rc
  71.   Queue Date( S ) Time() 'Restore:' a
  72. End /* If ... */
  73.  
  74. Return
  75. /* End SaveFNCFiles */
  76.  
  77.  
  78. /*==========( Set Default Gray Background )==========*/
  79. SetGrayBColor: Procedure
  80. procName = 'SetGrayBColor'
  81. Arg destPath
  82.  
  83. Queue Queue Date( S ) Time() 'Start'  procName
  84. /*---------------(Set key value data)---------------*/
  85. inifile = destPath'\GREED.INI'   /* USER SYSTEM BOTH Pathname */
  86. Queue Date( S ) Time() 'INI file:' inifile
  87. appl    = 'GREEDX'               /* Application name          */
  88. key     = 'Cnr_BColor'           /* Key name                  */
  89. value = SysIni( inifile, appl, key )
  90. If value = '13160392' Then Do
  91.   value   = '13487565'     /* Key value data            */
  92.   result = SysIni( inifile, appl, key, value )
  93. End
  94.  
  95. Return
  96. /* End SetGrayBColor */
  97.  
  98.  
  99.  
  100. /*============( Delete GreedX info object )============*/
  101. DelGreedXInfo: Procedure
  102. procName = 'DelGreedXInfo'
  103.  
  104. Queue Queue Date( S ) Time() 'Start'  procName
  105. /*-------------(Destroy a workplace object)------------*/
  106. objectName = '<DEL_GREEDX_INF>' /* ObjectID | Filename */
  107. result = SysDestroyObject( objectName )
  108.  
  109. Return
  110. /* End DelGreedXInfo */
  111.  
  112.  
  113. /*============(Delete Selected INI Key)============*/
  114. DelIniKey: Procedure Expose destPath
  115. procName = 'DelIniKey'
  116. Parse Arg keyName, applName, iniFile
  117.  
  118. Queue Queue Date( S ) Time() 'Start'  procName
  119. If keyName = '' Then Return -1
  120. /*-------------------(Delete a key)--------------------*/
  121. If iniFile = '' Then
  122.   iniFile = destPath'\GREED.INI'   /* Greed initialization file */
  123. If applName = '' Then
  124.   applName = 'Greed'       /* Application name          */
  125. Queue Date( S ) Time() 'INI file...:' inifile
  126. Queue Date( S ) Time() 'Application:' applName
  127. Queue Date( S ) Time() 'Key........:' keyName
  128.  
  129. result = SysIni( iniFile, applName, keyName, 'DELETE:')
  130. If result = 'ERROR:' Then
  131.   Return -2
  132. Return 0
  133. /* End DelIniKey */
  134.  
  135.  
  136.  
  137. /*============(Delete Selected INI Key)============*/
  138. DelIniAppl: Procedure Expose destPath
  139. procName = 'DelIniAppl'
  140. Parse Arg applName, iniFile
  141.  
  142. Queue Queue Date( S ) Time() 'Start'  procName
  143. If applName = '' Then Return -1
  144. /*-------------------(Delete a key)--------------------*/
  145. If iniFile = '' Then
  146.   iniFile = destPath'\GREED.INI'   /* Greed initialization file */
  147.  
  148. Queue Date( S ) Time() 'INI file...:' inifile
  149. Queue Date( S ) Time() 'Application:' applName
  150.  
  151. result = SysIni( iniFile, applName, 'DELETE:')
  152. If result = 'ERROR:' Then
  153.   Return -2
  154.  
  155. Return 0
  156. /* End DelIniKey */
  157.  
  158.  
  159. /*================( Default FNC files )================*/
  160. DfltFNCFiles: Procedure
  161. procName = 'DfltFNCFiles'
  162. Arg destPath
  163.  
  164. Queue Queue Date( S ) Time() 'Start'  procName
  165. Queue Date( S ) Time() 'Create Default FNC Directory'
  166. /*-----------(Find file/Set attributes)-------------*/
  167. rc = SysFileTree( '*.FN@', fileList, 'FO' )
  168. If fileList.0 > 0 Then Do
  169.   Do i = 1 To fileList.0
  170.     /*------------------(copy file)-------------------*/
  171.     "unpack" fileList.i destPath||"\DfltFNCs\ >>NUL"
  172.     a = "unpack" fileList.i destPath||"\DfltFNCs\" || ", RC="rc
  173.     Queue Date( S ) Time() 'Default FNC:' a
  174.   End /* Do ... */
  175.  
  176.   text = 'This is the directory with default FNC files delivered with GREED.'d2c(13)
  177.   text = text || 'The installation routine will not overwrite your private FNC files.'d2c(13)
  178.   text = text || 'You can also look here at default FNC files, copy the new functions from'd2c(13)
  179.   text = text || 'their into your private FNCs (only necessary if you have made private'd2c(13)
  180.   text = text || 'changes) or replace your files or functions by default.'d2c(13) 
  181.   text = text || ' 'd2c(13) 
  182.   text = text || 'Hint: Use Template Editor to make changes in your FNC files!'d2c(13) 
  183.  
  184.   filename = destPath||"\DfltFNCs\read.me"
  185.   delRC = SysFileDelete( filename )
  186.   rc = LineOut( filename, text )
  187.   status = Stream( filename, 'C', 'Close' )
  188.  
  189. End /* If ... */
  190. Else 
  191.   Queue Date( S ) Time() 'Create Default FNC Directory Error. RC='rc
  192.  
  193. Return
  194. /* End DfltFNCFiles */