home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: InfoMgt / InfoMgt.zip / calndr.zip / Install.Cmd < prev    next >
OS/2 REXX Batch file  |  1997-02-17  |  5KB  |  232 lines

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