1
0
mirror of https://github.com/Ylianst/MeshAgent synced 2025-12-18 01:03:14 +00:00

Updated comments in makefile, and update test for FreeBSD

This commit is contained in:
Bryan Roe
2019-07-22 16:38:22 -07:00
parent 4f89b363ee
commit 1b78195987
2 changed files with 20 additions and 5 deletions

View File

@@ -68,6 +68,8 @@
# make linux ARCHID=27 # Linux ARM 32 bit HardFloat NOKVM (Old Raspberry Pi on Raspian 7, 2015-02-02 build) # make linux ARCHID=27 # Linux ARM 32 bit HardFloat NOKVM (Old Raspberry Pi on Raspian 7, 2015-02-02 build)
# make pi KVM=1 ARCHID=25 # Linux ARM 32 bit HardFloat, compiled on the Pi. # make pi KVM=1 ARCHID=25 # Linux ARM 32 bit HardFloat, compiled on the Pi.
# gmake freebsd ARCHID=30 # FreeBSD x86 64 bit # gmake freebsd ARCHID=30 # FreeBSD x86 64 bit
# gmake freebsd ARCHID=31 # Reserved for FreeBSD x86 32 bit
# Microstack & Microscript # Microstack & Microscript
SOURCES = microstack/ILibAsyncServerSocket.c microstack/ILibAsyncSocket.c microstack/ILibAsyncUDPSocket.c microstack/ILibParsers.c microstack/ILibMulticastSocket.c SOURCES = microstack/ILibAsyncServerSocket.c microstack/ILibAsyncSocket.c microstack/ILibAsyncUDPSocket.c microstack/ILibParsers.c microstack/ILibMulticastSocket.c

View File

@@ -608,6 +608,7 @@ typedef enum MeshAgent_Posix_PlatformTypes
MeshAgent_Posix_PlatformTypes_INITD = 2, MeshAgent_Posix_PlatformTypes_INITD = 2,
MeshAgent_Posix_PlatformTypes_INIT_UPSTART =4, MeshAgent_Posix_PlatformTypes_INIT_UPSTART =4,
MeshAgent_Posix_PlatformTypes_LAUNCHD = 3, MeshAgent_Posix_PlatformTypes_LAUNCHD = 3,
MeshAgent_Posix_PlatformTypes_BSD = 5
}MeshAgent_Posix_PlatformTypes; }MeshAgent_Posix_PlatformTypes;
size_t MeshAgent_Linux_ReadMemFile(char *path, char **buffer) size_t MeshAgent_Linux_ReadMemFile(char *path, char **buffer)
@@ -634,8 +635,10 @@ size_t MeshAgent_Linux_ReadMemFile(char *path, char **buffer)
} }
MeshAgent_Posix_PlatformTypes MeshAgent_Posix_GetPlatformType() MeshAgent_Posix_PlatformTypes MeshAgent_Posix_GetPlatformType()
{ {
#ifdef __APPLE__ #if defined(__APPLE__)
return(MeshAgent_Posix_PlatformTypes_LAUNCHD); return(MeshAgent_Posix_PlatformTypes_LAUNCHD);
#elif defined(_FREEBSD)
return(MeshAgent_Posix_PlatformTypes_BSD);
#else #else
MeshAgent_Posix_PlatformTypes retVal = MeshAgent_Posix_PlatformTypes_UNKNOWN, fini = 0; MeshAgent_Posix_PlatformTypes retVal = MeshAgent_Posix_PlatformTypes_UNKNOWN, fini = 0;
char *status; char *status;
@@ -4688,11 +4691,20 @@ int MeshAgent_Start(MeshAgentHostContainer *agentHost, int paramLen, char **para
stat(agentHost->exePath, &results); // This the mode of the current executable stat(agentHost->exePath, &results); // This the mode of the current executable
chmod(updateFilePath, results.st_mode); // Set the new executable to the same mode as the current one. chmod(updateFilePath, results.st_mode); // Set the new executable to the same mode as the current one.
sprintf_s(ILibScratchPad, sizeof(ILibScratchPad), "mv \"%s\" \"%s\"", updateFilePath, agentHost->exePath); // Move the update over our own executable if (pt == MeshAgent_Posix_PlatformTypes_BSD)
if (system(ILibScratchPad)) {}
switch (pt)
{ {
// FreeBSD doesn't support hot-swapping the binary
if (agentHost->logUpdate != 0) { ILIBLOGMESSSAGE("SelfUpdate -> Handing off to child to complete"); }
sprintf_s(ILibScratchPad, sizeof(ILibScratchPad), "%s -exec \"var s=require('service-manager').manager.getService('meshagent');s.stop();require('fs').copyFileSync('%s', '%s');s.start();process.exit();\"", updateFilePath, updateFilePath, agentHost->exePath);
ignore_result(MeshAgent_System(ILibScratchPad));
}
else
{
sprintf_s(ILibScratchPad, sizeof(ILibScratchPad), "mv \"%s\" \"%s\"", updateFilePath, agentHost->exePath); // Move the update over our own executable
if (system(ILibScratchPad)) {}
switch (pt)
{
#ifdef __APPLE__ #ifdef __APPLE__
case MeshAgent_Posix_PlatformTypes_LAUNCHD: case MeshAgent_Posix_PlatformTypes_LAUNCHD:
if (agentHost->logUpdate != 0) { ILIBLOGMESSSAGE("SelfUpdate -> Complete... [kickstarting service]"); } if (agentHost->logUpdate != 0) { ILIBLOGMESSSAGE("SelfUpdate -> Complete... [kickstarting service]"); }
@@ -4716,6 +4728,7 @@ int MeshAgent_Start(MeshAgentHostContainer *agentHost, int paramLen, char **para
break; break;
default: default:
break; break;
}
} }
} }
} }