#40: Support for remote Windows mounts - partial

This commit is contained in:
2019-10-05 17:17:24 -05:00
parent 38825f970a
commit 9be55984bc
13 changed files with 268 additions and 185 deletions

View File

@@ -130,7 +130,7 @@ module.exports.createSignatureFiles = (signature, publicKey) => {
};
};
module.exports.detectRepertoryMounts = version => {
module.exports.detectRepertoryMounts = (version, providerList) => {
return new Promise((resolve, reject) => {
const processOptions = {
detached: true,
@@ -155,7 +155,7 @@ module.exports.detectRepertoryMounts = version => {
process.on('exit', () => {
let defaultData = {};
for (const provider of Constants.PROVIDER_LIST) {
for (const provider of providerList) {
defaultData[provider] = {
Active: false,
Location: '',
@@ -320,7 +320,7 @@ module.exports.executeScript = script => {
});
};
module.exports.executeMount = (version, provider, location, noConsoleSupported, exitCallback) => {
module.exports.executeMount = (version, provider, remote, location, noConsoleSupported, exitCallback) => {
return new Promise((resolve) => {
const processOptions = {
detached: false,
@@ -330,7 +330,10 @@ module.exports.executeMount = (version, provider, location, noConsoleSupported,
const command = path.join(_getDataDirectory(), version, (os.platform() === 'win32') ? 'repertory.exe' : 'repertory');
const args = [];
if (Constants.PROVIDER_ARG[provider.toLowerCase()].length > 0) {
if (remote) {
args.push('-rm');
args.push(provider.substr(6));
} else if (Constants.PROVIDER_ARG[provider.toLowerCase()].length > 0) {
args.push(Constants.PROVIDER_ARG[provider.toLowerCase()]);
}
@@ -365,7 +368,7 @@ module.exports.executeMount = (version, provider, location, noConsoleSupported,
});
};
module.exports.getConfig = (version, provider) => {
module.exports.getConfig = (version, provider, remote) => {
return new Promise((resolve, reject) => {
const processOptions = {
detached: true,
@@ -376,7 +379,10 @@ module.exports.getConfig = (version, provider) => {
const command = path.join(_getDataDirectory(), version, (os.platform() === 'win32') ? 'repertory.exe' : 'repertory');
const args = [];
args.push('-dc');
if (Constants.PROVIDER_ARG[provider.toLowerCase()].length > 0) {
if (remote) {
args.push('-rm');
args.push(provider.substr(6));
} else if (Constants.PROVIDER_ARG[provider.toLowerCase()].length > 0) {
args.push(Constants.PROVIDER_ARG[provider.toLowerCase()]);
}
@@ -411,7 +417,7 @@ module.exports.getConfig = (version, provider) => {
});
};
module.exports.getConfigTemplate = (version, provider) => {
module.exports.getConfigTemplate = (version, provider, remote) => {
return new Promise((resolve, reject) => {
const processOptions = {
detached: true,
@@ -422,7 +428,10 @@ module.exports.getConfigTemplate = (version, provider) => {
const command = path.join(_getDataDirectory(), version, (os.platform() === 'win32') ? 'repertory.exe' : 'repertory');
const args = [];
args.push('-gt');
if (Constants.PROVIDER_ARG[provider.toLowerCase()].length > 0) {
if (remote) {
args.push('-rm');
args.push(provider.substr(6));
} else if (Constants.PROVIDER_ARG[provider.toLowerCase()].length > 0) {
args.push(Constants.PROVIDER_ARG[provider.toLowerCase()]);
}
@@ -625,7 +634,7 @@ module.exports.removeDirectoryRecursively = (p) => {
module.exports.resolvePath = _resolvePath;
module.exports.setConfigValue = (name, value, provider, version) => {
module.exports.setConfigValue = (name, value, provider, remote, version) => {
return new Promise((resolve, reject) => {
const processOptions = {
detached: true,
@@ -638,7 +647,10 @@ module.exports.setConfigValue = (name, value, provider, version) => {
args.push('-set');
args.push(name);
args.push(value);
if (Constants.PROVIDER_ARG[provider.toLowerCase()].length > 0) {
if (remote) {
args.push('-rm');
args.push(provider.substr(6));
} else if (Constants.PROVIDER_ARG[provider.toLowerCase()].length > 0) {
args.push(Constants.PROVIDER_ARG[provider.toLowerCase()]);
}
@@ -656,7 +668,7 @@ module.exports.setConfigValue = (name, value, provider, version) => {
});
};
module.exports.stopMountProcess = (version, provider) => {
module.exports.stopMountProcess = (version, provider, remote) => {
return new Promise((resolve, reject) => {
const processOptions = {
detached: os.platform() === 'darwin',
@@ -666,7 +678,10 @@ module.exports.stopMountProcess = (version, provider) => {
const command = path.join(_getDataDirectory(), version, (os.platform() === 'win32') ? 'repertory.exe' : 'repertory');
const args = ['-unmount'];
if (Constants.PROVIDER_ARG[provider.toLowerCase()].length > 0) {
if (remote) {
args.push('-rm');
args.push(provider.substr(6));
} else if (Constants.PROVIDER_ARG[provider.toLowerCase()].length > 0) {
args.push(Constants.PROVIDER_ARG[provider.toLowerCase()]);
}
@@ -688,7 +703,7 @@ module.exports.stopMountProcess = (version, provider) => {
});
};
module.exports.stopMountProcessSync = (version, provider) => {
module.exports.stopMountProcessSync = (version, provider, remote) => {
const processOptions = {
detached: true,
shell: os.platform() !== 'darwin',
@@ -697,7 +712,10 @@ module.exports.stopMountProcessSync = (version, provider) => {
const command = path.join(_getDataDirectory(), version, (os.platform() === 'win32') ? 'repertory.exe' : 'repertory');
const args = ['-unmount'];
if (Constants.PROVIDER_ARG[provider.toLowerCase()].length > 0) {
if (remote) {
args.push('-rm');
args.push(provider.substr(6));
} else if (Constants.PROVIDER_ARG[provider.toLowerCase()].length > 0) {
args.push(Constants.PROVIDER_ARG[provider.toLowerCase()]);
}