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