mirror of
https://github.com/zerotier/ZeroTierOne.git
synced 2025-01-03 03:36:41 +00:00
More netconf work... set ZT_HOME and chdir there on service launch.
This commit is contained in:
parent
99c5fae9da
commit
42f6aae259
@ -476,6 +476,7 @@ function doNetconfRequest(message)
|
|||||||
|
|
||||||
}],function(err) {
|
}],function(err) {
|
||||||
|
|
||||||
|
// Send response to parent process
|
||||||
if (err) {
|
if (err) {
|
||||||
console.error('unable to generate certificate for peer '+peerId.address()+' on network '+nwid+': '+err);
|
console.error('unable to generate certificate for peer '+peerId.address()+' on network '+nwid+': '+err);
|
||||||
response.data['error'] = 'ACCESS_DENIED'; // unable to generate certificate
|
response.data['error'] = 'ACCESS_DENIED'; // unable to generate certificate
|
||||||
@ -489,7 +490,8 @@ function doNetconfRequest(message)
|
|||||||
//netconf.data[ZT_NETWORKCONFIG_DICT_KEY_MULTICAST_DEPTH] = 0;
|
//netconf.data[ZT_NETWORKCONFIG_DICT_KEY_MULTICAST_DEPTH] = 0;
|
||||||
//netconf.data[ZT_NETWORKCONFIG_DICT_KEY_MULTICAST_RATES] = '';
|
//netconf.data[ZT_NETWORKCONFIG_DICT_KEY_MULTICAST_RATES] = '';
|
||||||
netconf.data[ZT_NETWORKCONFIG_DICT_KEY_PRIVATE] = privateNetwork ? '1' : '0';
|
netconf.data[ZT_NETWORKCONFIG_DICT_KEY_PRIVATE] = privateNetwork ? '1' : '0';
|
||||||
netconf.data[ZT_NETWORKCONFIG_DICT_KEY_NAME] = network['name'];
|
if (network['name'])
|
||||||
|
netconf.data[ZT_NETWORKCONFIG_DICT_KEY_NAME] = network['name'];
|
||||||
if (network['desc'])
|
if (network['desc'])
|
||||||
netconf.data[ZT_NETWORKCONFIG_DICT_KEY_DESC] = network['desc'];
|
netconf.data[ZT_NETWORKCONFIG_DICT_KEY_DESC] = network['desc'];
|
||||||
if ((v4NeedAssign)&&(v4Assignments.length > 0))
|
if ((v4NeedAssign)&&(v4Assignments.length > 0))
|
||||||
|
13
netconf-service/netconf.service
Executable file
13
netconf-service/netconf.service
Executable file
@ -0,0 +1,13 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
export PATH=/bin:/usr/bin:/usr/local/bin
|
||||||
|
|
||||||
|
# We will start in ZT_HOME
|
||||||
|
|
||||||
|
if [ ! -d ./services.d/netconf-service ]; then
|
||||||
|
echo 'cannot find netconf-service subfolder to launch subprocess' >>&2
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
cd services.d/netconf-service
|
||||||
|
exec node index.js
|
@ -139,6 +139,8 @@ void Service::threadMain()
|
|||||||
dup2(in[0],STDIN_FILENO);
|
dup2(in[0],STDIN_FILENO);
|
||||||
dup2(out[1],STDOUT_FILENO);
|
dup2(out[1],STDOUT_FILENO);
|
||||||
dup2(err[1],STDERR_FILENO);
|
dup2(err[1],STDERR_FILENO);
|
||||||
|
setenv("ZT_HOME",_r->homePath.c_str(),1);
|
||||||
|
chdir(_r->homePath.c_str());
|
||||||
execl(_path.c_str(),_path.c_str(),_r->homePath.c_str(),(const char *)0);
|
execl(_path.c_str(),_path.c_str(),_r->homePath.c_str(),(const char *)0);
|
||||||
exit(-1);
|
exit(-1);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user