mirror of
https://github.com/Ylianst/MeshAgent
synced 2025-12-25 20:53:15 +00:00
Updated installer, so will still work if launched from same path as description
This commit is contained in:
@@ -200,9 +200,14 @@ function uninstallService2(params, msh)
|
||||
var i;
|
||||
var dataFolder = null;
|
||||
var appPrefix = null;
|
||||
var uninstallOptions = null;
|
||||
|
||||
try { require('fs').unlinkSync(msh); } catch (mshe) { }
|
||||
|
||||
if ((i = params.indexOf('__skipBinaryDelete')) >= 0)
|
||||
{
|
||||
params.splice(i, 1);
|
||||
uninstallOptions = { skipDeleteBinary: true };
|
||||
}
|
||||
if (params && params.includes('--_deleteData="1"'))
|
||||
{
|
||||
for (i = 0; i < params.length; ++i)
|
||||
@@ -223,7 +228,7 @@ function uninstallService2(params, msh)
|
||||
process.stdout.write(' -> Uninstalling previous installation...');
|
||||
try
|
||||
{
|
||||
require('service-manager').manager.uninstallService(process.platform == 'win32' ? 'Mesh Agent' : 'meshagent');
|
||||
require('service-manager').manager.uninstallService(process.platform == 'win32' ? 'Mesh Agent' : 'meshagent', uninstallOptions);
|
||||
process.stdout.write(' [DONE]\n');
|
||||
if (dataFolder && appPrefix)
|
||||
{
|
||||
@@ -414,12 +419,12 @@ function fullInstall(jsonString)
|
||||
{
|
||||
console.setDestination(console.Destinations.DISABLED);
|
||||
var parms = JSON.parse(jsonString);
|
||||
|
||||
var loc = null;
|
||||
try
|
||||
{
|
||||
process.stdout.write('...Checking for previous installation');
|
||||
var s = require('service-manager').manager.getService(process.platform == 'win32' ? 'Mesh Agent' : 'meshagent');
|
||||
var loc = s.appLocation();
|
||||
loc = s.appLocation();
|
||||
s.close();
|
||||
}
|
||||
catch (e)
|
||||
@@ -428,6 +433,10 @@ function fullInstall(jsonString)
|
||||
installService(parms);
|
||||
return;
|
||||
}
|
||||
if (process.execPath == loc)
|
||||
{
|
||||
parms.push('__skipBinaryDelete');
|
||||
}
|
||||
serviceExists(loc, parms);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user