home *** CD-ROM | disk | FTP | other *** search
/ Network Support Encyclopedia 96-1 / novell-nsepro-1996-1-cd2.iso / download / netware / vlmkt6.exe / WS_DONE.CPF < prev    next >
Text File  |  1993-09-28  |  5KB  |  207 lines

  1. /*
  2. **      Copyright (c) 1992 Novell, Inc.  All Rights Reserved.
  3. **
  4. **      THIS WORK IS SUBJECT TO U.S. AND INTERNATIONAL COPYRIGHT LAWS 
  5. **      AND TREATIES. NO PART OF THIS WORK MAY BE USED, PRACTICED, 
  6. **      PERFORMED COPIED, DISTRIBUTED, REVISED, MODIFIED, TRANSLATED, 
  7. **      ABRIDGED, CONDENSED, EXPANDED, COLLECTED, COMPILED, LINKED, 
  8. **      RECAST, TRANSFORMED OR ADAPTED WITHOUT THE PRIOR WRITTEN CONSENT
  9. **      OF NOVELL, INC.  ANY USE OR EXPLOITATION OF THIS WORK WITHOUT 
  10. **      AUTHORIZATION COULD SUBJECT THE PERPETRATOR TO CRIMINAL AND CIVIL
  11. **      LIABILITY.
  12. */
  13.  
  14. syntax (1.1); 
  15.  
  16. component (
  17.     /* CompID     */    WS_DONE,
  18.     /* CompVer    */    4.1,
  19.     /* CompStatus */    Retail
  20. );
  21.  
  22.     int    found;
  23.     int    sourceVersion;
  24.     int    targetVersion;
  25.     string    pathLANWP_BAT;
  26.     string    fileName[6];
  27.     string    fileExt[6];
  28.     int    limit;
  29.     int    i;
  30.     int    f;
  31.     string    sourceFile;
  32.     string    targetFile;
  33.     string    editedFile;
  34.     int    fh;        /* File handle for fopen, etc. */
  35.     string    command;
  36.     int    rc;
  37.  
  38.  
  39. /*
  40. ====================================================================
  41. =  Get the boot disk back in the FDU if workstation boots by FDU.  =
  42. ====================================================================
  43. */
  44. if (bootType == BOOT_BY_FDU) {
  45.     found = 0;
  46.     do {
  47.         PushHelpContext (INSERT_BOOT_DISK_HELP);
  48.         DisplayInformation (NO_MESSAGE, 18, 0, INSERT_BOOT_DISKETTE);
  49.         PopHelpContext();
  50.  
  51.         if (IsFile (bootDrive + "\\IO.SYS") &&
  52.             IsFile (bootDrive + "\\MSDOS.SYS")) {
  53.             found = 1;
  54.         } /* end if */
  55.         if (IsFile (bootDrive + "\\IBMBIO.COM") &&
  56.             IsFile (bootDrive + "\\IBMDOS.COM")) {
  57.             found = 1;
  58.         } /* end if */
  59.     } while (!found);
  60. } /* end if */
  61.  
  62.  
  63. /*
  64. ========================================
  65. =  Save the existing \LANWP.BAT file.  =
  66. ========================================
  67. */
  68. pathLANWP_BAT = bootDrive + "\\lanwp.bat";
  69. if (IsFile (pathLANWP_BAT)) {
  70.     pathLANWP_BAT = bootDrive + "\\olanwp.bat";
  71.  
  72.     i = 0;
  73.     while (IsFile (pathLANWP_BAT)) {
  74.         pathLANWP_BAT = bootDrive + "\\olanwp" + itoa (i, 10) + ".bat";
  75.  
  76.         i = i + 1;
  77.     } /* end while */
  78.  
  79.     rename (bootDrive + "\\lanwp.bat", pathLANWP_BAT);
  80. } /* end if */
  81.  
  82. if (copy (GetTempDir() + "\\lanwp.bat", bootDrive + "\\lanwp.bat")) {
  83.     DisplayErrorCondition (FATAL);
  84. } /* end if */
  85.  
  86.  
  87. /*
  88. =====================================================
  89. =  Copy the system files based on the update flag.  =
  90. =====================================================
  91. */
  92. fileName[0] = bootDrive + "\\AUTOEXEC";
  93. if (req40) {
  94.     fileName[1] = req40PATH + "NET";
  95. } else {
  96.     fileName[1] = bootDrive + "\\NET";
  97. }
  98. fileName[2] = windowsDirectory + "\\SYSTEM";
  99.  
  100. fileExt[0] = ".BAT";
  101. fileExt[1] = ".CFG";
  102. fileExt[2] = ".INI";
  103.  
  104. f = (bootType == BOOT_BY_RPL) ? 1 : 0;
  105. limit = (WS_LWP_W) ? 2 : 1;
  106. do {
  107.     sourceFile = fileName[f] + fileExt[f];
  108.     targetFile = fileName[f] + ".LWP";
  109.  
  110.     i = 0;
  111.     while ((i <= 9) && IsFile (targetFile)) {
  112.         targetFile = fileName[f] + ".LW" + itoa (i, 10);
  113.         i = i + 1;
  114.     } /* end while */
  115.  
  116.     if (f == 0) {
  117.         editedFile = pathAUTOEXEC_BAT;
  118.     } else if (f == 1) {
  119.         editedFile = pathNET_CFG;
  120.     } else if (f == 2) {
  121.         editedFile = pathSYSTEM_INI;
  122.     } /* end if */
  123.  
  124.     if (updateSystemFiles) {
  125.         if (IsFile (sourceFile)) {
  126.             if (copy (sourceFile, targetFile)) {
  127.                 DisplayErrorCondition (FATAL);
  128.             } /* end if */
  129.         } /* end if */
  130.  
  131.         if (IsFile (editedFile)) {
  132.             if (copy (editedFile, sourceFile)) {
  133.                 DisplayErrorCondition (FATAL);
  134.             } /* end if */
  135.         } /* end if */
  136.  
  137.         if (IsFile (targetFile)) {
  138.             if (copy (targetFile, editedFile)) {
  139.                 DisplayErrorCondition (FATAL);
  140.             } /* end if */
  141.         } /* end if */
  142.     } else {
  143.         if (IsFile (editedFile)) {
  144.             if (copy (editedFile, targetFile)) {
  145.                 DisplayErrorCondition (FATAL);
  146.             } /* end if */
  147.         } /* end if */
  148.  
  149.         if (IsFile (sourceFile)) {
  150.             if (copy (sourceFile, editedFile)) {
  151.                 DisplayErrorCondition (FATAL);
  152.             } /* end if */
  153.         } /* end if */
  154.     } /* end if */
  155.  
  156.     f = f + 1;
  157. } while (f <= limit);
  158.  
  159.  
  160. /*
  161. ====================================
  162. =  Create the uninstall.bat file.  =
  163. ====================================
  164. */
  165. fileName[0] = bootDrive + "\\autoexec.bat";
  166.  
  167. if (req40) fileName[1] = req40PATH + "net.cfg";
  168. else fileName[1] = bootDrive + "\\net.cfg";
  169.  
  170. fileName[2] = windowsDirectory + "\\system.ini";
  171.  
  172. fh = fopen (targetPath + "\\INSTALL\\uninstal.bat", "w");
  173. rc = fputs ("echo off", fh);
  174.  
  175. if (bootType == BOOT_BY_FDU) {
  176.     rc = fputs ("echo " + GetMessage (BOOT_DISK_PROMPT), fh);
  177.     rc = fputs ("pause", fh);
  178. } /* end if */
  179.  
  180. command = "copy " + targetPath + "\\INSTALL\\";
  181.  
  182. if (bootType != BOOT_BY_RPL) {
  183.     rc = fputs (command + "autoexec.bat " + fileName[0], fh);
  184. } /* end if */
  185.  
  186. rc = fputs (command + "net.cfg " + fileName[1], fh);
  187.  
  188. if (WS_LWP_W) {
  189.     rc = fputs (command + "system.ini "   + fileName[2], fh);
  190. } /* end if */
  191.  
  192. rc = fclose (fh);
  193.  
  194.  
  195. /*
  196. ======================
  197. =  Hey, we're done.  =
  198. ======================
  199. */
  200. if (updateSystemFiles) {
  201.     DisplayHelp (WS_DONE_UPDATE_HELP);  
  202.     PushHelpContext (WS_DONE_UPDATE_HELP);
  203. } else {
  204.     DisplayHelp (WS_DONE_NO_UPDATE_HELP);  
  205.     PushHelpContext (WS_DONE_NO_UPDATE_HELP);
  206. } /* end if */
  207.