home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 7 Games / 07-Games.zip / bummer20.zip / INSTALL.CMD < prev    next >
OS/2 REXX Batch file  |  1995-02-11  |  5KB  |  139 lines

  1. /* Bummer 2.0 installation program */
  2.  
  3.   Call RxFuncAdd 'SysLoadFuncs', 'RexxUtil', 'SysLoadFuncs'    /* Make REXX functions available */
  4.   Call SysLoadFuncs
  5.  
  6.   Parse Arg InstallDir                         /* Command line parameter */
  7.   Signal On Halt Name ErrorHandler                   /* Error handler */
  8.  
  9.   Call SysCls
  10.   Say
  11.   Say
  12.   Say " Bummer! 2.0 Installation "
  13.   Say " ------------------------ "
  14.  
  15.   If InstallDir=" " Then Do                    /* If no path is given, get one from the user */
  16.     Say
  17.     Say " Please specify the name of the subdirectory to"
  18.     Say " which you would like to install Bummer!, hit <Enter>"
  19.     Say " to use the current directory, or type 'Q'<Enter>"
  20.     Say " to quit."
  21.     Say
  22.     Say " For Example     C:\GAMES\BUMMER<Enter>"
  23.     Say
  24.     Say " Please specify:"                    /* Prompt for input */
  25.  
  26.     Parse Value SysCurPos() with Row Col
  27.     Col=Col+17
  28.     Row=Row-1
  29.     Call SysCurPos Row, Col
  30.     Pull InstallDir
  31.     If (InstallDir="Q")|(InstallDir="q") Then Exit        /* Quit if they hit 'Q' */
  32.   End
  33.  
  34.   Say                                /* Give a nice blank line */
  35.  
  36.   CurrentDir = directory()                    /* Find the current directory */
  37.   
  38.   If (InstallDir=" ") Then InstallDir=CurrentDir        /* Set to the current directory if none given */
  39.  
  40.    If (CurrentDir\=directory(InstallDir)) Then Do                /* If installing to different dir, do copying bit */
  41.     Command = '@CD 'directory(CurrentDir)            /* Switch back to installation dir */
  42.     Command
  43.  
  44.     Call SysFileTree InstallDir, FileDirectory, 'D'        /* Search for new directory */
  45.  
  46.     If FileDirectory.0='0' Then Do                /* If not found, create it */
  47.       Say " Now creating directory "InstallDir" . . ."
  48.       rc=SysMkDir(InstallDir)
  49.       If rc\=0 Then Do
  50.     Say
  51.     Say " UURGH! Sorry, the desired directory couldn't be created,"
  52.     Say " probably because you specified an invalid directory name"
  53.     Say " or the destination disk is write-protected.  Please re-run"
  54.         Say " this command file and try again."
  55.     Exit
  56.       End
  57.     End
  58.  
  59.     Say " Now copying files to "InstallDir" . . ."                      /* Now copy files */
  60.     Call FileCopy 'INSTALL.CMD', InstallDir
  61.     Call FileCopy 'BUMMER.*', InstallDir
  62.     Call FileCopy 'README.TXT', InstallDir
  63.     Call FileCopy '*.WAV', InstallDir
  64.     Call FileCopy '*.BSG', InstallDir
  65.   End
  66.  
  67.   Say " Now creating/updating WPS program object . . ."            /* Now create/update the Desktop object*/                                       
  68.  
  69.   LastChar = substr(InstallDir,length(InstallDir),1)            /* See if directory terminates in a \ */
  70.  
  71.   If LastChar = "\" Then SetupString="EXENAME="InstallDir"BUMMER.EXE;STARTUPDIR="InstallDir
  72.   Else SetupString="EXENAME="InstallDir"\BUMMER.EXE"; InstallDir=InstallDir"\"
  73.  
  74.   If SysCreateObject("WPFolder", "Bummer!", "<WP_DESKTOP>","OBJECTID=<MYFOLDER>") Then Do
  75.      
  76.   If SysCreateObject("WPProgram", "Bummer! 2.0", "<MYFOLDER>",SetupString, UPDATE) then
  77.      Say "Bummer program object successfully created"
  78.   else
  79.      Say "Could not create program object."
  80.  
  81.   If SysCreateShadow(InstallDir"Game1.bsg", "<MYFOLDER>") then
  82.      Say "Shadow of Game1.bsg Successfully created."
  83.   else
  84.      Say "Could not create shadow of Game1.bsg"
  85.  
  86.   if SysCreateShadow(InstallDir"Game2.bsg", "<MYFOLDER>") then
  87.      Say "Shadow of Game2.bsg Successfully created."
  88.   else
  89.      Say "Could not create shadow of game2.bsg"
  90.  
  91.   if SysCreateShadow(InstallDIr"Readme.txt", "<MYFOLDER>") then
  92.      Say "Shadow of readme.txt Successfully.created."
  93.   else
  94.      Say "Could not create shadow of readme.txt"
  95.   End
  96.   else
  97.      Say "Could not create folder on the desktop"
  98.  
  99.     
  100.   
  101.   Say " Now you get to read the README.TXT file . . ."
  102.  
  103.   Command='@E README.TXT'            /* Look at the README.TXT */
  104.   Command
  105.  
  106.   Say
  107.   Say " All Right!  Bummer 2.0 has been installed successfully!"
  108.  
  109.   Exit
  110.  
  111.  
  112. /******* FileCopy procedure */
  113.  
  114.   FileCopy: Arg FileName, Destination
  115.     
  116.     Command='@Copy 'FileName' 'Destination' >NUL'
  117.     Command
  118.     If rc\=0 Then Do               /* Error copying file */
  119.       Say
  120.       Say " AAAGH! Error copying files. This is probably because"
  121.       Say " the destination disk is write protected (a CD-ROM, for"
  122.       Say " example) or a file is missing.  Please make sure that"
  123.       Say " this program can find all the files listed in the"
  124.       Say " README.TXT file and ensure that the destination disk"
  125.       Say " isn't write protected, and try again."
  126.       Exit
  127.     End
  128.     Return
  129.  
  130.  
  131. /******* ErrorHandler procedure */
  132.  
  133.   ErrorHandler:
  134.  
  135.     Call SysCls
  136.     Say " EEEEWWWW! Unknown error! - aborting installation . . ."
  137.   Exit
  138.  
  139.