home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: InfoMgt / InfoMgt.zip / omnifile.zip / INSTALL.CMD < prev    next >
OS/2 REXX Batch file  |  1998-02-04  |  6KB  |  153 lines

  1. /* REXX PROGRAM */
  2. /* OMNIFILE INSTALLATION PROGRAM */
  3. SAY "INSTALLATION PROGRAM FOR OMNIFILE"
  4. SAY ""
  5. /* You may optionally specify the destination path for the program as an argument. */
  6. /* If you do not specify the destination path you will be prompted to enter a path. */
  7. PARSE SOURCE os processor cmd
  8. srcdrive = FILESPEC("drive",cmd)
  9. srcpath = FILESPEC("path",cmd)
  10. src = srcdrive||srcpath
  11.  
  12. "@echo off"
  13. arg destpath
  14.  
  15. /* Determine if user is installing from floppies or hard disk */
  16. minHardDiskSize = 3800000  /* ~3.8 MB */
  17. call RxFuncAdd 'SysMkDir', 'RexxUtil', 'SysMkDir'
  18. call RxFuncAdd 'SysDriveInfo', 'RexxUtil', 'SysDriveInfo'
  19. driveInfo = SysDriveInfo(srcdrive)
  20. driveSize = SUBWORD(driveInfo, 3, 1)
  21. IF driveSize > minHardDiskSize
  22.    THEN InstallFromFloppy = FALSE
  23.    ELSE InstallFromFloppy = TRUE
  24.  
  25. InstallInCurDir = FALSE
  26. call RxFuncAdd 'SysMkDir', 'RexxUtil', 'SysMkDir'
  27. call RxFuncAdd 'SysFileTree', 'RexxUtil', 'SysFileTree'
  28. DO FOREVER
  29.    IF destpath == "" THEN DO
  30.       IF InstallFromFloppy == TRUE THEN DO
  31.          SAY "Enter the full directory path (including drive) where you would like"
  32.          SAY "OmniFile installed.  If you press Enter without typing anything"
  33.          SAY 'it will be installed in the "C:\OMNIFILE" directory.'
  34.          END
  35.       ELSE DO
  36.          tempsrc = STRIP(src, 'T', '\')
  37.          SAY "If you would like to install this program"
  38.          SAY "in "tempsrc" without copying"
  39.          SAY "the files to a new directory simply"
  40.          SAY "press Enter without typing anything."
  41.          SAY ""
  42.          SAY "Otherwise enter the full directory path (including drive)"
  43.          SAY "where you would like the program to be installed."
  44.          SAY '(We suggest "C:\OMNIFILE").'
  45.          END
  46.       SAY ""
  47.       SAY "If you would like to abort this installation type QUIT and press Enter."
  48.       PULL destpath
  49.       IF destpath = "QUIT" THEN EXIT
  50.       IF destpath = "" THEN DO
  51.          IF InstallFromFloppy == TRUE
  52.             THEN destpath = "C:\OMNIFILE"
  53.             ELSE DO
  54.                InstallInCurDir = TRUE
  55.                destpath = src
  56.                LEAVE
  57.                END
  58.          END
  59.       END
  60.    rc = SysMkDir(destpath)
  61.    if rc == 0 THEN LEAVE
  62.    SAY ""
  63.    SAY "ERROR: Unable to make the directory "destpath"."
  64.    if rc == 3 THEN say "The path was not found."
  65.    if rc == 5 THEN say "Either it already exists or you do not have access to the directory."
  66.    SAY "Enter a new path."
  67.    SAY ""
  68.    destpath = ""
  69.    END
  70.  
  71. /* Copy the files */
  72. IF InstallInCurDir == FALSE THEN DO
  73.    IF InstallFromFloppy == TRUE
  74.       THEN CopyCmd = src"decomp "
  75.       ELSE CopyCmd = "copy "
  76.    SAY ""
  77.    SAY "Now copying files..."
  78.    CopyCmd src"Omnifile.exe "destpath"\Omnifile.exe"
  79.    CopyCmd src"Omnifile.hlp "destpath"\Omnifile.hlp"
  80.    "copy "src"*.cmd "destpath"/v"
  81.    "copy "src"*.txt "destpath"/v"
  82.  
  83.    /* Copy registration info if found */
  84.    rc = SysFileTree("register.dat", TempFileTime, 'FT')
  85.    IF TempFileTime.0 \= 0 THEN "copy "src"register.dat "destpath"/v"
  86.  
  87.    "md "destpath"\ICONS.OS2 2>nul"
  88.    "copy "src"ICONS.OS2\*.* "destpath"\ICONS.OS2/v"
  89.    "md "destpath"\SYSTEM 2>nul"
  90.    "copy "src"SYSTEM\*.db* "destpath"\SYSTEM/v"
  91.  
  92.    CopyCmd src"impex2wn.ntx "destpath"\impex2wn.ntx"
  93.    CopyCmd src"impex295.ntx "destpath"\impex295.ntx"
  94.    CopyCmd src"impexpwn.ntx "destpath"\impexpwn.ntx"
  95.    CopyCmd src"impexp95.ntx "destpath"\impexp95.ntx"
  96.    CopyCmd src"impexpwn.gbf "destpath"\impexpwn.gbf"
  97.    CopyCmd src"impexpwn.gbt "destpath"\impexpwn.gbt"
  98.    CopyCmd src"impexp95.gbf "destpath"\impexp95.gbf"
  99.    CopyCmd src"impexp95.gbt "destpath"\impexp95.gbt"
  100.    "copy "src"*.rep "destpath"/v"
  101.  
  102.    CopyCmd src"cicooi01.dll "destpath"\cicooi01.dll"
  103.    CopyCmd src"cicoom0.dll "destpath"\cicoom0.dll"
  104.    CopyCmd src"cicoor01.dll "destpath"\cicoor01.dll"
  105.  
  106.    IF InstallFromFloppy == TRUE THEN DO
  107.       SAY ""
  108.       SAY "Insert the disk Labeled Disk 2 and press Enter."
  109.       PULL response
  110.       SAY ""
  111.       SAY "Now copying files..."
  112.       END
  113.    CopyCmd src"cicoop01.dll "destpath"\cicoop01.dll"
  114.    CopyCmd src"cicooa01.dll "destpath"\cicooa01.dll"
  115.    CopyCmd src"cicoov01.dll "destpath"\cicoov01.dll"
  116.    CopyCmd src"cicoow01.dll "destpath"\cicoow01.dll"
  117.    CopyCmd src"cicood01.dll "destpath"\cicood01.dll"
  118.    CopyCmd src"cicoot01.dll "destpath"\cicoot01.dll"
  119.    CopyCmd src"cicoob0.dll "destpath"\cicoob0.dll"
  120.    CopyCmd src"cicoou0.dll "destpath"\cicoou0.dll"
  121.  
  122.    IF InstallFromFloppy == TRUE THEN DO
  123.       SAY ""
  124.       SAY "Insert the disk Labeled Disk 3 and press Enter."
  125.       PULL response
  126.       SAY ""
  127.       SAY "Now copying files..."
  128.       END
  129.    CopyCmd src"cicoox01.dll "destpath"\cicoox01.dll"
  130.  
  131.    "erase "destpath"\install.cmd 2>nul"
  132.    "erase "destpath"\upgrade.cmd 2>nul"
  133.    END
  134.  
  135. /* Make sub directories */
  136. "md "destpath"\FILES 2>nul"
  137.  
  138. /* Create the Omnifile Icon. */
  139. call RxFuncAdd 'SysCreateObject', 'RexxUtil', 'SysCreateObject'
  140. if SysCreateObject('WPProgram', 'OmniFile', '<WP_DESKTOP>', 'EXENAME='destpath'\Omnifile.exe;STARTUPDIR='destpath, 'replace') == 0 then SAY 'Unable to create the OmniFile icon.  You should add it manually after the installation program finishes.'
  141.  
  142. SAY ""
  143. SAY "DONE INSTALLING OMNIFILE."
  144. SAY "To use the program double click on the OmniFile icon on your desktop."
  145. IF InstallInCurDir == TRUE THEN DO
  146.    SAY "Once you have verified the installation was successful"
  147.    SAY "we suggest you delete the following files from this directory:"
  148.    SAY "   install.cmd"
  149.    SAY "   omnifile.zip"
  150.    END
  151. SAY ""
  152. EXIT
  153.