home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 11 Util / 11-Util.zip / gg2-aug.zip / INSTALL.CMD < prev    next >
OS/2 REXX Batch file  |  1995-08-05  |  6KB  |  161 lines

  1. /* OS/2 Gamer's Guide installation */
  2. SIGNAL ON SYNTAX
  3.  
  4. CALL RxFuncAdd "SysLoadFuncs","REXXUTIL","SysLoadFuncs"
  5. CALL SysLoadFuncs
  6.  
  7. PARSE ARG destDir
  8.  
  9. IF destDir="" | destDir="/?" | TRANSLATE(destDir)="HELP" | TRANSLATE(destDir)="/H" THEN
  10. DO
  11.     SAY "Usage: INSTALL destDir"
  12.     SAY ""
  13.     SAY "       destDir     = Directory location where you want"
  14.     SAY "                     the OS/2 Gamer's Guide installed."
  15.     SAY "                  NOTE: Do not install over an old"
  16.     SAY "              version!"
  17.     EXIT
  18. END
  19.  
  20. SAY "Installing the OS/2 Gamer's Guide to "||destdir
  21. SAY "Program requires approximately 3Megs of HD space."
  22. currentDir = DIRECTORY()
  23. CALL CheckSource currentDir
  24. destDir = CreateDestDir(destDir)
  25. CALL UnZipFiles destDir currentDir
  26. CALL MakeObjects destDir
  27. SAY "------------------------"
  28. SAY "Program installation complete."
  29. PAUSE
  30. SAY "Installing the Watcom SQL RunTime"
  31. SAY "Copyright (c) WATCOM International Corporation 1992"
  32. "setup"
  33. EXIT
  34.  
  35. /***** SUBROUTINES *****/
  36.  
  37. /*****************************************************************************
  38.  * CheckSource      - makes sure that all necessary files are present
  39.  *                    in the source directory. Terminates the install
  40.  *                    script if an error occurs.
  41.  *****************************************************************************/
  42. CheckSource: PROCEDURE
  43.     PARSE ARG currentDir
  44.  
  45.     sourceList.0 = 5
  46.     sourceList.1 = 'gguide2.zip'
  47.     sourceList.2 = 'wsql.zip'
  48.     sourceList.3 = 'unzip.exe'
  49.     sourceList.4 = 'README.TXT'
  50.     sourceList.5 = 'vrobj.dll'
  51.  
  52.     DO n = 1 TO sourceList.0
  53.         IF STREAM(sourceList.n,"C","QUERY EXISTS")="" THEN
  54.         DO
  55.             SAY "** Installation failed! **"
  56.             SAY "Unable to find file "||sourceList.n||" in "||currentDir
  57.             EXIT
  58.         END
  59.     END
  60.     RETURN
  61. /*****************************************************************************/
  62.  
  63. /*****************************************************************************
  64.  * CreateDestDir    - procedure to create the destination directory.
  65.  *                    Returns the fully qualified pathname of the
  66.  *                    destination directory. Terminates the install script
  67.  *                    if an error occurs.
  68.  *****************************************************************************/
  69. CreateDestDir: PROCEDURE
  70.     PARSE ARG destDir
  71.  
  72.     CALL SETLOCAL
  73.     target = DIRECTORY(destDir)            /* check whether dest dir exists        */
  74.     IF target="" THEN                /* dest dir doesn't exist so create it        */
  75.     DO
  76.         IF 0\=SysMkDir(destDir) THEN
  77.         DO
  78.             SAY ""        
  79.             SAY "Error creating directory '"||destDir||"'"
  80.             EXIT
  81.         END
  82.     END
  83.     destDir = DIRECTORY(destDir)        /* get fully qualified pathname of dest dir    */
  84.     CALL ENDLOCAL
  85.     RETURN destDir
  86. /*****************************************************************************/
  87.  
  88. /*****************************************************************************
  89.  * CopyProgramFiles - procedure to copy the program files to the
  90.  *                    specified directory. Terminates the install
  91.  *                    script if an error occurs.
  92.  *****************************************************************************/
  93. CopyProgramFiles: PROCEDURE
  94.     PARSE ARG destDir
  95.  
  96.     filelist.0 = 2
  97.     filelist.1 = "UNZIP.EXE"
  98.     filelist.2 = "GGUIDE2.ZIP"
  99.  
  100.     SAY "Copying program files to "||destDir||" ..."
  101.     DO n=1 TO filelist.0
  102.         '@COPY '||filelist.n||' '||destDir
  103.         IF rc\=0 THEN
  104.         DO
  105.             SAY "Error copying "||filelist.n
  106.             EXIT
  107.         END
  108.     END
  109.  
  110.     RETURN
  111. /*****************************************************************************/
  112.  
  113. /*****************************************************************************
  114.  * UnZipFiles - procedure to uncompress the program files.
  115.  *****************************************************************************/
  116. UnZipFiles: PROCEDURE
  117.     PARSE ARG destDir currentDir
  118.  
  119.     SAY "Uncompressing the program files."
  120.     zipfile = "GGUIDE2.ZIP"
  121.     "unzip" zipfile "-d" destDir
  122.     SAY "Uncompressing the WSQL install files."
  123.     zipfile = "WSQL.ZIP"
  124.     "unzip" zipfile
  125.     RETURN
  126. /*****************************************************************************/
  127.  
  128. /*****************************************************************************
  129.  * MakeObjects  - procedure to create the necessary Workplace Shell objects.
  130.  *                Terminates the install script if an error occurs.
  131.  *****************************************************************************/
  132. MakeObjects: PROCEDURE
  133.     PARSE ARG destDir
  134.  
  135.     SAY "Creating/updating Games folder on the desktop."
  136.     objectSetup = "OBJECTID=<Gamers_Guide>;"
  137.     IF 0=SysCreateObject( "WPFolder", "Games Folder", "<WP_DESKTOP>", objectSetup, "U" ) THEN
  138.     DO
  139.         SAY "Unable to create program object."
  140.         EXIT
  141.     END
  142.  
  143.     SAY 'Creating/updating OS/2 Gamer''s Guide program object.'
  144.     objectSetup = "EXENAME="||destDir||"\GAMERS.EXE;PROGTYPE=PM;"
  145.     IF 0=SysCreateObject( 'WPProgram', 'Gamer''s Guide', '<Gamers_Guide>', objectSetup, 'U' ) THEN
  146.         DO
  147.             SAY "Unable to create shadow object."
  148.             EXIT
  149.         END
  150.     RETURN
  151. /*****************************************************************************/
  152.  
  153. /*****************************************************************************/
  154.  * Standard REXX program error handlers
  155.  *****************************************************************************/
  156. SYNTAX:
  157.     SAY 'REXX error' rc 'in line' sigl
  158.     SAY "Instruction = "||SOURCELINE(sigl)
  159.     EXIT
  160. /*****************************************************************************/
  161.