gpt4all/gpt4all-chat/cmake/installerscript.qs

69 lines
2.8 KiB
Plaintext
Raw Normal View History

2023-04-22 03:23:57 +00:00
function Component() {
}
2023-04-22 03:23:57 +00:00
var targetDirectory;
Component.prototype.beginInstallation = function() {
targetDirectory = installer.value("TargetDir");
};
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-24 03:42:55 +00:00
targetDirectory + "/bin/chat.exe",
2023-04-13 16:01:31 +00:00
"@UserProfile@/Desktop/GPT4All.lnk",
2023-04-22 03:23:57 +00:00
"workingDirectory=" + targetDirectory + "/bin",
"iconPath=" + targetDirectory + "/favicon.ico",
"iconId=0", "description=Open GPT4All");
} catch (e) {
print("ERROR: creating desktop shortcut" + e);
}
component.addOperation("CreateShortcut",
2023-04-24 03:42:55 +00:00
targetDirectory + "/bin/chat.exe",
2023-04-13 16:01:31 +00:00
"@StartMenuDir@/GPT4All.lnk",
2023-04-22 03:23:57 +00:00
"workingDirectory=" + targetDirectory + "/bin",
"iconPath=" + targetDirectory + "/favicon.ico",
"iconId=0", "description=Open GPT4All");
} else if (systemInfo.productType === "osx") {
2023-04-29 01:48:10 +00:00
var gpt4allAppPath = targetDirectory + "/bin/gpt4all.app";
2023-04-29 01:26:38 +00:00
var symlinkPath = targetDirectory + "/../GPT4All.app";
// Remove the symlink if it already exists
component.addOperation("Execute", "rm", "-f", symlinkPath);
// Create the symlink
component.addOperation("Execute", "ln", "-s", gpt4allAppPath, symlinkPath);
} else { // linux
2023-04-22 03:23:57 +00: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-24 03:42:55 +00:00
"/bin/chat\"\nName=GPT4All\nIcon=" + targetDirectory +
2023-04-22 03:23:57 +00:00
"/logo-48.png\nName[en_US]=GPT4All");
}
}
} catch (e) {
2023-04-22 03:23:57 +00:00
print("ERROR: running post installscript.qs" + e);
}
2023-04-13 10:55:00 +00:00
}
2023-04-29 01:51:39 +00:00
Component.prototype.createOperationsForArchive = function(archive)
{
component.createOperationsForArchive(archive);
if (systemInfo.productType === "osx") {
2023-04-29 02:28:11 +00:00
var uninstallTargetDirectory = installer.value("TargetDir");
var symlinkPath = uninstallTargetDirectory + "/../GPT4All.app";
2023-04-29 01:51:39 +00:00
// Remove the symlink during uninstallation
if (installer.isUninstaller()) {
component.addOperation("Execute", "rm", "-f", symlinkPath, "UNDOEXECUTE");
}
2023-04-29 01:51:39 +00:00
}
}