home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 19 Printer / 19-Printer.zip / psup_300.zip / PSUPINST.CMD < prev    next >
OS/2 REXX Batch file  |  1996-06-07  |  3KB  |  120 lines

  1. /* REXX */
  2.  
  3. '@ECHO OFF'
  4. Call RxFuncAdd 'SysLoadFuncs','REXXUTIL','SysLoadFuncs';
  5. Call SysLoadFuncs;
  6.  
  7.  START_DIR = directory();
  8.  cls;
  9.  say 'PSUP Installation Program - Copyright (c) 1996 - Knight Research'
  10.  say '                       All Rights Reserved';say
  11.  
  12.  psup_fullpath = stream(START_DIR || '\PSUP.EXE', 'c', 'query exists')
  13.  if '' = psup_fullpath then
  14.      DO
  15.         say
  16.         say 'PSUPInst Install ERROR! - Can not find PSUP.EXE in current directory.'
  17.         say 'Please run the "PSUPInst" command from the directory in which'
  18.         say '  you unzipped the files (from PSUP_300.ZIP).'
  19.         say
  20.         EXIT
  21.      END
  22.  else do
  23.      say; say "Found:" psup_fullpath
  24.      end
  25.  
  26.  
  27. looper:
  28.  say;say;
  29.  say 'Please type in the drive letter and directory in which to install PSUP'
  30.  say
  31.  say '    Example ==>  C:\PSUP'
  32.  say '            ==>  D:\UTIL\PSUP'
  33.  say '            ==>  F:\FRED'
  34.  say
  35.  pull INST_DIR .
  36.  INST_DIR = strip(INST_DIR)
  37.  if ':\' \= substr(INST_DIR,2,2) then
  38.      DO
  39.      say 'Please type in the DRIVE LETTER and the \path...see Example'
  40.      say; signal looper
  41.      END
  42.  
  43.  
  44.  if INST_DIR = directory() then
  45.      DO
  46.      say "Can't install TO the" INST_DIR "directory...this is the directory"
  47.      say "    we are installing FROM...specify another drive/path."
  48.      signal looper
  49.      END
  50.  
  51.  say 'Install PSUP to the' INST_DIR '  Is this correct? (Y/N)'
  52.  pull yesno .
  53.  if 'Y' = substr(yesno, 1, 1) then
  54.      DO
  55.      say; say 'Installing to' INST_DIR
  56.      END
  57.  else DO
  58.      signal looper
  59.      END
  60.  
  61.  say 'Proceed with install? (Y --> Install PSUP  or   N --> Cancel)'
  62.  pull yesno .
  63.  if 'Y' \= substr(yesno, 1, 1) then
  64.      DO
  65.       say 'Install Canceled.'
  66.       exit
  67.      END
  68.  
  69.  
  70. /*** Proceed with install - MKDIR & copy all files to INST_DIR ***/
  71. /*** Check for NEW directories more than 1 deep ***/
  72.  numtimes = 0
  73.  pos1 = 3
  74.  DO WHILE pos('\', INST_DIR) \= lastpos('\', INST_DIR) & numtimes < 10
  75.      pos2 = pos('\', INST_DIR, pos1 + 1)
  76.      if pos2 = 0 then leave
  77.      make_dir_first = substr(INST_DIR, 1, (pos2 - 1))
  78.      'mkdir' make_dir_first '1> nul 2>&1'
  79.      pos1 = pos2
  80.      END
  81.  
  82.  'mkdir' INST_DIR '1> nul 2>&1'
  83.  if rc = 0 | rc = 1 then
  84.      DO
  85.        NEW_DIR = Directory(INST_DIR)
  86.        if INST_DIR \= NEW_DIR then
  87.          DO
  88.           say; say 'Unable to Create/Change-To' INST_DIR 'directory!'
  89.           say 'Install Canceled.'
  90.           EXIT
  91.          END
  92.      END
  93.  else DO
  94.      say 'Unexpected RC from MKDIR...Installation Canceled'
  95.      say 'RC:' rc
  96.      EXIT
  97.      END
  98.  
  99.  say;say 'We are now in the' directory() 'directory!'
  100.  
  101. /*********** COPY FILES HERE *************************/
  102.  
  103.  'copy' START_DIR || '\PSUP.EXE     .'
  104.  'copy' START_DIR || '\PSUPREF.INF     .'
  105.  'copy' START_DIR || '\1UP.ICO      .'
  106.  'copy' START_DIR || '\2UP.ICO      .'
  107.  'copy' START_DIR || '\4UP.ICO      .'
  108.  'copy' START_DIR || '\PSFOLDER.ICO   .'
  109.  'copy' START_DIR || '\PSFOLDER.CMD .'
  110.  
  111.  /* Create PSUP Folder and all objects within */
  112.  call 'PSFOLDER'
  113.  
  114.  NEW_DIR = Directory(START_DIR)
  115. /******************** DONE ***************************/
  116. say; say "PSUPInst - Done"
  117. EXIT
  118.  
  119.  
  120.