home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 11 Util / 11-Util.zip / utlpak.zip / Install.Cmd < prev    next >
OS/2 REXX Batch file  |  1997-02-17  |  6KB  |  239 lines

  1. /* Install.CMD: Install Sheppard Software Utilities. */
  2.  
  3. '@Echo Off'
  4.  
  5. /* Initialize object title and program name(s) */
  6.  
  7. Title = 'Utility Pack Version 3.1'
  8. Pgmname.0 = 7
  9. Pgmname.1 = 'BMPView'
  10. Pgmname.2 = 'Calclatr'
  11. Pgmname.3 = 'Calendar'
  12. Pgmname.4 = 'Compare'
  13. Pgmname.5 = 'DiskSpac'
  14. Pgmname.6 = 'FontView'
  15. Pgmname.7 = 'StrngSch'
  16.  
  17. IconName.0 = 7
  18. IconName.1 = 'BitmapViewer'
  19. IconName.2 = 'Calculator'
  20. IconName.3 = 'Calendar'
  21. IconName.4 = 'CompareFiles'
  22. IconName.5 = 'DiskSpace'
  23. IconName.6 = 'FontView'
  24. IconName.7 = 'StringSearch'
  25.  
  26. /* Load REXXUTIL */
  27.  
  28. Call RxFuncAdd 'SysLoadFuncs', 'REXXUTIL', 'SysLoadFuncs'
  29. Call SysLoadFuncs
  30.  
  31.  
  32. /* Initialize */
  33.  
  34. Signal On Failure Name FAILURE
  35. Signal On Halt Name HALT
  36. Signal On Syntax Name SYNTAX
  37.  
  38. Call SysCls
  39. Say 'Installing ' Title
  40. Say ''
  41.  
  42.  
  43. /* Verify the existence of the component files. */
  44.  
  45.  
  46. Result = SysFileTree( Pgmname.1".Exe", 'Files', 'F' )
  47. If Files.0 = 0 Then
  48.    Do
  49.    Say 'ERROR:' Pgmname.1'.Exe not found!'
  50.    Signal DONE
  51.    End
  52.  
  53. Result = SysFileTree( Pgmname.1".Ico", 'Files', 'F' )
  54. If Files.0 = 0 Then
  55.    Do
  56.    Say 'ERROR:' Pgmname.1'.Ico not found!'
  57.    Signal DONE
  58.    End
  59.  
  60. Result = SysFileTree( Pgmname.1".Txt", 'Files', 'F' )
  61. If Files.0 = 0 Then
  62.    Do
  63.    Say 'ERROR:' Pgmname.1'.Txt not found!'
  64.    Signal DONE
  65.    End
  66.  
  67. Result = SysFileTree( "Register.Txt", 'Files', 'F' )
  68. If Files.0 = 0 Then
  69.    Do
  70.    Say 'ERROR: Register.Txt not found!'
  71.    Signal DONE
  72.    End
  73.  
  74. Result = SysFileTree( "Read.Me", 'Files', 'F' )
  75. If Files.0 = 0 Then
  76.    Do
  77.    Say 'ERROR: Read.Me not found!'
  78.    Signal DONE
  79.    End
  80.  
  81. Result = SysFileTree( "File_ID.Diz", 'Files', 'F' )
  82. If Files.0 = 0 Then
  83.    Do
  84.    Say 'ERROR: File_ID.Diz not found!'
  85.    Signal DONE
  86.    End
  87.  
  88. Result = SysFileTree( "UtilPack.Ico", 'Files', 'F' )
  89. If Files.0 = 0 Then
  90.    Do
  91.    Say 'ERROR: UtilPack.Ico not found!'
  92.    Signal DONE
  93.    End
  94.  
  95. /* Find out where we are. */
  96.  
  97. curdir = directory()
  98.  
  99. /* Ask for the target directory name. */
  100.  
  101. Say 'Please enter the full name of the directory in which'
  102. Say '  you want' Title' installed (default: 'curdir'): '
  103. Pull InstDir
  104. If InstDir = "" Then
  105.   InstDir = curdir
  106.  
  107.  
  108. /* Create the target directory if necessary. */
  109.  
  110. Result = SysFileTree(InstDir, 'Dirs', 'D')
  111. If Dirs.0 = 0 Then
  112.   Do
  113.     Result = SysMkDir(InstDir)
  114.     If Result == 0 Then
  115.       Do
  116.       End
  117.     Else
  118.       Do
  119.         Say 'ERROR: Unable to create target directory.'
  120.         Signal DONE
  121.       End
  122.   End
  123. Say ''
  124.  
  125.  
  126. /* Perform the installation. */
  127.  
  128. if InstDir <> curdir then
  129.   Do
  130.     i = 1
  131.     Do until i > Pgmname.0
  132.       Say 'Copying' Pgmname.i 'to' InstDir '...'
  133.       Copy Pgmname.i".Exe" InstDir  '>NUL'
  134.       Copy Pgmname.i".Ico" InstDir  '>NUL'
  135.       Copy Pgmname.i".Txt" InstDir  '>NUL'
  136.       i = i + 1
  137.     End
  138.     Copy Register.Txt InstDir  '>NUL'
  139.     Copy Read.Me      InstDir  '>NUL'
  140.     Copy File_ID.Diz  InstDir  '>NUL'
  141.     Copy Install.Cmd  InstDir  '>NUL'
  142.     Copy UtilPack.Ico InstDir  '>NUL'
  143.     if filespec("name", "Calclatr.Ini") = "" then
  144.       Copy Calclatr.Ini InstDir  '>NUL'
  145.     if filespec("name", "Calendar.Ini") = "" then
  146.       Copy Calendar.Ini InstDir  '>NUL'
  147.   End
  148. Say 'Creating program folder...'
  149. x = SysCreateObject("WPFolder",,
  150.                     "Sheppard^Utilities",,
  151.                     "<WP_DESKTOP>",,
  152.                     "OBJECTID=<SSCUtil>;ICONFILE="||InstDir||"\UtilPack.Ico",,
  153.                     "Update")
  154. If x <> 1 Then
  155.   Do 
  156.     Say 'ERROR: Folder not created.'
  157.     Signal DONE
  158.   End
  159. i = 1
  160. Folder = '<SSCUtil>'
  161. Do until i > Pgmname.0
  162.   Say 'Creating program object for' IconName.i '...'
  163.   Type = 'WPProgram'
  164.   Parms = "EXENAME="InstDir"\"Pgmname.i".Exe;STARTUPDIR="InstDir
  165.   If Pgmname.i = 'BMPView' then
  166.     Parms = Parms";PARAMETERS=[]"
  167.   If Pgmname.i = 'Compare' then
  168.     Parms = Parms";PARAMETERS=[Enter file names]"
  169.   If Pgmname.i = 'FontView' then
  170.     Parms = Parms";PARAMETERS=[Enter size.Fontname]"
  171.   x = SysCreateObject(Type,,
  172.                       IconName.i,,
  173.                       Folder,,
  174.                       Parms,,
  175.                       "Replace")
  176.   If x <> 1 Then
  177.     Do
  178.       Say 'ERROR: Object not created.'
  179.       Signal DONE
  180.     End
  181.  
  182.   Say 'Creating documentation object for' IconName.i '...'
  183.   Type = 'WPShadow'
  184.   Parms = "SHADOWID="InstDir"\"Pgmname.i".Txt"
  185.   x = SysCreateObject(Type,,
  186.                       Pgmname.i||".Txt",,
  187.                       Folder,,
  188.                       Parms,,
  189.                       "Replace")
  190.   If x <> 1 Then
  191.     Say 'ERROR: Shadow of' Pgmname.i'.Txt not created.'
  192.   i = i + 1
  193. End
  194.  
  195. Say 'Creating Register.Txt object...'
  196. x = SysCreateObject("WPShadow",,
  197.                     "Register.Txt",,
  198.                     Folder,,
  199.                     "SHADOWID="||InstDir||"\Register.Txt",,
  200.                     "Replace")
  201. If x <> 1 Then
  202.   Say 'ERROR: Shadow of Register.Txt not created.'
  203.  
  204. Say 'Creating Read.Me object...'
  205. x = SysCreateObject("WPShadow",,
  206.                     "Read.Me",,
  207.                     Folder,,
  208.                     "SHADOWID="||InstDir||"\Read.Me",,
  209.                     "Replace")
  210. If x <> 1 Then
  211.   Say 'ERROR: Shadow of Read.Me not created.'
  212.  
  213. Say 'Creating File_ID.Diz object...'
  214. x = SysCreateObject("WPShadow",,
  215.                     "File_ID.Diz",,
  216.                     Folder,,
  217.                     "SHADOWID="||InstDir||"\File_ID.Diz",,
  218.                     "Replace")
  219. If x <> 1 Then
  220.   Say 'ERROR: Shadow of File_ID.Diz not created.'
  221.  
  222. say 'Install completed.'
  223. Signal DONE
  224.  
  225. FAILURE:
  226. Say 'REXX failure.'
  227. Signal DONE
  228.  
  229. HALT:
  230. Say 'REXX halt.'
  231. Signal DONE
  232.  
  233. SYNTAX:
  234. Say 'REXX syntax error.'
  235. Signal DONE
  236.  
  237. DONE:
  238. Exit
  239.