home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 11 Util / 11-Util.zip / sdwps.zip / install.cmd next >
OS/2 REXX Batch file  |  1993-08-15  |  5KB  |  176 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 SDWPS Shutdown program          --*/
  23. /*----------------------------------------------*/
  24. /*-- AUTHOR:                                  --*/
  25. /*-- Kelly Schrock                            --*/
  26. /*----------------------------------------------*/
  27. /*-- DATE:                                    --*/
  28. /*-- 08.15.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 Shutdown'
  42.   say '(Default: C:\SDWPS):'
  43.   parse pull destdir
  44.   /*-- if error --*/
  45.   if destdir = ' ' then do
  46.     destdir = 'C:\SDWPS'
  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 '                             Shutdown Installation'
  70. say
  71. say 'Shutdown 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 'SDWPS.EXE',       sourcedir,    destdir
  111.  
  112. /*-- create a program object --*/
  113. call SysCls
  114. say
  115. say 'Shutdown can be installed as an object on your desktop.'
  116. say 'Do you want to create it now(Y/n)?'
  117. k = SysGetKey('NOECHO')
  118. if k = 'N' | k = 'n' then call GoodBye
  119.  
  120. say
  121. say 'Creating the program object...'
  122. x = SysCreateObject("WPProgram",,
  123.                     "Shutdown",,
  124.                     "<WP_DESKTOP>",,
  125.                     "EXENAME="||destdir||"\SDWPS.EXE")
  126.  
  127. GoodBye:
  128. /*-- exit with a goodbye --*/
  129. say
  130. say 'Done.'
  131. say
  132. say
  133. say 'Shutdown has been installed on your system.'
  134. say
  135. say 'Press any key to exit installation...'
  136. k = SysGetKey('NOECHO')
  137. call SysCls
  138. exit
  139.  
  140. /*----------------------------------------------*/
  141. /*-- FUNCTION:                                --*/
  142. /*-- LoadLibs                                 --*/
  143. /*-- ACTION:                                  --*/
  144. /*-- loads the libraries needed by this REXX  --*/
  145. /*----------------------------------------------*/
  146. LoadLibs:
  147.   if RxFuncQuery('SysLoadFuncs') THEN
  148.   do
  149.     /*-- load the load-function --*/
  150.     CALL RxFuncAdd 'SysLoadFuncs', 'RexxUtil', 'SysLoadFuncs'
  151.     /*-- load the Sys* utilities --*/
  152.     CALL SysLoadFuncs
  153.   end
  154. return
  155.  
  156. HALT:
  157.   say
  158.   say 'User interrupted program.'
  159.   exit
  160.  
  161. /*-----------------------------------------------------------------------------*/
  162. /*-- CopyFile                                                                --*/
  163. /*-----------------------------------------------------------------------------*/
  164. CopyFile: Arg ArgFile2Copy, ArgFloppyDir, ArgInstallDir
  165.  
  166.     Say 'Copying 'ArgFloppyDir||ArgFile2Copy' to 'ArgInstallDir||'\'||ArgFile2Copy'...'
  167.     Command = '@Copy 'ArgFloppyDir||ArgFile2Copy' 'ArgInstallDir||'\'||ArgFile2Copy' >NUL'
  168.     Command
  169.     if rc \= 0 Then Do
  170.         say 'Error! 'ArgFile2Copy' was not installed properly.'
  171.         Pull ConfirmIt
  172.     End
  173.     Return
  174.  
  175.  
  176.