1
0
mirror of https://github.com/Ylianst/MeshAgent synced 2025-12-18 17:23:16 +00:00

Updated for macos

This commit is contained in:
Bryan Roe
2020-02-26 00:03:57 -08:00
parent 6f5f065eb5
commit ee8bf176e8
2 changed files with 33 additions and 1 deletions

File diff suppressed because one or more lines are too long

View File

@@ -40,6 +40,23 @@ function installService(params)
if (process.platform == 'darwin') if (process.platform == 'darwin')
{ {
svc.load(); svc.load();
process.stdout.write(' -> setting up launch agent...');
try
{
require('service-manager').manager.installLaunchAgent(
{
name: 'meshagent',
servicePath: svc.appLocation(),
startType: 'AUTO_START',
sessionTypes: ['LoginWindow'],
parameters: ['-kvm1']
});
process.stdout.write(' [DONE]\n');
}
catch (sie)
{
process.stdout.write(' [ERROR] ' + sie);
}
} }
@@ -131,6 +148,21 @@ function uninstallService2(params)
{ {
process.stdout.write(' [ERROR]\n'); process.stdout.write(' [ERROR]\n');
} }
if (process.platform == 'darwin')
{
process.stdout.write(' -> Uninstalling launch agent...');
try
{
var launchagent = require('service-manager').manager.getLaunchAgent('meshagent');
launchagent.unload();
require('fs').unlinkSync(launchagent.plist);
process.stdout.write(' [DONE]\n');
}
catch (e)
{
process.stdout.write(' [ERROR]\n');
}
}
if (params != null) if (params != null)
{ {
installService(params); installService(params);