home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 8 Other / 08-Other.zip / redneck.zip / install.cmd < prev    next >
OS/2 REXX Batch file  |  1998-08-20  |  2KB  |  80 lines

  1. /* REXX file to install "You might be a redneck if.." */
  2. /* if you use this script as a starting point for your   */
  3. /* own install script and make improvements, please send */
  4. /* me a copy ---  dwhawk@southwind.net                   */
  5.  
  6. call rxfuncadd 'sysloadfuncs', 'rexxutil', 'sysloadfuncs'
  7. call sysloadfuncs                /* register system functions */
  8. address cmd '@echo off'          /* echo is turned off */
  9.  
  10. call SysCLS
  11.  
  12. say "Enter destination drive and directory"
  13. say "for example C:\OS2\APPS"
  14. say "to install in the curent directory just press enter"
  15.  
  16. pull dest
  17. call setup_dir(dest) 
  18. call copy_files
  19. call MKOBJ
  20. exit
  21.  
  22. check_ok:
  23.   say  'Okay to continue(Y/N) ? '        
  24.   k = SysGetKey('NOECHO') 
  25.   if k = 'Y' | k = 'y'  then return
  26.   say 'halting'
  27.     exit
  28.  
  29.  
  30. mkdir:  /* Procedure for creating dir */
  31.   Parse Arg dir
  32.   rc = SysMkDir(dir)
  33.   If (rc = 0 | rc = 5) Then Return
  34.   Say 'Problem creating destination directory "'dir'"'
  35.   Exit
  36.  
  37.  
  38. MKOBJ:
  39. Settings = 'EXENAME='direct||'\redneck.exe;'
  40. Settings = Settings||'PROGTYPE=PM;MINIMIZED=NO;'
  41. Settings = Settings||'ICONFILE='direct||'\Cookie.ICO;'
  42. Settings = Settings||'CCVIEW=YES;'
  43. Settings = Settings||'STARTUPDIR='||direct';'
  44. rc=SysCreateObject('WPProgram','Redneck','<WP_DESKTOP>',Settings,'R');
  45.  
  46. if rc = 1 then Say "Redneck installed on desktop"
  47. return
  48.  
  49. setup_dir:      /* accept install path and create it if needed */
  50.                 /* the desired install path is in ARG(1) */
  51.                 /* if no path is specified current directory is used*/
  52.  
  53. Parse Arg destin  /* parameter of setup_dir */
  54.  
  55. save_dest = destin    /*  save original destin to */
  56.                       /*  determine if copy needed */
  57.  
  58. If destin = "" Then destin = Directory()
  59.  
  60. Say "Shall I install in "destin" ?"
  61. Call Check_Ok  /* your check routine */
  62.  
  63. Parse Var destin direct ':\' destin   /* get drive name only */
  64. direct=direct':'
  65.  
  66. Do Until destin = ""     /* No matter how many sub dirs present */
  67.   Parse Var destin sub '\' destin
  68.   direct=direct'\'sub
  69.   Call mkdir direct
  70. End
  71. return
  72.  
  73. copy_files:
  74. if save_dest \= ""  then do
  75.    'COPY redneck.dat' direct
  76.    'COPY cookie.ico' direct
  77.    'COPY redneck.dat' direct
  78. end
  79. return
  80.