mirror of
https://github.com/Ylianst/MeshCentral.git
synced 2025-03-09 15:40:18 +00:00
Added server console, KVM jumbo accumulator.
This commit is contained in:
parent
0ed26d55cf
commit
cebb0ce63e
17 changed files with 275 additions and 130 deletions
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
Copyright 2018-2019 Intel Corporation
|
||||
Copyright 2018 Intel Corporation
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
|
@ -46,9 +46,6 @@ function parseServiceStatus(token)
|
|||
case 0x00000001:
|
||||
j.state = 'STOPPED';
|
||||
break;
|
||||
default:
|
||||
// Unknown service status.
|
||||
break;
|
||||
}
|
||||
var controlsAccepted = token.Deref((2 * 4), 4).toBuffer().readUInt32LE();
|
||||
j.controlsAccepted = [];
|
||||
|
@ -295,13 +292,14 @@ function serviceManager()
|
|||
require('fs').chmodSync('/etc/init.d/' + options.name, m);
|
||||
this._update = require('child_process').execFile('/bin/sh', ['sh'], { type: require('child_process').SpawnTypes.TERM });
|
||||
this._update._moduleName = options.name;
|
||||
this._update.on('exit', function onUpdateRC_d() { console.log(this._moduleName + ' installed'); process.exit(); });
|
||||
this._update.stdout.on('data', function (chunk) { });
|
||||
this._update.stdin.write('update-rc.d ' + options.name + ' defaults\n');
|
||||
this._update.stdin.write('exit\n');
|
||||
//update-rc.d meshagent defaults # creates symlinks for rc.d
|
||||
//service meshagent start
|
||||
|
||||
this._update.waitExit();
|
||||
|
||||
break;
|
||||
case 'systemd':
|
||||
var serviceDescription = options.description ? options.description : 'MeshCentral Agent';
|
||||
|
@ -313,13 +311,12 @@ function serviceManager()
|
|||
require('fs').writeFileSync('/lib/systemd/system/' + options.name + '.service', '[Unit]\nDescription=' + serviceDescription + '\n[Service]\nExecStart=/usr/local/mesh/' + options.name + '\nStandardOutput=null\nRestart=always\nRestartSec=3\n[Install]\nWantedBy=multi-user.target\nAlias=' + options.name + '.service\n', { flags: 'w' });
|
||||
this._update = require('child_process').execFile('/bin/sh', ['sh'], { type: require('child_process').SpawnTypes.TERM });
|
||||
this._update._moduleName = options.name;
|
||||
this._update.on('exit', function onUpdateRC_d() { console.log(this._moduleName + ' installed'); process.exit(); });
|
||||
this._update.stdout.on('data', function (chunk) { });
|
||||
this._update.stdin.write('systemctl enable ' + options.name + '.service\n');
|
||||
this._update.stdin.write('exit\n');
|
||||
|
||||
this._update.waitExit();
|
||||
break;
|
||||
default: // Unknown platform service type
|
||||
default: // unknown platform service type
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
@ -416,43 +413,41 @@ function serviceManager()
|
|||
{
|
||||
case 'init':
|
||||
this._update = require('child_process').execFile('/bin/sh', ['sh'], { type: require('child_process').SpawnTypes.TERM });
|
||||
this._update._svcname = name;
|
||||
this._update.on('exit', function onUninstallExit() {
|
||||
try {
|
||||
require('fs').unlinkSync('/etc/init.d/' + this._svcname);
|
||||
console.log(this._svcname + ' uninstalled');
|
||||
|
||||
}
|
||||
catch (e) {
|
||||
console.log(this._svcname + ' could not be uninstalled')
|
||||
}
|
||||
process.exit();
|
||||
});
|
||||
this._update.stdout.on('data', function (chunk) { });
|
||||
this._update.stdin.write('service ' + name + ' stop\n');
|
||||
this._update.stdin.write('update-rc.d -f ' + name + ' remove\n');
|
||||
this._update.stdin.write('exit\n');
|
||||
this._update.waitExit();
|
||||
try
|
||||
{
|
||||
require('fs').unlinkSync('/etc/init.d/' + name);
|
||||
console.log(name + ' uninstalled');
|
||||
|
||||
}
|
||||
catch (e)
|
||||
{
|
||||
console.log(name + ' could not be uninstalled', e)
|
||||
}
|
||||
break;
|
||||
case 'systemd':
|
||||
this._update = require('child_process').execFile('/bin/sh', ['sh'], { type: require('child_process').SpawnTypes.TERM });
|
||||
this._update._svcname = name;
|
||||
this._update.on('exit', function onUninstallExit() {
|
||||
try {
|
||||
require('fs').unlinkSync('/usr/local/mesh/' + this._svcname);
|
||||
require('fs').unlinkSync('/lib/systemd/system/' + this._svcname + '.service');
|
||||
console.log(this._svcname + ' uninstalled');
|
||||
}
|
||||
catch (e) {
|
||||
console.log(this._svcname + ' could not be uninstalled')
|
||||
}
|
||||
process.exit();
|
||||
});
|
||||
this._update.stdout.on('data', function (chunk) { });
|
||||
this._update.stdin.write('systemctl stop ' + name + '.service\n');
|
||||
this._update.stdin.write('systemctl disable ' + name + '.service\n');
|
||||
this._update.stdin.write('exit\n');
|
||||
this._update.waitExit();
|
||||
try
|
||||
{
|
||||
require('fs').unlinkSync('/usr/local/mesh/' + name);
|
||||
require('fs').unlinkSync('/lib/systemd/system/' + name + '.service');
|
||||
console.log(name + ' uninstalled');
|
||||
}
|
||||
catch (e)
|
||||
{
|
||||
console.log(name + ' could not be uninstalled', e)
|
||||
}
|
||||
break;
|
||||
default: // Unknown platform service type
|
||||
default: // unknown platform service type
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
Copyright 2018-2019 Intel Corporation
|
||||
Copyright 2018 Intel Corporation
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
|
@ -77,7 +77,8 @@ function SMBiosTables()
|
|||
var SMData;
|
||||
var structcount = 0;
|
||||
|
||||
while (SMData && i < SMData.length) {
|
||||
while (SMData && i < SMData.length)
|
||||
{
|
||||
var SMtype = SMData[i];
|
||||
var SMlength = SMData[i + 1];
|
||||
|
||||
|
@ -88,12 +89,20 @@ function SMBiosTables()
|
|||
|
||||
ret[SMtype].peek()._strings = [];
|
||||
|
||||
while (SMData[i] != 0) {
|
||||
while (SMData[i] != 0 && i <= SMData.length)
|
||||
{
|
||||
var strstart = i;
|
||||
|
||||
// Start of String, find end of string
|
||||
while (SMData[i++] != 0);
|
||||
ret[SMtype].peek()._strings.push(SMData.slice(strstart, i).toString().trim());
|
||||
while (SMData[i++] != 0 && i <= SMData.length);
|
||||
try
|
||||
{
|
||||
ret[SMtype].peek()._strings.push(SMData.slice(strstart, i).toString().trim());
|
||||
}
|
||||
catch (ee)
|
||||
{
|
||||
console.log('oops');
|
||||
}
|
||||
}
|
||||
i += (ret[SMtype].peek()._strings.length == 0) ? 2 : 1;
|
||||
++structcount;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue