\#28: Fix Linux upgrade

This commit is contained in:
Scott E. Graves
2019-07-04 17:42:48 -05:00
parent 0d524376d1
commit a2c66f1047
6 changed files with 27 additions and 21 deletions

View File

@@ -1,5 +1,6 @@
# Changelog #
## 1.0.4 ##
* \#28: Fix Linux upgrade
* Additional Linux distribution support:
* OpenSUSE Leap 15
* OpenSUSE Leap 15.1

View File

@@ -16,7 +16,6 @@ require.extensions['.sh'] = function (module, filename) {
module.exports = fs.readFileSync(filename, 'utf8');
};
const detectScript = require('./detect_linux.sh');
const installScript = require('./update_linux.sh');
// Keep a global reference of the window object, if you don't, the window will
// be closed automatically when the JavaScript object is garbage collected.
@@ -747,11 +746,8 @@ ipcMain.on(Constants.IPC_Install_Upgrade, (event, data) => {
args = ['-a', 'Finder', data.Source];
} else if (platform === 'linux') {
try {
const execPath = path.join(os.tmpdir(), 'install_linux.sh');
fs.writeFileSync(execPath, installScript);
fs.chmodSync(execPath, '750');
command = execPath;
args = [data.Source];
command = data.Source;
fs.chmodSync(command, '750');
} catch (e) {
errorHandler(e);
}

View File

@@ -1,8 +0,0 @@
#!/bin/sh
sleep 5
chmod +x "$1"
"$1"&
sleep 1
rm -f "$0"

View File

@@ -113,9 +113,12 @@ class App extends IPCContainer {
};
handleDownloadUpgrade = () => {
const url = this.props.UpgradeData.urls[0];
const name = this.props.Platform === 'win32' ? 'upgrade.exe' : this.props.Platform === 'darwin' ? 'upgrade.dmg' : extractFileNameFromURL(url);
this.props.downloadItem(name, Constants.INSTALL_TYPES.Upgrade, url, this.onDownloadFileComplete);
const name = (this.props.Platform === 'win32') ?
'upgrade.exe' :
(this.props.Platform === 'darwin') ?
'upgrade.dmg' :
'repertory-ui_' + this.props.UpgradeVersion + '_linux_x86_64.AppImage';
this.props.downloadItem(name, Constants.INSTALL_TYPES.Upgrade, this.props.UpgradeData.urls[0], this.onDownloadFileComplete);
};
installDependency = result => {
@@ -338,6 +341,7 @@ const mapStateToProps = state => {
UpgradeAvailable: state.relver.UpgradeAvailable,
UpgradeData: state.relver.UpgradeData,
UpgradeDismissed: state.relver.UpgradeDismissed,
UpgradeVersion: state.relver.UpgradeVersion,
Version: state.common.Version,
VersionLookup: state.relver.VersionLookup,
};

View File

@@ -26,7 +26,7 @@ export const detectUIUpgrade = () => {
data.Versions[appPlatform] &&
(data.Versions[appPlatform].length > 0) &&
(data.Versions[appPlatform][0] !== version)) {
dispatch(setUIUpgradeData(data.Locations[appPlatform][data.Versions[appPlatform][0]]));
dispatch(setUIUpgradeData(data.Locations[appPlatform][data.Versions[appPlatform][0]], data.Versions[appPlatform][0]));
} else {
dispatch(clearUIUpgrade());
}
@@ -115,4 +115,14 @@ export const setReleaseData = (locationsLookup, versionLookup)=> {
};
export const setReleaseUpgradeAvailable = createAction('relver/setReleaseUpgradeAvailable');
export const setUIUpgradeData = createAction('relver/setUIUpgradeData');
export const SET_UI_UPGRADE_DATA = 'relver/setUIUpgradeData';
export const setUIUpgradeData = (upgradeData, version) => {
return {
type: SET_UI_UPGRADE_DATA,
payload: {
upgrade_data: upgradeData,
version: version,
}
}
};

View File

@@ -20,6 +20,7 @@ export const releaseVersionReducer = createReducer({
ReleaseUpgradeAvailable: false,
UpgradeAvailable: false,
UpgradeData: null,
UpgradeVersion: null,
UpgradeDismissed: false,
Version: -1,
VersionLookup: versionLookup,
@@ -30,6 +31,7 @@ export const releaseVersionReducer = createReducer({
UpgradeAvailable: false,
UpgradeDismissed: false,
UpgradeData: null,
UpgradeVersion: null,
};
},
[Actions.SET_ACTIVE_RELEASE]: (state, action) => {
@@ -64,11 +66,12 @@ export const releaseVersionReducer = createReducer({
ReleaseUpgradeAvailable: action.payload,
};
},
[Actions.setUIUpgradeData]: (state, action) => {
[Actions.SET_UI_UPGRADE_DATA]: (state, action) => {
return {
...state,
UpgradeAvailable: true,
UpgradeData: action.payload,
UpgradeData: action.payload.upgrade_data,
UpgradeVersion: action.payload.version,
UpgradeDismissed: false,
};
}