1
0
mirror of https://github.com/Ylianst/MeshAgent synced 2025-12-28 14:13:37 +00:00

Added workaround for 'busybox' as service type

This commit is contained in:
Bryan Roe
2019-07-16 15:12:52 -07:00
parent 735ac0f0c9
commit 134461448e
2 changed files with 21 additions and 11 deletions

View File

@@ -1311,6 +1311,8 @@ function serviceManager()
break;
default: // unknown platform service type
console.log('Unknown Service Platform Type: ' + options.servicePlatform);
throw ('Unknown Service Platform Type: ' + options.servicePlatform);
break;
}
}
@@ -1639,6 +1641,14 @@ function serviceManager()
this.getServiceType = function getServiceType()
{
var platform = require('process-manager').getProcessInfo(1).Name;
if (platform == "busybox")
{
var child = require('child_process').execFile('/bin/sh', ['sh']);
child.stdout.str = ''; child.stdout.on('data', function (c) { this.str += c.toString(); });
child.stdin.write("ps -ax -o pid -o command | awk '{ if($1==\"1\") { $1=\"\"; split($0, res, \" \"); print res[2]; }}'\nexit\n");
child.waitExit();
platform = child.stdout.str.trim();
}
if (platform == 'init')
{
if(require('fs').existsSync('/etc/init'))