home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: InfoMgt / InfoMgt.zip / pmmeal10.zip / install.cmd < prev    next >
OS/2 REXX Batch file  |  1994-08-16  |  5KB  |  189 lines

  1. /*
  2. @echo off
  3. cls
  4. echo.
  5. echo.
  6. echo ERROR:
  7. echo REXX support not installed
  8. echo You must have REXX support installed to run this
  9. echo program.
  10. echo.
  11. echo To run this program, run Selective Install from
  12. echo your System Setup folder, and install REXX.
  13. exit
  14. */
  15.  
  16. call RxFuncAdd 'SysLoadFuncs', 'RexxUtil', 'SysLoadFuncs'
  17. call SysLoadFuncs
  18. /*-- get the command line --*/
  19. parse arg sourcedir destdir
  20.  
  21.   /* Go search for the OS2.INI file, this will be our bootdrive */
  22.   testos2path = SysSearchPath('PATH', 'OS2.INI');
  23.   bootdrive = FILESPEC("drive", testos2path);
  24.   os2path = FILESPEC("path",testos2path);
  25.  
  26. /*-- get dest dir --*/
  27. if destdir = '' then do
  28.   say ''
  29.   say 'Please enter a directory name for PMMeal'
  30.   say '(Default: 'bootdrive'\PMMeal):'
  31.   /*-- if error --*/
  32.   parse pull destdir
  33.   if destdir = ' ' then do
  34.     destdir = bootdrive'\PMMeal'
  35.   end
  36. end
  37.  
  38.  
  39.   DestDrive = FILESPEC("drive", destdir)
  40. if sourcedir = '' then do
  41.   thisdir = directory()
  42.   say ''
  43.   say 'Please enter the directory where the program is being installed'
  44.   say 'from(Default: 'thisdir'):'
  45.   parse pull sourcedir
  46.   /*-- if another error --*/
  47.   if sourcedir = ' ' then do
  48.     sourcedir = thisdir
  49.     say 'using the current directory as the source directory.'
  50. end
  51.  
  52. /*-- make sure path is good --*/
  53. If substr( sourcedir, length(sourcedir), 1 ) \= '\' then
  54.     sourcedir = sourcedir||'\'
  55.  
  56. /*-- Select language --*/
  57.  
  58. call sysfiletree sourcedir'*.lng','languages',"FO"
  59. say 'Select the language you prefer'
  60. say ''
  61. say '  A = DEUTSCH'
  62. do n=1 to languages.0
  63.   languages.n=substr(languages.n,lastpos("\",languages.n)+1)
  64.   languages.n=translate(left(languages.n,pos(".",languages.n)-1))
  65.   say "  "d2c(65+n)" = "languages.n
  66. end
  67.  
  68. l = c2d(translate(SysGetKey('NOECHO')))-65
  69. if l>languages.0 | l<0 then do
  70.   say
  71.   say 'Installation cancelled.'
  72.   exit
  73. end
  74.  
  75. if l=0 then do
  76.   language="DEUTSCH"
  77. end; else do
  78.   language=languages.l
  79. end
  80.  
  81. /*-- do main screen --*/
  82. call SysCls
  83. say
  84. say '                        PMMeal Installation'
  85. say
  86. say 'The Programm PMMeal will be Installed with the following settings:'
  87. say
  88. say '     Source directory: "'sourcedir'"'
  89. say 'Destination directory: "'destdir'"'
  90. say '             Language: "'language'"'
  91. say
  92. say 'Okay to continue(Y/n)?'
  93. k = SysGetKey('NOECHO')
  94. if k = 'N' | k = 'n' then do
  95.   say
  96.   say 'Installation cancelled.'
  97.   exit
  98. end
  99.  
  100.     call copyfiles sourcedir,destdir
  101.  
  102.      DestDrive
  103.      "@CD "||destdir
  104.  End
  105. /*-- create a program object --*/
  106. call SysCls
  107.  
  108. say
  109. say 'Creating the program folder,'
  110. x = SysCreateObject("WPFolder",,
  111.                     "PMMeal",,
  112.                     "<WP_DESKTOP>",,
  113.                     "OBJECTID=<PMMealFLDR>;ICONFILE="||destdir||"\PMealFld.ICO", "replace")
  114. if x = 0 then do
  115.   say 'Unable to create folder; cancelling.'
  116.   exit
  117. end
  118.  
  119.  
  120. x = SysCreateObject("WPProgram",,
  121.                     "Lies Mich"||"0d0a"x||"Read Me"||"0d0a"x||"Liez Moi",,
  122.                     "<PMMealFLDR>",,
  123.                     "EXENAME=VIEW.EXE;PARAMETERS="||destdir||"\PMMeal.INF")
  124.  
  125. x = SysCreateObject("WPProgram",,
  126.                     "PMMeal"||"0d0a"x||"Rezeptverwaltung",,
  127.                     "<PMMealFLDR>",,
  128.                     "EXENAME="||destdir||"\PMMeal.EXE;STARTUPDIR="||destdir)
  129.  
  130. x = SysCreateObject("WPProgram",,
  131.                     "PMMeal"||"0d0a"x||"Registrierung",,
  132.                     "<PMMealFLDR>",,
  133.                     "EXENAME="||destdir||"\REGPMEAL.EXE;STARTUPDIR="||destdir)
  134.  
  135.  
  136.  
  137. GoodBye:
  138. /*-- exit with a goodbye --*/
  139. call SysCls
  140. say
  141. say
  142. say
  143. say
  144. say 'PMMeal was installed successfully.'
  145. say
  146. say 'Be sure to read the file LIES MICH for up-to-date information.'
  147. say
  148. say 'Press any key to exit installation...'
  149. k = SysGetKey('NOECHO')
  150. call SysCls
  151. "@start view.exe "||destdir||"\PMMeal.inf"
  152. exit
  153.  
  154.  
  155. INST_EXIT:
  156.   EXIT
  157.  
  158.  
  159.  
  160. CopyFiles: Arg SrcDrive , DestDir
  161.  
  162.   DestDrive = FILESPEC("drive",DestDir)
  163.   /*-- create the dest. dir --*/
  164.   DestDrive
  165.   rc = SysMkDir(DestDir)
  166.   if rc = 0 then do
  167.     say 'The directory ' DestDir ' was created successfully.'
  168.   end
  169.   else do
  170.     if SysFileTree(DestDir,file,D)>0 then
  171.     do
  172.        say 'The directory ' DestDir ' could not be created successfully; cancelling.'
  173.        exit
  174.     end
  175.   end
  176.   say 'Please wait ....'
  177.   "@copy "||SrcDrive||"PMMEAL.EXE "||DestDir
  178.   "@copy "||SrcDrive||"PMMEAL.INF "||DestDir
  179.   "@copy "||SrcDrive||"PMMEAL.INF "||DestDir"\PMMEAL.HLP"
  180.   "@copy "||SrcDrive||"RegPMEAL.EXE "||DestDir
  181.   "@if exist "SrcDrive||language||".EH copy "||SrcDrive||language||".EH "||DestDir"\PMMEAL.EH"
  182.   "@if exist "SrcDrive||language||".LNG copy "||SrcDrive||language||".LNG "||DestDir"\PMMEAL.LNG"
  183.   "@copy "||SrcDrive||"CONVERT.CMD "||DestDir
  184.   "@copy "||SrcDrive||"CNVKOCHB.CMD "||DestDir
  185.   "@copy "||SrcDrive||"INSTALL.CMD "||DestDir
  186.   "@copy "||SrcDrive||"PMEALFLD.ICO "||DestDir
  187.   call charout DestDir"\PMMEAL.HLP","10"x,4
  188. return
  189.