2023-04-21 23:23:57 -04:00
|
|
|
function Component() {
|
2023-04-12 15:31:21 -04:00
|
|
|
}
|
|
|
|
|
2023-04-21 23:23:57 -04:00
|
|
|
var targetDirectory;
|
|
|
|
Component.prototype.beginInstallation = function() {
|
|
|
|
targetDirectory = installer.value("TargetDir");
|
|
|
|
};
|
|
|
|
|
2023-04-12 15:31:21 -04:00
|
|
|
Component.prototype.createOperations = function()
|
|
|
|
{
|
|
|
|
try {
|
|
|
|
// call the base create operations function
|
|
|
|
component.createOperations();
|
|
|
|
if (systemInfo.productType === "windows") {
|
|
|
|
try {
|
|
|
|
var userProfile = installer.environmentVariable("USERPROFILE");
|
|
|
|
installer.setValue("UserProfile", userProfile);
|
|
|
|
component.addOperation("CreateShortcut",
|
2023-04-23 23:42:55 -04:00
|
|
|
targetDirectory + "/bin/chat.exe",
|
2023-04-13 12:01:31 -04:00
|
|
|
"@UserProfile@/Desktop/GPT4All.lnk",
|
2023-04-21 23:23:57 -04:00
|
|
|
"workingDirectory=" + targetDirectory + "/bin",
|
|
|
|
"iconPath=" + targetDirectory + "/favicon.ico",
|
|
|
|
"iconId=0", "description=Open GPT4All");
|
2023-04-12 15:31:21 -04:00
|
|
|
} catch (e) {
|
|
|
|
print("ERROR: creating desktop shortcut" + e);
|
|
|
|
}
|
|
|
|
component.addOperation("CreateShortcut",
|
2023-04-23 23:42:55 -04:00
|
|
|
targetDirectory + "/bin/chat.exe",
|
2023-04-13 12:01:31 -04:00
|
|
|
"@StartMenuDir@/GPT4All.lnk",
|
2023-04-21 23:23:57 -04:00
|
|
|
"workingDirectory=" + targetDirectory + "/bin",
|
|
|
|
"iconPath=" + targetDirectory + "/favicon.ico",
|
|
|
|
"iconId=0", "description=Open GPT4All");
|
2023-04-12 15:31:21 -04:00
|
|
|
} else if (systemInfo.productType === "osx") {
|
2023-04-28 21:48:10 -04:00
|
|
|
var gpt4allAppPath = targetDirectory + "/bin/gpt4all.app";
|
2023-04-28 21:26:38 -04:00
|
|
|
var symlinkPath = targetDirectory + "/../GPT4All.app";
|
2023-04-28 21:19:12 -04:00
|
|
|
// Remove the symlink if it already exists
|
|
|
|
component.addOperation("Execute", "rm", "-f", symlinkPath);
|
|
|
|
// Create the symlink
|
|
|
|
component.addOperation("Execute", "ln", "-s", gpt4allAppPath, symlinkPath);
|
2023-04-12 15:31:21 -04:00
|
|
|
} else { // linux
|
2023-04-21 23:23:57 -04:00
|
|
|
var homeDir = installer.environmentVariable("HOME");
|
|
|
|
if (!installer.fileExists(homeDir + "/Desktop/GPT4All.desktop")) {
|
|
|
|
component.addOperation("CreateDesktopEntry",
|
|
|
|
homeDir + "/Desktop/GPT4All.desktop",
|
|
|
|
"Type=Application\nTerminal=false\nExec=\"" + targetDirectory +
|
2023-04-23 23:42:55 -04:00
|
|
|
"/bin/chat\"\nName=GPT4All\nIcon=" + targetDirectory +
|
2023-04-21 23:23:57 -04:00
|
|
|
"/logo-48.png\nName[en_US]=GPT4All");
|
|
|
|
}
|
2023-04-12 15:31:21 -04:00
|
|
|
}
|
|
|
|
} catch (e) {
|
2023-04-21 23:23:57 -04:00
|
|
|
print("ERROR: running post installscript.qs" + e);
|
2023-04-12 15:31:21 -04:00
|
|
|
}
|
2023-04-13 06:55:00 -04:00
|
|
|
}
|
2023-04-28 21:51:39 -04:00
|
|
|
|
|
|
|
Component.prototype.createOperationsForArchive = function(archive)
|
|
|
|
{
|
|
|
|
component.createOperationsForArchive(archive);
|
|
|
|
|
|
|
|
if (systemInfo.productType === "osx") {
|
2023-04-28 22:28:11 -04:00
|
|
|
var uninstallTargetDirectory = installer.value("TargetDir");
|
|
|
|
var symlinkPath = uninstallTargetDirectory + "/../GPT4All.app";
|
2023-04-28 21:51:39 -04:00
|
|
|
|
|
|
|
// Remove the symlink during uninstallation
|
2023-04-28 22:07:37 -04:00
|
|
|
if (installer.isUninstaller()) {
|
|
|
|
component.addOperation("Execute", "rm", "-f", symlinkPath, "UNDOEXECUTE");
|
|
|
|
}
|
2023-04-28 21:51:39 -04:00
|
|
|
}
|
|
|
|
}
|