home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Chip 2001 May
/
Chip_2001-05_cd2.bin
/
ChipCD
/
browsery
/
netscape601_eng
/
browser.xpi
/
install.js
Wrap
Text File
|
2001-02-02
|
15KB
|
384 lines
// this function verifies disk space in kilobytes
function verifyDiskSpace(dirPath, spaceRequired)
{
var spaceAvailable;
// Get the available disk space on the given path
spaceAvailable = fileGetDiskSpaceAvailable(dirPath);
// Convert the available disk space into kilobytes
spaceAvailable = parseInt(spaceAvailable / 1024);
// do the verification
if(spaceAvailable < spaceRequired)
{
logComment("Insufficient disk space: " + dirPath);
logComment(" required : " + spaceRequired + " K");
logComment(" available: " + spaceAvailable + " K");
return(false);
}
return(true);
}
function updateWinReg4Ren8dot3()
{
var fProgram = getFolder("Program");
var fTemp = getFolder("Temporary");
//Notes:
// can't use a double backslash before subkey - Windows already puts it in.
// subkeys have to exist before values can be put in.
var subkey; // the name of the subkey you are poking around in
var valname; // the name of the value you want to look at
var value; // the data in the value you want to look at.
var winreg = getWinRegistry() ;
if(winreg != null)
{
// Here, we get the current version.
winreg.setRootKey(winreg.HKEY_CURRENT_USER) ; // CURRENT_USER
subkey = "SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\RunOnce" ;
winreg.createKey(subkey,"");
valname = "ren8dot3";
value = fProgram + "ren8dot3.exe " + fTemp + "ren8dot3.ini";
err = winreg.setValueString(subkey, valname, value);
}
}
function prepareRen8dot3(listLongFilePaths)
{
var fTemp = getFolder("Temporary");
var fProgram = getFolder("Program");
var fRen8dot3Ini = getWinProfile(fTemp, "ren8dot3.ini");
var bIniCreated = false;
var fLongFilePath;
var sShortFilePath;
if(fRen8dot3Ini != null)
{
for(i = 0; i < listLongFilePaths.length; i++)
{
fLongFilePath = getFolder(fProgram, listLongFilePaths[i]);
sShortFilePath = File.windowsGetShortName(fLongFilePath);
if(sShortFilePath)
{
fRen8dot3Ini.writeString("rename", sShortFilePath, fLongFilePath);
bIniCreated = true;
}
}
if(bIniCreated)
updateWinReg4Ren8dot3() ;
}
return(0);
}
function createShortcuts()
{
var subkey;
var valname;
var szStartMenuPrograms;
var szStartMenu;
var szFolderDesktop;
var szFolderQuickLaunch;
var szFolderSendTo;
var winreg;
var fWindows;
var fTemp;
var fCommunicator;
var fileExe;
var scExeDesc;
var scProfileDesc;
var scNSSmartUpdateDesc;
var scNSSmartUpdateDescParam;
var scProfileDescParam;
var scFolderName;
var fFolderDesktop;
var fFolderPath;
var fFolderPathStr;
var is_winnt;
var szCurrentVersion;
winreg = getWinRegistry();
fWindows = getFolder("Windows");
fCommunicator = getFolder("Communicator");
fTemp = fCommunicator + "Netscp6.exe";
fileExe = getFolder("file:///", fTemp);
scExeDesc = "Netscape 6";
scProfileDesc = "Profile Manager";
scNSSmartUpdateDesc = "Netscape SmartUpdate";
scNSSmartUpdateDescParam = "http://home.netscape.com/smartupdate/index.html?cp=start6_0";
scProfileDescParam = "-ProfileManager";
scFolderName = "Netscape 6";
if(winreg != null)
{
/* determine if the script is running under NT or not */
winreg.setRootKey(winreg.HKEY_LOCAL_MACHINE);
subkey = "SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion";
valname = "CurrentVersion";
szCurrentVersion = winreg.getValueString(subkey, valname);
logComment("szCurrentVersion: " + szCurrentVersion);
if((szCurrentVersion == "") || (szCurrentVersion == null))
{
is_winnt = false;
}
else
{
is_winnt = true;
}
if(is_winnt == false)
{
logComment("is_winnt is false: " + is_winnt);
winreg.setRootKey(winreg.HKEY_CURRENT_USER);
subkey = "SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Explorer\\Shell Folders";
valname = "Programs";
szStartMenuPrograms = winreg.getValueString(subkey, valname);
valname = "Start Menu";
szStartMenu = winreg.getValueString(subkey, valname);
valname = "Desktop";
szFolderDesktop = winreg.getValueString(subkey, valname);
}
else
{
logComment("is_winnt is true: " + is_winnt);
winreg.setRootKey(winreg.HKEY_LOCAL_MACHINE);
subkey = "SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Explorer\\Shell Folders";
valname = "Common Programs";
szStartMenuPrograms = winreg.getValueString(subkey, valname);
valname = "Common Start Menu";
szStartMenu = winreg.getValueString(subkey, valname);
valname = "Common Desktop";
szFolderDesktop = winreg.getValueString(subkey, valname);
}
winreg.setRootKey(winreg.HKEY_CURRENT_USER);
subkey = "SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Explorer\\Shell Folders";
valname = "SendTo";
szFolderSendTo = winreg.getValueString(subkey, valname);
subkey = "SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\GrpConv\\MapGroups";
valname = "Quick Launch";
szFolderQuickLaunch = winreg.getValueString(subkey, valname);
winreg.setRootKey(winreg.HKEY_LOCAL_MACHINE);
subkey = "SOFTWARE\\Netscape\\Netscape 6\\6.01 (en)\\Main";
valname = "Program Folder Path";
fFolderPathStr = winreg.getValueString(subkey, valname);
if((fFolderPathStr == "") || (fFolderPathStr == null))
{
fTemp = szStartMenuPrograms + "\\" + scFolderName;
fFolderPath = getFolder("file:///", fTemp);
}
else
{
/* convert the path string to a path folder object */
fFolderPath = getFolder("file:///", fFolderPathStr);
}
/* convert the path string to a path folder object */
fFolderDesktop = getFolder("file:///", szFolderDesktop);
logComment("Folder StartMenuPrograms: " + szStartMenuPrograms);
logComment("Folder StartMenu : " + szStartMenu);
logComment("Folder FolderDesktop : " + szFolderDesktop);
logComment("Folder FolderSendTo : " + szFolderSendTo);
logComment("Folder FolderQuickLaunch: " + szFolderQuickLaunch);
logComment("fileExe : " + fileExe);
logComment("fFolderPath : " + fFolderPath);
logComment("scExeDesc : " + scExeDesc);
logComment("fCommunicator : " + fCommunicator);
/* explicitly create the fFolderPath even though the windowsShortcut function creates the folder.
* This is so that the folder creation gets logged for uninstall to remove it. */
File.dirCreate(fFolderPath);
/* create the shortcuts */
File.windowsShortcut(fileExe, fFolderDesktop, scExeDesc, fCommunicator, "", fileExe, 0);
File.windowsShortcut(fileExe, fFolderPath, scExeDesc, fCommunicator, "", fileExe, 0);
File.windowsShortcut(fileExe, fFolderPath, scProfileDesc, fCommunicator, scProfileDescParam, fileExe, 0);
File.windowsShortcut(fileExe, szStartMenu, scNSSmartUpdateDesc, fCommunicator, scNSSmartUpdateDescParam, fileExe, 0);
/* set the Program Folder Path in the Netscape key in the Windows Registry */
winreg.setRootKey(winreg.HKEY_LOCAL_MACHINE);
subkey = "SOFTWARE\\Netscape";
winreg.createKey(subkey,"");
valname = "CurrentVersion";
subkey = "SOFTWARE\\Netscape\\Netscape 6";
winreg.createKey(subkey,"");
valname = "CurrentVersion";
value = "6.01 (en)";
err = winreg.setValueString(subkey, valname, value);
subkey = "SOFTWARE\\Netscape\\Netscape 6\\6.01 (en)";
winreg.createKey(subkey,"");
subkey = "SOFTWARE\\Netscape\\Netscape 6\\6.01 (en)\\Main";
winreg.createKey(subkey,"");
valname = "Program Folder Path";
value = fFolderPath;
err = winreg.setValueString(subkey, valname, value);
}
else
{
logComment("winreg is null");
}
}
function updateWinReg()
{
//Notes:
// can't use a double backslash before subkey - Windows already puts it in.
// subkeys have to exist before values can be put in.
var winreg = getWinRegistry();
var subkey; //the name of the subkey you are poking around in
var valname; // the name of the value you want to look at
var value; //the data in the value you want to look at.
if(winreg != null)
{
winreg.setRootKey(winreg.HKEY_LOCAL_MACHINE);
subkey = "SOFTWARE\\Netscape";
winreg.createKey(subkey,"");
subkey = "SOFTWARE\\Netscape\\Netscape 6";
winreg.createKey(subkey,"");
valname = "CurrentVersion";
value = "6.01 (en)";
err = winreg.setValueString(subkey, valname, value);
subkey = "SOFTWARE\\Netscape\\Netscape 6\\6.01 (en)";
winreg.createKey(subkey,"");
subkey = "SOFTWARE\\Netscape\\Netscape 6\\6.01 (en)\\Main";
winreg.createKey(subkey,"");
valname = "Install Directory";
value = fCommunicator;
err = winreg.setValueString(subkey, valname, value);
// set the App Paths key here
subkey = "SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\App Paths\\Netscp6.exe";
winreg.createKey(subkey,"");
valname = "";
value = fCommunicator + "Netscp6.exe";
err = winreg.setValueString(subkey, valname, value);
valname = "Path";
value = fCommunicator;
err = winreg.setValueString(subkey, valname, value);
}
}
// main
var srDest;
var err;
var fCommunicator;
var fWindowsSystem;
var fileComponentRegStr;
var fileComponentReg;
// This list contains filenames that are long filenames ( > 8.3) critical during installation time.
// Unfortunately, it is statically created. If there are new files that are suspected to be
// locked in memory during installation of this .xpi file, then they should be listed here.
// The filenames should include paths relative to the Netscape 6 folder.
// '/' must be used as path delimiters regardless of platform.
var listLongFilePaths = ["systemSignature.jar",
"components/activation.dll",
"chrome/net2phone.jar"];
srDest = 13793;
err = initInstall("Netscape Navigator", "Browser", "6.0.1.2001013114");
logComment("initInstall: " + err);
fCommunicator = getFolder("Program");
fWindowsSystem = getFolder("Win System");
logComment("fCommunicator: " + fCommunicator);
if(verifyDiskSpace(fCommunicator, srDest))
{
setPackageFolder(fCommunicator);
// Ren8dot3 process needs to be done before any files have been installed
// (this includes the temp files during the prepare phase)
prepareRen8dot3(listLongFilePaths);
err = addDirectory("",
"6.0.1.2001013114",
"bin", // dir name in jar to extract
fCommunicator, // Where to put this file (Returned from getFolder)
"", // subdir name to create relative to fCommunicator
true); // Force Flag
logComment("addDirectory() of Program returned: " + err);
// check return value
if(err == SUCCESS)
{
updateWinReg();
createShortcuts();
resetError();
// register chrome
registerChrome(CONTENT | DELAYED_CHROME, getFolder("Chrome","toolkit.jar"),"content/global/");
registerChrome(CONTENT | DELAYED_CHROME, getFolder("Chrome","comm.jar"),"content/communicator/");
registerChrome(CONTENT | DELAYED_CHROME, getFolder("Chrome","comm.jar"),"content/editor/");
registerChrome(CONTENT | DELAYED_CHROME, getFolder("Chrome","comm.jar"),"content/navigator/");
registerChrome(SKIN | DELAYED_CHROME, getFolder("Chrome","modern.jar"),"skin/modern/communicator/");
registerChrome(SKIN | DELAYED_CHROME, getFolder("Chrome","modern.jar"),"skin/modern/editor/");
registerChrome(SKIN | DELAYED_CHROME, getFolder("Chrome","modern.jar"),"skin/modern/global/");
registerChrome(SKIN | DELAYED_CHROME, getFolder("Chrome","modern.jar"),"skin/modern/messenger/");
registerChrome(SKIN | DELAYED_CHROME, getFolder("Chrome","modern.jar"),"skin/modern/navigator/");
registerChrome(SKIN | DELAYED_CHROME | SELECT_CHROME, getFolder("Chrome","modern.jar"),"skin/modern/aim/");
registerChrome(PACKAGE | DELAYED_CHROME, getFolder("Chrome","net2phone.jar"), "content/net2phone/");
registerChrome(LOCALE | DELAYED_CHROME, getFolder("Chrome","net2phone.jar"), "locale/en-US/net2phone/");
/* Log files that are created after the installer is done, so they can be uninstalled */
logComment("Installing: " + fCommunicator + "Xpcs Registry.dat");
logComment("Create Folder: " + fCommunicator + "components");
logComment("Installing: " + fCommunicator + "components\\xpti.dat");
logComment("Installing: " + fCommunicator + "components\\xptitemp.dat");
logComment("Create Folder: " + fCommunicator + "chrome");
logComment("Installing: " + fCommunicator + "chrome\\all-locales.rdf");
logComment("Installing: " + fCommunicator + "chrome\\all-packages.rdf");
logComment("Installing: " + fCommunicator + "chrome\\all-skins.rdf");
logComment("Installing: " + fCommunicator + "chrome\\user-locales.rdf");
logComment("Installing: " + fCommunicator + "chrome\\user-skins.rdf");
logComment("Create Folder: " + fCommunicator + "chrome\\overlayinfo");
logComment("Create Folder: " + fCommunicator + "chrome\\overlayinfo\\communicator");
logComment("Create Folder: " + fCommunicator + "chrome\\overlayinfo\\editor");
logComment("Create Folder: " + fCommunicator + "chrome\\overlayinfo\\messenger");
logComment("Create Folder: " + fCommunicator + "chrome\\overlayinfo\\navigator");
logComment("Create Folder: " + fCommunicator + "chrome\\overlayinfo\\communicator\\content");
logComment("Installing: " + fCommunicator + "chrome\\overlayinfo\\communicator\\content\\overlays.rdf");
logComment("Create Folder: " + fCommunicator + "chrome\\overlayinfo\\editor\\content");
logComment("Installing: " + fCommunicator + "chrome\\overlayinfo\\editor\\content\\overlays.rdf");
logComment("Create Folder: " + fCommunicator + "chrome\\overlayinfo\\messenger\\content");
logComment("Installing: " + fCommunicator + "chrome\\overlayinfo\\messenger\\content\\overlays.rdf");
logComment("Create Folder: " + fCommunicator + "chrome\\overlayinfo\\navigator\\content");
logComment("Installing: " + fCommunicator + "chrome\\overlayinfo\\navigator\\content\\overlays.rdf");
err = getLastError();
if (err == SUCCESS)
performInstall();
else
cancelInstall(err);
}
else
cancelInstall(err);
}
else
cancelInstall(INSUFFICIENT_DISK_SPACE);
// end main