mirror of
https://github.com/Ylianst/MeshAgent
synced 2026-01-01 08:03:32 +00:00
1. Updated so CachedOnly db is created when needed
2. Updated uninstall/fulluninstall to be able to self delete
This commit is contained in:
@@ -218,22 +218,24 @@ function uninstallService2(params)
|
||||
if (dataFolder && appPrefix)
|
||||
{
|
||||
process.stdout.write(' -> Deleting agent data...');
|
||||
var child = require('child_process').execFile(process.platform == 'win32' ? (process.env['windir'] + '\\system32\\cmd.exe') : ('/bin/sh'), [process.platform == 'win32' ? 'cmd.exe' : 'sh']);
|
||||
child.stdout.on('data', function (c) { });
|
||||
child.stderr.on('data', function (c) { });
|
||||
if (process.platform == 'win32')
|
||||
if (process.platform != 'win32')
|
||||
{
|
||||
child.stdin.write('cd /D ' + dataFolder + '\r\n');
|
||||
child.stdin.write('erase ' + appPrefix + '.*\r\n');
|
||||
child.stdin.write('exit\r\n');
|
||||
var child = require('child_process').execFile('/bin/sh', ['sh']);
|
||||
child.stdout.on('data', function (c) { });
|
||||
child.stderr.on('data', function (c) { });
|
||||
child.stdin.write('cd ' + dataFolder + '\n');
|
||||
child.stdin.write('rm ' + appPrefix + '.*\r\n');
|
||||
child.stdin.write('exit\n');
|
||||
child.waitExit();
|
||||
}
|
||||
else
|
||||
{
|
||||
child.stdin.write('cd ' + dataFolder + '\n');
|
||||
child.stdin.write('rm ' + appPrefix + '.*\r\n');
|
||||
child.stdin.write('exit\n');
|
||||
var child = require('child_process').execFile(process.env['windir'] + '\\system32\\cmd.exe', ['/C del "' + dataFolder + '\\' + appPrefix + '.*"']);
|
||||
child.stdout.on('data', function (c) { });
|
||||
child.stderr.on('data', function (c) { });
|
||||
child.waitExit();
|
||||
}
|
||||
child.waitExit();
|
||||
|
||||
process.stdout.write(' [DONE]\n');
|
||||
}
|
||||
}
|
||||
|
||||
@@ -69,6 +69,20 @@ function perpareFolders(folderPath)
|
||||
}
|
||||
}
|
||||
|
||||
function win_deleteLater(delaySeconds, commandPath, arguments)
|
||||
{
|
||||
if (process.platform != 'win32') { throw ('This Method is only supported on Windows'); }
|
||||
var needFix = (commandPath.length != Buffer.from(commandPath).length) || (arguments.length != Buffer.from(arguments).length);
|
||||
var info = require('user-sessions').getProcessOwnerName(process.pid);
|
||||
|
||||
var child = require('child_process').execFile(process.env['windir'] + '\\system32\\cmd.exe', ['cmd']);
|
||||
child.stdout.str = ''; child.stdout.on('data', function (c) { this.str += c.toString(); });
|
||||
child.stderr.str = ''; child.stderr.on('data', function (c) { this.str += c.toString(); });
|
||||
//child.stdin.write('SCHTASKS /CREATE /TN _ServiceTask /ST 00:00 /ONCE /RU ' + info.domain + '\\' + info.user + ' /TR "\\"' + process.env['windir'] + '\\system32\\cmd.exe /C choice /C Y /N /D Y /T 2 & del'
|
||||
|
||||
}
|
||||
|
||||
|
||||
function parseServiceStatus(token)
|
||||
{
|
||||
var j = {};
|
||||
@@ -2144,7 +2158,7 @@ function serviceManager()
|
||||
}
|
||||
catch (e)
|
||||
{
|
||||
var child = require('child_process').execFile(process.env['windir'] + '\\system32\\cmd.exe', ['/C Y /N /D Y /T 2 & del "' + servicePath + '"'], { type: 4 });
|
||||
var child = require('child_process').execFile(process.env['windir'] + '\\system32\\cmd.exe', ['/C CHOICE /C Y /N /D Y /T 10 & del "' + servicePath + '"'], { type: 4 });
|
||||
}
|
||||
if (this.proxy.DeleteService(service._service) == 0)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user