mozilla

Installer Script

 1. // this function verifies disk space in kilobytes
 2. function verifyDiskSpace(dirPath, spaceRequired)
 3. {
 4.   var spaceAvailable;

 5.   // Get the available disk space on the given path
 6.   spaceAvailable = fileGetDiskSpaceAvailable(dirPath);

 7.   // Convert the available disk space into kilobytes
 8.   spaceAvailable = parseInt(spaceAvailable / 1024);

 9.   // do the verification
10.   if(spaceAvailable < spaceRequired)
11.   {
12.     logComment("Insufficient disk space: " + dirPath);
13.     logComment("  required : " + spaceRequired + " K");
14.     logComment("  available: " + spaceAvailable + " K");
15.     return(false);
16.   }

17.   return(true);
18. }

19. var srDest = 17311;

20. var err = initInstall("Netscape Seamonkey", "Browser", "6.0.0.2000110807"); 
21. logComment("initInstall: " + err);

22. var communicatorFolder = getFolder("Program");
23. logComment("communicatorFolder: " + communicatorFolder);

24. if (verifyDiskSpace(communicatorFolder, srDest))
25. {
26.     err = addDirectory("Program",
27.                        "6.0.0.2000110807",
28.                        "bin",              // jar source folder
29.                        communicatorFolder, // target folder
30.                        "",                 // target subdir 
31.                        true );             // force flag 

32.     logComment("addDirectory() returned: " + err);

33.     // create the plugins folder next to mozilla 
34.     var pluginsFolder = getFolder("Plugins");
35.     if (!fileExists(pluginsFolder))
36.     {
37.         var ignoreErr = dirCreate(pluginsFolder);
38.         logComment("dirCreate() returned: " + ignoreErr);
39.     }
40.     else
41.         logComment("Plugins folder already exists");

42.     var cf = getFolder("Chrome");
43.     registerChrome(CONTENT | DELAYED_CHROME, getFolder(cf,"toolkit.xpi"),"content/global/");
44.     registerChrome(CONTENT | DELAYED_CHROME, getFolder(cf,"browser.xpi"),"content/communicator/");
45.     registerChrome(CONTENT | DELAYED_CHROME, getFolder(cf,"browser.xpi"),"content/editor/");
46.     registerChrome(CONTENT | DELAYED_CHROME, getFolder(cf,"browser.xpi"),"content/navigator/");
47.     registerChrome(SKIN | DELAYED_CHROME, getFolder(cf,"modern.jar"),"skin/modern/communicator/");
48.     registerChrome(SKIN | DELAYED_CHROME, getFolder(cf,"modern.jar"),"skin/modern/editor/");
49.     registerChrome(SKIN | DELAYED_CHROME, getFolder(cf,"modern.jar"),"skin/modern/global/");
50.     registerChrome(SKIN | DELAYED_CHROME, getFolder(cf,"modern.jar"),"skin/modern/messenger/");
51.     registerChrome(SKIN | DELAYED_CHROME, getFolder(cf,"modern.jar"),"skin/modern/navigator/");
52.     registerChrome(SKIN | DELAYED_CHROME, getFolder(cf,"modern.jar"),"skin/modern/aim/");
53.     registerChrome(SKIN | DELAYED_CHROME, getFolder(cf,"classic.jar"),"skin/classic/communicator/");
54.     registerChrome(SKIN | DELAYED_CHROME, getFolder(cf,"classic.jar"),"skin/classic/editor/");
55.     registerChrome(SKIN | DELAYED_CHROME, getFolder(cf,"classic.jar"),"skin/classic/global/");
56.     registerChrome(SKIN | DELAYED_CHROME, getFolder(cf,"classic.jar"),"skin/classic/messenger/");
57.     registerChrome(SKIN | DELAYED_CHROME, getFolder(cf,"classic.jar"),"skin/classic/navigator/");
58.     registerChrome(SKIN | DELAYED_CHROME, getFolder(cf,"classic.jar"),"skin/classic/aim/");


59.     if (err==SUCCESS)
60.     {
61. 	    err = performInstall(); 
62.     	logComment("performInstall() returned: " + err);
63.     }
64.     else
65.     {
66. 	    cancelInstall(err);
67.     	logComment("cancelInstall() due to error: " + err);
68.     }
69. }
70. else
71.     cancelInstall(INSUFFICIENT_DISK_SPACE);

Document Tags and Contributors

Contributors to this page: Sheppy, Anguis
Last updated by: Sheppy,
Hide Sidebar