home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 18 REXX / 18-REXX.zip / pmsyslev.zip / INSTALL.CMD < prev    next >
OS/2 REXX Batch file  |  1995-08-02  |  11KB  |  289 lines

  1. /*rexx*/
  2. /**********************************************************************/
  3. /* Exec:     Install utility                                          */
  4. /* Function: Install Heliotropic Systems, Inc. shareware              */
  5. /* History:  08/02/95 - LMK - Set up for PMSysLev                     */
  6. /*                          - Included handling for possible previous */
  7. /*                            install of FileFind...                  */
  8. /**********************************************************************/
  9. /*                                                                    */
  10. "@echo off"
  11. /*                                                                    */
  12. /* Ensure that you can use the REXXUTILs...                           */
  13. /*                                                                    */
  14.   if 0 < RxFuncQuery('SysLoadFuncs') then do
  15.       call RxFuncAdd 'SysLoadFuncs', 'REXXUTIL', 'SysLoadFuncs'
  16.       call SysLoadFuncs
  17.   end
  18. /*                                                                    */
  19. /* Set up the default variables...                                    */
  20. /*                                                                    */
  21.   bootdrive = translate(value('PATH',,'OS2ENVIRONMENT'))
  22.   thedrive  = substr(bootdrive,pos('\OS2\SYSTEM',bootdrive)-2,2)
  23.   ObjMode   = 'Replace'
  24.   returnRC  = 0
  25.   TRUE      = (1=1)
  26.   FALSE     = (0=1)
  27.   been_here = FALSE
  28.   done_that = FALSE
  29.   drop bootdrive
  30. /*                                                                    */
  31. /* Proceed with the installation...                                   */
  32. /*                                                                    */
  33.   say ' '
  34.   say '                 Installing PMSysLev Utility'
  35.   say ' '
  36.   call Drive_Check
  37.   result = VROBJ_Check()
  38.   if result \= 0 then
  39.       signal Done
  40.   result = File_Check()
  41.   if result \= 0 then
  42.       signal Done
  43.   call Check_Kit
  44.   result = Inst_Part1()
  45.   if result \= 0 then
  46.       signal Done
  47.   call Inst_Part2
  48.   if been_here = FALSE then
  49.       call Create_Kit
  50.   call Create_PMSysLev
  51.   call Create_Register
  52.   call Create_ReadMe
  53.   call Clean_Up
  54.   say ' '
  55.   say '     Installation completed.'
  56.   say ' '
  57. Done:
  58.   exit
  59. /*                                                                    */
  60. /* Determine all of the available Drive letters...                    */
  61. /*                                                                    */
  62. Drive_Check:
  63.   all_drives = SysDriveMap(thedrive,'USED') /* can't see CD's empty!! */
  64.   i = 1
  65.   do forever
  66.       parse var all_drives d_letter.i all_drives
  67.       if all_drives = "" then
  68.           leave
  69.       i = i + 1
  70.   end
  71.   d_letter.0 = i
  72. return
  73. /*                                                                    */
  74. /* Check to see if there is a vrobj.dll to work with...               */
  75. /*                                                                    */
  76. VROBJ_Check:
  77.   say ' '
  78.   say '  Please wait while your system is checked for VROBJ.DLL...'
  79.   say ' '
  80.   dll_check = 0
  81.   do i = 1 to d_letter.0
  82.       say '     Checking Drive 'd_letter.i
  83.       saveRC = SysFileTree( d_letter.i || '\VROBJ.DLL', 'DLLs', 'FS' )
  84.       dll_check = dll_check + DLLs.0
  85.       if DLLs.0 > 0 then do
  86.           say '     VROBJ.DLL has been located.'
  87.           leave
  88.       end
  89.   end
  90.   if dll_check = 0 then do
  91.       say '  Warning:  VROBJ.DLL was not found on this system! '
  92.       say '  You must download it and put it in your LIBPATH to use PMSysLev.'
  93.       returnRC = 4
  94.   end
  95. return returnRC
  96. /*                                                                    */
  97. /* Make sure everything is here to work on...                         */
  98. /*                                                                    */
  99. File_Check:
  100.   say ' '
  101.   say '  Checking to make sure all of the PMSysLev files are intact...'
  102.   say ' '
  103.   ifile.0 = 8
  104.   ifile.1 = 'pmsyslev.exe'
  105.   ifile.2 = 'pmsyslev.hlp'
  106.   ifile.3 = 'pmsyslev.hst'
  107.   ifile.4 = 'regpmsl.txt'
  108.   ifile.5 = 'readme.1st'
  109.   ifile.6 = 'file_id.diz'
  110.   ifile.7 = 'sun.ico'
  111.   ifile.8 = 'install.cmd'
  112.   do i = 1 to ifile.0 - 1
  113.       saveRC = SysFileTree( ifile.i, 'Files', 'F' )
  114.       if Files.0 = 0 then do
  115.           say '  Warning:  'ifile.i' was not found!'
  116.           say ' '
  117.           say '  All of the files are required for installation of PMSysLev.'
  118.           say '  Use PKUNZIP again with the "-o" operand.'
  119.           returnRC = 4
  120.           leave
  121.       end
  122.   end
  123.   if returnRC = 0 then
  124.       say '     OK, everthing is intact.'
  125. return returnRC
  126. /*                                                                    */
  127. /* Check for existence of previous installs...                        */
  128. /*                                                                    */
  129. Check_Kit:
  130.   call SysInI 'USER', 'PM_Workplace:Location', 'All:', 'ids.'
  131.   do i = 1 to ids.0
  132.       if ids.i = '<WP_LMK_HSU>' then do
  133.           been_here = TRUE
  134.           leave
  135.       end
  136.   end
  137. return
  138. /*                                                                    */
  139. /* Find out where to put all of this...                               */
  140. /*                                                                    */
  141. Inst_Part1:
  142.   UnPack_Dir = Directory()
  143.   say ' '
  144.   say '  Enter the drive letter and name of the directory in which you want'
  145.   say '  PMSysLev installed (default: 'UnPack_Dir'):'
  146.   pull Install_Dir
  147.   if Install_Dir = "" then
  148.       Install_Dir = UnPack_Dir
  149.   else do
  150. /*                                                                    */
  151. /* If you need to, create the directory...                            */
  152. /*                                                                    */
  153.       saveRC = SysFileTree(Install_Dir, 'Dirs', 'D')
  154.       if Dirs.0 = 0 then do
  155.           if 0 < SysMkDir(Install_Dir) then do
  156.               say ' '
  157.               say '  Warning:  Unable to create target directory.'
  158.               returnRC = 4
  159.               leave
  160.           end
  161.       end
  162.   end
  163.   say ' '
  164. return returnRC
  165. /*                                                                    */
  166. /* Install the puppy...                                               */
  167. /*                                                                    */
  168. Inst_Part2:
  169.   if Install_Dir \= UnPack_Dir then do
  170.       say '  Please wait will PMSysLev files are copied to 'Install_Dir'...'
  171.       do i = 1 to ifile.0 - 1
  172.           '@xcopy 'ifile.i Install_Dir || '\*.* > nul'
  173.       end
  174.   end
  175.   saveRC = SysFileTree( Install_Dir'\Filefind.exe', 'Files', 'F' )
  176.   if Files.0 = 1 then
  177.       done_that = TRUE
  178. return
  179. /*                                                                    */
  180. /* Create the folder for Heliotropic Systems...                       */
  181. /*                                                                    */
  182. Create_Kit:
  183.   location    = "<WP_DESKTOP>"
  184.   title       = "Heliotropic^Systems^Utilities"
  185.   classname   = "WPFolder"
  186.   SetupString = "OBJECTID=<WP_LMK_HSU>;"
  187.   SetupString = SetupString || "NOLINK=YES;"
  188.   SetupString = SetupString || "NOCOPY=YES;"
  189.   SetupString = SetupString || "NOPRINT=YES;"
  190.   SetupString = SetupString || "NORENAME=YES;"
  191.   SetupString = SetupString || "NOSHADOW=YES;"
  192.   SetupString = SetupString || "NOTDEFAULTICON=YES;"
  193.   SetupString = SetupString || "ICONFILE="Install_Dir"\SUN.ICO;"
  194.   call Make_Object
  195. return
  196. /*                                                                    */
  197. /* Create the object for PMSysLev                                     */
  198. /*                                                                    */
  199. Create_PMSysLev:
  200.   location    = "<WP_LMK_HSU>"
  201.   title       = "PMSysLev"
  202.   classname   = "WPProgram"
  203.   SetupString = "OBJECTID=<LMK_HSU_PMSL>;"
  204.   SetupString = SetupString || "EXENAME="Install_Dir"\PMSysLev.EXE;"
  205.   SetupString = SetupString || "STARTUPDIR="Install_Dir";"
  206.   SetupString = SetupString || "PROGTYPE=PM;"
  207.   SetupString = SetupString || "AUTOCLOSE=YES;"
  208.   call Make_Object
  209. return
  210. /*                                                                    */
  211. /* Create the object for the registration form                        */
  212. /*                                                                    */
  213. Create_Register:
  214.   if been_here = TRUE then do
  215.       if done_that = TRUE then do
  216.           call SysDestroyObject "<LMK_HSU_REG>"
  217.           location    = "<WP_LMK_HSU>"
  218.           title       = "FileFind Registration"
  219.           classname   = "WPShadow"
  220.           SetupString = "SHADOWID="Install_Dir"\Register.Txt;"
  221.           SetupString = SetupString || "OBJECTID=<LMK_HSU_REGFF>;"
  222.           call Make_Object
  223.       end
  224.   end
  225.   location    = "<WP_LMK_HSU>"
  226.   title       = "PMSysLev Registration"
  227.   classname   = "WPShadow"
  228.   SetupString = "SHADOWID="Install_Dir"\Regpmsl.Txt;"
  229.   SetupString = SetupString || "OBJECTID=<LMK_HSU_REGPMSL>;"
  230.   call Make_Object
  231. return
  232. /*                                                                    */
  233. /* Create the object for the readme file                              */
  234. /*                                                                    */
  235. Create_ReadMe:
  236.   if been_here = TRUE then do
  237.       if done_that = TRUE then do
  238.           tempfile = SysTempFileName('TEMP.???')
  239.           outfile  = tempfile
  240.           fline.0  = 10
  241.           fline.1  = '******************************************************************'
  242.           fline.2  = 'Utility:   FileFind'
  243.           fline.3  = '******************************************************************'
  244.           fline.4  = ' '
  245.           fline.5  = 'Version:  2.07 - Release date:  July 13, 1995'
  246.           fline.6  = ' '
  247.           fline.7  = 'Changes:  None'
  248.           fline.8  = ' '
  249.           fline.9  = 'History:  07/13/95 - lmk - Public release'
  250.           fline.10 = ' '
  251.           do i = 1 to fline.0
  252.               call lineout outfile, fline.i
  253.           end
  254.           call lineout outfile
  255.           newfile  = 'FileFind.Hst'
  256.           "@copy "outfile Install_Dir"\"newfile '> nul'
  257.           call SysFileDelete outfile
  258.       end
  259.   end
  260.   location    = "<WP_LMK_HSU>"
  261.   title       = "Read Me First"
  262.   classname   = "WPShadow"
  263.   SetupString = "SHADOWID="Install_Dir"\Readme.1st;"
  264.   SetupString = SetupString || "OBJECTID=<LMK_HSU_1ST>;"
  265.   call Make_Object
  266. return
  267. /*                                                                    */
  268. /* Clean up the files you no longer need...                           */
  269. /*                                                                    */
  270. Clean_Up:
  271.   if Install_Dir \= UnPack_Dir then do
  272.       do i = 6 to ifile.0
  273.           call SysFileDelete Install_Dir'\'ifile.i
  274.       end
  275.   end
  276. return
  277. /*                                                                    */
  278. /* Build the objects for the desktop...                               */
  279. /*                                                                    */
  280. Make_Object:
  281.   say ' '
  282.   say '     Creating 'title' at 'location' as 'classname
  283.   saveRC = 0
  284.   saveRC = SysCreateObject(classname,title,location,SetupString,ObjMode)
  285.   if saveRC \= 1 then
  286.       say '  Warning:  Creation of new object returned 'saveRC
  287.   say ' '
  288. return
  289.