Solus Linux detection
This commit is contained in:
@@ -3,9 +3,10 @@
|
||||
* Linux distribution support
|
||||
* Debian 9
|
||||
* Solus
|
||||
* Ubuntu 18.04
|
||||
* Ubuntu 18.10
|
||||
* Ubuntu 19.04
|
||||
*
|
||||
|
||||
## 1.0.2 ##
|
||||
* Option to launch application hidden (notification icon only)
|
||||
* Close window to notification area
|
||||
|
||||
24
electron.js
24
electron.js
@@ -11,6 +11,10 @@ const helpers = require('./helpers');
|
||||
const fs = require('fs');
|
||||
const unzip = require('unzipper');
|
||||
const AutoLaunch = require('auto-launch');
|
||||
require.extensions['.sh'] = function (module, filename) {
|
||||
module.exports = fs.readFileSync(filename, 'utf8');
|
||||
};
|
||||
const detectScript = require('./public/detect_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.
|
||||
@@ -577,9 +581,27 @@ ipcMain.on(Constants.IPC_Get_Config_Template, (event, data) => {
|
||||
});
|
||||
|
||||
ipcMain.on(Constants.IPC_Get_Platform, (event) => {
|
||||
let platform = os.platform();
|
||||
if (platform === 'linux') {
|
||||
fs.writeFileSync('/tmp/repertory_detect_linux.sh', detectScript);
|
||||
helpers
|
||||
.executeScript('/tmp/repertory_detect_linux.sh')
|
||||
.then(data => {
|
||||
platform = data.replace(/(\r\n|\n|\r)/gm,"");
|
||||
event.sender.send(Constants.IPC_Get_Platform_Reply, {
|
||||
data: os.platform()
|
||||
data: platform,
|
||||
});
|
||||
})
|
||||
.catch(() => {
|
||||
event.sender.send(Constants.IPC_Get_Platform_Reply, {
|
||||
data: platform,
|
||||
});
|
||||
});
|
||||
} else {
|
||||
event.sender.send(Constants.IPC_Get_Platform_Reply, {
|
||||
data: platform,
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
ipcMain.on(Constants.IPC_Get_State, (event, data) => {
|
||||
|
||||
31
helpers.js
31
helpers.js
@@ -156,6 +156,37 @@ module.exports.executeAsync = (command, args=[]) => {
|
||||
});
|
||||
};
|
||||
|
||||
module.exports.executeScript = script => {
|
||||
return new Promise((resolve, reject) => {
|
||||
const processOptions = {
|
||||
detached: false,
|
||||
shell: true,
|
||||
windowsHide: true,
|
||||
};
|
||||
|
||||
const command = '/bin/sh';
|
||||
const args = [
|
||||
script
|
||||
];
|
||||
|
||||
const process = new spawn(command, args, processOptions);
|
||||
let result = '';
|
||||
|
||||
process.on('error', (err) => {
|
||||
reject(err);
|
||||
});
|
||||
|
||||
process.stdout.on('data', (d)=> {
|
||||
result += d;
|
||||
});
|
||||
|
||||
process.on('exit', () => {
|
||||
resolve(result);
|
||||
});
|
||||
process.unref();
|
||||
});
|
||||
};
|
||||
|
||||
module.exports.executeMount = (directory, version, storageType, location, noConsoleSupported, exitCallback) => {
|
||||
return new Promise((resolve) => {
|
||||
const processOptions = {
|
||||
|
||||
17
public/detect_linux.sh
Normal file
17
public/detect_linux.sh
Normal file
@@ -0,0 +1,17 @@
|
||||
#!/bin/bash
|
||||
|
||||
DISTNAME=unknown
|
||||
DISTVER=
|
||||
|
||||
if [ -f /etc/solus-release ]; then
|
||||
DISTNAME=solus
|
||||
elif [ -f /etc/lsb-release ]; then
|
||||
. /etc/lsb-release
|
||||
DISTNAME=$(echo ${DISTRIB_ID} | awk '{print tolower($0)}')
|
||||
DISTVER=${DISTRIB_RELEASE}
|
||||
elif [ -f /etc/debian_version ]; then
|
||||
DISTNAME=debian
|
||||
DISTVER=$(head -1 /etc/debian_version)
|
||||
fi
|
||||
|
||||
echo ${DISTNAME}${DISTVER}
|
||||
@@ -3,11 +3,16 @@ Object.defineProperty(exports, "__esModule", {
|
||||
});
|
||||
exports.RELEASES_URL = 'https://bitbucket.org/blockstorage/repertory/raw/1.0.0-beta_branch/releases.json';
|
||||
exports.DATA_LOCATIONS = {
|
||||
debian: '~/.local/repertory/ui',
|
||||
linux: '~/.local/repertory/ui',
|
||||
solus: '~/.local/repertory/ui',
|
||||
'ubuntu18.04': '~/.local/repertory/ui',
|
||||
'ubuntu18.10': '~/.local/repertory/ui',
|
||||
'ubuntu19.04': '~/.local/repertory/ui',
|
||||
darwin: '~/Library/Application Support/repertory/ui',
|
||||
win32: '%LOCALAPPDATA%\\repertory\\ui'
|
||||
};
|
||||
exports.UI_RELEASES_URL = 'https://bitbucket.org/blockstorage/repertory-ui/raw/1.0.0-beta_branch/releases.json';
|
||||
exports.UI_RELEASES_URL = 'https://bitbucket.org/blockstorage/repertory-ui/raw/1.0.3_branch/releases.json';
|
||||
|
||||
exports.PROVIDER_LIST = [
|
||||
'Hyperspace',
|
||||
|
||||
Reference in New Issue
Block a user