mirror of
https://github.com/Ylianst/MeshAgent
synced 2025-12-25 20:53:15 +00:00
1. Updated service-manager to support dependencies from Buffer
2. Updated service-host to have a 'create' method
This commit is contained in:
File diff suppressed because one or more lines are too long
@@ -316,3 +316,7 @@ function serviceHost(serviceName)
|
||||
}
|
||||
|
||||
module.exports = serviceHost;
|
||||
module.exports.create = function create(options)
|
||||
{
|
||||
return (new serviceHost(options));
|
||||
};
|
||||
@@ -730,11 +730,19 @@ function serviceManager()
|
||||
if (options.files)
|
||||
{
|
||||
for(var i in options.files)
|
||||
{
|
||||
if (options.files[i]._buffer)
|
||||
{
|
||||
console.log('writing ' + extractFileName(options.files[i]));
|
||||
require('fs').writeFileSync(folder + '\\' + options.name + '\\' + extractFileName(options.files[i]), options.files[i]._buffer);
|
||||
}
|
||||
else
|
||||
{
|
||||
console.log('copying ' + extractFileSource(options.files[i]));
|
||||
require('fs').copyFileSync(extractFileSource(options.files[i]), folder + '\\' + options.name + '\\' + extractFileName(options.files[i]));
|
||||
}
|
||||
}
|
||||
}
|
||||
if (options.parameters)
|
||||
{
|
||||
var reg = require('win-registry');
|
||||
@@ -957,13 +965,23 @@ function serviceManager()
|
||||
}
|
||||
}
|
||||
|
||||
if (options.files) {
|
||||
for (var i in options.files) {
|
||||
if (options.files)
|
||||
{
|
||||
for (var i in options.files)
|
||||
{
|
||||
if (options.files[i]._buffer)
|
||||
{
|
||||
console.log('writing ' + extractFileName(options.files[i]));
|
||||
require('fs').writeFileSync('/usr/local/mesh_services/' + options.name + '/' + extractFileName(options.files[i]), options.files[i]._buffer);
|
||||
}
|
||||
else
|
||||
{
|
||||
console.log('copying ' + extractFileSource(options.files[i]));
|
||||
require('fs').copyFileSync(extractFileSource(options.files[i]), '/usr/local/mesh_services/' + options.name + '/' + extractFileName(options.files[i]));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
this.uninstallService = function uninstallService(name)
|
||||
{
|
||||
if (!this.isAdmin()) { throw ('Uninstalling a service, requires admin'); }
|
||||
|
||||
Reference in New Issue
Block a user