home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 6 File / 06-File.zip / wsfil102.zip / INSTALL.CMD < prev    next >
OS/2 REXX Batch file  |  1998-12-04  |  2KB  |  83 lines

  1. /* Install.cmd for WSSFill
  2.  */
  3.  
  4. ProgName = "WSSFill"
  5. Version = "1.02"
  6.  
  7. InstFile.0 = 5
  8. InstFile.1 = "wssfill.exe"
  9. InstFile.2 = "wssfill.htm"
  10. InstFile.3 = "wssfill.ico"
  11. InstFile.4 = "wssf-ord.htm"
  12. InstFile.5 = "wssfill.res"
  13.  
  14. call RxFuncAdd 'SysLoadFuncs', 'RexxUtil', 'SysLoadFuncs'
  15. call SysLoadFuncs
  16.  
  17. say
  18. say 'This will install' ProgName 'version' Version 'and create an icon on the desktop'
  19.  
  20. parse arg instdir
  21.  
  22. if "" = instdir then do
  23.     say
  24.     say "Please specify the installation directory.  It will be created if it"
  25.     say "doesn't already exist (but top level must exist).  Example: C:\utils\wssfill"
  26.     say "is ok, but only if C:\utils already exists."
  27.     say 'Enter "Q" to quit or just enter to use current directory.'
  28.     say
  29.     call charout ,"Install directory: "
  30.     pull instdir
  31.     instdir = strip(instdir)
  32.     instdir = strip(instdir, "trailing", "\")
  33.     if ('Q' = instdir) | ('q' = instdir) then
  34.         exit
  35.     end
  36.  
  37. if "" = instdir then do
  38.     instdir = directory()
  39.     copyfiles = 'f'
  40.     end
  41. else
  42.     copyfiles = 't'
  43.  
  44. if 't' = copyfiles then do
  45.     rc = SysMkDir(instdir)
  46.     if rc>0 & rc !=5 then do
  47.         say 'Unable to create target directory' instdir
  48.         exit
  49.         end
  50.     do i = 1 to InstFile.0
  51.         if "" = stream(InstFile.i, 'C', 'Query exists') then do
  52.             say InstFile.i 'not found, installation cannot continue'
  53.             exit
  54.         end
  55.     end
  56.     do i = 1 to InstFile.0
  57.         if "" = stream(instdir || "\" || InstFile.i, 'C', 'Query exists') then
  58.             iterate
  59.         call charout ,'One or more files to be installed already exists, ok to overwrite?: '
  60.         action = translate(SysGetKey())
  61.         say
  62.         if 'Y' = action then
  63.             leave
  64.         else
  65.             exit
  66.     end
  67.  
  68.     do i = 1 to InstFile.0
  69.         '@copy' InstFile.i instdir
  70.     end
  71. end
  72.  
  73. title = ProgName || " " || Version
  74. setupstring = "EXENAME=" || instdir || "\" || ProgName || ".exe;STARTUPDIR=" || instdir
  75. rc = SysCreateObject("WPProgram", title, "<WP_DESKTOP>", SetupString, "Replace")
  76.  
  77. say
  78.  
  79. if 0 = rc then
  80.     say 'Unable to create desktop object for' ProgName
  81. else
  82.     say 'Installation complete'
  83.