home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 32 Periodic / 32-Periodic.zip / edmi2-10.zip / INSTALL.CMD < prev   
OS/2 REXX Batch file  |  1994-11-06  |  5KB  |  121 lines

  1. /***************************************************************************/
  2. /* This command file "installs" this issue of EDM/2 on your machine.       */
  3. /*                                                                         */
  4. /* Change history:                                                         */
  5. /*                                                                         */
  6. /* October 1993 - Initial release. (Version 1.00)                          */
  7. /* November 1993 - Completely rewritten by Gordon W. Zeglinski.            */
  8. /*                 Modularization and minor modifications made by Larry    */
  9. /*                 Salomon. (Version 2.00)                                 */
  10. /* November 1993 - Use the built-in Directory() function instead of our    */
  11. /*                 home-grown version (Version 2.01)                       */
  12. /***************************************************************************/
  13.  
  14. /***************************************************************************/
  15. /* Load the RexxUtil functions                                             */
  16. /***************************************************************************/
  17. Call RxFuncAdd 'SysLoadFuncs', 'REXXUTIL', 'SysLoadFuncs'
  18. Call SysLoadFuncs
  19.  
  20. Say "EDM/2 Installation program  Version 2.01"
  21. Say
  22.  
  23. "@ECHO OFF"
  24. Parse Upper Arg VOLUME ISSUE
  25.  
  26. /***************************************************************************/
  27. /* Check for help and for default issue installation                       */
  28. /***************************************************************************/
  29. If VOLUME="?" Then Do
  30.    Say "Syntax:  INSTALL [volume issue]"
  31.    Say
  32.    Say "If not specified, this installs the current issue of EDM/2 in a"
  33.    Say "folder on your machine.  Explicitly specifying the volume and"
  34.    Say "issue is for reinstallation."
  35.    Exit 1
  36. End
  37.  
  38. If (VOLUME="") | (ISSUE="") Then Call SetVars
  39.  
  40. /***************************************************************************/
  41. /* Because version 1.00 did not set the object id, we want to avoid        */
  42. /* creating two folders with the same title, so set the folder title       */
  43. /* to something different, state the new folder title in the diagnostic    */
  44. /* message, and hope the users pick up on the change.                      */
  45. /***************************************************************************/
  46. FOLDERNAME="EDM/2 Issues"
  47.  
  48. Say "Attempting to install volume" VOLUME "issue" ISSUE "to folder '"|| ,
  49.    FOLDERNAME||"'."
  50.  
  51. /***************************************************************************/
  52. /* If the folder doesn't exist, create it.                                 */
  53. /***************************************************************************/
  54. If CheckFolder(FOLDERNAME)=0 Then Do
  55.    Say "EDM/2 folder did not exist and could not be created.  Stop."
  56.    Exit 2
  57. End
  58.  
  59. /***************************************************************************/
  60. /* Install the issue.  Note that we do not install the icon for the user.  */
  61. /***************************************************************************/
  62. If InstallIssue(VOLUME ISSUE)=0 Then Do
  63.    Say "The issue could not be installed in the EDM/2 folder.  Stop."
  64.    Exit 2
  65. End
  66.  
  67. Say "Installation was successful."
  68. Exit 0
  69.  
  70. CheckFolder:  Procedure
  71. /***************************************************************************/
  72. /* SysSetObjectData() relies on the fact that the folder was previously    */
  73. /* created with an object id of "EDM/2_FOLDER".  If this call fails, then  */
  74. /* we can assume that either 1) the folder doesn't exist or 2) that the    */
  75. /* folder does exist but was created with the original INSTALL.CMD .       */
  76. /***************************************************************************/
  77. Parse Arg FOLDERNAME
  78.  
  79. If SysSetObjectData("<EDM/2_FOLDER>"," ")=0 Then Do
  80.    Say "The EDM/2 folder was not found.  Attempting to create it."
  81.    Return SysCreateObject("WPFolder", ,
  82.                           FOLDERNAME, ,
  83.                           "<WP_DESKTOP>", ,
  84.                           "OBJECTID=<EDM/2_FOLDER>")
  85. End
  86.  
  87. Return 1
  88.  
  89. InstallIssue:  Procedure
  90. Parse Arg VOLUME ISSUE .
  91.  
  92. /***************************************************************************/
  93. /* Determine the current directory.  Why the hell is there a SysMkDir()    */
  94. /* and a SysRmDir() but no SysQueryCurrentDir() (or something like         */
  95. /* that)???                                                                */
  96. /***************************************************************************/
  97. CURDIR=Directory()
  98.  
  99. Parse Upper Value CURDIR With CURDIR
  100.  
  101. ISSUEFILE=CURDIR||"\EDMI"||VOLUME||"-"||ISSUE||".INF"
  102. ICONFILE=CURDIR||"\EDMI.ICO"
  103.  
  104. PRGOPTION="PROGTYPE=PM;EXENAME=VIEW.EXE;PARAMETERS="""||ISSUEFILE||""";"
  105. PRGOPTION=PRGOPTION||"ICONFILE="||ICONFILE
  106.  
  107. Return SysCreateObject("WPProgram", ,
  108.                        "Volume" VOLUME "issue" ISSUE, ,
  109.                        "<EDM/2_FOLDER>", ,
  110.                        PRGOPTION, ,
  111.                        "REPLACE")
  112.  
  113. SetVars:
  114. /*****************************************************************************/
  115. /* This function sets the VOLUME and ISSUE variables used by the rest of the */
  116. /* program and is generated by 'newissue.cmd'                                */
  117. /*****************************************************************************/
  118. VOLUME=2 
  119. ISSUE=10 
  120. Return 
  121.