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