home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 9 Archive / 09-Archive.zip / arcm30.zip / INSTALL.CMD < prev    next >
OS/2 REXX Batch file  |  1996-03-19  |  8KB  |  254 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. /*-- 03.17.96                                 --*/
  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. 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 'AMFILE.DLL',       sourcedir,    destdir
  122. call CopyFile 'AMFILE.HLP',       sourcedir,    destdir
  123. call CopyFile 'LICENSE.TXT',   sourcedir,    destdir
  124. call CopyFile 'REGISTER.TXT',   sourcedir,    destdir
  125.  
  126. /*-- create a program object --*/
  127. call SysCls
  128. say
  129. say 'Archive Manager can be installed as an object on your desktop.'
  130. say 'Do you want to create it now(Y/n)?'
  131. k = SysGetKey('NOECHO')
  132. if k = 'N' | k = 'n' then call GoodBye
  133.  
  134. say
  135. say 'Creating the program folder,'
  136. x = SysCreateObject("WPFolder",,
  137.                     "Archive Manager",,
  138.                     "<WP_DESKTOP>",,
  139.                     "OBJECTID=<ARCMAN>;ICONFILE="||destdir||"\ARCMAN.ICO", "replace")
  140. if x = 0 then do
  141.   say 'Unable to create folder; cancelling.'
  142.   exit
  143. end
  144.  
  145. say 'Adding the'
  146. say 'Manual,'
  147. x = SysCreateObject("WPProgram",,
  148.                     "Manual",,
  149.                     "<ARCMAN>",,
  150.                     "EXENAME=VIEW.EXE;PARAMETERS="||destdir||"\ARCMAN.INF About")
  151.  
  152. say 'ReadMe file,'
  153. x = SysCreateObject("WPProgram",,
  154.                     "Read Me",,
  155.                     "<ARCMAN>",,
  156.                     "EXENAME=E.EXE;PARAMETERS="||destdir||"\README.TXT")
  157.  
  158. say 'Liscense agreement,'
  159. x = SysCreateObject("WPProgram",,
  160.                     "License Agreement",,
  161.                     "<ARCMAN>",,
  162.                     "EXENAME=E.EXE;PARAMETERS="||destdir||"\LICENSE.TXT")
  163.  
  164. say 'Registration Form,'
  165. x = SysCreateObject("WPProgram",,
  166.                     "Registration Form",,
  167.                     "<ARCMAN>",,
  168.                     "EXENAME=E.EXE;PARAMETERS="||destdir||"\REGISTER.TXT")
  169.  
  170. say 'and the Program file.'
  171. x = SysCreateObject("WPProgram",,
  172.                     "Archive Manager",,
  173.                     "<ARCMAN>",,
  174.     "EXENAME="||destdir||"\ARCMAN.EXE;STARTUPDIR="||destdir";ASSOCFILTER=*.ZIP,*.LZH")
  175.  
  176. say 'Setting up the Archive file template...'
  177. system_dll=FileSpec('Drive',Value('SYSTEM_INI',,'OS2ENVIRONMENT'))||'\OS2\DLL';
  178. system_hlp=FileSpec('Drive',Value('SYSTEM_INI',,'OS2ENVIRONMENT'))||'\OS2\HELP';
  179.  
  180. say 'Deregistering ArcmanFile class...';
  181. rc=SysDeregisterObjectClass('ArcmanFile');
  182.  
  183. say 'Erasing the current DLL...';
  184. Address CMD '@ERASE 'system_dll'\AMFILE.DLL 2>NUL';
  185.  
  186. say 'Copying the new DLL and help file...';
  187. Address CMD '@COPY 'destdir'\AMFILE.DLL 'system_dll;
  188. Address CMD '@COPY 'destdir'\AMFILE.HLP 'system_hlp;
  189.  
  190. If rc <> 0 Then Do
  191.   Say  "ArcmanFile: Could not replace the ArcmanFile DLL, rc="rc".";
  192.   Say  "Delete the object and the DLL from the "system_dll" directory.";
  193.   Say  "Then copy "destdir"\AMFILE.DLL to the "system_dll" directory.";
  194. End
  195. Else
  196.   say 'Registering the new DLL...';
  197.   rc=SysRegisterObjectClass('ArcmanFile',system_dll||'\AMFILE.DLL');
  198.  
  199.   If rc <> 1
  200.      Then Do;
  201.        Say  "ArcmanFile: could not register ArcmanFile class, rc="rc".";
  202.        End;
  203. End;
  204.  
  205. GoodBye:
  206. /*-- exit with a goodbye --*/
  207. say
  208. say 'Done.'
  209. say
  210. say 'Archive Manager has been installed on your system.'
  211. say
  212. say 'Be sure to read the file README.TXT for up-to-date information.'
  213. say
  214. "@view "||destdir||"\arcman.inf Introduction"
  215. exit
  216.  
  217. /*----------------------------------------------*/
  218. /*-- FUNCTION:                                --*/
  219. /*-- LoadLibs                                 --*/
  220. /*-- ACTION:                                  --*/
  221. /*-- loads the libraries needed by this REXX  --*/
  222. /*----------------------------------------------*/
  223. LoadLibs:
  224.   if RxFuncQuery('SysLoadFuncs') THEN
  225.   do
  226.     /*-- load the load-function --*/
  227.     CALL RxFuncAdd 'SysLoadFuncs', 'RexxUtil', 'SysLoadFuncs'
  228.     /*-- load the Sys* utilities --*/
  229.     CALL SysLoadFuncs
  230.   end
  231. return
  232.  
  233. HALT:
  234.   say
  235.   say 'Program cancelled; Interrupted by user.'
  236.   exit
  237.  
  238. /*-----------------------------------------------------------------------------*/
  239. /*-- CopyFile                                                                --*/
  240. /*-----------------------------------------------------------------------------*/
  241. CopyFile: Arg ArgFile2Copy, ArgFloppyDir, ArgInstallDir
  242.  
  243.     Say 'Copying 'ArgFloppyDir||ArgFile2Copy' to 'ArgInstallDir||'\'||ArgFile2Copy'...'
  244.     Command = '@Copy 'ArgFloppyDir||ArgFile2Copy' 'ArgInstallDir||'\'||ArgFile2Copy' >NUL'
  245.     Command
  246.     if rc \= 0 Then Do
  247.         say 'Error! 'ArgFile2Copy' was not installed properly.'
  248.         Pull ConfirmIt
  249.     End
  250.     Return
  251.  
  252. /* eof */
  253.  
  254.