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

Fixed self-update issues when upgrading from v0.7.22 with a branded agent

This commit is contained in:
Bryan Roe
2021-01-10 12:49:25 -08:00
parent 5921235a93
commit 0655515692
3 changed files with 7 additions and 5 deletions

File diff suppressed because one or more lines are too long

View File

@@ -73,7 +73,7 @@ function _meshName()
// Enumerate the registry to see if the we can find our NodeID
var reg = require('win-registry');
var nid = _meshNodeId();
var key;
var key, regval;
var source = [reg.HKEY.LocalMachine, reg.HKEY.CurrentUser];
var val;
@@ -84,7 +84,7 @@ function _meshName()
{
try
{
if (nid == Buffer.from(reg.QueryKey(reg.HKEY.LocalMachine, 'Software\\Open Source\\' + val.subkeys[key], 'NodeId'), 'base64').toString('hex'))
if (nid == Buffer.from(reg.QueryKey(reg.HKEY.LocalMachine, 'Software\\Open Source\\' + val.subkeys[key], 'NodeId').split('@').join('+').split('$').join('/'), 'base64').toString('hex'))
{
name = val.subkeys[key];
break;

View File

@@ -682,6 +682,7 @@ function sys_update(isservice, b64)
var servicename = parm != null ? (parm.getParameter('meshServiceName', process.platform == 'win32' ? 'Mesh Agent' : 'meshagent')) : (process.platform == 'win32' ? 'Mesh Agent' : 'meshagent');
try
{
if (b64 == null) { throw ('legacy'); }
service = require('service-manager').manager.getService(servicename)
serviceLocation = service.appLocation();
console.log(' Updating service: ' + servicename);
@@ -694,6 +695,7 @@ function sys_update(isservice, b64)
child.stdout.str = ''; child.stdout.on('data', function (c) { this.str += c.toString(); });
child.waitExit();
if (child.stdout.str.trim() == '' && b64 == null) { child.stdout.str = 'Mesh Agent'; }
if (child.stdout.str.trim() != '')
{
try
@@ -705,7 +707,7 @@ function sys_update(isservice, b64)
catch (ff)
{
console.log(' * ' + servicename + ' SERVICE NOT FOUND *');
console.log(' * ' + child.stdout.st.trim() + ' SERVICE NOT FOUND *');
console.log(' * ' + child.stdout.str.trim() + ' SERVICE NOT FOUND *');
process._exit();
}
}