#36: Add ability to select Linux distribution type if OS is unsupported
This commit is contained in:
@@ -584,6 +584,7 @@ ipcMain.on(Constants.IPC_Download_File, (event, data) => {
|
|||||||
|
|
||||||
ipcMain.on(Constants.IPC_Extract_Release, (event, data) => {
|
ipcMain.on(Constants.IPC_Extract_Release, (event, data) => {
|
||||||
const destination = path.join(helpers.getDataDirectory(), data.Version);
|
const destination = path.join(helpers.getDataDirectory(), data.Version);
|
||||||
|
helpers.removeDirectoryRecursively(destination);
|
||||||
helpers.mkDirByPathSync(destination);
|
helpers.mkDirByPathSync(destination);
|
||||||
|
|
||||||
const stream = fs.createReadStream(data.Source);
|
const stream = fs.createReadStream(data.Source);
|
||||||
@@ -968,6 +969,17 @@ ipcMain.on(Constants.IPC_Show_Window + '_sync', event => {
|
|||||||
event.returnValue = true;
|
event.returnValue = true;
|
||||||
});
|
});
|
||||||
|
|
||||||
|
ipcMain.on(Constants.IPC_Test_Release, (event, data) => {
|
||||||
|
helpers
|
||||||
|
.testRepertoryBinary(data.Version)
|
||||||
|
.then(() => {
|
||||||
|
standardIPCReply(event, Constants.IPC_Test_Release_Reply, {});
|
||||||
|
})
|
||||||
|
.catch(error => {
|
||||||
|
standardIPCReply(event, Constants.IPC_Test_Release_Reply, {}, error);
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
ipcMain.on(Constants.IPC_Unmount_All_Drives, (event, data) => {
|
ipcMain.on(Constants.IPC_Unmount_All_Drives, (event, data) => {
|
||||||
unmountAllDrives();
|
unmountAllDrives();
|
||||||
standardIPCReply(event, Constants.IPC_Unmount_All_Drives_Reply);
|
standardIPCReply(event, Constants.IPC_Unmount_All_Drives_Reply);
|
||||||
|
|||||||
@@ -1,13 +1,16 @@
|
|||||||
import React from 'react';
|
import React from 'react';
|
||||||
import IPCContainer from '../IPCContainer/IPCContainer';
|
|
||||||
import './SelectAppPlatform.css';
|
import './SelectAppPlatform.css';
|
||||||
import * as Constants from '../../constants';
|
import axios from 'axios';
|
||||||
import {connect} from 'react-redux';
|
import {connect} from 'react-redux';
|
||||||
|
import * as Constants from '../../constants';
|
||||||
import Box from '../../components/UI/Box/Box';
|
import Box from '../../components/UI/Box/Box';
|
||||||
import Button from '../../components/UI/Button/Button';
|
import Button from '../../components/UI/Button/Button';
|
||||||
import {downloadItem} from '../../redux/actions/download_actions';
|
import {
|
||||||
|
downloadItem,
|
||||||
|
setAllowDownload
|
||||||
|
} from '../../redux/actions/download_actions';
|
||||||
import DropDown from '../../components/UI/DropDown/DropDown';
|
import DropDown from '../../components/UI/DropDown/DropDown';
|
||||||
import axios from 'axios';
|
import IPCContainer from '../IPCContainer/IPCContainer';
|
||||||
import {notifyError} from '../../redux/actions/error_actions';
|
import {notifyError} from '../../redux/actions/error_actions';
|
||||||
import {setInstallTestActive} from '../../redux/actions/install_actions';
|
import {setInstallTestActive} from '../../redux/actions/install_actions';
|
||||||
|
|
||||||
@@ -20,6 +23,7 @@ class SelectAppPlatform extends IPCContainer {
|
|||||||
const errorHandler = error => {
|
const errorHandler = error => {
|
||||||
this.props.notifyError(error);
|
this.props.notifyError(error);
|
||||||
this.props.setInstallTestActive(false);
|
this.props.setInstallTestActive(false);
|
||||||
|
this.props.setAllowDownload(false);
|
||||||
};
|
};
|
||||||
axios
|
axios
|
||||||
.get(Constants.RELEASES_URL)
|
.get(Constants.RELEASES_URL)
|
||||||
@@ -40,6 +44,7 @@ class SelectAppPlatform extends IPCContainer {
|
|||||||
|
|
||||||
handleTestClicked = () => {
|
handleTestClicked = () => {
|
||||||
this.props.setInstallTestActive(true);
|
this.props.setInstallTestActive(true);
|
||||||
|
this.props.setAllowDownload(true);
|
||||||
this.grabLatestRelease(Constants.LINUX_SELECTABLE_PLATFORMS[this.state.Selected])
|
this.grabLatestRelease(Constants.LINUX_SELECTABLE_PLATFORMS[this.state.Selected])
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -76,6 +81,7 @@ const mapDispatchToProps = dispatch => {
|
|||||||
return {
|
return {
|
||||||
downloadItem: (name, type, urls, isWinFSP, testVersion, appPlatform) => dispatch(downloadItem(name, type, urls, isWinFSP, testVersion, appPlatform)),
|
downloadItem: (name, type, urls, isWinFSP, testVersion, appPlatform) => dispatch(downloadItem(name, type, urls, isWinFSP, testVersion, appPlatform)),
|
||||||
notifyError: msg => dispatch(notifyError(msg)),
|
notifyError: msg => dispatch(notifyError(msg)),
|
||||||
|
setAllowDownload: allow => dispatch(setAllowDownload(allow)),
|
||||||
setInstallTestActive: active => dispatch(setInstallTestActive(active)),
|
setInstallTestActive: active => dispatch(setInstallTestActive(active)),
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -705,6 +705,23 @@ module.exports.stopMountProcessSync = (version, provider) => {
|
|||||||
process.unref();
|
process.unref();
|
||||||
};
|
};
|
||||||
|
|
||||||
|
module.exports.testRepertoryBinary = version => {
|
||||||
|
return new Promise((resolve, reject) => {
|
||||||
|
const command = path.join(_getDataDirectory(), version, (os.platform() === 'win32') ? 'repertory.exe' : 'repertory');
|
||||||
|
_executeProcess(command, ['-dc'])
|
||||||
|
.then(code => {
|
||||||
|
if (code === 0) {
|
||||||
|
resolve();
|
||||||
|
} else {
|
||||||
|
reject(Error('Invalid exit code: ' + code));
|
||||||
|
}
|
||||||
|
})
|
||||||
|
.catch(error => {
|
||||||
|
reject(error);
|
||||||
|
});
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
module.exports.verifyHash = (file, hash) => {
|
module.exports.verifyHash = (file, hash) => {
|
||||||
return new Promise((resolve, reject) => {
|
return new Promise((resolve, reject) => {
|
||||||
const platform = os.platform();
|
const platform = os.platform();
|
||||||
|
|||||||
@@ -55,6 +55,9 @@ export const downloadItem = (name, type, urls, isWinFSP, testVersion, appPlatfor
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
if (type === Constants.INSTALL_TYPES.TestRelease) {
|
||||||
|
this.props.setAllowDownload(false);
|
||||||
|
}
|
||||||
dispatch(notifyError(result.Error));
|
dispatch(notifyError(result.Error));
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -139,7 +139,7 @@ export const installDependency = (source, url, isWinFSP) => {
|
|||||||
|
|
||||||
export const installAndTestRelease = (source, version, appPlatform) => {
|
export const installAndTestRelease = (source, version, appPlatform) => {
|
||||||
return (dispatch, getState) => {
|
return (dispatch, getState) => {
|
||||||
if (ipcRenderer && !getState().install.InstallTestActive) {
|
if (ipcRenderer && getState().install.InstallTestActive) {
|
||||||
const extractReleaseComplete = (event, arg) => {
|
const extractReleaseComplete = (event, arg) => {
|
||||||
ipcRenderer.send(Constants.IPC_Delete_File, {
|
ipcRenderer.send(Constants.IPC_Delete_File, {
|
||||||
FilePath: source,
|
FilePath: source,
|
||||||
@@ -153,6 +153,7 @@ export const installAndTestRelease = (source, version, appPlatform) => {
|
|||||||
dispatch(setLinuxAppPlatform(appPlatform));
|
dispatch(setLinuxAppPlatform(appPlatform));
|
||||||
dispatch(setInstallTestActive(false));
|
dispatch(setInstallTestActive(false));
|
||||||
dispatch(displaySelectAppPlatform(false));
|
dispatch(displaySelectAppPlatform(false));
|
||||||
|
dispatch(setAllowDownload(false));
|
||||||
dispatch(loadReleases());
|
dispatch(loadReleases());
|
||||||
} else {
|
} else {
|
||||||
dispatch(notifyError(arg.data.Error));
|
dispatch(notifyError(arg.data.Error));
|
||||||
|
|||||||
Reference in New Issue
Block a user