mirror of
https://github.com/Ylianst/MeshAgent
synced 2025-12-15 15:53:55 +00:00
Updated comments in makefile, and update test for FreeBSD
This commit is contained in:
2
makefile
2
makefile
@@ -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 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=31 # Reserved for FreeBSD x86 32 bit
|
||||
|
||||
|
||||
# Microstack & Microscript
|
||||
SOURCES = microstack/ILibAsyncServerSocket.c microstack/ILibAsyncSocket.c microstack/ILibAsyncUDPSocket.c microstack/ILibParsers.c microstack/ILibMulticastSocket.c
|
||||
|
||||
@@ -608,6 +608,7 @@ typedef enum MeshAgent_Posix_PlatformTypes
|
||||
MeshAgent_Posix_PlatformTypes_INITD = 2,
|
||||
MeshAgent_Posix_PlatformTypes_INIT_UPSTART =4,
|
||||
MeshAgent_Posix_PlatformTypes_LAUNCHD = 3,
|
||||
MeshAgent_Posix_PlatformTypes_BSD = 5
|
||||
}MeshAgent_Posix_PlatformTypes;
|
||||
|
||||
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()
|
||||
{
|
||||
#ifdef __APPLE__
|
||||
#if defined(__APPLE__)
|
||||
return(MeshAgent_Posix_PlatformTypes_LAUNCHD);
|
||||
#elif defined(_FREEBSD)
|
||||
return(MeshAgent_Posix_PlatformTypes_BSD);
|
||||
#else
|
||||
MeshAgent_Posix_PlatformTypes retVal = MeshAgent_Posix_PlatformTypes_UNKNOWN, fini = 0;
|
||||
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
|
||||
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 (system(ILibScratchPad)) {}
|
||||
|
||||
switch (pt)
|
||||
if (pt == MeshAgent_Posix_PlatformTypes_BSD)
|
||||
{
|
||||
// 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__
|
||||
case MeshAgent_Posix_PlatformTypes_LAUNCHD:
|
||||
if (agentHost->logUpdate != 0) { ILIBLOGMESSSAGE("SelfUpdate -> Complete... [kickstarting service]"); }
|
||||
@@ -4716,6 +4728,7 @@ int MeshAgent_Start(MeshAgentHostContainer *agentHost, int paramLen, char **para
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user