home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 18 REXX / 18-REXX.zip / filefnd.zip / INSTALL.CMD < prev    next >
OS/2 REXX Batch file  |  1995-07-17  |  9KB  |  218 lines

  1. /*rexx*/
  2. /**********************************************************************/
  3. /* Exec:     Install utility                                          */
  4. /* Function: Install Heliotropic Systems, Inc. sharware               */
  5. /* History:  07/13/95 - LMK - Set up for FileFind                     */
  6. /**********************************************************************/
  7. /*                                                                    */
  8. "@ECHO OFF"
  9. /*                                                                    */
  10. /* Ensure that you can use the REXXUTILs...                           */
  11. /*                                                                    */
  12.   if 0 < RxFuncQuery('SysLoadFuncs') then do
  13.     call RxFuncAdd 'SysLoadFuncs', 'REXXUTIL', 'SysLoadFuncs'
  14.     call SysLoadFuncs
  15.   end
  16. /*                                                                    */
  17. /* Set up the global variables...                                     */
  18. /*                                                                    */
  19.   bootdrive = translate(value('PATH',,'OS2ENVIRONMENT'))
  20.   thedrive  = substr(bootdrive,pos('\OS2\SYSTEM',bootdrive)-2,2)
  21.   ObjMode   = 'Replace'
  22.   returnRC  = 0
  23. /*                                                                    */
  24. /* Proceed with the installation...                                   */
  25. /*                                                                    */
  26.   say ' '
  27.   say '                 Installing FileFind Utility'
  28.   say ' '
  29.   call Drive_Check
  30.   result = VROBJ_Check()
  31.   if result \= 0 then
  32.     signal Done
  33.   result = File_Check()
  34.   if result \= 0 then
  35.     signal Done
  36.   result = Inst_Part1()
  37.   if result \= 0 then
  38.     signal Done
  39.   call Inst_Part2
  40.   call Create_Kit
  41.   call Create_FileFind
  42.   call Create_Register
  43.   call Create_Read
  44.   say ' '
  45.   say '     Installation completed.'
  46.   say ' '
  47. Done:
  48.   EXIT
  49. /*                                                                    */
  50. /* Determine all of the available Drive letters...                    */
  51. /*                                                                    */
  52. Drive_Check:
  53.   all_drives = SysDriveMap(thedrive,'USED') /* can't see CD's empty!! */
  54.   i = 1
  55.   do forever
  56.     parse var all_drives d_letter.i all_drives
  57.     if all_drives = "" then
  58.       leave
  59.     i = i + 1
  60.   end
  61.   d_letter.0 = i
  62. return
  63. /*                                                                    */
  64. /* Check to see if there is a vrobj.dll to work with...               */
  65. /*                                                                    */
  66. VROBJ_Check:
  67.   say ' '
  68.   say '  Please wait while your system is checked for VROBJ.DLL...'
  69.   say ' '
  70.   dll_check = 0
  71.   do i = 1 to d_letter.0
  72.     say '     Checking Drive 'd_letter.i
  73.     saveRC = SysFileTree( d_letter.i || '\VROBJ.DLL', 'DLLs', 'FS' )
  74.     dll_check = dll_check + DLLs.0
  75.     if DLLs.0 > 0 then do
  76.       say '     VROBJ.DLL has been located.'
  77.       leave
  78.     end
  79.   end
  80.   if dll_check = 0 then do
  81.     say '  Warning:  VROBJ.DLL was not found on this system! '
  82.     say '  You must download it and put it in your PATH to use FileFind.'
  83.     returnRC = 4
  84.   end
  85. return returnRC
  86. /*                                                                    */
  87. /* Make sure everything is here to work on...                         */
  88. /*                                                                    */
  89. File_Check:
  90.   say ' '
  91.   say '  Checking to make sure all of the FileFind files are intact...'
  92.   say ' '
  93.   ifile.0 = 7
  94.   ifile.1 = 'filefind.exe'
  95.   ifile.2 = 'filefind.hlp'
  96.   ifile.3 = 'register.txt'
  97.   ifile.4 = 'file_id.diz'
  98.   ifile.5 = 'readme.1st'
  99.   ifile.6 = 'sun.ico'
  100.   ifile.7 = 'install.cmd'
  101.   do i = 1 to ifile.0 - 1
  102.     saveRC = SysFileTree( ifile.i, 'Files', 'F' )
  103.     if Files.0 = 0 then do
  104.       say '  Warning:  'ifile.i' was not found!'
  105.       say ' '
  106.       say '  All of the files are required for installation.'
  107.       say '  Use PKUNZIP again with the "-o" operand.'
  108.       returnRC = 4
  109.       leave
  110.     end
  111.   end
  112.   if returnRC = 0 then
  113.     say '     OK, everthing is intact.'
  114. return returnRC
  115. /*                                                                    */
  116. /* Find out where to put all of this...                               */
  117. /*                                                                    */
  118. Inst_Part1:
  119.   UnPack_Dir = Directory()
  120.   say ' '
  121.   say '  Enter the complete name of the directory in which you want'
  122.   say '  FileFind installed (default: 'UnPack_Dir'):'
  123.   pull Install_Dir
  124.   if Install_Dir = "" then
  125.     Install_Dir = UnPack_Dir
  126. /*                                                                    */
  127. /* If you need to, create the directory...                            */
  128. /*                                                                    */
  129.   saveRC = SysFileTree(Install_Dir, 'Dirs', 'D')
  130.   if Dirs.0 = 0 then do
  131.     if 0 < SysMkDir(Install_Dir) then do
  132.       say ' '
  133.       say '  Warning:  Unable to create target directory.'
  134.       returnRC = 4
  135.       leave
  136.     end
  137.   end
  138.   say ' '
  139. return returnRC
  140. /*                                                                    */
  141. /* Install the puppy...                                               */
  142. /*                                                                    */
  143. Inst_Part2:
  144.   if Install_Dir \= UnPack_Dir then do
  145.     say '  Please wait will FileFind files are copied to 'Install_Dir'...'
  146.     do i = 1 to ifile.0
  147.       '@xcopy 'ifile.i Install_Dir || '\*.* > nul'
  148.     end
  149.   end
  150. return
  151. /*                                                                    */
  152. /* Create the folder for Heliotropic Systems...                       */
  153. /*                                                                    */
  154. Create_Kit:
  155.   location    = "<WP_DESKTOP>"
  156.   title       = "Heliotropic^Systems^Utilities"
  157.   classname   = "WPFolder"
  158.   SetupString = "OBJECTID=<WP_LMK_HSU>;"
  159.   SetupString = SetupString || "NOLINK=YES;"
  160.   SetupString = SetupString || "NOCOPY=YES;"
  161.   SetupString = SetupString || "NOPRINT=YES;"
  162.   SetupString = SetupString || "NORENAME=YES;"
  163.   SetupString = SetupString || "NOSHADOW=YES;"
  164.   SetupString = SetupString || "NOTDEFAULTICON=YES;"
  165.   SetupString = SetupString || "ICONFILE="Install_Dir"\SUN.ICO;"
  166.   call Make_Object
  167. return
  168. /*                                                                    */
  169. /* Create the object for FileFind                                     */
  170. /*                                                                    */
  171. Create_FileFind:
  172.   location    = "<WP_LMK_HSU>"
  173.   title       = "FileFind"
  174.   classname   = "WPProgram"
  175.   SetupString = "OBJECTID=<LMK_HSU_FF>;"
  176.   SetupString = SetupString || "EXENAME="Install_Dir"\FileFind.EXE;"
  177.   SetupString = SetupString || "STARTUPDIR="Install_Dir";"
  178.   SetupString = SetupString || "PROGTYPE=PM;"
  179.   SetupString = SetupString || "AUTOCLOSE=YES;"
  180.   call Make_Object
  181. return
  182. /*                                                                    */
  183. /* Create the object for the registration form                        */
  184. /*                                                                    */
  185. Create_Register:
  186.   location    = "<WP_LMK_HSU>"
  187.   title       = "Registration"
  188.   classname   = "WPShadow"
  189.   SetupString = "OBJECTID=<LMK_HSU_REG>;"
  190.   SetupString = SetupString || "SHADOWID="Install_Dir"\Register.Txt;"
  191.   SetupString = SetupString || "AUTOCLOSE=YES;"
  192.   call Make_Object
  193. return
  194. /*                                                                    */
  195. /* Create the object for the readme file                              */
  196. /*                                                                    */
  197. Create_Read:
  198.   location    = "<WP_LMK_HSU>"
  199.   title       = "Read Me First"
  200.   classname   = "WPShadow"
  201.   SetupString = "OBJECTID=<LMK_HSU_1ST>;"
  202.   SetupString = SetupString || "SHADOWID="Install_Dir"\Readme.1st;"
  203.   SetupString = SetupString || "AUTOCLOSE=YES;"
  204.   call Make_Object
  205. return
  206. /*                                                                    */
  207. /* Build the objects for the desktop...                               */
  208. /*                                                                    */
  209. Make_Object:
  210.   say ' '
  211.   say '     Creating 'title' at 'location' as 'classname
  212.   saveRC = 0
  213.   saveRC = SysCreateObject(classname,title,location,SetupString,ObjMode)
  214.   if saveRC \= 1 then
  215.     say '  Warning:  Creation of new object returned 'saveRC
  216.   say ' '
  217. return
  218.