home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 29 Fixes_o / 29-Fixes_o.zip / fix4pd.zip / INSTFIX.CMD < prev    next >
OS/2 REXX Batch file  |  1994-04-15  |  5KB  |  140 lines

  1. /* Rexx command script to install PTFs for IBM Personal Dictation System */
  2.  
  3.   say
  4.   say "This program will install a fix for the"
  5.   say "IBM Personal Dictation System 1.0"
  6.   say
  7.  
  8.   call RxFuncAdd 'SysLoadFuncs', 'RexxUtil', 'SysLOADFUNCS'
  9.   call SysLoadFuncs
  10.  
  11.   Ar_Path="SPCH_RUN\ARCHIVE"
  12.  
  13.   /* inplst  = "input.lst" */
  14.  
  15.   parse upper arg inplst
  16.  
  17.   if (inplst = "") then do
  18.      say "Invalid number of arguments"
  19.      say "Example: INSTALL <CONTROL-FILENAME>"
  20.      exit(0)
  21.   end /* do */
  22.  
  23.  
  24.  
  25.  
  26.   SpeechDrive = value('SPCH_DRIVE',,'OS2ENVIRONMENT')   /* Determine the speech drive drive */
  27.  
  28.   if length(SpeechDrive )=0 then do
  29.      say "The environment variable SPCH_DRIVE is not set."
  30.      say "Please make sure this variable is set in your config.sys"
  31.      say
  32.      say "*** Installation Failed ***"
  33.      exit(1)
  34.   end
  35.  
  36.   if length(SpeechDrive) \= 1 then do
  37.      SpeechDrive=substr(SpeechDrive,1,1)      /* consider only the first character keyed */
  38.   end  /* Do */
  39.  
  40.   SpeechDrive = SpeechDrive||":\"
  41.  
  42.   parse source full_cmd_file       /* get the drive and path of the cmd file */
  43.   parse var full_cmd_file os2_string invoked_from cmd_file
  44.   zip_drv = filespec("drive", cmd_file)  /* extract the drive */
  45.   zip_path = filespec("path", cmd_file)  /* extract the path */
  46.  
  47.   iplst = zip_drv||zip_path||inplst
  48.  
  49.      if stream(iplst, 'c', 'query exists') \= iplst  then  do /* verify if the file is in the directory */
  50.          call beep 800, 300
  51.          say "The file " inplst " cannot be found in the directory "zip_drv||zip_path
  52.          say "This file is required for the installation of the fix."
  53.          say
  54.          say "*** The fix could not be installed ***"
  55.          say "Call your IBM Support Representative for assistance."
  56.          exit(1)
  57.      end /*do */
  58.  
  59.       j=1
  60.      copylist.0=0
  61.  
  62.  do until lines(iplst) = 0
  63.      line = linein(iplst)
  64.      parse upper var  line file Sp_Path
  65.      Sp_Path = strip(Sp_Path)
  66.      cur_dir = directory()           /* get the current directory */
  67.      Spch_dir = directory(SpeechDrive||Sp_Path) /* go to spch_ro\bin directory */
  68.      Spch_dir = translate(Spch_dir)
  69.      call directory cur_dir          /* return to the original directory */
  70.  
  71.  
  72.      if Spch_dir \= translate(SpeechDrive||Sp_Path) then do /* verify if spch_ro/bin exists */
  73.         call beep 800, 300
  74.         say "The directory " SpeechDrive||Sp_Path "cannot be found"
  75.         say "This directory is required for the installation of the fix."
  76.         say
  77.         say "*** The fix could not be installed ***"
  78.         say "Call your IBM Support Representative for assistance."
  79.         exit(1)
  80.      end  /* Do */
  81.  
  82.      play_path=zip_drv||zip_path||file
  83.  
  84.      if stream(play_path, 'c', 'query exists') \= play_path  then  do /* verify if the file is in the directory */
  85.          call beep 800, 300
  86.          say "The file " file " cannot be found in the directory "zip_drv||zip_path
  87.          say "This file is required for the installation of the fix."
  88.          say
  89.          say "*** The fix could not be installed ***"
  90.          say "Call your IBM Support Representative for assistance."
  91.          exit(1)
  92.      end  /* do */
  93.  
  94.     say "   Updating " file||"..."
  95.     CheckPath=SpeechDrive||Sp_Path||"\"||file
  96.     if stream(CheckPath, 'c', 'query exists') = CheckPath then do
  97.        say "archive the files..."
  98.        call sysmkdir(SpeechDrive||Ar_Path)
  99.        '@copy ' CheckPath  SpeechDrive||Ar_path || ' >NUL'
  100.        /*if the copy is not a success then exit */
  101.        if rc \= 0 then do
  102.  
  103.            if copylist.0 > 0 then do
  104.               /* Restore the directory with original files */
  105.               do k=1 to copylist.0 by 1
  106.                  '@copy ' SpeechDrive||Ar_path||"\"||filespec("name",copylist.k) filespec("drive", copylist.k)||filespec("path", copylist.k)
  107.               end /* do k */
  108.            end /* do copylist.0 */
  109.           say " "
  110.           say "The installation could not copy the files onto the Speech Drive."
  111.           say "There might not be enough space on the drive to install the fix."
  112.           say "Please verify there is adequate space on your Speech Drive"
  113.           say "and retry the installation."
  114.           say "*** The fix could not be installed ***"
  115.           exit (1)
  116.        end  /* do rc*/
  117.  
  118.       copylist.j=checkPath
  119.       copylist.0=j
  120.       j = j+1
  121.     end /* do rc */
  122.     /*
  123.     else do
  124.        say "File " file "not found in the directory " SpeechDrive||Sp_Path
  125.     end
  126.     */
  127.  
  128.     /* turn off the readonly attribute of the files to be tranfered */
  129.     '@attrib -r 'CheckPath
  130.     say "Copy the file into the correct directory"
  131.     '@copy ' play_path  SpeechDrive||Sp_Path||'>NUL'
  132.   end /* do until lines */
  133.   call beep 800, 300
  134.   say " "
  135.   say "The fix for the IBM Personal Dictation System 1.0"
  136.   say "has been successfully applied."
  137.  
  138. exit(0)
  139.  
  140.