mirror of
https://github.com/nomic-ai/gpt4all.git
synced 2025-09-06 19:10:15 +00:00
Sign maintenancetool.app on macOS (#3391)
Signed-off-by: Jared Van Bortel <jared@nomic.ai> Signed-off-by: AT <manyoso@users.noreply.github.com> Co-authored-by: AT <manyoso@users.noreply.github.com>
This commit is contained in:
67
gpt4all-chat/cmake/installer_gpt4all_component.qs
Normal file
67
gpt4all-chat/cmake/installer_gpt4all_component.qs
Normal file
@@ -0,0 +1,67 @@
|
||||
function Component() {
|
||||
}
|
||||
|
||||
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",
|
||||
targetDirectory + "/bin/chat.exe",
|
||||
"@UserProfile@/Desktop/GPT4All.lnk",
|
||||
"workingDirectory=" + targetDirectory + "/bin",
|
||||
"iconPath=" + targetDirectory + "/gpt4all.ico",
|
||||
"iconId=0", "description=Open GPT4All");
|
||||
} catch (e) {
|
||||
print("ERROR: creating desktop shortcut" + e);
|
||||
}
|
||||
component.addOperation("CreateShortcut",
|
||||
targetDirectory + "/bin/chat.exe",
|
||||
"@StartMenuDir@/GPT4All.lnk",
|
||||
"workingDirectory=" + targetDirectory + "/bin",
|
||||
"iconPath=" + targetDirectory + "/gpt4all.ico",
|
||||
"iconId=0", "description=Open GPT4All");
|
||||
} else if (systemInfo.productType === "macos") {
|
||||
var gpt4allAppPath = targetDirectory + "/bin/gpt4all.app";
|
||||
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
|
||||
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 +
|
||||
"/bin/chat\"\nName=GPT4All\nIcon=" + targetDirectory +
|
||||
"/gpt4all-48.png\nName[en_US]=GPT4All");
|
||||
}
|
||||
}
|
||||
} catch (e) {
|
||||
print("ERROR: running post installscript.qs" + e);
|
||||
}
|
||||
}
|
||||
|
||||
Component.prototype.createOperationsForArchive = function(archive)
|
||||
{
|
||||
component.createOperationsForArchive(archive);
|
||||
|
||||
if (systemInfo.productType === "macos") {
|
||||
var uninstallTargetDirectory = installer.value("TargetDir");
|
||||
var symlinkPath = uninstallTargetDirectory + "/../GPT4All.app";
|
||||
|
||||
// Remove the symlink during uninstallation
|
||||
if (installer.isUninstaller()) {
|
||||
component.addOperation("Execute", "rm", "-f", symlinkPath, "UNDOEXECUTE");
|
||||
}
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user