mirror of
https://github.com/quine-global/hyper.git
synced 2026-01-17 14:08:41 -09:00
Add support for updating to arm builds
This commit is contained in:
parent
dd0ae33dda
commit
4469281861
1 changed files with 18 additions and 1 deletions
|
|
@ -7,6 +7,7 @@ import retry from 'async-retry';
|
||||||
import {version} from './package.json';
|
import {version} from './package.json';
|
||||||
import {getDecoratedConfig} from './plugins';
|
import {getDecoratedConfig} from './plugins';
|
||||||
import autoUpdaterLinux from './auto-updater-linux';
|
import autoUpdaterLinux from './auto-updater-linux';
|
||||||
|
import {execSync} from 'child_process';
|
||||||
|
|
||||||
const {platform} = process;
|
const {platform} = process;
|
||||||
const isLinux = platform === 'linux';
|
const isLinux = platform === 'linux';
|
||||||
|
|
@ -17,9 +18,25 @@ let isInit = false;
|
||||||
// Default to the "stable" update channel
|
// Default to the "stable" update channel
|
||||||
let canaryUpdates = false;
|
let canaryUpdates = false;
|
||||||
|
|
||||||
|
// Detect if we are running inside Rosetta emulation
|
||||||
|
const isRosetta = () => {
|
||||||
|
if (platform !== 'darwin') {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
const sysctlRosettaInfoKey = 'sysctl.proc_translated';
|
||||||
|
let results = '';
|
||||||
|
try {
|
||||||
|
results = execSync(`sysctl ${sysctlRosettaInfoKey}`).toString();
|
||||||
|
} catch (error) {
|
||||||
|
console.log('Failed to detect Rosetta');
|
||||||
|
}
|
||||||
|
return results.includes(`${sysctlRosettaInfoKey}: 1`);
|
||||||
|
};
|
||||||
|
|
||||||
const buildFeedUrl = (canary: boolean, currentVersion: string) => {
|
const buildFeedUrl = (canary: boolean, currentVersion: string) => {
|
||||||
const updatePrefix = canary ? 'releases-canary' : 'releases';
|
const updatePrefix = canary ? 'releases-canary' : 'releases';
|
||||||
return `https://${updatePrefix}.hyper.is/update/${isLinux ? 'deb' : platform}/${currentVersion}`;
|
const archSuffix = process.arch === 'arm64' || isRosetta() ? '_arm64' : '';
|
||||||
|
return `https://${updatePrefix}.hyper.is/update/${isLinux ? 'deb' : platform}${archSuffix}/${currentVersion}`;
|
||||||
};
|
};
|
||||||
|
|
||||||
const isCanary = (updateChannel: string) => updateChannel === 'canary';
|
const isCanary = (updateChannel: string) => updateChannel === 'canary';
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue