1
0
mirror of https://github.com/Ylianst/MeshAgent synced 2025-12-06 00:13:33 +00:00

Updated self-update to support procd (OpenWRT)

This commit is contained in:
Bryan Roe
2020-08-22 00:05:07 -07:00
parent 105ff1dcb4
commit f98f976eba
2 changed files with 7 additions and 2 deletions

View File

@@ -4347,7 +4347,7 @@ int MeshAgent_AgentMode(MeshAgentHostContainer *agentHost, int paramLen, char **
agentHost->platformType = MeshAgent_Posix_PlatformTypes_UNKNOWN;
agentHost->JSRunningAsService = 0;
if (duk_peval_string(tmpCtx, "(function foo() { var f = require('service-manager').manager.getServiceType(); switch(f){case 'windows': return(10); case 'launchd': return(3); case 'freebsd': return(5); case 'systemd': return(1); case 'init': return(2); case 'upstart': return(4); default: return(0);}})()") == 0)
if (duk_peval_string(tmpCtx, "(function foo() { var f = require('service-manager').manager.getServiceType(); switch(f){case 'procd': return(7); case 'windows': return(10); case 'launchd': return(3); case 'freebsd': return(5); case 'systemd': return(1); case 'init': return(2); case 'upstart': return(4); default: return(0);}})()") == 0)
{
agentHost->platformType = (MeshAgent_Posix_PlatformTypes)duk_get_int(tmpCtx, -1);
}
@@ -5429,6 +5429,10 @@ int MeshAgent_Start(MeshAgentHostContainer *agentHost, int paramLen, char **para
if (agentHost->logUpdate != 0) { ILIBLOGMESSSAGE("SelfUpdate -> Complete... [SYSTEMD should auto-restart]"); }
exit(1);
break;
case MeshAgent_Posix_PlatformTypes_PROCD:
if (agentHost->logUpdate != 0) { ILIBLOGMESSSAGE("SelfUpdate -> Complete... [PROCD should auto-restart]"); }
exit(1);
break;
case MeshAgent_Posix_PlatformTypes_INITD:
if (agentHost->logUpdate != 0) { ILIBLOGMESSSAGE("SelfUpdate -> Complete... Calling Service restart (INITD)"); }
sprintf_s(ILibScratchPad, sizeof(ILibScratchPad), "service meshagent restart"); // Restart the service

View File

@@ -55,7 +55,8 @@ typedef enum MeshAgent_Posix_PlatformTypes
MeshAgent_Posix_PlatformTypes_INIT_UPSTART = 4,
MeshAgent_Posix_PlatformTypes_LAUNCHD = 3,
MeshAgent_Posix_PlatformTypes_BSD = 5,
MeshAgent_Posix_PlatformTypes_WINDOWS = 10
MeshAgent_Posix_PlatformTypes_WINDOWS = 10,
MeshAgent_Posix_PlatformTypes_PROCD = 7
}MeshAgent_Posix_PlatformTypes;
typedef enum MeshCommand_AuthInfo_CapabilitiesMask