home *** CD-ROM | disk | FTP | other *** search
/ PC Welt 2001 January / PC-WELT 01-2001.ISO / software / linux / netscap6 / xpi / jre.xpi / install.js next >
Encoding:
JavaScript  |  2000-11-08  |  1.8 KB  |  63 lines

  1. // this function verifies disk space in kilobytes
  2. function verifyDiskSpace(dirPath, spaceRequired)
  3. {
  4.   var spaceAvailable;
  5.  
  6.   // Get the available disk space on the given path
  7.   spaceAvailable = fileGetDiskSpaceAvailable(dirPath);
  8.  
  9.   // Convert the available disk space into kilobytes
  10.   spaceAvailable = parseInt(spaceAvailable / 1024);
  11.  
  12.   // do the verification
  13.   if(spaceAvailable < spaceRequired)
  14.   {
  15.     logComment("Insufficient disk space: " + dirPath);
  16.     logComment("  required : " + spaceRequired + " K");
  17.     logComment("  available: " + spaceAvailable + " K");
  18.     return(false);
  19.   }
  20.  
  21.   return(true);
  22. }
  23.  
  24. var srDest = 40098;
  25.  
  26. var err = initInstall("Sun Java 2", "/Sun/Java2", "1.3"); 
  27. logComment("initInstall: " + err);
  28.  
  29. var fPlugins= getFolder("Plugins");
  30. logComment("plugins folder: " + fPlugins);
  31.  
  32. if (verifyDiskSpace(fPlugins, srDest))
  33. {
  34.     err = addDirectory("JRE_Plugin_Linux_i386",
  35.                        "1.3",
  36.                        "jre-image-i386",   // jar source folder 
  37.                        fPlugins,           // target folder 
  38.                        "java2",            // target subdir 
  39.                        true );             // force flag 
  40.  
  41.     logComment("addDirectory() returned: " + err);
  42.  
  43.     // create symlink: plugins/libjavaplugin_oji.so ->
  44.     //                 plugins/java2/plugin/i386/libjavaplugin_oji.so
  45.     var lnk = fPlugins + "libjavaplugin_oji.so";
  46.     var tgt = fPlugins + "java2/plugin/i386/ns600/libjavaplugin_oji.so";
  47.     var ignoreErr = execute("symlink.sh", tgt + " " + lnk);
  48.     logComment("execute symlink.sh "+tgt+" "+lnk+" returned: "+ignoreErr);
  49.  
  50.     if (err==SUCCESS)
  51.     {
  52.         err = performInstall(); 
  53.         logComment("performInstall() returned: " + err);
  54.     }
  55.     else
  56.     {
  57.         cancelInstall(err);
  58.         logComment("cancelInstall() returned: " + err);
  59.     }
  60. }
  61. else
  62.     cancelInstall(INSUFFICIENT_DISK_SPACE);
  63.