home *** CD-ROM | disk | FTP | other *** search
/ The World of Computer Software / World_Of_Computer_Software-02-387-Vol-3of3.iso / p / pc2.zip / INSTALL.CMD next >
OS/2 REXX Batch file  |  1993-03-09  |  11KB  |  216 lines

  1. /***********************************************************************\
  2.  *                                 PC2.c                               *
  3.  *                 Copyright (C) by Stangl Roman, 1992                 *
  4.  * This Code may be freely distributed, provided the Copyright isn't   *
  5.  * removed.                                                            *
  6.  *                                                                     *
  7.  * Install.cmd  Installation batch file.                               *
  8.  *                                                                     *
  9.  *              INSTALL <InstallationPathDirectory>                    *
  10.  *              F.e. INSTALL C:\PMAPPS\PC2                             *
  11.  *                                                                     *
  12.  *              The PC/2 Package is installed in the Path pointed      *
  13.  *              by <InstallationPathDirectory> from the current path.  *
  14.  *                                                                     *
  15. \***********************************************************************/
  16.  
  17. /* static char RCSID[]="@(#) $Header: Install.cmd Version 1.20 03,1993 $ (LBL)" */
  18.  
  19.                                         /* Register REXX APIs */
  20. Call RxFuncAdd 'SysLoadFuncs', 'RexxUtil', 'SysLoadFuncs'
  21. Call SysLoadFuncs
  22.  
  23. Parse Arg InstallationPathDirectory     /* Command line parameter */
  24. Signal On Halt Name SignalHandler       /* Exception handler */
  25. Call DisplayLogo                        /* Display logo panel */
  26.                                         /* Query the current path and directory */
  27. CurrentPathDirectory=SysSearchPath("Path", "Install.cmd")
  28.                                         /* Installation path must be given */
  29. Do While InstallationPathDirectory=" "
  30.     Call DisplayLogo                    /* Display logo panel */
  31.     Say "                       PC/2 Installation Instruction:"
  32.     Say
  33.     Say " To install PC/2, you must provide a target path to install PC/2 into."
  34.     Say
  35.     Say " Syntax:       INSTALL <InstallationPathDirectory>"
  36.     Say
  37.     Say " Example:      INSTALL C:\PMAPPS\PC2"
  38.     Say
  39.     Parse Value SysCurPos() with Row Col
  40.     Say " Please input: "
  41.     Col=Col+15
  42.     Call SysCurPos Row, Col
  43.     Pull InstallationPathDirectory
  44. End
  45. Call DisplayLogo                        /* Display logo panel */
  46.  
  47.                                         /* Test for installation directory */
  48. Call SysFileTree InstallationPathDirectory, FileDirectory, 'D'
  49. If FileDirectory.0='0' Then Do
  50.                                         /* Make the installation directory */
  51.     rc=SysMkDir(InstallationPathDirectory)
  52.     If rc\=0 Then Do
  53.         Say " Sorry, the desired directory couldn't be created - exiting..."
  54.         Exit
  55.     End
  56. End
  57.  
  58.                                         /* Now copy files */
  59. Say
  60. Say " Now copying files..."
  61. Call FileCopy 'PC2.exe', InstallationPathDirectory
  62. Call FileCopy 'PC2.hlp', InstallationPathDirectory
  63. Call FileCopy 'PC2*.cfg', InstallationPathDirectory
  64. Call FileCopy 'PC2Hook.dll', InstallationPathDirectory
  65. Call FileCopy 'PC2.doc', InstallationPathDirectory
  66. Call FileCopy 'Makefile', InstallationPathDirectory
  67. Call FileCopy 'Install.cmd', InstallationPathDirectory
  68. Call FileCopy 'Source.zip', InstallationPathDirectory
  69. Call DisplayLogo                        /* Display logo panel */
  70.  
  71.                                         /* Create an object on the Desktop */
  72. SetupString="EXENAME="InstallationPathDirectory"\PC2.EXE;STARTUPDIR="InstallationPathDirectory
  73. rc=SysCreateObject("WPProgram",,
  74.                    "PC/2",,
  75.                    "<WP_DESKTOP>",,
  76.                    SetupString)
  77. If rc=0 Then Do
  78.     Say " Sorry, PC/2 couldn't be created as a WPS object - exiting..."
  79.     Exit
  80. End
  81.  
  82. If Substr(InstallationPathDirectory, 2, 1)=":" Then Do
  83.                                         /* Change to the drive where we copied files to */
  84.     Command="@"Filespec("Drive", InstallationPathDirectory)" >NUL"
  85.     Command
  86. End
  87.                                         /* Change in the directory */
  88. Command="@CD "InstallationPathDirectory" >NUL"
  89. Command
  90. Say                                     /* Now we start PC/2 with help */
  91. Command="@Start PC2.exe -INSTALL >NUL"
  92. Command
  93. If rc\=0 Then Do
  94.     Say " Sorry, I couldn't start PC/2 for you..."
  95. End
  96. Else Do
  97.     Say " After you have finished reading all help panels exit PC/2 and restart it by"
  98.     Say " clicking on the Desktop with mouse button 1. You will notice that the back-"
  99.     Say " ground behind the icon changed its color and shape if PC/2 is started."
  100. End
  101. Say
  102.                                         /* Now search for CONFIG.SYS and the statement
  103.                                            SET RESTARTOBJECTS=STARTUPFOLDERSONLY */
  104. FoundConfig=FALSE
  105. SearchConfig="C:\CONFIG.SYS D:\CONFIG.SYS E:\CONFIG.SYS F:\CONFIG.SYS G:\CONFIG.SYS"
  106. Do Temp=1 to Words(SearchConfig)
  107.     Call SysFileSearch "STARTUPFOLDERSONLY", Word(SearchConfig, 1), LinesCount
  108.     If LinesCount.0\=0 Then FoundConfig=TRUE
  109. End
  110.                                         /* Inform the user about CONFIG.SYS */
  111. If FoundConfig=TRUE Then Do
  112.     Say " You have the statement SET RESTARTOBJECTS=STARTUPFOLDERSONLY in your"
  113.     Say " Config.Sys. To enable OS/2 to start PC/2 during boot, you have to create"
  114.     Say " a shadow of PC/2 and move it into your startup folder."
  115. End
  116. Else Do
  117.     Say " You don't have the statement SET RESTARTOBJECTS=STARTUPFOLDERSONLY in ypur"
  118.     Say " Config.Sys. OS/2 will start automatically PC/2 during next boot, if PC/2 is"
  119.     Say " active before you Shutdown your System."
  120. End
  121. Say
  122. Say " Press Enter to continue!..."
  123. Pull Ignore
  124. Call DisplayLogo                        /* Display logo panel */
  125.                                         /* Now search for CONFIG.SYS and the statement
  126.                                            SET RUNWORKPLACE=C:\OS2\PMSHELL.EXE */
  127. FoundConfig=FALSE
  128. SearchConfig="C:\CONFIG.SYS D:\CONFIG.SYS E:\CONFIG.SYS F:\CONFIG.SYS G:\CONFIG.SYS"
  129. Do Temp=1 to Words(SearchConfig)
  130.     Call SysFileSearch "SET RUNWORKPLACE=C:\OS2\PMSHELL.EXE", Word(SearchConfig, 1), LinesCount
  131.     If LinesCount.0\=0 Then FoundConfig=TRUE
  132. End
  133.                                         /* Inform the user about CONFIG.SYS */
  134. If FoundConfig=TRUE Then Do
  135.     Say " You have the statement SET RUNWORKPLACE=C:\OS2\PMSHELL.EXE in your"
  136.     Say " Config.Sys. You may replace the WPS by PC/2, please lokk into the help-"
  137.     Say " panels of PC/2 for further information."
  138. End
  139. Else Do
  140.     Say " It seems that you don't run the WPS (WorkPlace Shell). You may use PC/2 as"
  141.     Say " a replacement for the WPS by adding to or modifying your CONFIG.SYS:"
  142.     Say " SET RUNWORKPLACE="InstallationPathDirectory"\PC2.EXE"
  143.     Say " But be sure that PC2HOOK.DLL and PC2.HLP are in a path pointed to by the"
  144.     Say " LIBPATH and HELP environment variable (the '.;' statement is not"
  145.     Say " sufficient. Please look into the help panels of PC/2 for further"
  146.     Say " information."
  147. End
  148. Say
  149. Say " Press Enter to continue!..."
  150. Pull Ignore
  151. Call DisplayLogo                        /* Display logo panel */
  152.                                         /* Inform the user about safety an fee */
  153. Say " Don't forget to backup your configuration file regularily to avoid possible"
  154. Say " damages to your configuration file."
  155. Say
  156. Say " If you find this utility useful and want to honor four weeks of work, you are"
  157. Say " welcome to send me a small fee. Please read the documentation for further"
  158. Say " information - Thank you!"
  159. Say
  160. Say "   And now - enjoy! - And now - enjoy! - And now - enjoy! - And Now - enjoy!"
  161.                                         /* Change to the drive where we installed from */
  162. Command="@"Filespec("Drive", CurrentPathDirectory)" >NUL"
  163. Command
  164.                                         /* Change in the directory */
  165. Command="@CD "Strip(Filespec("Path", CurrentPathDirectory), T, "\")" >NUL"
  166. Command
  167. Exit
  168.  
  169. /*--------------------------------------------------------------------------------------*\
  170.  * Copy files from current directory to destination directory                           *
  171.  * Req:                                                                                 *
  172.  *      FileName ...... File to copy                                                    *
  173.  *      Destination ... Destination directory                                           *
  174.  * Returns:                                                                             *
  175.  *      none                                                                            *
  176. \*--------------------------------------------------------------------------------------*/
  177. FileCopy: Arg FileName, Destination
  178.     
  179. Command='@Copy 'FileName' 'Destination' >NUL'
  180. Command
  181. If rc\=0 Then Do
  182.     Say "Sorry, the files couldn't be copied - exiting..."
  183.     Exit
  184. End
  185. Return
  186.  
  187. /*--------------------------------------------------------------------------------------*\
  188.  * Display the logo lines                                                               *
  189.  * Req:                                                                                 *
  190.  *      none                                                                            *
  191.  * Returns:                                                                             *
  192.  *      none                                                                            *
  193. \*--------------------------------------------------------------------------------------*/
  194. DisplayLogo:
  195. Call SysCls
  196. Say
  197. Say
  198. Say "                 PC/2 - Program Commander/2 Version 1.10 for"
  199. Say "                       IBM OS/2 2.0 Presentation Manager"
  200. Say "                    Copyright (C) by Stangl Roman 01, 1993"
  201. Say
  202. Return
  203.  
  204. /*--------------------------------------------------------------------------------------*\
  205.  * The signal handler to exit after an exception                                        *
  206.  * Req:                                                                                 *
  207.  *      none                                                                            *
  208.  * Returns:                                                                             *
  209.  *      none                                                                            *
  210. \*--------------------------------------------------------------------------------------*/
  211. SignalHandler:
  212. Call SysCls
  213. Say "PC/2 abnormal error - exiting..."
  214. Exit
  215.  
  216.