home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: SysTools / SysTools.zip / csed_10.zip / install.cmd < prev    next >
OS/2 REXX Batch file  |  1993-07-09  |  7KB  |  220 lines

  1. /*
  2. @echo off
  3. cls
  4. echo.
  5. echo.
  6. echo ERROR:
  7. echo REXX support not installed
  8. echo You must have REXX support installed to run this
  9. echo program.
  10. echo.
  11. echo To run this program, run Selective Install from
  12. echo your System Setup folder, and install REXX.
  13. exit
  14. */
  15. /*----------------------------------------------*/
  16. /*-- REXX                                     --*/
  17. /*----------------------------------------------*/
  18. /*-- PROGRAM NAME:                            --*/
  19. /*-- install                                  --*/
  20. /*--                                          --*/
  21. /*-- DESCRIPTION:                             --*/
  22. /*-- Installs System Configuration Editor     --*/
  23. /*----------------------------------------------*/
  24. /*-- AUTHOR:                                  --*/
  25. /*-- Kelly Schrock                            --*/
  26. /*----------------------------------------------*/
  27. /*-- DATE:                                    --*/
  28. /*-- 07.07.93                                 --*/
  29. /*----------------------------------------------*/
  30.  
  31. TRACE n
  32. signal on HALT
  33. call LoadLibs
  34.  
  35. /*-- get the command line --*/
  36. parse arg sourcedir destdir
  37.  
  38. /*-- get dest dir --*/
  39. if destdir = '' then do
  40.   say ''
  41.   say 'Please enter a directory name for System Configuration Editor'
  42.   say '(Default: C:\CSED):'
  43.   parse pull destdir
  44.   /*-- if error --*/
  45.   if destdir = ' ' then do
  46.     destdir = 'C:\CSED'
  47.   end
  48. end
  49.  
  50. if sourcedir = ' ' then do
  51.   thisdir = directory()
  52.   say ''
  53.   say 'Please enter the directory where the program is being installed'
  54.   say 'from(Default: 'thisdir'):'
  55.   parse pull sourcedir
  56.   /*-- if another error --*/
  57.   if sourcedir = ' ' then do
  58.     sourcedir = thisdir
  59.     say 'using the current directory as the source directory.'
  60. end
  61.  
  62. /*-- make sure path is good --*/
  63. If substr( sourcedir, length(sourcedir), 1 ) \= '\' then
  64.     sourcedir = sourcedir||'\'
  65.  
  66. /*-- do main screen --*/
  67. call SysCls
  68. say
  69. say '                      System Configuration Editor Installation'
  70. say
  71. say 'System Configuration Editor will be Installed with the following settings:'
  72. say
  73. say 'Source directory: "'sourcedir'"'
  74. say 'Destination directory: "'destdir'"'
  75. say
  76. say 'Okay to continue(Y/n)?'
  77. k = SysGetKey('NOECHO')
  78. if k = 'N' | k = 'n' then do
  79.   say
  80.   say 'Installation cancelled.'
  81.   exit
  82. end
  83.  
  84. /*-- see if the dest directory exists --*/
  85. Call SysFileTree destdir, file, 'D'
  86.  
  87. if file.0 = '0' then do
  88.   say 'The directory: 'destdir' does not exist on your hardfile. Create it(Y/n)?'
  89.   k = SysGetKey('NOECHO')
  90.   if k = 'N'| k = 'n' then do
  91.     say
  92.     say 'Installation cancelled.'
  93.     exit
  94.   end
  95.   /*-- create the dest. dir --*/
  96.   rc = SysMkDir(destdir)
  97.   if rc = 0 then do
  98.     say 'The directory ' destdir ' was created successfully.'
  99.   end
  100.   else do
  101.     say 'The directory ' destdir ' could not be created successfully; cancelling.'
  102.     exit
  103.   end
  104. end
  105.  
  106. /*-- copy the files --*/
  107. call SysCls
  108. say
  109. say 'Install is copying files, please wait...'
  110. call CopyFile 'CSED.EXE',       sourcedir,    destdir
  111. call CopyFile 'CSED.INF',       sourcedir,    destdir
  112. call CopyFile 'CSED.HLP',       sourcedir,    destdir
  113. call CopyFile 'README.TXT',     sourcedir,    destdir
  114. call CopyFile 'LISCENSE.TXT',   sourcedir,    destdir
  115. call CopyFile 'REGISTER.TXT',   sourcedir,    destdir
  116. call CopyFile 'FILE_ID.DIZ',    sourcedir,    destdir
  117.  
  118. /*-- create a program object --*/
  119. call SysCls
  120. say
  121. say 'System Configuration Editor can be installed as an object on your desktop.'
  122. say 'Do you want to create it now(Y/n)?'
  123. k = SysGetKey('NOECHO')
  124. if k = 'N' | k = 'n' then call GoodBye
  125.  
  126. say
  127. say 'Creating program folder, please wait...'
  128. x = SysCreateObject("WPFolder",,
  129.                     "Configuration Editor",,
  130.                     "<WP_DESKTOP>",,
  131.                     "OBJECTID=<CSEDFLDR>", "replace")
  132. if x = 0 then do
  133.   say 'Unable to create folder; cancelling.'
  134.   exit
  135. end
  136.  
  137. say 'Adding the'
  138. say 'Manual,'
  139. x = SysCreateObject("WPProgram",,
  140.                     "Manual",,
  141.                     "<CSEDFLDR>",,
  142.                     "EXENAME=VIEW.EXE;PARAMETERS="||destdir||"\CSED.INF")
  143.  
  144. say 'ReadMe file,'
  145. x = SysCreateObject("WPProgram",,
  146.                     "Read Me",,
  147.                     "<CSEDFLDR>",,
  148.                     "EXENAME=E.EXE;PARAMETERS="||destdir||"\README.TXT")
  149.  
  150. say 'Registration form,'
  151. x = SysCreateObject("WPProgram",,
  152.                     "Registration",,
  153.                     "<CSEDFLDR>",,
  154.                     "EXENAME=E.EXE;PARAMETERS="||destdir||"\REGISTER.TXT")
  155.  
  156. say 'Liscense agreement,'
  157. x = SysCreateObject("WPProgram",,
  158.                     "Liscense Agreement",,
  159.                     "<CSEDFLDR>",,
  160.                     "EXENAME=E.EXE;PARAMETERS="||destdir||"\LISCENSE.TXT")
  161.  
  162. say 'and the System Configuration Editor.'
  163. x = SysCreateObject("WPProgram",,
  164.                     "Configuration Editor",,
  165.                     "<CSEDFLDR>",,
  166.                     "EXENAME="||destdir||"\CSED.EXE;STARTUPDIR="||destdir)
  167.  
  168.  
  169. GoodBye:
  170. /*-- exit with a goodbye --*/
  171. say
  172. say
  173. say
  174. say 'Done.'
  175. say 'System Configuration Editor has been installed on your system.'
  176. say
  177. say 'Be sure to read the file README.TXT for up-to-date information.'
  178. say
  179. say 'Press any key to exit installation...'
  180. k = SysGetKey('NOECHO')
  181. call SysCls
  182. exit
  183.  
  184. /*----------------------------------------------*/
  185. /*-- FUNCTION:                                --*/
  186. /*-- LoadLibs                                 --*/
  187. /*-- ACTION:                                  --*/
  188. /*-- loads the libraries needed by this REXX  --*/
  189. /*----------------------------------------------*/
  190. LoadLibs:
  191.   if RxFuncQuery('SysLoadFuncs') THEN
  192.   do
  193.     /*-- load the load-function --*/
  194.     CALL RxFuncAdd 'SysLoadFuncs', 'RexxUtil', 'SysLoadFuncs'
  195.     /*-- load the Sys* utilities --*/
  196.     CALL SysLoadFuncs
  197.   end
  198. return
  199.  
  200. HALT:
  201.   say
  202.   say 'User interrupted program.'
  203.   exit
  204.  
  205. /*-----------------------------------------------------------------------------*/
  206. /*-- CopyFile                                                                --*/
  207. /*-----------------------------------------------------------------------------*/
  208. CopyFile: Arg ArgFile2Copy, ArgFloppyDir, ArgInstallDir
  209.  
  210.     Say 'Copying 'ArgFloppyDir||ArgFile2Copy' to 'ArgInstallDir||'\'||ArgFile2Copy'...'
  211.     Command = '@Copy 'ArgFloppyDir||ArgFile2Copy' 'ArgInstallDir||'\'||ArgFile2Copy' >NUL'
  212.     Command
  213.     if rc \= 0 Then Do
  214.         say 'Error! 'ArgFile2Copy' was not installed properly.'
  215.         Pull ConfirmIt
  216.     End
  217.     Return
  218.  
  219.  
  220.