browser/installer/unix/browser.jst
author hg@mozilla.com
Thu, 22 Mar 2007 10:30:00 -0700
changeset 1 9b2a99adc05e53cd4010de512f50118594756650
permissions -rw-r--r--
Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,

function upgradeCleanup()
{
  // Get rid of Chrome directory cruft.
  deleteThisFolder("Chrome",      "classic");
  deleteThisFolder("Chrome",      "comm");
  deleteThisFolder("Chrome",      "en-mac");
  deleteThisFile("Chrome",        "en-mac.jar");
  deleteThisFolder("Chrome",      "en-unix");
  deleteThisFile("Chrome",        "en-unix.jar");
  deleteThisFolder("Chrome",      "en-US");
  deleteThisFolder("Chrome",      "en-win");
  deleteThisFile("Chrome",        "en-win.jar");
  deleteThisFolder("Chrome",      "US");
  deleteThisFile("Chrome",        "help.jar");

  deleteThisFile("Chrome",        "chrome.rdf");
  deleteThisFile("Chrome",        "installed-chrome.txt");
  deleteThisFile("Chrome",        "app-chrome.manifest");
  deleteThisFolder("Chrome",      "overlayinfo");

  // Remove defunct components and type libraries
  deleteThisFile("Components",    "typeaheadfind.xpt");
  deleteThisFile("Components",    "chrome.xpt");
  deleteThisFile("Components",    "ipcd.xpt");
  deleteThisFile("Components",    "nsUpdateNotifier.js");
  deleteThisFile("Components",    "nsBackgroundUpdateService.js");
  deleteThisFile("Components",    "p3p.xpt");
  deleteThisFile("Components",    "prefmigr.xpt");
  deleteThisFile("Components",    "profilesharingsetup.xpt");
  deleteThisFile("Components",    "related.xpt");
  deleteThisFile("Components",    "ucnative.xpt");
  deleteThisFile("Components",    "util.xpt");
  deleteThisFile("Components",    "compreg.dat");
  deleteThisFile("Components",    "xpti.dat");

  // Remove non-linked xpt files for rev'd interfaces; this prevents a
  // conflict if you had previously installed a zip build in the app directory.
  deleteThisFile("Components",    "autocomplete.xpt");
  
  // Remove defunct defaults files. 
  deleteThisFile("Program",	      "defaults/pref/all.js");
  deleteThisFile("Program",	      "defaults/pref/editor.js");
  deleteThisFile("Program",	      "defaults/pref/mailnews.js");
  deleteThisFile("Program",	      "defaults/pref/non-shared.txt");
  deleteThisFile("Program",	      "defaults/pref/security-prefs.js");
  deleteThisFile("Program",	      "defaults/pref/unix.js");
  deleteThisFile("Program",	      "defaults/pref/xpinstall.js");
  deleteThisFile("Program",	      "defaults/pref/bug307259.js");
  deleteThisFile("Program",	      "defaults/profile/panels.rdf");
  deleteThisFolder("Program",	    "defaults/profile/US");
  
  // Delete dictionary.com search plugin  
  deleteThisFile("Program",     "searchplugins/dictionary.src");
  deleteThisFile("Program",     "searchplugins/dictionary.png");

  // These files are related to app patches and will interfere with the 
  // UA/app version strings if we do not remove them. 
  deleteThisFile("Program",	    "defaults/pref/bug259708.js");
  
  // Remove defunct miscellany
  deleteThisFolder("Program",     "ipc");
  deleteThisFile("Program",       "mangle");
  deleteThisFile("Program",       "mozipcd");
  deleteThisFile("Program",       "regchrome");
  deleteThisFile("Program",       "regxpcom");
  deleteThisFile("Program",       "shlibsign");
}

var srDest = $SpaceRequired$;

var err = initInstall("$ProductName$", "Browser", "$Version$"); 
logComment("initInstall: " + err);

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

if (verifyDiskSpace(communicatorFolder, srDest))
{
    // Call upgradeCleanup() before addDirectory() in case we accidentaly
    // delete files that we happen to be also installing.  This way, if we do,
    // it will just get reinstalled.  This is for safety measure.
    upgradeCleanup();
    err = addDirectory("Program",
                       "$Version$",
                       "bin",              // jar source folder
                       communicatorFolder, // target folder
                       "",                 // target subdir 
                       true );             // force flag 

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

    // create the plugins folder next to mozilla 
    var pluginsFolder = getFolder("Plugins");
    var ignoreErr = dirCreate(pluginsFolder);
    logComment("dirCreate() returned: " + ignoreErr);

    if (err==SUCCESS)
    {
	    err = performInstall(); 
	    logComment("performInstall() returned: " + err);
        if (! ('buildID' in Install))
        {
          logComment("Running Pre-Mozilla 0.9.1");
          initInstall("Post-install Cleanup Utility", "Browser/xpicleanup", "$Version$");
          cleanupUtility = getFolder(communicatorFolder, "xpicleanup");
          err = File.execute(cleanupUtility);
          logComment("execute() returned: " + err);
          err = performInstall();
        }
    }
    else
    {
	    cancelInstall(err);
	    logComment("cancelInstall() due to error: " + err);
    }
}
else
    cancelInstall(INSUFFICIENT_DISK_SPACE);