home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: Educate / Educate.zip / supk101s.zip / INSTALL.CMD < prev    next >
OS/2 REXX Batch file  |  1996-04-18  |  6KB  |  277 lines

  1. /********************************************/
  2. /*                                          */
  3. /*    Soup KIDchen installation program     */
  4. /*                                          */
  5. /********************************************/
  6.  
  7. TRACE 'OFF'
  8. ADDRESS CMD
  9.  
  10. '@ECHO OFF'
  11. 'cls'
  12.  
  13.  
  14. SAY "Soup KIDchen v1.01s Installation"
  15. SAY "-------------------------------"
  16. SAY ""
  17. SAY ""
  18. SAY "This installation utility will install Soup KIDchen to your hard"
  19. SAY "disk in the directory of your choice, and then create desktop objects"
  20. SAY "for Soup KIDchen if you desire."
  21. SAY ""
  22. SAY "Neither this installation program nor Soup KIDchen itself modifies"
  23. SAY "any files outside of the Soup KIDchen directory."
  24. SAY ""
  25. SAY "You will need about 7 megabytes of free space on the drive where"
  26. SAY "Soup KIDchen is to be installed."
  27. SAY ""
  28. SAY "This version of Soup KIDchen is equivalent to version 1.00s with the"
  29. SAY "exception that all the sounds are 8-bit rather than 16-bit."
  30. SAY ""
  31.  
  32. CALL RxFuncAdd SysLoadFuncs, RexxUtil, SysLoadFuncs
  33. CALL SysLoadFuncs
  34.  
  35. /*
  36.  *  Find out from where we're installing.
  37.  *
  38.  */
  39.  
  40. instFrom = DIRECTORY( )
  41. instFromDrv = LEFT( instFrom, 2 )
  42. instFromPath = SUBSTR( instFrom, 3 )
  43.  
  44. /*  This is necessary because on hard drive, no '\', on floppy, yes  */
  45. IF( RIGHT( instFromPath, 1 ) \= "\" ) THEN  instFromPath = instFromPath||'\'
  46.  
  47. instFrom = instFromDrv||instFromPath
  48.  
  49. /*
  50.  *  Get the installation drive
  51.  *
  52.  */
  53.  
  54. SAY ""
  55. CALL CHAROUT, "Please enter the drive upon which to install [ C: ]: "
  56.  
  57. PARSE UPPER PULL instToDrv
  58.  
  59. IF( instToDrv == '' ) THEN             instToDrv='C:'
  60. IF( RIGHT(instToDrv, 1) \= ':' ) THEN  instToDrv=instToDrv||':'
  61.  
  62. /*
  63.  *  Get the installation path
  64.  *
  65.  */
  66.  
  67. SAY ""
  68. SAY "Please enter the directory where you would like Soup KIDchen"
  69. CALL CHAROUT, "to be installed [ \SoupKID\ ] : "
  70.  
  71. PARSE UPPER PULL ans
  72. IF( ans \= '' ) THEN
  73. DO
  74.   IF( LEFT(ans, 1) \= '\' ) THEN  ans='\'||ans
  75.   IF( RIGHT(ans, 1) \= '\' ) THEN  ans=ans||'\'
  76. END
  77. ELSE  ans = '\SoupKID\'
  78.  
  79. instToPath = ans
  80. instTo = instToDrv||instToPath
  81.  
  82. /*
  83.  *  Verify installation drive and path
  84.  *
  85.  */
  86.  
  87. SAY ""
  88. SAY "Soup KIDchen will be installed to: "instTo
  89. CALL CHAROUT, "Is this correct? (Y/[N]) : "
  90.  
  91. PARSE UPPER PULL ans
  92. IF( ans \= 'Y' ) THEN
  93. DO
  94.   SAY ""
  95.   SAY "Please type INSTALL again and enter the correct drive:path."
  96.   CALL ErrorOut
  97. END
  98.  
  99. IF( TRANSLATE( instFrom ) == TRANSLATE( instTo ) ) THEN
  100. DO
  101.   SAY ""
  102.   SAY "You cannot install Soup KIDchen to this drive:path.  Type INSTALL"
  103.   SAY "again and choose a different drive and/or path."
  104.   CALL ErrorOut
  105. END
  106.  
  107. /*
  108.  *  O.K.  We have the paths, now unpack the files
  109.  *
  110.  */
  111.  
  112. CALL UnpackFiles
  113.  
  114. /*
  115.  *  Files have been unpacked.  Ask if WPS objects should be created,
  116.  *  and do it if the answer is yes.
  117.  *
  118.  */
  119.  
  120. SAY ""
  121. SAY "Would you like Workplace Shell objects for Soup KIDchen created"
  122. CALL CHAROUT, "on the desktop? ( [Y]/N ) : "
  123.  
  124. PARSE UPPER PULL ans
  125. IF( ans == 'Y' | ans == '' ) THEN
  126. DO
  127.   interpret 'res = SKDesk( instTo )'
  128.   IF( res \= 0 ) THEN CALL ErrorOut
  129. END
  130.  
  131. /*
  132.  *  Give the option to view the documentation right now.
  133.  *  We hope the user will say yes.  Maybe we should just force it?
  134.  *
  135.  */
  136.  
  137. SAY ""
  138. SAY "Would you like to view the Soup KIDchen documentation"
  139. CALL CHAROUT, "now? ( [Y]/N ) : "
  140.  
  141. PARSE UPPER PULL ans
  142. IF( ans == 'Y' | ans == '' ) THEN
  143. DO
  144.   'view 'instTo||'SoupKID.inf'
  145. END
  146.  
  147. /*
  148.  *  All done!
  149.  *
  150.  */
  151.  
  152. CALL BEEP  250, 50
  153. CALL BEEP  500, 50
  154. CALL BEEP 1000, 50
  155.  
  156. SAY ""
  157. SAY "Soup KIDchen installation program ending successfully."
  158. SAY ""
  159. SAY "If you need to re-create the desktop objects in the future,"
  160. SAY "just run SKDESK.CMD, which can be found in the Soup KIDchen"
  161. SAY "directory ("instTo")."
  162. SAY ""
  163. SAY "The distributed program does not contain a complete database."
  164. SAY "Rather, an example database is provided.  Therefore, if you get"
  165. SAY "the message "Image Not Found" when you run the program, don't"
  166. SAY "worry- you've simply chosen an item that doesn't have an entry"
  167. SAY "in the database."
  168.  
  169. rc = DIRECTORY( LEFT( instFrom, LENGTH( instFrom ) - 1 ) )
  170.  
  171. EXIT 0
  172.  
  173. /***********************************************************/
  174.  
  175. /*
  176.  *  Something bad happened.  Clean up, leave message, and
  177.  *  get out.
  178.  *
  179.  */
  180.  
  181. ErrorOut:
  182.  
  183.   SAY ""
  184.   SAY "Soup KIDchen installation aborted."
  185.   SAY ""
  186.   rc = DIRECTORY( LEFT( instFrom, LENGTH( instFrom ) - 1 ) )
  187.   CALL BEEP 125, 500
  188.   EXIT 1
  189.  
  190. /***********************************************************/
  191.  
  192. /*
  193.  *  Unpack the files.  They may be on the hard drive or over
  194.  *  two floppies.  Copy the unpack utility to the destination
  195.  *  in any case. (Might not be on user's system.)
  196.  *
  197.  */
  198.  
  199. UnpackFiles:
  200.  
  201. SAY ""
  202. SAY "Installing Soup KIDchen files..."
  203.  
  204.  
  205. /*  First create the directories, because unpack2 doesn't do
  206.  *  this for us, but will error out.
  207.  *  rc = 5 from SysMkDir indicates path already exists
  208.  */
  209.  
  210. SAY "Creating directory "||instTo"..."
  211. rc = SysMkDir( LEFT( instTo, LENGTH( instTo ) - 1 )  )
  212. IF( rc \= 0 & rc \= 5 ) THEN
  213. DO
  214.   SAY ""
  215.   SAY "Error creating directory "instTo". rc = "rc
  216.   CALL ErrorOut
  217. END
  218.  
  219. SAY ""
  220. SAY "Unpacking files.  Please wait..."
  221.  
  222. rc = SysFileTree( instFrom'SupK101s.ex1', files, 'FO' )
  223. IF( files.0 = 0 ) THEN
  224. DO
  225.   SAY 'The file SupK101s.ex1 must reside where this install program resides.'
  226.   Call ErrorOut
  227. END
  228.  
  229. rc = DIRECTORY( LEFT( instTo, LENGTH( instTo ) - 1 )  )
  230.  
  231. instFrom'SupK101s.ex1'
  232.  
  233. IF( rc \= 0 ) THEN
  234. DO
  235.   SAY ""
  236.   SAY "Error unzipping SupK101s.ex1"
  237.   CALL ErrorOut
  238. END
  239.  
  240. IF( instFromDrv == 'A:'  |  instFromDrv == 'B:' ) THEN
  241. DO
  242.  
  243. DiskLoop:
  244.  
  245.   CALL BEEP 250, 250
  246.   SAY ""
  247.   SAY "Please insert Soup KIDchen disk 2 in drive "instFromDrv
  248.   CALL CHAROUT, "and press Return to continue or 'Q' to quit..."
  249.   PARSE UPPER PULL ans
  250.   IF( ans == 'Q' ) THEN CALL ErrorOut
  251.  
  252.   rc = SysFileTree( instFrom'SupK101s.ex2', files, 'FO' )
  253.   IF( files.0 = 0 ) THEN  SIGNAL DiskLoop
  254. END
  255. ELSE
  256. DO
  257.   rc = SysFileTree( instFrom'SupK101s.ex2', files, 'FO' )
  258.   IF( files.0 = 0 ) THEN
  259.   DO
  260.     SAY "The file "instFrom"SupK101s.ex2 doesn't exist."
  261.     CALL ErrorOut
  262.   END
  263. END
  264.  
  265. instFrom'SupK101s.ex2'
  266.  
  267. IF( result \= 0 ) THEN
  268. DO
  269.   SAY ""
  270.   SAY "Error unzipping SupK101s.ex2"
  271.   CALL ErrorOut
  272. END
  273.  
  274. RETURN
  275.  
  276. /***********************************************************/
  277.