function Component() { } Component.prototype.beginInstallation = function() { component.beginInstallation(); } Component.prototype.createOperations = function() { component.createOperations(); // Remove old plugin if (installer.isInstaller()) { component.addOperation("ConsumeOutput", "AkPluginSymlink", "/usr/bin/readlink", "/Library/CoreMediaIO/Plug-Ins/DAL/@Name@.plugin"); if (installer.value("AkPluginSymlink") == "") component.addElevatedOperation("Execute", "rm", "-rf", "/Library/CoreMediaIO/Plug-Ins/DAL/@Name@.plugin"); } // Create a symlink to the plugin. component.addElevatedOperation("Execute", "ln", "-s", "@TargetDir@/@Name@.plugin", "/Library/CoreMediaIO/Plug-Ins/DAL/@Name@.plugin", "UNDOEXECUTE", "rm", "-f", "/Library/CoreMediaIO/Plug-Ins/DAL/@Name@.plugin"); // Set assistant daemon. let daemonPlist = "/Library/LaunchAgents/org.webcamoid.cmio.AkVCam.Assistant.plist" let plistContents = "\n" + "\n" + "\n" + " \n" + " Label\n" + " org.webcamoid.cmio.AkVCam.Assistant\n" + " ProgramArguments\n" + " \n" + " " + installer.value("TargetDir") + "/AkVirtualCamera.plugin/Contents/Resources/AkVCamAssistant" + "\n" + " --timeout\n" + " 300.0\n" + " \n" + " MachServices\n" + " \n" + " org.webcamoid.cmio.AkVCam.Assistant\n" + " \n" + " \n" + " StandardOutPath\n" + " /tmp/AkVCamAssistant.log\n" + " StandardErrorPath\n" + " /tmp/AkVCamAssistant.log\n" + " \n" + "\n"; component.addElevatedOperation("Delete", daemonPlist); component.addElevatedOperation("AppendFile", daemonPlist, plistContents); // Load assistant daemon. component.addElevatedOperation("Execute", "launchctl", "load", "-w", daemonPlist, "UNDOEXECUTE", "launchctl", "unload", "-w", daemonPlist); if (installer.isUninstaller()) component.addElevatedOperation("Delete", daemonPlist); if (installer.value("TargetDir") != "/Applications/" + installer.value("Name")) component.addElevatedOperation("Execute", "ln", "-s", "@TargetDir@", "/Applications/@Name@", "UNDOEXECUTE", "rm", "-f", "/Applications/@Name@"); }